diff --git a/Allwmake b/Allwmake index 749c60fc89db7731f3098bb8c576b94c12f2f4fb..d0110357f83f8007582a812aaf9db25153cf3997 100755 --- a/Allwmake +++ b/Allwmake @@ -1,19 +1,19 @@ #!/bin/sh +cd ${0%/*} || exit 1 # run from this directory set -x -# run from this directory only -cd ${0%/*} || exit 1 - # wmake is required for subsequent targets -(cd wmake/src && make) +( cd wmake/src && make ) -(cd $WM_THIRD_PARTY_DIR && ./Allwmake) +( cd $WM_THIRD_PARTY_DIR && ./Allwmake ) -(cd src && ./Allwmake) +( cd src && ./Allwmake ) -(cd applications && ./Allwmake) +( cd applications && ./Allwmake ) if [ "$1" = doc ] then - (cd doc && ./Allwmake) + ( cd doc && ./Allwmake ) fi + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/Allwmake b/applications/Allwmake index 7437e4f9b04f4bbe4514e75609894b60225e9eb7..0c582570683d1ce06ef041abb5e02c2eb3faed93 100755 --- a/applications/Allwmake +++ b/applications/Allwmake @@ -1,5 +1,8 @@ #!/bin/sh +cd ${0%/*} || exit 1 # run from this directory set -x -( cd solvers && wmake all ) +( cd solvers && wmake all ) ( cd utilities && wmake all ) + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H index 2cd4c5d2d365b617695c829c27789ed584ff044c..9c12cf95853dc73df86a65969425653ed98ff701 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H @@ -1,25 +1,36 @@ - // Solve the Momentum equation +// Solve the Momentum equation - tmp<fvVectorMatrix> UEqn - ( - fvm::ddt(rho, U) - + fvm::div(phi, U) - + turbulence->divDevRhoReff(U) - ); +tmp<fvVectorMatrix> UEqn +( + fvm::ddt(rho, U) + + fvm::div(phi, U) + + turbulence->divDevRhoReff(U) +); -//if (oCorr != nOuterCorr-1) +if (oCorr == nOuterCorr-1) +{ + UEqn().relax(1); +} +else +{ + UEqn().relax(); +} + +volScalarField rUA = 1.0/UEqn().A(); + +if (momentumPredictor) +{ + if (oCorr == nOuterCorr-1) { - UEqn().relax(); + solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal")); } - - if (momentumPredictor) + else { - if (oCorr == nOuterCorr-1) - { - solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal")); - } - else - { - solve(UEqn() == -fvc::grad(p)); - } + solve(UEqn() == -fvc::grad(p)); } +} +else +{ + U = rUA*(UEqn().H() - fvc::grad(p)); + U.correctBoundaryConditions(); +} diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H index a08812cee0284cf8311c8a011e7a36f08fbd7242..7918618404a9653761dff2f60d6b67ce73b91bfb 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H @@ -29,7 +29,12 @@ if (transonic) - fvm::laplacian(rho*rUA, p) ); - if (oCorr == nOuterCorr-1 && corr == nCorr-1 && nonOrth == nNonOrthCorr) + if + ( + oCorr == nOuterCorr-1 + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) { pEqn.solve(mesh.solver("pFinal")); } @@ -46,7 +51,7 @@ if (transonic) } else { - phi = + phi = fvc::interpolate(rho)* ( (fvc::interpolate(U) & mesh.Sf()) @@ -57,6 +62,7 @@ else for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { + // Pressure corrector fvScalarMatrix pEqn ( fvm::ddt(psi, p) @@ -64,7 +70,12 @@ else - fvm::laplacian(rho*rUA, p) ); - if (oCorr == nOuterCorr-1 && corr == nCorr-1 && nonOrth == nNonOrthCorr) + if + ( + oCorr == nOuterCorr-1 + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) { pEqn.solve(mesh.solver("pFinal")); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C index d13027da55a1f5567045cb4d4097253cf3965206..9b09d73bbe9bc53c4394e24a7d99abb6812ad4dc 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C @@ -68,9 +68,8 @@ int main(int argc, char *argv[]) rho.storePrevIter(); } - // --- PIMPLE loop - int oCorr=0; - do + // --- Pressure-velocity PIMPLE corrector loop + for (int oCorr=0; oCorr<nOuterCorr; oCorr++) { #include "UEqn.H" #include "hEqn.H" @@ -82,8 +81,7 @@ int main(int argc, char *argv[]) } turbulence->correct(); - - } while (++oCorr < nOuterCorr); + } runTime.write(); diff --git a/applications/solvers/incompressible/pimpleFoam/Make/files b/applications/solvers/incompressible/pimpleFoam/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..92943d3370c977025c7cdfee1e8681f06631655b --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/Make/files @@ -0,0 +1,3 @@ +pimpleFoam.C + +EXE = $(FOAM_USER_APPBIN)/pimpleFoam diff --git a/applications/solvers/incompressible/pimpleFoam/Make/options b/applications/solvers/incompressible/pimpleFoam/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..8a31f7e5abb705153daf5f003b320fbee11cdf32 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/Make/options @@ -0,0 +1,10 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/RAS \ + -I$(LIB_SRC)/transportModels + +EXE_LIBS = \ + -lincompressibleRASModels \ + -lincompressibleTransportModels \ + -lfiniteVolume \ + -lmeshTools diff --git a/applications/solvers/incompressible/pimpleFoam/UEqn.H b/applications/solvers/incompressible/pimpleFoam/UEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..12b4260e5df4e598ec73ff095a8aef7b2cc9bb37 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/UEqn.H @@ -0,0 +1,36 @@ +// Solve the Momentum equation + +tmp<fvVectorMatrix> UEqn +( + fvm::ddt(U) + + fvm::div(phi, U) + + turbulence->divDevReff(U) +); + +if (oCorr == nOuterCorr-1) +{ + UEqn().relax(1); +} +else +{ + UEqn().relax(); +} + +volScalarField rUA = 1.0/UEqn().A(); + +if (momentumPredictor) +{ + if (oCorr == nOuterCorr-1) + { + solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal")); + } + else + { + solve(UEqn() == -fvc::grad(p)); + } +} +else +{ + U = rUA*(UEqn().H() - fvc::grad(p)); + U.correctBoundaryConditions(); +} diff --git a/applications/solvers/incompressible/pimpleFoam/createFields.H b/applications/solvers/incompressible/pimpleFoam/createFields.H new file mode 100644 index 0000000000000000000000000000000000000000..d334e4a31f34ec8ab842bec1cc508b4a4aeb27c1 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/createFields.H @@ -0,0 +1,42 @@ +Info<< "Reading field p\n" << endl; +volScalarField p +( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "createPhi.H" + + +label pRefCell = 0; +scalar pRefValue = 0.0; +setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue); + + +singlePhaseTransportModel laminarTransport(U, phi); + +autoPtr<incompressible::RASModel> turbulence +( + incompressible::RASModel::New(U, phi, laminarTransport) +); diff --git a/applications/solvers/incompressible/pimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..41f99bb542daa9807fe751646c95dba5cfc4458c --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/pEqn.H @@ -0,0 +1,53 @@ +U = rUA*UEqn().H(); + +if (nCorr <= 1) +{ + UEqn.clear(); +} + +phi = (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rUA, U, phi); + +adjustPhi(phi, U, p); + +// Non-orthogonal pressure corrector loop +for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) +{ + // Pressure corrector + fvScalarMatrix pEqn + ( + fvm::laplacian(rUA, p) == fvc::div(phi) + ); + + pEqn.setReference(pRefCell, pRefValue); + + if + ( + oCorr == nOuterCorr-1 + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + { + pEqn.solve(mesh.solver("pFinal")); + } + else + { + pEqn.solve(); + } + + if (nonOrth == nNonOrthCorr) + { + phi -= pEqn.flux(); + } +} + +#include "continuityErrs.H" + +// Explicitly relax pressure for momentum corrector except for last corrector +if (oCorr != nOuterCorr-1) +{ + p.relax(); +} + +U -= rUA*fvc::grad(p); +U.correctBoundaryConditions(); diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C new file mode 100644 index 0000000000000000000000000000000000000000..f3c16142393a5205148221cb7582c81cd5044538 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + pimpleFoam + +Description + Large time-step transient solver for incompressible, turbulent flow using + the PIMPLE (merged PISO-SIMPLE) algorithm. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H" +#include "incompressible/RASModel/RASModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + #include "createFields.H" + #include "initContinuityErrs.H" + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readTimeControls.H" + #include "readPIMPLEControls.H" + #include "CourantNo.H" + #include "setDeltaT.H" + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + if (nOuterCorr != 1) + { + p.storePrevIter(); + } + + // --- Pressure-velocity PIMPLE corrector loop + for (int oCorr=0; oCorr<nOuterCorr; oCorr++) + { + #include "UEqn.H" + + // --- PISO loop + for (int corr=0; corr<nCorr; corr++) + { + #include "pEqn.H" + } + + turbulence->correct(); + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H index 8b7a3e145c9ec1ad1ca2058387c2d97889e12966..a17c2bb4a0d49d69c220c2a35d14dae6e30cf204 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H @@ -178,6 +178,11 @@ public: { return lambda_; } + + const volScalarField& kappa() const + { + return kappa_; + } }; diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C index cf33a413b6440feca2cdfaef410177ce6bea8a1b..9433725104087411abbda73486c6220ed925846f 100644 --- a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C +++ b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C @@ -520,7 +520,7 @@ void subsetMesh ( cellLabels, exposedFaces, - labelList(patchI, exposedFaces.size()), + labelList(exposedFaces.size(), patchI), meshMod ); diff --git a/applications/utilities/mesh/conversion/Optional/Allwmake b/applications/utilities/mesh/conversion/Optional/Allwmake index ca1fbac090eeefb0ce10abb09da231e311ee962f..2db40f48adc82bbfc4cf31f9c9401b5e3c7abe3b 100755 --- a/applications/utilities/mesh/conversion/Optional/Allwmake +++ b/applications/utilities/mesh/conversion/Optional/Allwmake @@ -1,9 +1,11 @@ #!/bin/sh +# # Build optional components (eg, may depend on third-party libraries) +# ----------------------------------------------------------------------------- + +cd ${0%/*} || exit 1 # run from this directory set -x -# run from this directory only -cd ${0%/*} || exit 1 # build libccmio and create lnInclude directory ( diff --git a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C index 39fa73dbcd25e782187225a1f58b27a468141efd..d3cca933528284b5511ce0956755f28cb1a61826 100644 --- a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C +++ b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C @@ -89,13 +89,11 @@ using namespace Foam; int main(int argc, char *argv[]) { argList::validArgs.append("Neutral file"); - argList::validOptions.insert("overwrite", ""); # include "setRootCase.H" # include "createTime.H" fileName neuFile(args.additionalArgs()[0]); - bool overwrite = args.options().found("overwrite"); IFstream str(neuFile); @@ -300,11 +298,6 @@ int main(int argc, char *argv[]) } - if (!overwrite) - { - runTime++; - } - polyMesh mesh ( IOobject diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C index 79f0fd30d1c1423ba1e00c1f257842912e432faf..1e50ccee0bf59e0e646e4f4e9f47c07a54e3202f 100644 --- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C +++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C @@ -54,8 +54,9 @@ Description NOTE: - for some reason boundary faces point inwards. I just reverse them always. Might use some geometric check instead. -- marked faces might not actually be boundary faces of mesh. This is not handled -and you'll have to run without face file (-noFaceFile option) +- marked faces might not actually be boundary faces of mesh. +This is hopefully handled now by first constructing without boundaries +and then reconstructing with boundary faces. \*---------------------------------------------------------------------------*/ @@ -69,20 +70,40 @@ using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Find label of face. +label findFace(const primitiveMesh& mesh, const face& f) +{ + const labelList& pFaces = mesh.pointFaces()[f[0]]; + + forAll(pFaces, i) + { + label faceI = pFaces[i]; + + if (mesh.faces()[faceI] == f) + { + return faceI; + } + } + + FatalErrorIn("findFace(const primitiveMesh&, const face&)") + << "Cannot find face " << f << " in mesh." << abort(FatalError); + + return -1; +} + + // Main program: int main(int argc, char *argv[]) { argList::validArgs.append("file prefix"); argList::validOptions.insert("noFaceFile", ""); - argList::validOptions.insert("overwrite", ""); # include "setRootCase.H" # include "createTime.H" bool readFaceFile = !args.options().found("noFaceFile"); - bool overwrite = args.options().found("overwrite"); fileName prefix(args.additionalArgs()[0]); @@ -287,16 +308,44 @@ int main(int argc, char *argv[]) } - label nPatches = 0; + // + // Construct mesh with default boundary only + // + + autoPtr<polyMesh> meshPtr + ( + new polyMesh + ( + IOobject + ( + polyMesh::defaultRegion, + runTime.constant(), + runTime + ), + points, + cells, + faceListList(0), + wordList(0), //boundaryPatchNames + wordList(0), //boundaryPatchTypes + "defaultFaces", + polyPatch::typeName, + wordList(0) + ) + ); + const polyMesh& mesh = meshPtr; - // List of Foam vertices per boundary face - faceList boundaryFaces; - // For each boundary faces the Foam patchID - labelList boundaryPatch; if (readFaceFile) { + label nPatches = 0; + + // List of Foam vertices per boundary face + faceList boundaryFaces; + + // For each boundary faces the Foam patchID + labelList boundaryPatch; + // // read boundary faces // @@ -366,48 +415,59 @@ int main(int argc, char *argv[]) f[2-i] = nodeToPoint[nodeI]; } - boundaryFaces[faceI] = f; - if (nFaceAttr > 0) + if (findFace(mesh, f) >= mesh.nInternalFaces()) { - // First attribute is the region number - faceLine >> region; + boundaryFaces[faceI] = f; + if (nFaceAttr > 0) + { + // First attribute is the region number + faceLine >> region; - // Get Foam patchID and update region->patch table. - label patchI = 0; - Map<label>::iterator patchFind = regionToPatch.find(region); + // Get Foam patchID and update region->patch table. + label patchI = 0; - if (patchFind == regionToPatch.end()) - { - patchI = nPatches; + Map<label>::iterator patchFind = + regionToPatch.find(region); - Info<< "Mapping tetgen region " << region - << " to Foam patch " - << patchI << endl; + if (patchFind == regionToPatch.end()) + { + patchI = nPatches; - regionToPatch.insert(region, nPatches++); - } - else - { - patchI = patchFind(); - } + Info<< "Mapping tetgen region " << region + << " to Foam patch " + << patchI << endl; - boundaryPatch[faceI] = patchI; + regionToPatch.insert(region, nPatches++); + } + else + { + patchI = patchFind(); + } - // Skip remaining attributes - for (label i = 1; i < nFaceAttr; i++) - { - faceLine >> dummy; + boundaryPatch[faceI] = patchI; + + // Skip remaining attributes + for (label i = 1; i < nFaceAttr; i++) + { + faceLine >> dummy; + } } - } - faceI++; + faceI++; + } } } - // Print region to patch mapping + + // Trim + boundaryFaces.setSize(faceI); + boundaryPatch.setSize(faceI); + + + // Print region to patch mapping Info<< "Regions:" << endl; for @@ -421,28 +481,23 @@ int main(int argc, char *argv[]) << iter() << endl; } Info<< endl; - } - // Storage for boundary faces + // Storage for boundary faces + faceListList patchFaces(nPatches); + wordList patchNames(nPatches); - faceListList patchFaces(nPatches); - - wordList patchNames(nPatches); - - forAll(patchNames, patchI) - { - patchNames[patchI] = word("patch") + name(patchI); - } + forAll(patchNames, patchI) + { + patchNames[patchI] = word("patch") + name(patchI); + } - wordList patchTypes(nPatches, polyPatch::typeName); - word defaultFacesName = "defaultFaces"; - word defaultFacesType = polyPatch::typeName; - wordList patchPhysicalTypes(nPatches, polyPatch::typeName); + wordList patchTypes(nPatches, polyPatch::typeName); + word defaultFacesName = "defaultFaces"; + word defaultFacesType = polyPatch::typeName; + wordList patchPhysicalTypes(nPatches, polyPatch::typeName); - if (readFaceFile) - { // Sort boundaryFaces by patch using boundaryPatch. List<DynamicList<face> > allPatchFaces(nPatches); @@ -464,34 +519,34 @@ int main(int argc, char *argv[]) } Info<< endl; - } - if (!overwrite) - { - runTime++; - } - polyMesh mesh - ( - IOobject + meshPtr.reset ( - polyMesh::defaultRegion, - runTime.constant(), - runTime - ), - points, - cells, - patchFaces, - patchNames, - patchTypes, - defaultFacesName, - defaultFacesType, - patchPhysicalTypes - ); + new polyMesh + ( + IOobject + ( + polyMesh::defaultRegion, + runTime.constant(), + runTime + ), + points, + cells, + patchFaces, + patchNames, + patchTypes, + defaultFacesName, + defaultFacesType, + patchPhysicalTypes + ) + ); + } + Info<< "Writing mesh to " << runTime.constant() << endl << endl; - mesh.write(); + meshPtr().write(); Info<< "End\n" << endl; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasLagrangian.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasLagrangian.H deleted file mode 100644 index 18f9ddf805919f9d7c1cecae9fc5daa511098aaf..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasLagrangian.H +++ /dev/null @@ -1,19 +0,0 @@ -// check for lagrangian/positions information in the final directory - -bool hasLagrangian = false; -if (timeDirs.size() > 1) -{ - IOobject io - ( - "positions", - timeDirs[timeDirs.size() - 1].name(), - "lagrangian", - mesh, - IOobject::NO_READ - ); - - if (io.headerOk()) - { - hasLagrangian = true; - } -} diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasSprayField.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasSprayField.H deleted file mode 100644 index e6601f71911eb1abdc58d80933832c5a40e45429..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasSprayField.H +++ /dev/null @@ -1,15 +0,0 @@ -// check that the spray variable is present for this time -// -bool hasSprayField = true; -{ - IOobject ioHeader - ( - fieldName, - mesh.time().timeName(), - "lagrangian", - mesh, - IOobject::NO_READ - ); - - hasSprayField = ioHeader.headerOk(); -} diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasValidField.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasValidField.H deleted file mode 100644 index 9973a7a5fbb682531938b5e719487ae025761325..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasValidField.H +++ /dev/null @@ -1,23 +0,0 @@ -// check that the variable is present for all times -// -bool hasValidField = true; -{ - for (label i=0; i < timeDirs.size() && hasValidField; ++i) - { - if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0") - { - hasValidField = false; - break; - } - - IOobject ioHeader - ( - fieldName, - timeDirs[i].name(), - mesh, - IOobject::NO_READ - ); - - hasValidField = ioHeader.headerOk(); - } -} diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightCaseTimes.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightCaseTimes.H deleted file mode 100644 index ab7f4de5312a1cd8b7ec15e765637e17cbb16498..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightCaseTimes.H +++ /dev/null @@ -1,91 +0,0 @@ -// write time values to case file -{ - scalar timeCorrection = 0; - if (timeDirs[0].value() < 0) - { - timeCorrection = - timeDirs[0].value(); - Info<< "Correcting time values. Adding " << timeCorrection << endl; - } - - caseFile.setf(ios_base::scientific, ios_base::floatfield); - caseFile.precision(5); - - // time set 1 - geometry and volume fields - if (fieldFileNumbers.size()) - { - caseFile - << "time set: " << 1 << nl - << "number of steps: " << fieldFileNumbers.size() << nl - << "filename numbers:" << nl; - - label count = 0; - forAll (fieldFileNumbers, i) - { - caseFile - << " " << setw(12) << fieldFileNumbers[i]; - - if (++count % 6 == 0) - { - caseFile << nl; - } - } - - caseFile - << nl << "time values:" << nl; - - count = 0; - forAll (fieldFileNumbers, i) - { - caseFile - << " " << setw(12) - << timeIndices[fieldFileNumbers[i]] + timeCorrection; - - if (++count % 6 == 0) - { - caseFile << nl; - } - } - caseFile << nl << nl; - } - - // time set 2 - lagrangian fields - if (hasLagrangian && sprayFileNumbers.size()) - { - caseFile - << "time set: " << 2 << nl - << "number of steps: " << sprayFileNumbers.size() << nl - << "filename numbers:" << nl; - - label count = 0; - forAll (sprayFileNumbers, i) - { - caseFile - << " " << setw(12) << sprayFileNumbers[i]; - - if (++count % 6 == 0) - { - caseFile << nl; - } - } - - caseFile - << nl << "time values:" << nl; - - count = 0; - forAll (sprayFileNumbers, i) - { - caseFile - << " " << setw(12) - << timeIndices[sprayFileNumbers[i]] + timeCorrection; - - if (++count % 6 == 0) - { - caseFile << nl; - } - } - caseFile << nl << nl; - } - - - caseFile << "# end" << nl; -} diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputCase.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputCase.H new file mode 100644 index 0000000000000000000000000000000000000000..d8f079ea6df347eeec1ae4e9d2795831699527a3 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputCase.H @@ -0,0 +1,224 @@ +// write time values to case file + +scalar timeCorrection = 0; +if (timeDirs[0].value() < 0) +{ + timeCorrection = - timeDirs[0].value(); + Info<< "Correcting time values. Adding " << timeCorrection << endl; +} + +// the case file is always ASCII +Info << "write case: " << caseFileName.c_str() << endl; + +OFstream caseFile(ensightDir/caseFileName, IOstream::ASCII); +caseFile.setf(ios_base::left); + +caseFile.setf(ios_base::scientific, ios_base::floatfield); +caseFile.precision(5); + +caseFile + << "FORMAT" << nl + << setw(16) << "type:" << "ensight gold" << nl << nl; + +if (hasMovingMesh) +{ + caseFile + << "GEOMETRY" << nl + << setw(16) << "model: 1" << (dataMask/geometryName).c_str() << nl; +} +else +{ + caseFile + << "GEOMETRY" << nl + << setw(16) << "model:" << geometryName << nl; +} + + +// add information for clouds +// multiple clouds currently require the same time index +forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter) +{ + const word& cloudName = cloudIter.key(); + + caseFile + << setw(16) << "measured: 2" + << fileName(dataMask/"lagrangian"/cloudName/"positions").c_str() + << nl; +} +caseFile + << nl << "VARIABLE" << nl; + +forAllConstIter(HashTable<word>, volumeFields, fieldIter) +{ + const word& fieldName = fieldIter.key(); + const word& fieldType = fieldIter(); + string ensightType; + + if (fieldType == volScalarField::typeName) + { + ensightType = "scalar"; + } + else if (fieldType == volVectorField::typeName) + { + ensightType = "vector"; + } + else if (fieldType == volSphericalTensorField::typeName) + { + ensightType = "tensor symm"; + } + else if (fieldType == volSymmTensorField::typeName) + { + ensightType = "tensor symm"; + } + else if (fieldType == volTensorField::typeName) + { + ensightType = "tensor asym"; + } + + if (ensightType.size()) + { + ensightCaseEntry + ( + caseFile, + ensightType, + fieldName, + dataMask + ); + } +} + +// TODO: allow similar/different time-steps for each cloud + + +label cloudNo = 0; +forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter) +{ + const word& cloudName = cloudIter.key(); + + forAllConstIter(HashTable<word>, cloudIter(), fieldIter) + { + const word& fieldName = fieldIter.key(); + const word& fieldType = fieldIter(); + string ensightType; + + if (fieldType == scalarIOField::typeName) + { + ensightType = "scalar"; + } + else if (fieldType == vectorIOField::typeName) + { + ensightType = "vector"; + } + else if (fieldType == tensorIOField::typeName) + { + ensightType = "tensor"; + } + + if (ensightType.size()) + { + ensightCaseEntry + ( + caseFile, + ensightType, + fieldName, + dataMask, + "lagrangian"/cloudName, + cloudNo, + 2 + ); + } + } + cloudNo++; +} + + +// add time values +caseFile << nl << "TIME" << nl; + +// time set 1 - geometry and volume fields +if (fieldTimesUsed.size()) +{ + caseFile + << "time set: " << 1 << nl + << "number of steps: " << fieldTimesUsed.size() << nl + << "filename numbers:" << nl; + + label count = 0; + forAll (fieldTimesUsed, i) + { + caseFile + << " " << setw(12) << fieldTimesUsed[i]; + + if (++count % 6 == 0) + { + caseFile << nl; + } + } + + caseFile + << nl << "time values:" << nl; + + count = 0; + forAll (fieldTimesUsed, i) + { + caseFile + << " " << setw(12) + << timeIndices[fieldTimesUsed[i]] + timeCorrection; + + if (++count % 6 == 0) + { + caseFile << nl; + } + } + caseFile << nl << nl; +} + +// TODO: allow similar/different time-steps for each cloud +cloudNo = 0; +forAllConstIter(HashTable<DynamicList<label> >, cloudTimesUsed, cloudIter) +{ + // const word& cloudName = cloudIter.key(); + const DynamicList<label>& timesUsed = cloudIter(); + + if (timesUsed.size() && cloudNo == 0) + { + caseFile + << "time set: " << 2 << nl + << "number of steps: " << timesUsed.size() << nl + << "filename numbers:" << nl; + + label count = 0; + forAll (timesUsed, i) + { + caseFile + << " " << setw(12) << timesUsed[i]; + + if (++count % 6 == 0) + { + caseFile << nl; + } + } + + caseFile + << nl << "time values:" << nl; + + count = 0; + forAll (timesUsed, i) + { + caseFile + << " " << setw(12) + << timeIndices[timesUsed[i]] + timeCorrection; + + if (++count % 6 == 0) + { + caseFile << nl; + } + } + caseFile << nl << nl; + + cloudNo++; + } +} + +caseFile << "# end" << nl; + diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C index 007fb1f6a2e521430cf36515297e73f75b4e698c..f8acfb311b1f8be273b9e555eab7cbc529168954 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C @@ -22,7 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - $Date: 2008/04/02 11:37:10 $ \*---------------------------------------------------------------------------*/ #include "ensightOutputFunctions.H" @@ -41,36 +40,51 @@ namespace Foam // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // -template<class Type> void ensightCaseEntry ( OFstream& caseFile, - const IOobject& fieldObject, + const string& ensightType, + const word& fieldName, const fileName& dataMask, - bool measured + const fileName& local, + const label cloudNo, + const label timeSet ) { caseFile.setf(ios_base::left); - if (measured) + fileName dirName(dataMask); + if (local.size()) + { + dirName = dirName/local; + } + + if (cloudNo >= 0) { + label ts = 1; + if (timeSet > ts) + { + ts = timeSet; + } + + // prefix variables with 'c' (cloud) caseFile - << pTraits<Type>::typeName - << " per measured node: 2 " + << ensightType.c_str() + << " per measured node: " << ts << " " << setw(15) - << ("s" + fieldObject.name()).c_str() + << ("c" + Foam::name(cloudNo) + fieldName).c_str() << " " - << (dataMask/"lagrangian"/fieldObject.name()).c_str() + << (dirName/fieldName).c_str() << nl; } else { caseFile - << pTraits<Type>::typeName - << " per element: " - << setw(15) << fieldObject.name() + << ensightType.c_str() + << " per element: " + << setw(15) << fieldName << " " - << (dataMask/fieldObject.name()).c_str() + << (dirName/fieldName).c_str() << nl; } } @@ -81,16 +95,17 @@ void ensightParticlePositions const polyMesh& mesh, const fileName& dataDir, const fileName& subDir, + const word& cloudName, IOstream::streamFormat format ) { - Cloud<passiveParticle> parcels(mesh); + Cloud<passiveParticle> parcels(mesh, cloudName, false); - fileName lagrangianDir = subDir/"lagrangian"; - fileName postFileName = lagrangianDir/"positions"; + fileName cloudDir = subDir/"lagrangian"/cloudName; + fileName postFileName = cloudDir/"positions"; // the ITER/lagrangian subdirectory must exist - mkDir(dataDir/lagrangianDir); + mkDir(dataDir/cloudDir); ensightFile os(dataDir/postFileName, format); // tag binary format (just like geometry files) @@ -139,20 +154,22 @@ void ensightParticlePositions template<class Type> -void ensightSprayField +void ensightLagrangianField ( const IOobject& fieldObject, const fileName& dataDir, const fileName& subDir, + const word& cloudName, IOstream::streamFormat format ) { Info<< " " << fieldObject.name() << flush; - fileName lagrangianDir = subDir/"lagrangian"; - fileName postFileName = lagrangianDir/fieldObject.name(); + fileName cloudDir = subDir/"lagrangian"/cloudName; + fileName postFileName = cloudDir/fieldObject.name(); - string title = postFileName + " with " + pTraits<Type>::typeName + " values"; + string title = + postFileName + " with " + pTraits<Type>::typeName + " values"; ensightFile os(dataDir/postFileName, format); os.write(title); @@ -225,9 +242,9 @@ void ensightVolField ); } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // end namespace Foam +} // namespace Foam + // ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.H index 70f5d33d73d2b225af1e262e9f8153621d7487a4..ec9da3923379857dffa15d18932552576c254dcc 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.H @@ -44,13 +44,15 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template<class Type> void ensightCaseEntry ( OFstream& caseFile, - const IOobject& fieldObject, + const string& ensightType, + const word& fieldName, const fileName& dataMask, - bool measured = false + const fileName& local=fileName::null, + const label cloudNo=-1, + const label timeSet=1 ); @@ -59,17 +61,19 @@ void ensightParticlePositions const polyMesh& mesh, const fileName& dataDir, const fileName& subDir, + const word& cloudName, IOstream::streamFormat format ); -//- write spray parcels +//- write lagrangian parcels template<class Type> -void ensightSprayField +void ensightLagrangianField ( const IOobject& fieldObject, const fileName& dataDir, const fileName& subDir, + const word& cloudName, IOstream::streamFormat format ); @@ -87,7 +91,7 @@ void ensightVolField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // end namespace Foam +} // namespace Foam #ifdef NoRepository # include "ensightOutputFunctions.C" diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H new file mode 100644 index 0000000000000000000000000000000000000000..cca3fbbcd3fbc4375b5282f66cfd94146e22be6e --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H @@ -0,0 +1,88 @@ +// check the final time directory for + +// 1. volume fields +HashTable<word> volumeFields; + +// 2. the fields for each cloud: +HashTable<HashTable<word> > cloudFields; + +if (timeDirs.size() > 1) +{ + IOobjectList objs(mesh, timeDirs[timeDirs.size()-1].name()); + + forAllConstIter(IOobjectList, objs, fieldIter) + { + const IOobject& obj = *fieldIter(); + + if + ( + obj.headerClassName() == volScalarField::typeName + || obj.headerClassName() == volVectorField::typeName + ) + { + // Add field and field type + volumeFields.insert + ( + obj.name(), + obj.headerClassName() + ); + } + } + + // now check for lagrangian/<cloudName> + + fileNameList cloudDirs = readDir + ( + runTime.path() + / timeDirs[timeDirs.size() - 1].name() + / regionPrefix + / "lagrangian", + fileName::DIRECTORY + ); + + forAll(cloudDirs, cloudI) + { + const word& cloudName = cloudDirs[cloudI]; + + // Create a new hash table for each cloud + cloudFields.insert(cloudName, HashTable<word>()); + + // Identify the new cloud in the hash table + HashTable<HashTable<word> >::iterator cloudIter = + cloudFields.find(cloudName); + + IOobjectList cloudObjs + ( + mesh, + timeDirs[timeDirs.size() - 1].name(), + "lagrangian"/cloudName + ); + + bool hasPositions = false; + forAllConstIter(IOobjectList, cloudObjs, fieldIter) + { + const IOobject obj = *fieldIter(); + + if (obj.name() == "positions") + { + hasPositions = true; + } + else + { + // Add field and field type + cloudIter().insert + ( + obj.name(), + obj.headerClassName() + ); + } + } + + // drop this cloud if it has no positions + if (!hasPositions) + { + cloudFields.erase(cloudIter); + } + } +} + diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index 65588d7dc87e54e3489d9a207e1829dbac1d54dc..f60e4948a6cb7fcad877fe9a0dc61528a553ef6d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -71,20 +71,26 @@ int main(int argc, char *argv[]) argList::noParallel(); argList::validOptions.insert("ascii", ""); - const label nTypes = 2; - const word fieldTypes[] = + const word volFieldTypes[] = { volScalarField::typeName, - volVectorField::typeName + volVectorField::typeName, + volSphericalTensorField::typeName, + volSymmTensorField::typeName, + volTensorField::typeName, + word::null }; - const label nSprayFieldTypes = 2; const word sprayFieldTypes[] = { scalarIOField::typeName, - vectorIOField::typeName + vectorIOField::typeName, + tensorIOField::typeName, + word::null }; + const char* geometryName = "geometry"; + # include "setRootCase.H" # include "createTime.H" @@ -104,14 +110,26 @@ int main(int argc, char *argv[]) fileName dataMask = fileName("data")/ensightFile::mask(); // Ensight and Ensight/data directories must exist + // do not remove old data - we might wish to convert new results + // or a particular time interval if (dir(ensightDir)) { - rmDir(ensightDir); + Info<<"Warning: reusing existing directory" << nl + << " " << ensightDir << endl; } mkDir(ensightDir); mkDir(dataDir); -# include "createMesh.H" +# include "createNamedMesh.H" + + // Mesh instance (region0 gets filtered out) + fileName regionPrefix; + + if (regionName != polyMesh::defaultRegion) + { + regionPrefix = regionName; + } + // Construct the list of ensight parts for the entire mesh ensightParts partsList(mesh); @@ -125,53 +143,24 @@ int main(int argc, char *argv[]) } # include "checkHasMovingMesh.H" -# include "checkHasLagrangian.H" +# include "findFields.H" +# include "validateFields.H" - // only take the objects that exists at the end of the calculation - IOobjectList objects(mesh, timeDirs[timeDirs.size()-1].name()); - IOobjectList sprayObjects(mesh, timeDirs[timeDirs.size()-1].name(), "lagrangian"); - - // write single geometry or one per time step - fileName geometryFileName("geometry"); - if (hasMovingMesh) - { - geometryFileName = dataMask/geometryFileName; - } + // map times used + Map<scalar> timeIndices; - // the case file is always ASCII - Info << "write case: " << caseFileName.c_str() << endl; + // Track the time indices used by the volume fields + DynamicList<label> fieldTimesUsed; - OFstream caseFile(ensightDir/caseFileName, IOstream::ASCII); - caseFile.setf(ios_base::left); - caseFile - << "FORMAT" << nl - << setw(16) << "type:" << "ensight gold" << nl << nl - << "GEOMETRY" << nl - << setw(16) << "model: 1" << geometryFileName.c_str() << nl; + // Track the time indices used by each cloud + HashTable<DynamicList<label> > cloudTimesUsed; - if (hasLagrangian) + // Create a new DynamicList for each cloud + forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter) { - caseFile - << setw(16) << "measured: 2" - << fileName(dataMask/"lagrangian"/"positions").c_str() << nl; + cloudTimesUsed.insert(cloudIter.key(), DynamicList<label>()); } - caseFile - << nl << "VARIABLE" << nl; - - label nFieldTime = timeDirs.size(); - if (nFieldTime < 0) - { - nFieldTime = 0; - } - - List<label> fieldFileNumbers(nFieldTime); - List<label> sprayFileNumbers(nFieldTime); - - // map used times used - Map<scalar> timeIndices; - nFieldTime = 0; - label nSprayTime = 0; forAll(timeDirs, timeI) { @@ -179,7 +168,8 @@ int main(int argc, char *argv[]) # include "getTimeIndex.H" - fieldFileNumbers[nFieldTime++] = timeIndex; + // remember the time index + fieldTimesUsed.append(timeIndex); // the data/ITER subdirectory must exist fileName subDir = ensightFile::subDir(timeIndex); @@ -195,300 +185,203 @@ int main(int argc, char *argv[]) # include "moveMesh.H" - if (nFieldTime == 1 || mesh.moving()) + if (timeI == 0 || mesh.moving()) { - if (hasMovingMesh) - { - geometryFileName = dataDir/subDir/"geometry"; - } if (mesh.moving()) { partsList.recalculate(mesh); } - ensightGeoFile geoFile(ensightDir/geometryFileName, format); + fileName geomDir; + if (hasMovingMesh) + { + geomDir = dataDir/subDir; + } + + ensightGeoFile geoFile(ensightDir/geomDir/geometryName, format); partsList.writeGeometry(geoFile); Info << nl; } - Info<< "write volume field: " << flush; + Info<< "write volume field (" << flush; - for (label i=0; i < nTypes; i++) + forAllConstIter(HashTable<word>, volumeFields, fieldIter) { - wordList fieldNames = objects.names(fieldTypes[i]); + const word& fieldName = fieldIter.key(); + const word& fieldType = fieldIter(); - forAll (fieldNames, fieldI) + IOobject fieldObject + ( + fieldName, + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ); + + if (fieldType == volScalarField::typeName) { - word fieldName = fieldNames[fieldI]; + ensightVolField<scalar> + ( + partsList, + fieldObject, + mesh, + dataDir, + subDir, + format + ); -# include "checkHasValidField.H" + } + else if (fieldType == volVectorField::typeName) + { + ensightVolField<vector> + ( + partsList, + fieldObject, + mesh, + dataDir, + subDir, + format + ); - if (!hasValidField) - { - continue; - } + } + else if (fieldType == volSphericalTensorField::typeName) + { + ensightVolField<sphericalTensor> + ( + partsList, + fieldObject, + mesh, + dataDir, + subDir, + format + ); - IOobject fieldObject + } + else if (fieldType == volSymmTensorField::typeName) + { + ensightVolField<symmTensor> ( - fieldName, - mesh.time().timeName(), + partsList, + fieldObject, mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE + dataDir, + subDir, + format ); + } + else if (fieldType == volTensorField::typeName) + { + ensightVolField<tensor> + ( + partsList, + fieldObject, + mesh, + dataDir, + subDir, + format + ); + } + } + Info<< " )" << endl; - if (fieldTypes[i] == volScalarField::typeName) - { - if (nFieldTime == 1) - { - ensightCaseEntry<scalar> - ( - caseFile, - fieldObject, - dataMask - ); - } - - ensightVolField<scalar> - ( - partsList, - fieldObject, - mesh, - dataDir, - subDir, - format - ); + // check for clouds + forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter) + { + const word& cloudName = cloudIter.key(); - } - else if (fieldTypes[i] == volVectorField::typeName) - { - if (nFieldTime == 1) - { - ensightCaseEntry<vector> - ( - caseFile, - fieldObject, - dataMask - ); - } - - ensightVolField<vector> - ( - partsList, - fieldObject, - mesh, - dataDir, - subDir, - format - ); + if (!dir(runTime.timePath()/regionPrefix/"lagrangian"/cloudName)) + { + continue; + } + IOobjectList cloudObjs + ( + mesh, + runTime.timeName(), + "lagrangian"/cloudName + ); + + // check that the positions field is present for this time + if (cloudObjs.lookup("positions")) + { + ensightParticlePositions + ( + mesh, + dataDir, + subDir, + cloudName, + format + ); + } + else + { + continue; + } + + Info<< "write " << cloudName << " (" << flush; + + forAllConstIter(HashTable<word>, cloudIter(), fieldIter) + { + const word& fieldName = fieldIter.key(); + const word& fieldType = fieldIter(); + + IOobject *fieldObject = cloudObjs.lookup(fieldName); + + if (!fieldObject) + { + Info<< "missing " + << runTime.timeName()/"lagrangian"/cloudName/fieldName + << endl; + continue; } - else if (fieldTypes[i] == volSphericalTensorField::typeName) + + if (fieldType == scalarIOField::typeName) { - if (nFieldTime == 1) - { - ensightCaseEntry<sphericalTensor> - ( - caseFile, - fieldObject, - dataMask - ); - } - - ensightVolField<sphericalTensor> + ensightLagrangianField<scalar> ( - partsList, - fieldObject, - mesh, + *fieldObject, dataDir, subDir, + cloudName, format ); } - else if (fieldTypes[i] == volSymmTensorField::typeName) + else if (fieldType == vectorIOField::typeName) { - if (nFieldTime == 1) - { - ensightCaseEntry<symmTensor> - ( - caseFile, - fieldObject, - dataMask - ); - } - - ensightVolField<symmTensor> + ensightLagrangianField<vector> ( - partsList, - fieldObject, - mesh, + *fieldObject, dataDir, subDir, + cloudName, format ); } - else if (fieldTypes[i] == volTensorField::typeName) + else if (fieldType == tensorIOField::typeName) { - if (nFieldTime == 1) - { - ensightCaseEntry<tensor> - ( - caseFile, - fieldObject, - dataMask - ); - } - - ensightVolField<tensor> + ensightLagrangianField<tensor> ( - partsList, - fieldObject, - mesh, + *fieldObject, dataDir, subDir, + cloudName, format ); } } - } - Info<< endl; - - if (hasLagrangian) - { - // check that the positions field is present for this time - { - IOobject ioHeader - ( - "positions", - mesh.time().timeName(), - "lagrangian", - mesh, - IOobject::NO_READ - ); + Info<< " )" << endl; - if (ioHeader.headerOk()) - { - sprayFileNumbers[nSprayTime++] = timeIndex; - } - } - - Info<< "write spray field: " << flush; - - ensightParticlePositions - ( - mesh, - dataDir, - subDir, - format - ); - - for (label i=0; i < nSprayFieldTypes; i++) - { - wordList fieldNames = sprayObjects.names(sprayFieldTypes[i]); - - forAll (fieldNames, fieldI) - { - word fieldName = fieldNames[fieldI]; - -# include "checkHasSprayField.H" - - if (!hasSprayField) - { - continue; - } - - IOobject fieldObject - ( - fieldName, - mesh.time().timeName(), - "lagrangian", - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if (sprayFieldTypes[i] == scalarIOField::typeName) - { - if (nSprayTime == 1) - { - ensightCaseEntry<scalar> - ( - caseFile, - fieldObject, - dataMask, - true - ); - } - - ensightSprayField<scalar> - ( - fieldObject, - dataDir, - subDir, - format - ); - - } - else if (sprayFieldTypes[i] == vectorIOField::typeName) - { - if (nSprayTime == 1) - { - ensightCaseEntry<vector> - ( - caseFile, - fieldObject, - dataMask, - true - ); - } - - ensightSprayField<vector> - ( - fieldObject, - dataDir, - subDir, - format - ); - - } - else if (sprayFieldTypes[i] == tensorIOField::typeName) - { - if (nSprayTime == 1) - { - ensightCaseEntry<tensor> - ( - caseFile, - fieldObject, - dataMask, - true - ); - } - - ensightSprayField<tensor> - ( - fieldObject, - dataDir, - subDir, - format - ); - - } - } - } - Info<< endl; + // remember the time index + cloudTimesUsed[cloudName].append(timeIndex); } } - fieldFileNumbers.setSize(nFieldTime); - sprayFileNumbers.setSize(nSprayTime); - - // add time values - caseFile << nl << "TIME" << nl; -# include "ensightCaseTimes.H" +# include "ensightOutputCase.H" Info<< "\nEnd\n"<< endl; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/validateFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/validateFields.H new file mode 100644 index 0000000000000000000000000000000000000000..61676b00b1476af3a5ee56c33d54c405f91bca43 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/validateFields.H @@ -0,0 +1,104 @@ +// ignore special fields or fields that we don't handle +// +forAllIter(HashTable<word>, volumeFields, fieldIter) +{ + const word& fieldName = fieldIter.key(); + const word& fieldType = fieldIter(); + + if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) != "_0") + { + volumeFields.erase(fieldIter); + } + else + { + // remove types that we don't handle: + bool invalid = true; + for (label typeI=0; invalid && volFieldTypes[typeI].size(); ++typeI) + { + if (fieldType == volFieldTypes[typeI]) + { + invalid = false; + } + } + + if (invalid) + { + Info<< "ignoring " << fieldType << ": " << fieldName << endl; + volumeFields.erase(fieldIter); + } + } +} + +// verify that the variable is present for all times +// +for (label i=0; volumeFields.size() && i < timeDirs.size(); ++i) +{ + IOobjectList objs(mesh, timeDirs[i].name()); + + forAllIter(HashTable<word>, volumeFields, fieldIter) + { + const word& fieldName = fieldIter.key(); + + if (!objs.found(fieldName)) + { + volumeFields.erase(fieldIter); + } + } +} + + + +// ignore fields that we don't handle +// +forAllIter(HashTable<HashTable<word> >, cloudFields, cloudIter) +{ + const word& cloudName = cloudIter.key(); + + forAllIter(HashTable<word>, cloudIter(), fieldIter) + { + const word& fieldName = fieldIter.key(); + const word& fieldType = fieldIter(); + + // remove types that we don't handle: + bool invalid = true; + for (label typeI=0; invalid && sprayFieldTypes[typeI].size(); ++typeI) + { + if (fieldType == sprayFieldTypes[typeI]) + { + invalid = false; + } + } + + if (invalid) + { + Info<< "ignoring " << fieldType << ": " << fieldName << endl; + cloudIter().erase(fieldIter); + } + } + + if (!cloudIter().size()) + { + Info<< "removing cloud " << cloudName<< endl; + cloudFields.erase(cloudIter); + } +} + +// DEBUGGING +// Info<<"final fields ("; +// forAllConstIter(HashTable<word>, volumeFields, fieldIter) +// { +// Info<< " " << fieldIter.key(); +// } +// +// Info<< " )\n"; +// +// forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter) +// { +// Info<<"final fields for lagrangian/" << cloudIter.key() << " ("; +// forAllConstIter(HashTable<word>, cloudIter(), fieldIter) +// { +// Info<< " " << fieldIter.key(); +// } +// Info<< " )\n"; +// } + diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwclean b/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwclean index 206ee020896e33df69584c40ee2f5886ce98c9f7..80507fd289e08db8ef2f8c22208d460eb4ec1503 100755 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwclean +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwclean @@ -1,4 +1,5 @@ #!/bin/sh +cd ${0%/*} || exit 1 # run from this directory set -x rm -rf PV3FoamReader/Make diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwmake b/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwmake index 9a91c339909b68e43085888cf68592ccf24e302e..a7e703b8c0a978741416ef3364367e2925dc9c06 100755 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwmake +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/Allwmake @@ -1,4 +1,5 @@ #!/bin/sh +cd ${0%/*} || exit 1 # run from this directory set -x if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml index 5113e718deb09d30b12d5ddf1cb609f27aa9c209..93bb9ffe9dac6602dafc8f67de2442b6aeaa3528 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml @@ -27,98 +27,6 @@ </Documentation> </DoubleVectorProperty> - <!-- Send continuous time info to the animation panel --> - <DoubleVectorProperty - name="TimeRange" - information_only="1"> - <TimeRangeInformationHelper/> - </DoubleVectorProperty> - - - <!-- Global attributes --> - - <!-- Update GUI check box --> - <IntVectorProperty - name="UpdateGUI" - command="SetUpdateGUI" - number_of_elements="1" - default_values="0" - animateable="0"> - <BooleanDomain name="bool"/> - <Documentation> - A simple way cause a reader GUI modification. - </Documentation> - </IntVectorProperty> - - <!-- Cache Mesh check-box --> - <IntVectorProperty - name="CacheMesh" - command="SetCacheMesh" - number_of_elements="1" - default_values="1" - animateable="0"> - <BooleanDomain name="bool"/> - <Documentation> - Cache the fvMesh in memory. - </Documentation> - </IntVectorProperty> - - <!-- Extrapolate Walls check-box --> - <IntVectorProperty - name="ExtrapolateWalls" - command="SetExtrapolateWalls" - number_of_elements="1" - default_values="0" - animateable="0"> - <BooleanDomain name="bool"/> - <Documentation> - Extrapolate internalField to wall and empty patches - </Documentation> - </IntVectorProperty> - - <!-- Include Sets check-box --> - <IntVectorProperty - name="IncludeSets" - command="SetIncludeSets" - number_of_elements="1" - default_values="0" - animateable="0"> - <Documentation> - Searches the polyMesh/sets/ directory - </Documentation> - <BooleanDomain name="bool"/> - </IntVectorProperty> - - <!-- Include Zones check-box --> - <IntVectorProperty - name="IncludeZones" - command="SetIncludeZones" - number_of_elements="1" - default_values="0" - animateable="0"> - <Documentation> - ZoneMesh information is used to find {cell,face,point}Zones. - The polyMesh/ directory is only checked on startup. - </Documentation> - <BooleanDomain name="bool"/> - </IntVectorProperty> - - <!-- Show Patch Names check-box --> - <IntVectorProperty - name="ShowPatchNames" - command="SetShowPatchNames" - number_of_elements="1" - default_values="0" - animateable="0"> - <BooleanDomain name="bool"/> - <Documentation> - Show patch names in render window. - </Documentation> - </IntVectorProperty> - - - <!-- Selections --> - <!-- Available Parts (volume, patches, lagrangian) array --> <StringVectorProperty name="PartArrayInfo" @@ -211,6 +119,86 @@ </ArraySelectionDomain> </StringVectorProperty> + <!-- Extrapolate Walls check-box --> + <IntVectorProperty + name="ExtrapolateWalls" + command="SetExtrapolateWalls" + number_of_elements="1" + default_values="0" + animateable="0"> + <BooleanDomain name="bool"/> + <Documentation> + Extrapolate internalField to wall and empty patches + </Documentation> + </IntVectorProperty> + + <!-- Include Sets check-box --> + <IntVectorProperty + name="IncludeSets" + command="SetIncludeSets" + number_of_elements="1" + default_values="0" + animateable="0"> + <Documentation> + Searches the polyMesh/sets/ directory + </Documentation> + <BooleanDomain name="bool"/> + </IntVectorProperty> + + <!-- Include Zones check-box --> + <IntVectorProperty + name="IncludeZones" + command="SetIncludeZones" + number_of_elements="1" + default_values="0" + animateable="0"> + <Documentation> + ZoneMesh information is used to find {cell,face,point}Zones. + The polyMesh/ directory is only checked on startup. + </Documentation> + <BooleanDomain name="bool"/> + </IntVectorProperty> + + <!-- Show Patch Names check-box --> + <IntVectorProperty + name="ShowPatchNames" + command="SetShowPatchNames" + number_of_elements="1" + default_values="0" + animateable="0"> + <BooleanDomain name="bool"/> + <Documentation> + Show patch names in render window. + </Documentation> + </IntVectorProperty> + + <!-- Cache Mesh check-box --> + <IntVectorProperty + name="CacheMesh" + command="SetCacheMesh" + number_of_elements="1" + default_values="1" + animateable="0"> + <BooleanDomain name="bool"/> + <Documentation> + Cache the fvMesh in memory. + </Documentation> + </IntVectorProperty> + + + <!-- Update GUI check box --> + <IntVectorProperty + name="UpdateGUI" + command="SetUpdateGUI" + number_of_elements="1" + default_values="0" + animateable="0"> + <BooleanDomain name="bool"/> + <Documentation> + A simple way cause a reader GUI modification. + </Documentation> + </IntVectorProperty> + </SourceProxy> </ProxyGroup> </ServerManagerConfiguration> diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx index 7d2f223ebec7dbc3df895a1815c8dc0f8035b38b..8fc518d745edaa19bd0107bcc391c94d6c9bbbb8 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx @@ -112,10 +112,7 @@ vtkPV3FoamReader::~vtkPV3FoamReader() { vtkDebugMacro(<<"Deconstructor"); - if (foamData_) - { - delete foamData_; - } + delete foamData_; if (FileName) { @@ -186,6 +183,15 @@ int vtkPV3FoamReader::RequestInformation int nTimeSteps = 0; double* timeSteps = foamData_->findTimes(nTimeSteps); + if (!nTimeSteps) + { + vtkErrorMacro("could not find valid OpenFOAM mesh"); + + // delete foamData and flag it as fatal error + delete foamData_; + foamData_ = NULL; + return 0; + } // set identical time steps for all ports for (int infoI = 0; infoI < nInfo; ++infoI) @@ -249,6 +255,13 @@ int vtkPV3FoamReader::RequestData return 0; } + // catch previous error + if (!foamData_) + { + vtkErrorMacro("Reader failed - perhaps no mesh?"); + return 0; + } + int nInfo = outputVector->GetNumberOfInformationObjects(); if (Foam::vtkPV3Foam::debug) @@ -263,6 +276,7 @@ int vtkPV3FoamReader::RequestData // take port0 as the lead for other outputs vtkInformation *outInfo = outputVector->GetInformationObject(0); + vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast ( outInfo->Get diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 10ccf691263ef8069171407b7f3aeb858a045a93..7780ad3cfd71156946731ee7501d50e23ae59ab5 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -103,10 +103,8 @@ int Foam::vtkPV3Foam::setTime(const double& requestedTime) // Get times list instantList Times = runTime.times(); - int foundIndex = Time::findClosestTimeIndex(Times, requestedTime); - int nearestIndex = foundIndex; - - if (foundIndex < 0) + int nearestIndex = Time::findClosestTimeIndex(Times, requestedTime); + if (nearestIndex < 0) { nearestIndex = 0; } @@ -146,7 +144,7 @@ int Foam::vtkPV3Foam::setTime(const double& requestedTime) << " fieldsChanged=" << fieldsChanged_ << endl; } - return foundIndex; + return nearestIndex; } @@ -206,7 +204,8 @@ Foam::vtkPV3Foam::vtkPV3Foam reader_(reader), dbPtr_(NULL), meshPtr_(NULL), - nMesh_(0), + meshRegion_(polyMesh::defaultRegion), + meshDir_(polyMesh::meshSubDir), timeIndex_(-1), meshChanged_(true), fieldsChanged_(true), @@ -248,10 +247,38 @@ Foam::vtkPV3Foam::vtkPV3Foam setEnv("FOAM_CASE", fullCasePath, true); } + // look for 'case{region}.OpenFOAM' + // could be stringent and insist the prefix match the directory name... + // Note: cannot use fileName::name() due to the embedded '{}' + string caseName(fileName(FileName).lessExt()); + string::size_type beg = caseName.find_last_of("/{"); + string::size_type end = caseName.find('}', beg); + + if + ( + beg != string::npos && caseName[beg] == '{' + && end != string::npos && end == caseName.size()-1 + ) + { + meshRegion_ = caseName.substr(beg+1, end-beg-1); + + // some safety + if (!meshRegion_.size()) + { + meshRegion_ = polyMesh::defaultRegion; + } + + if (meshRegion_ != polyMesh::defaultRegion) + { + meshDir_ = meshRegion_/polyMesh::meshSubDir; + } + } + if (debug) { Info<< "fullCasePath=" << fullCasePath << nl - << "FOAM_CASE=" << getEnv("FOAM_CASE") << endl; + << "FOAM_CASE=" << getEnv("FOAM_CASE") << nl + << "region=" << meshRegion_ << endl; } // Create time object @@ -368,15 +395,20 @@ void Foam::vtkPV3Foam::updateFoamMesh() { if (debug) { - Info<< "Creating Foam mesh" << endl; + Info<< "Creating Foam mesh for region " << meshRegion_ + << " at time=" << dbPtr_().timeName() + << endl; + } + meshPtr_ = new fvMesh ( IOobject ( - fvMesh::defaultRegion, + meshRegion_, dbPtr_().timeName(), - dbPtr_() + dbPtr_(), + IOobject::MUST_READ ) ); @@ -478,11 +510,26 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps) Time& runTime = dbPtr_(); instantList timeLst = runTime.times(); - // always skip "constant" time, unless there are no other times - nTimes = timeLst.size(); + // find the first time for which this mesh appears to exist label timeI = 0; + for (; timeI < timeLst.size(); ++timeI) + { + const word& timeName = timeLst[timeI].name(); - if (nTimes > 1) + if + ( + file(runTime.path()/timeName/meshDir_/"points") + && IOobject("points", timeName, meshDir_, runTime).headerOk() + ) + { + break; + } + } + + nTimes = timeLst.size() - timeI; + + // always skip "constant" time if possible + if (timeI == 0 && nTimes > 1) { timeI = 1; --nTimes; @@ -699,7 +746,6 @@ void Foam::vtkPV3Foam::removePatchNames(vtkRenderer* renderer) void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const { - os << indent << "Number of meshes: " << nMesh_ << "\n"; os << indent << "Number of nodes: " << (meshPtr_ ? meshPtr_->nPoints() : 0) << "\n"; @@ -708,6 +754,8 @@ void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const os << indent << "Number of available time steps: " << (dbPtr_.valid() ? dbPtr_().times().size() : 0) << endl; + + os << indent << "mesh region: " << meshRegion_ << "\n"; } // ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index ada85c137322fc457c615792384664c938e1f850..72d1edee5716aadb5037e57d1cdd91d09f9fc7ef 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -92,11 +92,8 @@ class polyPatch; class faceSet; class pointSet; -template<class Type> -class IOField; - -template<class Type> -class List; +template<class Type> class IOField; +template<class Type> class List; /*---------------------------------------------------------------------------*\ Class vtkPV3Foam Declaration @@ -248,9 +245,11 @@ class vtkPV3Foam //- Foam mesh fvMesh* meshPtr_; - //- Number of meshes - // TODO - for info only - only set up to process ONE mesh - int nMesh_; + //- The mesh region + word meshRegion_; + + //- The mesh directory for the region + fileName meshDir_; //- The time index int timeIndex_; @@ -716,6 +715,7 @@ public: return timeIndex_; } + // Access //- Debug information diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.C index bf5742e3a8671751db6527f789283ee78f00f65f..4f320c802c4e76ab22e85b8380d47fe847837309 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.C @@ -72,6 +72,8 @@ void Foam::vtkPV3Foam::convertVolFields vtkMultiBlockDataSet* output ) { + const fvMesh& mesh = *meshPtr_; + wordHashSet selectedFields = getSelected ( reader_->GetVolFieldSelection() @@ -82,8 +84,8 @@ void Foam::vtkPV3Foam::convertVolFields return; } - const fvMesh& mesh = *meshPtr_; // Get objects (fields) for this time - only keep selected fields + // the region name is already in the mesh db IOobjectList objects(mesh, dbPtr_().timeName()); pruneObjectList(objects, selectedFields); @@ -158,6 +160,8 @@ void Foam::vtkPV3Foam::convertPointFields vtkMultiBlockDataSet* output ) { + const fvMesh& mesh = *meshPtr_; + wordHashSet selectedFields = getSelected ( reader_->GetPointFieldSelection() @@ -168,8 +172,8 @@ void Foam::vtkPV3Foam::convertPointFields return; } - const fvMesh& mesh = *meshPtr_; // Get objects (fields) for this time - only keep selected fields + // the region name is already in the mesh db IOobjectList objects(mesh, dbPtr_().timeName()); pruneObjectList(objects, selectedFields); @@ -257,8 +261,10 @@ void Foam::vtkPV3Foam::convertLagrangianFields continue; } + // Get the Lagrangian fields for this time and this cloud // but only keep selected fields + // the region name is already in the mesh db IOobjectList objects ( mesh, diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C index 8539bca001ce85a70819c92cdefb85cfeaad790b..087790f9de41f295dac34b6288042dcc6e9fd960 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C @@ -64,7 +64,7 @@ void Foam::vtkPV3Foam::convertMeshVolume } // Convert the internalMesh - // TODO: multiple mesh regions + // this looks like more than one part, but it isn't for (int partId = selector.start(); partId < selector.end(); ++partId) { const word partName = "internalMesh"; @@ -239,7 +239,6 @@ void Foam::vtkPV3Foam::convertMeshCellZones } const cellZoneMesh& zMesh = mesh.cellZones(); - for (int partId = selector.start(); partId < selector.end(); ++partId) { const word zoneName = getPartName(partId); @@ -408,7 +407,6 @@ void Foam::vtkPV3Foam::convertMeshFaceZones } const faceZoneMesh& zMesh = mesh.faceZones(); - for (int partId = selector.start(); partId < selector.end(); ++partId) { const word zoneName = getPartName(partId); @@ -515,6 +513,7 @@ void Foam::vtkPV3Foam::convertMeshPointZones partInfo& selector = partInfoPointZones_; selector.block(blockNo); // set output block label datasetNo = 0; // restart at dataset 0 + const fvMesh& mesh = *meshPtr_; if (debug) { @@ -522,12 +521,9 @@ void Foam::vtkPV3Foam::convertMeshPointZones printMemory(); } - const fvMesh& mesh = *meshPtr_; - if (selector.size()) { const pointZoneMesh& zMesh = mesh.pointZones(); - for (int partId = selector.start(); partId < selector.end(); ++partId) { word zoneName = getPartName(partId); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C index d1b0492235c56aa1d63717439bba31f062a4b650..ce050d1ae0499740db6e85c5bb1d118b2f1692ec 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C @@ -36,6 +36,7 @@ Description #include "vtkPV3FoamPoints.H" // VTK includes +#include "vtkCellArray.h" #include "vtkPoints.h" #include "vtkPolyData.h" @@ -56,6 +57,8 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh printMemory(); } + + // the region name is already in the mesh db IOobjectList sprayObjs ( mesh, @@ -75,15 +78,25 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh vtkmesh = vtkPolyData::New(); vtkPoints* vtkpoints = vtkPoints::New(); + vtkCellArray* vtkcells = vtkCellArray::New(); + vtkpoints->Allocate( parcels.size() ); + vtkcells->Allocate( parcels.size() ); + vtkIdType particleId = 0; forAllConstIter(Cloud<passiveParticle>, parcels, iter) { vtkPV3FoamInsertNextPoint(vtkpoints, iter().position()); + + vtkcells->InsertNextCell(1, &particleId); + particleId++; } vtkmesh->SetPoints(vtkpoints); vtkpoints->Delete(); + + vtkmesh->SetVerts(vtkcells); + vtkcells->Delete(); } if (debug) diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C index bacaa0f63d01724660e68655768b7033f7e21903..bbe324b9434d7a7c696e2821b6a10ea3bdda12eb 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C @@ -35,8 +35,8 @@ Description // VTK includes #include "vtkCellArray.h" +#include "vtkPoints.h" #include "vtkPolyData.h" -#include "vtkUnstructuredGrid.h" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C index 1c00a04a8573edf498772061a60d081b95e06a1c..32d78c9d17485e495e78f5c62fcb2d5bbd8c4735 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C @@ -91,11 +91,11 @@ Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType) zoneType, dbPtr_().findInstance ( - polyMesh::meshSubDir, + meshDir_, zoneType, IOobject::READ_IF_PRESENT ), - polyMesh::meshSubDir, + meshDir_, dbPtr_(), IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, @@ -126,10 +126,6 @@ void Foam::vtkPV3Foam::updateInfoInternalMesh() vtkDataArraySelection* partSelection = reader_->GetPartSelection(); - // Determine number of meshes available - HashTable<const fvMesh*> meshObjects = dbPtr_().lookupClass<const fvMesh>(); - nMesh_ = meshObjects.size(); - // Determine mesh parts (internalMesh, patches...) //- Add internal mesh as first entry partInfoVolume_ = partSelection->GetNumberOfArrays(); @@ -155,10 +151,19 @@ void Foam::vtkPV3Foam::updateInfoLagrangian() << " " << dbPtr_->timePath()/"lagrangian" << endl; } + + // use the db directly since this might be called without a mesh, + // but the region must get added back in + fileName lagrangianPrefix("lagrangian"); + if (meshRegion_ != polyMesh::defaultRegion) + { + lagrangianPrefix = meshRegion_/"lagrangian"; + } + // Search for list of lagrangian objects for this time fileNameList cloudDirs ( - readDir(dbPtr_->timePath()/"lagrangian", fileName::DIRECTORY) + readDir(dbPtr_->timePath()/lagrangianPrefix, fileName::DIRECTORY) ); vtkDataArraySelection* partSelection = reader_->GetPartSelection(); @@ -221,43 +226,50 @@ void Foam::vtkPV3Foam::updateInfoPatches() } else { - // Read patches - polyBoundaryMeshEntries patchEntries + // mesh not loaded - read from file + // but this could fail if we've supplied a bad region name + IOobject ioObj ( - IOobject + "boundary", + dbPtr_().findInstance ( + meshDir_, "boundary", - dbPtr_().findInstance(polyMesh::meshSubDir, "boundary"), - polyMesh::meshSubDir, - dbPtr_(), - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ) + IOobject::READ_IF_PRESENT + ), + meshDir_, + dbPtr_(), + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false ); - // Add (non-zero) patches to the list of mesh parts - forAll(patchEntries, entryI) + // this should only ever fail if the mesh region doesn't exist + if (ioObj.headerOk()) { - label nFaces - ( - readLabel(patchEntries[entryI].dict().lookup("nFaces")) - ); + polyBoundaryMeshEntries patchEntries(ioObj); - // Valid patch if nFace > 0 - if (nFaces) + // Add (non-zero) patches to the list of mesh parts + forAll(patchEntries, entryI) { - // Add patch to GUI list - partSelection->AddArray + label nFaces ( - (patchEntries[entryI].keyword() + " - patch").c_str() + readLabel(patchEntries[entryI].dict().lookup("nFaces")) ); - ++nPatches; + // Valid patch if nFace > 0 - add patch to GUI list + if (nFaces) + { + partSelection->AddArray + ( + (patchEntries[entryI].keyword() + " - patch").c_str() + ); + + ++nPatches; + } } } } - partInfoPatches_ += nPatches; if (debug) @@ -380,8 +392,8 @@ void Foam::vtkPV3Foam::updateInfoSets() IOobjectList objects ( dbPtr_(), - dbPtr_().findInstance(polyMesh::meshSubDir, "faces"), - polyMesh::meshSubDir/"sets" + dbPtr_().findInstance(meshDir_, "faces", IOobject::READ_IF_PRESENT), + meshDir_/"sets" ); @@ -449,11 +461,19 @@ void Foam::vtkPV3Foam::updateInfoLagrangianFields() word cloudName = getPartName(partId); + // use the db directly since this might be called without a mesh, + // but the region must get added back in + fileName lagrangianPrefix("lagrangian"); + if (meshRegion_ != polyMesh::defaultRegion) + { + lagrangianPrefix = meshRegion_/"lagrangian"; + } + IOobjectList objects ( dbPtr_(), dbPtr_().timeName(), - "lagrangian"/cloudName + lagrangianPrefix/cloudName ); addToSelection<IOField<label> > diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H index bd18d66d944640a02ad8fdc30bad1333d7117b28..89eb653c8369aa98ca7fd8982829230b46e74bd9 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H @@ -59,8 +59,16 @@ void Foam::vtkPV3Foam::updateInfoFields select->RemoveAllArrays(); - // Search for list of objects for this time - IOobjectList objects(dbPtr_(), dbPtr_().timeName()); + // use the db directly since this might be called without a mesh, + // but the region must get added back in + word regionPrefix; + if (meshRegion_ != polyMesh::defaultRegion) + { + regionPrefix = meshRegion_; + } + + // Search for list of objects for this time and mesh region + IOobjectList objects(dbPtr_(), dbPtr_().timeName(), regionPrefix); //- Add volume fields to GUI addToSelection<GeometricField<scalar, patchType, meshType> > diff --git a/applications/utilities/postProcessing/velocityField/Co/Co.C b/applications/utilities/postProcessing/velocityField/Co/Co.C index d69bc37a7987e04b351ef0b09a95111db561ac7d..615fac46893f11991abc5b056674e7c3b0e5fa1d 100644 --- a/applications/utilities/postProcessing/velocityField/Co/Co.C +++ b/applications/utilities/postProcessing/velocityField/Co/Co.C @@ -38,6 +38,52 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +namespace Foam +{ + tmp<volScalarField> Co(const surfaceScalarField& Cof) + { + const fvMesh& mesh = Cof.mesh(); + + tmp<volScalarField> tCo + ( + new volScalarField + ( + IOobject + ( + "Co", + mesh.time().timeName(), + mesh + ), + mesh, + dimensionedScalar("0", Cof.dimensions(), 0) + ) + ); + + volScalarField& Co = tCo(); + + // Set local references to mesh data + const unallocLabelList& owner = mesh.owner(); + const unallocLabelList& neighbour = mesh.neighbour(); + + forAll(owner, facei) + { + label own = owner[facei]; + label nei = neighbour[facei]; + + Co[own] = max(Co[own], Cof[facei]); + Co[nei] = max(Co[nei], Cof[facei]); + } + + forAll(Co.boundaryField(), patchi) + { + Co.boundaryField()[patchi] = Cof.boundaryField()[patchi]; + } + + return tCo; + } +} + + void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) { bool writeResults = !args.options().found("noWrite"); @@ -79,7 +125,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) ( IOobject ( - "Co", + "Cof", runTime.timeName(), mesh, IOobject::NO_READ @@ -101,7 +147,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) ( IOobject ( - "Co", + "Cof", runTime.timeName(), mesh, IOobject::NO_READ @@ -126,6 +172,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) if (writeResults) { CoPtr().write(); + Co(CoPtr())().write(); } } else diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionaryDict b/applications/utilities/preProcessing/changeDictionary/changeDictionaryDict index 93935af0252f366af3d1d12caf8719b394e5d836..946682c0dc4ad670b9a733b35d9d123f7bf26f96 100644 --- a/applications/utilities/preProcessing/changeDictionary/changeDictionaryDict +++ b/applications/utilities/preProcessing/changeDictionary/changeDictionaryDict @@ -1,20 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ FoamFile { - version 2.0; - format ascii; - - root "/home/warhol/chris/foam/chris2.1/run/tutorials/interFoam"; - case "damBreak"; - instance "system"; - local ""; - - class dictionary; - object changePatchTypeDict; + version 2.0; + format ascii; + class dictionary; + object changeDictionaryDict; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - dictionaryReplacement { T @@ -61,7 +60,6 @@ dictionaryReplacement } } - K { internalField uniform 80; @@ -83,7 +81,6 @@ dictionaryReplacement } } - cp { internalField uniform 450; diff --git a/applications/utilities/surface/surfaceAutoPatch/Make/files b/applications/utilities/surface/surfaceAutoPatch/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..38a0ebbbf2a913b022dd9b4302f29b4eeee0984f --- /dev/null +++ b/applications/utilities/surface/surfaceAutoPatch/Make/files @@ -0,0 +1,3 @@ +surfaceAutoPatch.C + +EXE = $(FOAM_APPBIN)/surfaceAutoPatch diff --git a/applications/utilities/surface/surfaceAutoPatch/Make/options b/applications/utilities/surface/surfaceAutoPatch/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..e4751082e14ff667621dfbf92ccf70545c128a26 --- /dev/null +++ b/applications/utilities/surface/surfaceAutoPatch/Make/options @@ -0,0 +1,8 @@ +EXE_INC = \ + /* -I$(LIB_SRC)/cfdTools/general/lnInclude */ \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/triSurface/lnInclude + +EXE_LIBS = \ + -lmeshTools \ + -ltriSurface diff --git a/applications/utilities/surface/surfaceAutoPatch/surfaceAutoPatch.C b/applications/utilities/surface/surfaceAutoPatch/surfaceAutoPatch.C new file mode 100644 index 0000000000000000000000000000000000000000..60f078409c879435042497aab9a25db37faa9b2c --- /dev/null +++ b/applications/utilities/surface/surfaceAutoPatch/surfaceAutoPatch.C @@ -0,0 +1,129 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + surfaceAutoPatch + +Description + Patches surface according to feature angle. Like autoPatch. + +\*---------------------------------------------------------------------------*/ + +#include "triangle.H" +#include "triSurface.H" +#include "argList.H" +#include "surfaceFeatures.H" +#include "treeBoundBox.H" +#include "meshTools.H" +#include "OFstream.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Main program: + +int main(int argc, char *argv[]) +{ + argList::noParallel(); + argList::validArgs.clear(); + argList::validArgs.append("input surface file"); + argList::validArgs.append("output surface file"); + argList::validArgs.append("included angle [0..180]"); + argList args(argc, argv); + + fileName inFileName(args.additionalArgs()[0]); + fileName outFileName(args.additionalArgs()[1]); + scalar includedAngle(readScalar(IStringStream(args.additionalArgs()[2])())); + + Pout<< "Surface : " << inFileName << nl + << endl; + + + // Read + // ~~~~ + + Info << "Reading : " << inFileName << endl; + triSurface surf(inFileName); + + Info<< "Read surface:" << endl; + surf.writeStats(Info); + Info<< endl; + + + + // Construct features from surface&featureangle + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Info<< "Constructing feature set from included angle " << includedAngle + << endl; + + surfaceFeatures set(surf, includedAngle); + + Pout<< nl + << "Feature set:" << nl + << " feature points : " << set.featurePoints().size() << nl + << " feature edges : " << set.featureEdges().size() << nl + << " of which" << nl + << " region edges : " << set.nRegionEdges() << nl + << " external edges : " << set.nExternalEdges() << nl + << " internal edges : " << set.nInternalEdges() << nl + << endl; + + // Get per-edge status. + boolList borderEdge(surf.nEdges(), false); + forAll(set.featureEdges(), i) + { + borderEdge[set.featureEdges()[i]] = true; + } + + labelList faceRegion(surf.size()); + label nRegions = surf.markZones(borderEdge, faceRegion); + + // Reregion triangles. + forAll(surf, i) + { + surf[i].region() = faceRegion[i]; + } + + // Create some patches + surf.patches().setSize(nRegions); + + forAll(surf.patches(), patchI) + { + surf.patches()[patchI].name() = "patch" + Foam::name(patchI); + surf.patches()[patchI].geometricType() = "empty"; + } + + + Info << "Writing : " << outFileName << endl; + surf.write(outFileName, true); + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/bin/buildParaView3.3-cvs b/bin/buildParaView3.3-cvs index 0327402419e01ed85ddbcdd89e0942b3b61250a8..1f95596f3c56c6e1d9cf87b3b28efce845109719 100755 --- a/bin/buildParaView3.3-cvs +++ b/bin/buildParaView3.3-cvs @@ -29,66 +29,108 @@ # Description # Build and install ParaView # - run from folder above ParaView source folder or place the -# ParaView source under $WM_PROJECT_INST_DIR +# ParaView source under $WM_THIRD_PARTY_DIR # #------------------------------------------------------------------------------ . $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions -# set -x - PARAVIEW_SRC="ParaView3.3-cvs" PARAVIEW_MAJOR_VERSION="3.3" -VERBOSE=OFF - -# User options -# ~~~~~~~~~~~~ +# User options: +# ~~~~~~~~~~~~~ -# MPI suport -INCLUDE_MPI=OFF +# MPI support: +WITH_MPI=OFF MPI_MAX_PROCS=32 -# Python -# note: script will try to determine python library. If it fails, specify the -# path using the PYTHON_LIBRARY variable -INCLUDE_PYTHON=OFF -#PYTHON_LIBRARY="/usr/lib64/libpython2.5.so.1.0" +# Python support: +# note: script will try to determine python library. +# If it fails, specify the path using the PYTHON_LIBRARY variable +WITH_PYTHON=OFF PYTHON_LIBRARY="" +# PYTHON_LIBRARY="/usr/lib64/libpython2.5.so.1.0" -# MESA graphics -INCLUDE_MESA=OFF - - -# No further editing should be required below this line -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -set +x - -# Provide a shortcut for repeated builds - use with caution -if [ "$#" -gt 0 ] -then - CMAKE_SKIP=YES -fi - - -# Initialisation -#~~~~~~~~~~~~~~~ -initialiseVariables +# MESA graphics support: +WITH_MESA=OFF +# +# No further editing below this line +#------------------------------------------------------------------------------ +Script=${0##*/} + +usage() { + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat<<USAGE + +usage: ${0##*/} [OPTION] +options: + -fast skip cmake for repeated builds - use with caution + -mpi with mpi (if not already enabled) + -python with python (if not already enabled) + -mesa with mesa (if not already enabled) + -verbose verbose cmake output + -help + +Build and install $PARAVIEW_SRC + - run from folder above the ParaView source folder or place the + ParaView source under \$WM_THIRD_PARTY_DIR + +USAGE + exit 1 +} + +# options based on the script name: +case "$Script" in *-fast*) CMAKE_SKIP=ON;; esac +case "$Script" in *-mpi*) WITH_MPI=ON;; esac +case "$Script" in *-python*) WITH_PYTHON=ON;; esac +case "$Script" in *-mesa*) WITH_MESA=ON;; esac + +# parse options +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help) + usage + ;; + -fast) + CMAKE_SKIP=YES + shift + ;; + -mpi) + WITH_MPI=ON + shift + ;; + -python) + WITH_PYTHON=ON + shift + ;; + -mesa) + WITH_MESA=ON + shift + ;; + -verbose) + VERBOSE=ON + shift + ;; + *) + usage "unknown option/argument: '$*'" + ;; + esac +done # Set configure options #~~~~~~~~~~~~~~~~~~~~~~ -addMpiSupport # set MPI specific options -addPythonSupport # set python specific options -addMesaSupport # set MESA specific options - +addVerbosity # set CMake verbosity +addMpiSupport # set MPI-specific options +addPythonSupport # set Python-specific options +addMesaSupport # set MESA-specific options # Build and install # ~~~~~~~~~~~~~~~~~ buildParaView installParaView - echo "done" #------------------------------------------------------------------------------ diff --git a/bin/buildParaView3.3-cvs-python b/bin/buildParaView3.3-cvs-python new file mode 120000 index 0000000000000000000000000000000000000000..db5ce4641b139ff974bcef01ee90a13c71a117d6 --- /dev/null +++ b/bin/buildParaView3.3-cvs-python @@ -0,0 +1 @@ +buildParaView3.3-cvs \ No newline at end of file diff --git a/bin/foamUpdateCaseFileHeader b/bin/foamUpdateCaseFileHeader index 6b7aa8439ff85426d5aa82012978712ee8b0583e..805f4e128a72d215cf0eebc67d7477e4fe75b87a 100755 --- a/bin/foamUpdateCaseFileHeader +++ b/bin/foamUpdateCaseFileHeader @@ -121,17 +121,18 @@ do if grep FoamFile $caseFile >/dev/null 2>&1 then echo "Updating case file: $caseFile" - sed -n '/FoamFile/,/}/p' $caseFile > FoamFile + sed -n '/FoamFile/,/}/p' $caseFile > FoamFile.tmp - CLASS=`FoamFileAttribute class FoamFile` - OBJECT=`FoamFileAttribute object FoamFile` - FORMAT=`FoamFileAttribute format FoamFile` + CLASS=`FoamFileAttribute class FoamFile.tmp` + OBJECT=`FoamFileAttribute object FoamFile.tmp` + FORMAT=`FoamFileAttribute format FoamFile.tmp` printHeader $FORMAT $CLASS $OBJECT $NOTE > FoamFile.tmp sed '1,/}/d' $caseFile | sed '/./,/^$/!d' >> FoamFile.tmp - mv FoamFile.tmp $caseFile - rm FoamFile + # use cat to avoid removing/replace soft-links + [ -s FoamFile.tmp ] && cat FoamFile.tmp >| $caseFile + rm FoamFile.tmp else echo " Invalid case file: $caseFile" fi diff --git a/bin/foamUpgradeTurbulenceProperties b/bin/foamUpgradeTurbulenceProperties index 8c1437aca6675224f53814c0e7cb2326e1c4e6c6..297b7e4e63567f6dc3cd6d1d817ce4e839292e3b 100755 --- a/bin/foamUpgradeTurbulenceProperties +++ b/bin/foamUpgradeTurbulenceProperties @@ -57,15 +57,20 @@ USAGE # convertDict() { - echo "Identified $1 turbulence model in '$3'" - outputPath=`dirname $3` + echo "Identified $1 turbulence model in '$3'" + outputPath=`dirname $3` - sed -e "s/turbulenceProperties/$1Properties/" \ - -e "s/$2/$1Model/" \ - -e "s/[a-zA-Z0-9]* [ ]*\[[0-9 ]*\]//" \ - $3 > "$outputPath/$1Properties" + if [ -e "$outputPath/$1Properties" ] + then + echo "Error: file already exists $outputPath/$1Properties'" + else + sed -e "s/turbulenceProperties/$1Properties/" \ + -e "s/$2/$1Model/" \ + -e "s/[a-zA-Z0-9]* [ ]*\[[0-9 ]*\]//" \ + $3 > "$outputPath/$1Properties" - echo " wrote $outputPath/$1Properties" + echo " wrote $outputPath/$1Properties" + fi } [ $# -ge 1 ] || usage diff --git a/bin/paraFoam b/bin/paraFoam index 217596343a61e3051102dd3dce44e276ee65f411..101bba1674e1867ee9ddad85f2acbef9b7cc34bc 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -34,7 +34,11 @@ usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<<USAGE -usage: ${0##*/} [-case dir] +usage: ${0##*/} [OPTION] +options: + -case dir specify alternative case directory + -region name specify mesh region name + -touch create the .OpenFOAM file only and exit * start paraview $ParaView_VERSION with the OpenFOAM libraries @@ -42,6 +46,8 @@ USAGE exit 1 } +unset regionName touchOnly + # parse options while [ "$#" -gt 0 ] do @@ -55,6 +61,15 @@ do shift 2 cd "$caseDir" 2>/dev/null || usage "directory does not exist: '$caseDir'" ;; + -region) + [ "$#" -ge 2 ] || usage "'-region' option requires an argument" + regionName=$2 + shift 2 + ;; + -touch) + touchOnly=1 + shift + ;; *) usage "unknown option/argument: '$*'" ;; @@ -64,6 +79,17 @@ done # get a sensible caseName caseName=${PWD##*/} caseFile="$caseName.OpenFOAM" +if [ -n "$regionName" ] +then + caseFile="$caseName{$regionName}.OpenFOAM" +fi + +if [ -n "$touchOnly" ]; +then + touch "$caseFile" + echo "created '$caseFile'" + exit 0 +fi # parent directory for normal or parallel results case "$caseName" in @@ -80,7 +106,6 @@ done case "$ParaView_VERSION" in 2*) - # Clean up on termination and on Ctrl-C trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT touch $caseFile @@ -92,10 +117,14 @@ case "$ParaView_VERSION" in ;; *) - # Clean up on termination and on Ctrl-C - trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT - touch $caseFile - paraview --data=$caseFile + # only create/remove caseFile if it doesn't exist + [ -e $caseFile ] || { + trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT + touch "$caseFile" + echo "created temporary '$caseFile'" + } + + paraview --data="$caseFile" ;; esac diff --git a/bin/rmclassall b/bin/rmclassall index 5ee1c736290e32193b48e9d0b743f1574485ef5f..059306bee51bfd47d4ef7d1e0aaa26abaca9eb2b 100755 --- a/bin/rmclassall +++ b/bin/rmclassall @@ -1,2 +1,24 @@ #!/bin/sh -find . \( -name '*.class' \) -print | xargs -t rm + +# default is pwd +if [ "$#" -eq 0 ] +then + set -- . +elif [ "$1" = "-h" -o "$1" = "-help" ] +then + echo "Usage: ${0##*/} [dir1] .. [dirN]" + echo " remove all .class files" + exit 1 +fi + +for i +do + if [ -d "$i" ] + then + echo "removing all .class files" + find $i -name '*.class' -print | xargs -t rm + else + echo "no directory: $i" + fi +done +#------------------------------------------------------------------------------ diff --git a/bin/rmcore b/bin/rmcore index 1245878ff311755659c7fbe23b8c054e803d2b0a..f34cae57a5cbc8b5da54210e6a167c03d328e72e 100755 --- a/bin/rmcore +++ b/bin/rmcore @@ -1,3 +1,25 @@ #!/bin/sh -# find . \( -name 'core' \) -exec ls -l {} \; -exec rm {} \; -find . \( -type f -name 'core' -o -name 'core.[1-9]*' -o -name 'vgcore.*' \) -print | xargs -t rm + +# default is pwd +if [ "$#" -eq 0 ] +then + set -- . +elif [ "$1" = "-h" -o "$1" = "-help" ] +then + echo "Usage: ${0##*/} [dir1] .. [dirN]" + echo " remove all core files" + exit 1 +fi + +for i +do + if [ -d "$i" ] + then + echo "removing all core files" + find $i \( -type f -name 'core' -o -name 'core.[1-9]*' -o -name 'vgcore.*' \) -print | xargs -t rm + else + echo "no directory: $i" + fi +done +#------------------------------------------------------------------------------ + diff --git a/bin/rmdepall b/bin/rmdepall index 84e65267410fa146989f744ada55c549876d2f49..4cfa1ad680111fac750ab2306583bd515d834b35 100755 --- a/bin/rmdepall +++ b/bin/rmdepall @@ -1,15 +1,19 @@ #!/bin/sh -if [ $# -eq 0 ] +if [ "$1" = "-h" -o "$1" = "-help" -o "$#" -gt 1 ] then - find . \( -name '*.dep' \) -print | xargs -t rm -elif [ $# -eq 1 ] + echo "Usage: ${0##*/} : remove all .dep files" + echo " ${0##*/} <file> : remove all .dep files referring to <file>" + exit 1 +fi + +if [ "$#" -eq 0 ] then - echo "Removing all dep files containing $1..." - find . -name '*.dep' -exec grep "$1" '{}' \; -exec rm '{}' \; + echo "removing all .dep files" + find . -name '*.dep' -print | xargs -t rm else - echo "Usage: ${0##/} to remove all .dep files" - echo " ${0##/} <file> to remove all .dep files referring to <file>" - exit 1 + echo "removing all .dep files containing $1..." + find . -name '*.dep' -exec grep "$1" '{}' \; -exec rm '{}' \; fi +#------------------------------------------------------------------------------ diff --git a/bin/rmoall b/bin/rmoall index 636e055e5bc43967f313b407afed1a86fd9b272d..32bd80478891e618880fccec7cb7e27b6700a468 100755 --- a/bin/rmoall +++ b/bin/rmoall @@ -1,2 +1,24 @@ #!/bin/sh -find . \( -name '*.o' \) -print | xargs -t rm + +# default is pwd +if [ "$#" -eq 0 ] +then + set -- . +elif [ "$1" = "-h" -o "$1" = "-help" ] +then + echo "Usage: ${0##*/} [dir1] .. [dirN]" + echo " remove all .o files" + exit 1 +fi + +for i +do + if [ -d "$i" ] + then + echo "removing all .o files: $i" + find $i -name '*.o' -print | xargs -t rm + else + echo "no directory: $i" + fi +done +#------------------------------------------------------------------------------ diff --git a/bin/rm~all b/bin/rm~all index 6ee2bad3700447e1bb99ffef67ec4a9b699aece4..0725382447aacd8296aa4f9aeecec8949dc4fe16 100755 --- a/bin/rm~all +++ b/bin/rm~all @@ -1,3 +1,24 @@ #!/bin/sh -# find . \( -name '*~' -o -name '.*~' \) -exec ls -l {} \; -exec rm {} \; -find . \( -name '*~' -o -name '.*~' \) -print | xargs -t rm + +# default is pwd +if [ "$#" -eq 0 ] +then + set -- . +elif [ "$1" = "-h" -o "$1" = "-help" ] +then + echo "Usage: ${0##*/} [dir1] .. [dirN]" + echo " remove all *~ files" + exit 1 +fi + +for i +do + if [ -d "$i" ] + then + echo "removing all *~ files" + find $i \( -name '*~' -o -name '.*~' \) -print | xargs -t rm + else + echo "no directory: $i" + fi +done +#------------------------------------------------------------------------------ diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index 03a34c208a54474925bdbc46acee5a97f75663af..1577d5583c783434ced371e507e1806e493c17f5 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -40,7 +40,7 @@ # rm -rf ${T} > /dev/null 2>&1 # fi # done -# rm -rf {log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.foam} > /dev/null 2>&1 +# rm -rf {log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1 #} cleanTimeDirectories () @@ -55,7 +55,7 @@ cleanTimeDirectories () zeros=`printf %0${nZeros}d 0` nZeros=$(($nZeros + 1)) done - rm -rf ./{[1-9]*,-[1-9]*,log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.foam} > /dev/null 2>&1 + rm -rf ./{[1-9]*,-[1-9]*,log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1 } cleanCase () diff --git a/bin/tools/buildParaView3.2.1 b/bin/tools/buildParaView3.2.1 index e6a87af07bb4c99997e9a48d62566d38ca057b9a..904682581df68d664661819d29b88fe4a24bfc7d 100755 --- a/bin/tools/buildParaView3.2.1 +++ b/bin/tools/buildParaView3.2.1 @@ -24,7 +24,7 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Script -# buildParaView +# buildParaView3.2.1 # # Description # Build and install ParaView @@ -34,34 +34,38 @@ #------------------------------------------------------------------------------ . $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions -# set -x - PARAVIEW_SRC="ParaView3.2.1" PARAVIEW_MAJOR_VERSION="3.2" -VERBOSE=OFF -INCLUDE_MPI=ON +# User options: +# ~~~~~~~~~~~~~ + +WITH_MPI=ON MPI_MAX_PROCS=32 -INCLUDE_PYTHON=ON +WITH_PYTHON=ON PYTHON_LIBRARY="" -INCLUDE_MESA=OFF +WITH__MESA=OFF -set +x +# +# No further editing below this line +#------------------------------------------------------------------------------ -# provide a shortcut for repeated builds - use with caution -if [ "$#" -gt 0 ] +# shortcut for repeated builds - use with caution +if [ "$1" = "-fast" ] then CMAKE_SKIP=YES +elif [ "$#" -gt 0 ] +then + echo "$0: only supports a -fast option" + exit 1 fi -# set paraview environment -PARAVIEW_SRC_DIR=$PWD/$PARAVIEW_SRC -#PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS/obj$OBJ_ADD -PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_ARCH$WM_COMPILER - -addMpiSupport # set MPI specific options -addPythonSupport # set python specific options -addMesaSupport # set MESA specific options +# Set configure options +#~~~~~~~~~~~~~~~~~~~~~~ +addVerbosity # set cmake verbosity +addMpiSupport # set MPI-specific options +addPythonSupport # set Python-specific options +addMesaSupport # set MESA-specific options buildParaView installParaView diff --git a/bin/tools/buildParaViewFunctions b/bin/tools/buildParaViewFunctions index 7231ad140e79cab6a0cb4c1c55ee4b0c0bbb34d1..ef5a25923a0ab4d605cd2d4ab40a1720b23e0580 100644 --- a/bin/tools/buildParaViewFunctions +++ b/bin/tools/buildParaViewFunctions @@ -30,247 +30,300 @@ # #------------------------------------------------------------------------------ -addCMakeVariable () +# ParaView_INST_DIR : location of the original sources +# ParaView_DIR : location of the compiled output + +addCMakeVariable() { - while [ -n "$1" ] - do - CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1" - shift - done + while [ -n "$1" ] + do + CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1" + shift + done } -initialiseVariables () +addVerbosity() { - unset CMAKE_VARIABLES OBJ_ADD - - if [ "$VERBOSE" = ON ]; then - addCMakeVariable "CMAKE_VERBOSE_MAKEFILE=TRUE" - fi - addCMakeVariable "VTK_USE_TK=FALSE" + [ "$VERBOSE" = ON ] && addCMakeVariable CMAKE_VERBOSE_MAKEFILE=TRUE } -addMpiSupport () +addMpiSupport() { - [ "$INCLUDE_MPI" = ON ] || return - - MPI_LIBRARY=$MPI_ARCH_PATH/lib/libmpi.so - MPI_INCLUDE_PATH=$MPI_ARCH_PATH/include - MPI_RUN=$MPI_ARCH_PATH/bin/mpirun - - OBJ_ADD="$OBJ_ADD-mpi" - addCMakeVariable "VTK_USE_MPI=ON" - addCMakeVariable "PARAVIEW_USE_MPI=ON" - addCMakeVariable "MPI_INCLUDE_PATH=$MPI_INCLUDE_PATH" - addCMakeVariable "MPI_LIBRARY=$MPI_LIBRARY" - addCMakeVariable "VTK_MPIRUN_EXE=$MPI_RUN" - addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS" + [ "$WITH_MPI" = ON ] || return + OBJ_ADD="$OBJ_ADD-mpi" + + addCMakeVariable PARAVIEW_USE_MPI=ON + addCMakeVariable VTK_USE_MPI=ON + addCMakeVariable MPI_INCLUDE_PATH=$MPI_ARCH_PATH/include + addCMakeVariable MPI_LIBRARY=$MPI_ARCH_PATH/lib/libmpi.so + addCMakeVariable VTK_MPIRUN_EXE=$MPI_ARCH_PATH/bin/mpirun + addCMakeVariable VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS } -addPythonSupport () +addPythonSupport() { - [ "$INCLUDE_PYTHON" = ON ] || return - - WHICH_PYTHON=`which python` - if [ -n "$WHICH_PYTHON" ]; then - OBJ_ADD="$OBJ_ADD-py" - - if [ -n "$PYTHON_LIBRARY" ]; then - # check $PYTHON_LIBRARY if it has been set - if [ ! -e "$PYTHON_LIBRARY" ]; then - echo "*** Error: libpython not found at location specified " \ - "by PYTHON_LIBRARY: $PYTHON_LIBRARY" - echo " Please set the variable PYTHON_LIBRARY to the full" - echo " path to (and including) libpython, or deactivate" - echo " python support by setting INCLUDE_PYTHON=OFF" - exit 1 - fi - else - # Try to obtain $PYTHON_LIBRARY if not set - # - assumes dynamically linked - PYTHON_LIBRARY=`ldd $WHICH_PYTHON | \ - sed -ne '/libpython/s/.* => \(.*\) (.*/\1/p'` - fi - - if [ ! -n "$PYTHON_LIBRARY" ]; then + [ "$WITH_PYTHON" = ON ] || return + OBJ_ADD="$OBJ_ADD-py" + + if pythonBin=$(which python 2>/dev/null) + then + if [ -n "$PYTHON_LIBRARY" ] + then + # check $PYTHON_LIBRARY if it has been set + if [ ! -e "$PYTHON_LIBRARY" ] + then + echo "*** Error: libpython not found at location specified " \ + "by PYTHON_LIBRARY=$PYTHON_LIBRARY" + fi + else + # Try to get $PYTHON_LIBRARY from dynamically linked binary + PYTHON_LIBRARY=$(ldd $pythonBin | \ + sed -ne '/libpython/s/.* => \(.*\) (.*/\1/p') + + if [ ! -e "$PYTHON_LIBRARY" ] + then echo "*** Error: Unable to determine path to python library." - echo " Please set the variable PYTHON_LIBRARY to the full" - echo " path to (and including) libpython, or deactivate" - echo " python support by setting INCLUDE_PYTHON=OFF" - exit 1 - fi - PYTHON_MAJOR_VERSION=`echo $PYTHON_LIBRARY | \ - sed 's/.*libpython\(.*\)\.so.*/\1/'` - PYTHON_INCLUDE_DIR=/usr/include/python$PYTHON_MAJOR_VERSION - - addCMakeVariable "PARAVIEW_ENABLE_PYTHON=ON" - addCMakeVariable "PYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_DIR" - addCMakeVariable "PYTHON_LIBRARY=$PYTHON_LIBRARY" - else - echo "*** Error: python not installed" - echo "*** De-activate python support by setting " \ - "INCLUDE_PYTHON=OFF" - exit 1 - fi + fi + fi + + [ -e "$PYTHON_LIBRARY" ] || { + echo " Please set the variable PYTHON_LIBRARY to the full" + echo " path to (and including) libpython, or deactivate" + echo " python support by setting WITH_PYTHON=OFF" + exit 1 + } + + pythonMajor=$(echo $PYTHON_LIBRARY | sed 's/.*libpython\(.*\)\.so.*/\1/') + pythonInclude=/usr/include/python$pythonMajor + + [ -e "$PYTHON_LIBRARY" ] || { + echo " Please set the variable PYTHON_LIBRARY to the full" + echo " path to (and including) libpython, or deactivate" + echo " python support by setting WITH_PYTHON=OFF" + exit 1 + } + + # note - we could also allow for a PYTHON_INCLUDE variable ... + [ -e "$pythonInclude" ] || { + echo " No python include headers found" + echo " Please install python headers or deactivate " + echo " python support by setting WITH_PYTHON=OFF" + exit 1 + } + + addCMakeVariable PARAVIEW_ENABLE_PYTHON=ON + addCMakeVariable PYTHON_INCLUDE_PATH=$pythonInclude + addCMakeVariable PYTHON_LIBRARY=$PYTHON_LIBRARY + + echo "----" + echo "Python information:" + echo " executable : $pythonBin" + echo " version : $pythonMajor" + echo " include path : $pythonInclude" + echo " library : $PYTHON_LIBRARY" + + unset pythonBin pythonInclude pythonMajor + else + echo "*** Error: python not installed" + echo "*** Deactivate python support by setting WITH_PYTHON=OFF" + exit 1 + fi +} + + +addMesaSupport() +{ + [ "$WITH_MESA" = ON ] || return + + MESA_INCLUDE_DIR=/usr/include/GL + MESA_LIBRARY=/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so + + if [ -d "$MESA_INCLUDE_DIR" -a -f "$MESA_LIBRARY" ] + then + OBJ_ADD="$OBJ_ADD-mesa" + + addCMakeVariable VTK_OPENGL_HAS_OSMESA=ON + addCMakeVariable OSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR + addCMakeVariable OSMESA_LIBRARY=$MESA_LIBRARY + + else + echo "*** Error: no MESA information found" + exit 1 + fi } -addMesaSupport () +buildParaView() { - [ "$INCLUDE_MESA" = ON ] || return - - MESA_INCLUDE_DIR=/usr/include/GL - MESA_LIBRARY=/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so - - if [ -d "$MESA_INCLUDE_DIR" -a -f "$MESA_LIBRARY" ]; then - OBJ_ADD="$OBJ_ADD-mesa" - addCMakeVariable "VTK_OPENGL_HAS_OSMESA=ON" - addCMakeVariable "OSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR" - addCMakeVariable "OSMESA_LIBRARY=$MESA_LIBRARY" - else - echo "*** Error: no MESA information found" - exit 1 - fi + # set paraview environment + for i in $PWD $WM_THIRD_PARTY_DIR + do + ParaView_INST_DIR=$i/$PARAVIEW_SRC + [ -d $ParaView_INST_DIR ] && break + done + + if [ ! -d "$ParaView_INST_DIR" ] + then + # last chance: maybe already in the paraview directory + [ "${PWD##*/}" = $PARAVIEW_SRC ] && ParaView_INST_DIR=$PWD + + [ -d "$ParaView_INST_DIR" ] || { + echo "did not find $PARAVIEW_SRC in these directories:" + echo " PWD=$PWD" + echo " WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR" + echo "abort build" + exit 1 + } + fi + + + # ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER$OBJ_ADD + ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER + + # shortcut for repeated builds - use with caution + if [ "$CMAKE_SKIP" = YES ] + then + + # change to build/install folder + cd $ParaView_DIR || exit 1 + + else + + # remove any existing build folder and recreate + rm -rf $ParaView_DIR + mkdir -p $ParaView_DIR + cd $ParaView_DIR + + echo "----" + echo "Building $PARAVIEW_SRC" + echo " MPI support : $WITH_MPI" + echo " Python support : $WITH_PYTHON" + echo " MESA support : $WITH_MESA" + echo " Source : $ParaView_INST_DIR" + echo " Target : $ParaView_DIR" + echo "----" + + # make paraview + cmake \ + -DCMAKE_INSTALL_PREFIX=$PARAVIEW_APP_DIR \ + $CMAKE_VARIABLES \ + $ParaView_INST_DIR + fi + + # change to build folder + echo " Starting make" + + if [ -r /proc/cpuinfo ] + then + WM_NCOMPPROCS=$(egrep "^processor" /proc/cpuinfo | wc -l) + + if [ $WM_NCOMPPROCS -gt 8 ] + then + WM_NCOMPPROCS=8 + fi + + make -j $WM_NCOMPPROCS + else + make + fi } -buildParaView () +# adjust hard-links +# Note: use loop with grep to avoid touching too many files +fixCMakeHardLinks() { - # set general options - addCMakeVariable "BUILD_SHARED_LIBS:BOOL=ON" - addCMakeVariable "VTK_USE_RPATH:BOOL=OFF" - addCMakeVariable "CMAKE_BUILD_TYPE:STRING=Release" - - # set paraview environment - unset PARAVIEW_SRC_DIR - for i in $PWD $WM_THIRD_PARTY_DIR - do - if [ -d $i/$PARAVIEW_SRC ] - then - PARAVIEW_SRC_DIR=$i/$PARAVIEW_SRC - break - fi - done - - [ -d "$PARAVIEW_SRC_DIR" ] || { - echo "did not find $PARAVIEW_SRC in these directories:" - echo " PWD=$PWD" - echo " WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR" - echo "abort build" - exit 1 - } - - # PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS/obj$OBJ_ADD - PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_ARCH$WM_COMPILER - - # provide a shortcut for repeated builds - use with caution - if [ "$CMAKE_SKIP" = YES ] - then - - # change to build folder - cd $PARAVIEW_OBJ_DIR || exit 1 - - else - - # remove existing build folder if present - if [ -e "$PARAVIEW_OBJ_DIR" ]; then - rm -rf $PARAVIEW_OBJ_DIR - fi - - # create paraview build folder - mkdir -p $PARAVIEW_OBJ_DIR - cd $PARAVIEW_OBJ_DIR - - echo "Building $PARAVIEW_SRC" - echo " MPI support : $INCLUDE_MPI" - echo " Python support : $INCLUDE_PYTHON" - echo " MESA support : $INCLUDE_MESA" - echo " Source : $PARAVIEW_SRC_DIR" - echo " Target : $PARAVIEW_OBJ_DIR" - - # make paraview - cmake \ - -DCMAKE_INSTALL_PREFIX=$PARAVIEW_APP_DIR \ - $CMAKE_VARIABLES \ - $PARAVIEW_SRC_DIR - fi - - if [ -r /proc/cpuinfo ]; then - WM_NCOMPPROCS=`egrep "^processor" /proc/cpuinfo | wc -l` - - if [ $WM_NCOMPPROCS -gt 8 ]; then - WM_NCOMPPROCS=8 - fi - - make -j $WM_NCOMPPROCS - else - make - fi + fileSpec=$1 + string=$2 + envName=$3 + + echo -n " for \$$envName " + for i in $(find . -type f -iname "$fileSpec") + do + if grep -q "$string" $i + then + echo -n "#" + sed -i "s,$string,\$ENV{$envName},g" $i + fi + done + echo } -installParaView () +installParaView() { - if [ -e "$PARAVIEW_OBJ_DIR/bin/paraview" ]; then - echo " Build complete" - - cd $PARAVIEW_OBJ_DIR - - # Replace PARAVIEW_SRC_DIR path with ParaView_INST_DIR - # environment variables - echo " Replacing path hard links" - find . -iname \*.cmake -execdir sed -i \ - "s,$PARAVIEW_SRC_DIR,\$ENV{ParaView_INST_DIR},g" {} ';' \ - -print - - # Replace local MPI_ARCH_PATH path with MPI_ARCH_PATH - # environment variables - if [ "$INCLUDE_MPI" = ON ]; then - find . -iname \*.cmake -execdir sed -i \ - "s,$MPI_ARCH_PATH,\$ENV{MPI_ARCH_PATH},g" {} ';' \ - -print - fi - - # Replace local CMAKE_HOME path with CMAKE_HOME - # environment variables - find . -iname '*cmake*' -execdir sed -i \ - "s,$CMAKE_HOME,\$ENV{CMAKE_HOME},g" {} ';' \ - -print - - # Replace local WM_COMPILER_DIR path with WM_COMPILER_DIR - # environment variables - find . -iname '*cmake*' -execdir sed -i \ - "s,$WM_COMPILER_DIR,\$ENV{WM_COMPILER_DIR},g" {} ';' \ - -print - - # create a softlink to the $PARAVIEW_OBJ_DIR/bin folder - # - workaround for chosen install location - echo " Creating paraview $PARAVIEW_MAJOR_VERSION soft link to /bin" - ( mkdir lib && cd lib && ln -s ../bin \ - paraview-$PARAVIEW_MAJOR_VERSION ) - - # info on symlinks to screen - echo "" - echo " ---" - echo " Installation complete" - echo " Set environment variables:" - echo " - ParaView_INST_DIR to $PARAVIEW_SRC_DIR" - echo " - ParaView_DIR to $PARAVIEW_OBJ_DIR" - echo " - PV_PLUGIN_PATH to $FOAM_LIBBIN" - echo " Add $PARAVIEW_OBJ_DIR/bin to PATH" - # echo " Add $ParaView_INST_DIR/lib to LD_LIBRARY_PATH" - echo " ---" - fi + if [ ! -e "$ParaView_DIR/bin/paraview" ] + then + echo " Cannot install - no paraview binary found" + return + fi + echo " Build complete" + + cd $ParaView_DIR + + echo " Replacing path hard links" + + # Replace local ParaView_INST_DIR path with ParaView_INST_DIR + # environment variable + fixCMakeHardLinks '*.cmake' "$ParaView_INST_DIR" ParaView_INST_DIR + + # Replace local MPI_ARCH_PATH path with MPI_ARCH_PATH + # environment variable + if [ "$WITH_MPI" = ON ] + then + fixCMakeHardLinks '*.cmake' "$MPI_ARCH_PATH" MPI_ARCH_PATH + fi + + # Replace local CMAKE_HOME path with CMAKE_HOME + # environment variable + if [ -r "$CMAKE_HOME" ] + then + fixCMakeHardLinks '*cmake*' "$CMAKE_HOME" CMAKE_HOME + fi + + # Replace local WM_COMPILER_DIR path with WM_COMPILER_DIR + # environment variable + fixCMakeHardLinks '*cmake*' "$WM_COMPILER_DIR" WM_COMPILER_DIR + + # create a softlink to the $ParaView_DIR/bin folder + # - workaround for chosen install location + echo " Creating lib/paraview-$PARAVIEW_MAJOR_VERSION soft link to 'bin'" + rm -rf lib/paraview-$PARAVIEW_MAJOR_VERSION + [ -d lib ] || mkdir lib + ( cd lib && ln -s ../bin paraview-$PARAVIEW_MAJOR_VERSION ) + + # info on symlinks to screen + echo "" + echo " ---" + echo " Installation complete" + echo " Set environment variables:" + echo " - ParaView_INST_DIR to $ParaView_INST_DIR" + echo " - ParaView_DIR to $ParaView_DIR" + echo " - PV_PLUGIN_PATH to $FOAM_LIBBIN" + echo " Add $ParaView_DIR/bin to PATH" + # echo " Add $ParaView_INST_DIR/lib to LD_LIBRARY_PATH" + echo " ---" } -# for good measure - clear a few variables before using any of the functions +# clear all the variables used before using any of the functions -unset VERBOSE INCLUDE_MPI INCLUDE_PYTHON INCLUDE_MESA PYTHON_LIBRARY -unset CMAKE_VARIABLES OBJ_ADD +unset VERBOSE +unset WITH_MPI +unset WITH_MESA +unset WITH_PYTHON +unset PYTHON_LIBRARY +unset CMAKE_VARIABLES unset CMAKE_SKIP +unset OBJ_ADD +# start with these general settings +addCMakeVariable VTK_USE_TK=FALSE +addCMakeVariable BUILD_SHARED_LIBS:BOOL=ON +addCMakeVariable VTK_USE_RPATH:BOOL=OFF +addCMakeVariable CMAKE_BUILD_TYPE:STRING=Release # ----------------------------------------------------------------- end-of-file diff --git a/bin/touchapp b/bin/touchapp index 38325105ef9f4778e3631955c6cb9ae488ac7d73..6c76f2208ad4a26f2e28211fba06517f8ab78f4c 100755 --- a/bin/touchapp +++ b/bin/touchapp @@ -1,3 +1,17 @@ #!/bin/sh -touch $FOAM_APPBIN/* +if [ "$#" -ne 0 ] +then + echo "Usage: ${0##*/}" + echo " touch FOAM_APPBIN" + exit 1 +fi + +if [ -d "$FOAM_APPBIN" ] +then + echo "touching FOAM_APPBIN: $FOAM_APPBIN" + touch $FOAM_APPBIN/* +else + echo "no FOAM_APPBIN: $FOAM_APPBIN" +fi +#------------------------------------------------------------------------------ diff --git a/bin/touchdep b/bin/touchdep index 25d4b75fa45968dc5db0f5a1f6e549952591dc75..497fae79ee2eae9bd0a2023587189af838ce3a70 100755 --- a/bin/touchdep +++ b/bin/touchdep @@ -1,3 +1,24 @@ #!/bin/sh -find . \( -name '*.dep' \) -print | xargs -t touch +# default is pwd +if [ "$#" -eq 0 ] +then + set -- . +elif [ "$1" = "-h" -o "$1" = "-help" ] +then + echo "Usage: ${0##*/} [dir1] .. [dirN]" + echo " touch all .dep files" + exit 1 +fi + +for i +do + if [ -d "$i" ] + then + echo "touching all .dep files: $i" + find $i -name '*.dep' -print | xargs -t touch + else + echo "no directory: $i" + fi +done +#------------------------------------------------------------------------------ diff --git a/bin/touchlib b/bin/touchlib index bda6880c96eacbea181b6142658e62eb07c89443..ef4a7cc6fe1f941b319a9b11ce8b7a08ca161a08 100755 --- a/bin/touchlib +++ b/bin/touchlib @@ -1,3 +1,17 @@ #!/bin/sh -touch $FOAM_LIBBIN/* +if [ "$#" -ne 0 ] +then + echo "Usage: ${0##*/}" + echo " touch FOAM_LIBBIN" + exit 1 +fi + +if [ -d "$FOAM_LIBBIN" ] +then + echo "touching FOAM_LIBBIN: $FOAM_LIBBIN" + touch $FOAM_LIBBIN/* $FOAM_LIBBIN/*/* +else + echo "no FOAM_LIBBIN: $FOAM_LIBBIN" +fi +#------------------------------------------------------------------------------ diff --git a/bin/toucho b/bin/toucho index bf3a69f6d8e548bb31f2adfb137930e2ec5475ec..0236225d73b136844acac3485021e3636b1758b7 100755 --- a/bin/toucho +++ b/bin/toucho @@ -1,3 +1,24 @@ #!/bin/sh -find . \( -name '*.o' \) -print | xargs -t touch +# default is pwd +if [ "$#" -eq 0 ] +then + set -- . +elif [ "$1" = "-h" -o "$1" = "-help" ] +then + echo "Usage: ${0##*/} [dir1] .. [dirN]" + echo " touch all .o files" + exit 1 +fi + +for i +do + if [ -d "$i" ] + then + echo "touching all .o files: $i" + find $i -name '*.o' -print | xargs -t touch + else + echo "no directory: $i" + fi +done +#------------------------------------------------------------------------------ diff --git a/doc/Allwmake b/doc/Allwmake index 0e4ba76d85611acd889dc76885bf693997005098..e75f1030e2c55e7d1e27df75f17aed1eb2042b67 100755 --- a/doc/Allwmake +++ b/doc/Allwmake @@ -1,4 +1,5 @@ #!/bin/sh +cd ${0%/*} || exit 1 # run from this directory set -x chmod a+rX $WM_PROJECT_DIR @@ -6,3 +7,5 @@ chmod a+rX $WM_PROJECT_DIR/doc chmod -R a+rX Doxygen ( cd Doxygen && ./Allwmake ) + +# ----------------------------------------------------------------- end-of-file diff --git a/doc/Doxygen/Allwmake b/doc/Doxygen/Allwmake index f48d320d001625041f53bf4414981322f34fd3a0..7f9ccb0522b32ab61ea468a925c22d5a789e9ffb 100755 --- a/doc/Doxygen/Allwmake +++ b/doc/Doxygen/Allwmake @@ -5,5 +5,7 @@ umask 22 rm -rf html latex man doxygen -# fix permissions (NB: '-X' and not '-x'!) +# fix permissions (NB: '+X' and not '+x'!) chmod -R a+rX ./ + +# ----------------------------------------------------------------- end-of-file diff --git a/src/Allwmake b/src/Allwmake index 08bb914b740eff477bdfe8019cf9bb665b0f4493..2c532a41aaf587895363cb889a38e819d0e5f64e 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -1,9 +1,11 @@ #!/bin/sh +cd ${0%/*} || exit 1 # run from this directory set -x ( cd OpenFOAM && wmakeLnInclude . ) ( cd Pstream && ./Allwmake ) -wmake libo OSspecific/$WM_OS + +wmake libo OSspecific/$WM_OS wmake libso OpenFOAM wmake libso lagrangian/basic diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C index 298a0af95ce2a40659d82c30d57441c253dd72bc..97cb2b321b0d5f3a5246de0ed7bc07477244f687 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C @@ -485,6 +485,43 @@ void HashTable<T, Key, Hash>::operator=(const HashTable<T, Key, Hash>& ht) } +template<class T, class Key, class Hash> +bool HashTable<T, Key, Hash>::operator==(const HashTable<T, Key, Hash>& ht) + const +{ + // Are all my elements in ht? + for (const_iterator iter = begin(); iter != end(); ++iter) + { + const_iterator fnd = ht.find(iter.key()); + + if (fnd == ht.end() || (fnd() != iter())) + { + return false; + } + } + + // Are all ht elements in me? + for (const_iterator iter = ht.begin(); iter != ht.end(); ++iter) + { + const_iterator fnd = find(iter.key()); + + if (fnd == end() || (fnd() != iter())) + { + return false; + } + } + return true; +} + + +template<class T, class Key, class Hash> +bool HashTable<T, Key, Hash>::operator!=(const HashTable<T, Key, Hash>& ht) + const +{ + return !(operator==(ht)); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H index 02609be7fa6a980b7005fcce33debab61094cd23..2f3913d2e2cd8f8bc8162738c47f8ccfaff04827 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H @@ -223,6 +223,15 @@ public: //- Assignment void operator=(const HashTable<T, Key, Hash>&); + //- Equality. Two hashtables are equal if all contents of first are + // also in second and vice versa. So does not depend on table size or + // order! + bool operator==(const HashTable<T, Key, Hash>&) const; + + //- The opposite of the equality operation. Takes linear time. + bool operator!=(const HashTable<T, Key, Hash>&) const; + + // STL type definitions diff --git a/src/OpenFOAM/containers/Keyed/Keyed.H b/src/OpenFOAM/containers/Keyed/Keyed.H new file mode 100644 index 0000000000000000000000000000000000000000..2d0caa7b1839d8b8360a4b5bea7101868c94853f --- /dev/null +++ b/src/OpenFOAM/containers/Keyed/Keyed.H @@ -0,0 +1,129 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::Keyed + +Description + A container with an integer key attached to any item. + + The key can useful for sorting. + +SourceFiles + KeyedI.H + +\*---------------------------------------------------------------------------*/ + +#ifndef Keyed_H +#define Keyed_H + +#include "List.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators + +template<class T> class Keyed; + +template<class T> Istream& operator>>(Istream&, Keyed<T>&); +template<class T> Ostream& operator<<(Ostream&, const Keyed<T>&); + +/*---------------------------------------------------------------------------*\ + Class Keyed Declaration +\*---------------------------------------------------------------------------*/ + +template<class T> +class Keyed +: + public T +{ + // Private data + + label key_; + +public: + + // Static Members + + //- Add labels to a list of values + inline static List<Keyed<T> > createList + ( + const List<T>&, + const label key=0 + ); + + //- Add labels to a list of values + inline static List<Keyed<T> > createList + ( + const List<T>&, + const List<label>& keys + ); + + + // Constructors + + //- Construct null + inline Keyed(); + + //- Construct as a copy of item, with a key + inline Keyed(const T& item, const label key=0); + + //- Construct from Istream + inline Keyed(Istream&); + + + // Member Functions + + // Access + + //- Return const access to the integer key + inline label key() const; + + //- Return non-const access to the integer key + inline label& key(); + + + // IOstream Operators + + friend Istream& operator>> <T>(Istream&, Keyed<T>&); + friend Ostream& operator<< <T>(Ostream&, const Keyed<T>&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "KeyedI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/containers/Keyed/KeyedI.H b/src/OpenFOAM/containers/Keyed/KeyedI.H new file mode 100644 index 0000000000000000000000000000000000000000..ecae23da3d69bc31b05fddbedbcc6c8b04da1af8 --- /dev/null +++ b/src/OpenFOAM/containers/Keyed/KeyedI.H @@ -0,0 +1,146 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +//- Construct null +template<class T> +inline Foam::Keyed<T>::Keyed() +: + key_(-1) +{} + + +//- Construct from components +template<class T> +inline Foam::Keyed<T>::Keyed(const T& item, const label key) +: + T(item), + key_(key) +{} + + +template<class T> +inline Foam::Keyed<T>::Keyed(Istream& is) +{ + is >> *this; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class T> +inline Foam::label Foam::Keyed<T>::key() const +{ + return key_; +} + +template<class T> +inline Foam::label& Foam::Keyed<T>::key() +{ + return key_; +} + + +template<class T> +inline Foam::List<Foam::Keyed<T> > +Foam::Keyed<T>::createList(const List<T>& lst, const label key) +{ + List<Keyed<T> > newList(lst.size()); + + forAll (lst, elemI) + { + newList[elemI] = Keyed(lst[elemI], key); + } + return newList; +} + + +template<class T> +inline Foam::List<Foam::Keyed<T> > +Foam::Keyed<T>::createList(const List<T>& lst, const List<label>& keys) +{ + if (lst.size() != keys.size()) + { + FatalErrorIn + ( + "Foam::Keyed<T>::createList(const List<T>&, const List<label>&)" + ) + << "size mismatch adding keys to a list:" << nl + << "List has size " << lst.size() + << " and keys has size " << keys.size() << nl + << abort(FatalError); + } + + List<Keyed<T> > newList(lst.size()); + + forAll (lst, elemI) + { + newList[elemI] = Keyed(lst[elemI], keys[elemI]); + } + return newList; +} + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + +template<class T> +inline Foam::Istream& Foam::operator>>(Istream& is, Keyed<T>& item) +{ + // Read beginning of Keyed item/key pair + is.readBegin("Keyed<T>"); + + is >> static_cast<T&>(item); + is >> item.key_; + + // Read end of Keyed item/key pair + is.readEnd("Keyed<T>"); + + // Check state of Ostream + is.check("Istream& operator>>(Istream&, Keyed&)"); + + return is; +} + + +template<class T> +inline Foam::Ostream& Foam::operator<<(Ostream& os, const Keyed<T>& item) +{ + os << token::BEGIN_LIST + << static_cast<const T&>(item) + << token::SPACE << item.key_ + << token::END_LIST; + + return os; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H index 87a1d8e4d5268c1e528f1a8a00e5ba387299cc2b..8aebd8959eb6989cea2ede027ecf0e446a7bf280 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H @@ -53,14 +53,9 @@ inline Foam::label Foam::globalIndex::toGlobal(const label i) const //- Is on local processor inline bool Foam::globalIndex::isLocal(const label i) const { - label localI = - ( - Pstream::myProcNo() == 0 - ? i - : i - offsets_[Pstream::myProcNo()-1] - ); - - return localI >= 0 && localI < offsets_[Pstream::myProcNo()]; + return + (i < offsets_[Pstream::myProcNo()]) + && (i >= (Pstream::myProcNo() == 0 ? 0 : offsets_[Pstream::myProcNo()-1])); } @@ -69,7 +64,7 @@ inline Foam::label Foam::globalIndex::toLocal(const label procI, const label i) { label localI = (procI == 0 ? i : i - offsets_[procI-1]); - if (localI < 0 || localI >= offsets_[procI]) + if (localI < 0 || i >= offsets_[procI]) { FatalErrorIn("globalIndex::toLocal(const label, const label)") << "Global " << i << " does not belong on processor " diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.C new file mode 100644 index 0000000000000000000000000000000000000000..7ab4c43084ccf61527e51fed59ca15115ddea1a7 --- /dev/null +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.C @@ -0,0 +1,173 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "PrimitivePatchExtra.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +PrimitivePatchExtra +( + const ListType<Face>& faces, + const pointField& points +) +: + PrimitivePatch<Face, ListType, PointField, PointType>(faces, points), + sortedEdgeFacesPtr_(NULL), + edgeOwnerPtr_(NULL) +{} + + +// Construct as copy +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +PrimitivePatchExtra +( + const PrimitivePatchExtra<Face, ListType, PointField, PointType>& pp +) +: + PrimitivePatch<Face, ListType, PointField, PointType>(pp), + sortedEdgeFacesPtr_(NULL), + edgeOwnerPtr_(NULL) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +~PrimitivePatchExtra() +{ + clearOut(); +} + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +clearOut() +{ + PrimitivePatch<Face, ListType, PointField, PointType>::clearOut(); + clearTopology(); +} + + +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +clearTopology() +{ + PrimitivePatch<Face, ListType, PointField, PointType>::clearTopology(); + deleteDemandDrivenData(sortedEdgeFacesPtr_); + deleteDemandDrivenData(edgeOwnerPtr_); +} + + +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +const Foam::labelListList& +Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +sortedEdgeFaces() const +{ + if (!sortedEdgeFacesPtr_) + { + calcSortedEdgeFaces(); + } + + return *sortedEdgeFacesPtr_; +} + + +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +const Foam::labelList& +Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +edgeOwner() const +{ + if (!edgeOwnerPtr_) + { + calcEdgeOwner(); + } + + return *edgeOwnerPtr_; +} + + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "PrimitivePatchExtraAddressing.C" +#include "PrimitivePatchExtraCleanup.C" +#include "PrimitivePatchExtraSearch.C" + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.H new file mode 100644 index 0000000000000000000000000000000000000000..6c3f381ff9ba516a6b4cc09154e9553d7f09729c --- /dev/null +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.H @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::PrimitivePatchExtra + +Description + PrimitivePatch with some extra functionality. + +SourceFiles + PrimitivePatchExtra.C + +\*---------------------------------------------------------------------------*/ + +#ifndef PrimitivePatchExtra_H +#define PrimitivePatchExtra_H + +#include "PrimitivePatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class PrimitivePatchExtra Declaration +\*---------------------------------------------------------------------------*/ + +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType=point +> +class PrimitivePatchExtra +: + public PrimitivePatch<Face, ListType, PointField, PointType> +{ + +public: + + // Public typedefs + + typedef Face FaceType; + typedef ListType<Face> FaceListType; + typedef PointField PointFieldType; + +private: + + // Private typedefs + typedef PrimitivePatch<Face, ListType, PointField, PointType> TemplateType; + + // Private data + + // Demand driven private data + + //- Edge-face addressing (sorted) + mutable labelListList* sortedEdgeFacesPtr_; + + //- Label of face that 'owns' edge + // i.e. e.vec() is righthanded walk along face + mutable labelList* edgeOwnerPtr_; + + + // Private Member Functions + + //- Calculate sorted edgeFaces + void calcSortedEdgeFaces() const; + + //- Calculate owner + void calcEdgeOwner() const; + +public: + + // Constructors + + //- Construct from components + PrimitivePatchExtra + ( + const ListType<Face>& faces, + const pointField& points + ); + + //- Construct as copy + PrimitivePatchExtra + ( + const PrimitivePatchExtra<Face, ListType, PointField, PointType>& + ); + + + // Destructor + + virtual ~PrimitivePatchExtra(); + + void clearOut(); + + void clearTopology(); + + + // Member Functions + + // Access functions for demand driven data + + // Topological data; no mesh required. + + //- Return edge-face addressing sorted + // (for edges with more than 2 faces) according to the + // angle around the edge. + // Orientation is anticlockwise looking from + // edge.vec(localPoints()) + const labelListList& sortedEdgeFaces() const; + + //- If 2 face neighbours: label of face where ordering of edge + // is consistent with righthand walk. + // If 1 neighbour: label of only face. + // If >2 neighbours: undetermined. + const labelList& edgeOwner() const; + + + // Addressing into mesh + + + // Other patch operations + + + // Check + + //- Check multiply-connected edges. + void checkEdges(const bool verbose) const; + + //- Check orientation (normals) and normals of neighbouring faces + boolList checkOrientation(const bool verbose) const; + + + // Edit + + //- Fill faceZone with currentZone for every face reachable + // from faceI without crossing edge marked in borderEdge. + // Note: faceZone has to be sized nFaces before calling. + void markZone + ( + const boolList& borderEdge, + const label faceI, + const label currentZone, + labelList& faceZone + ) const; + + //- (size and) fills faceZone with zone of face. + // Zone is area reachable by edge crossing without crossing borderEdge + // (bool for every edge in surface). Returns number of zones. + label markZones + ( + const boolList& borderEdge, + labelList& faceZone + ) const; + + //- Determine the mapping for a sub-mesh. + // Only include faces for which boolList entry is true + // @param[out] pointMap mapping new to old localPoints + // @param[out] faceMap mapping new to old faces + void subsetMap + ( + const boolList& include, + labelList& pointMap, + labelList& faceMap + ) const; + + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "PrimitivePatchExtra.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraAddressing.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraAddressing.C new file mode 100644 index 0000000000000000000000000000000000000000..1773014a4d5ce4da1bf08ad6840b7cfdd1dde808 --- /dev/null +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraAddressing.C @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Contains fix for PrimitivePatch addressing (which doesn't work if surface + is non-manifold). Should be moved into PrimitivePatch. + +\*---------------------------------------------------------------------------*/ + +#include "PrimitivePatchExtra.H" +#include "HashTable.H" +#include "SortableList.H" +#include "transform.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +calcSortedEdgeFaces() const +{ + if (sortedEdgeFacesPtr_) + { + FatalErrorIn("PrimitivePatchExtra<Face, ListType, PointField>::calcSortedEdgeFaces()") + << "sortedEdgeFacesPtr_ already set" + << abort(FatalError); + } + + const labelListList& eFaces = TemplateType::edgeFaces(); + const edgeList& edgeLst = TemplateType::edges(); + const pointField& locPointLst = TemplateType::localPoints(); + const List<FaceType>& locFaceLst = TemplateType::localFaces(); + + // create the lists for the various results. (resized on completion) + sortedEdgeFacesPtr_ = new labelListList(eFaces.size()); + labelListList& sortedEdgeFaces = *sortedEdgeFacesPtr_; + + forAll(eFaces, edgeI) + { + const labelList& myFaceNbs = eFaces[edgeI]; + + if (myFaceNbs.size() > 2) + { + // Get point on edge and normalized direction of edge (= e2 base + // of our coordinate system) + const edge& e = edgeLst[edgeI]; + + const point& edgePt = locPointLst[e.start()]; + + vector e2 = e.vec(locPointLst); + e2 /= mag(e2) + VSMALL; + + // Get opposite vertex for 0th face + const Face& f = locFaceLst[myFaceNbs[0]]; + + label fp0 = findIndex(f, e[0]); + label fp1 = f.fcIndex(fp0); + label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1)); + + // Get vector normal both to e2 and to edge from opposite vertex + // to edge (will be x-axis of our coordinate system) + vector e0 = e2 ^ (locPointLst[vertI] - edgePt); + e0 /= mag(e0) + VSMALL; + + // Get y-axis of coordinate system + vector e1 = e2 ^ e0; + + SortableList<scalar> faceAngles(myFaceNbs.size()); + + // e0 is reference so angle is 0 + faceAngles[0] = 0; + + for (label nbI = 1; nbI < myFaceNbs.size(); nbI++) + { + // Get opposite vertex + const FaceType& f = locFaceLst[myFaceNbs[nbI]]; + label fp0 = findIndex(f, e[0]); + label fp1 = f.fcIndex(fp0); + label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1)); + + vector vec = e2 ^ (locPointLst[vertI] - edgePt); + vec /= mag(vec) + VSMALL; + + faceAngles[nbI] = pseudoAngle + ( + e0, + e1, + vec + ); + } + + faceAngles.sort(); + + sortedEdgeFaces[edgeI] = IndirectList<label> + ( + myFaceNbs, + faceAngles.indices() + ); + } + else + { + // No need to sort. Just copy. + sortedEdgeFaces[edgeI] = myFaceNbs; + } + } +} + + +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +calcEdgeOwner() const +{ + if (edgeOwnerPtr_) + { + FatalErrorIn("PrimitivePatchExtra<Face, ListType, PointField>::calcEdgeOwner()") + << "edgeOwnerPtr_ already set" + << abort(FatalError); + } + + // create the owner list + edgeOwnerPtr_ = new labelList + ( + TemplateType::nEdges() + ); + labelList& edgeOwner = *edgeOwnerPtr_; + + const edgeList& edgeLst = TemplateType::edges(); + const labelListList& eFaces = TemplateType::edgeFaces(); + const List<FaceType>& locFaceLst = TemplateType::localFaces(); + + + forAll(edgeLst, edgeI) + { + const edge& e = edgeLst[edgeI]; + + const labelList& myFaces = eFaces[edgeI]; + + if (myFaces.size() == 1) + { + edgeOwner[edgeI] = myFaces[0]; + } + else + { + // Find the first face whose vertices are aligned with the edge. + // (in case of multiply connected edge the best we can do) + edgeOwner[edgeI] = -1; + + forAll(myFaces, i) + { + const FaceType& f = locFaceLst[myFaces[i]]; + + if (f.findEdge(e) > 0) + { + edgeOwner[edgeI] = myFaces[i]; + break; + } + } + + if (edgeOwner[edgeI] == -1) + { + FatalErrorIn("PrimitivePatchExtra<Face, ListType, PointField>::calcEdgeOwner()") + << "Edge " << edgeI << " vertices:" << e + << " is used by faces " << myFaces + << " vertices:" + << IndirectList<FaceType>(locFaceLst, myFaces)() + << " none of which use the edge vertices in the same order" + << nl << "I give up" << abort(FatalError); + } + } + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraCleanup.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraCleanup.C new file mode 100644 index 0000000000000000000000000000000000000000..7a5343a7acc176f418383166e96d9189b4ea3a2b --- /dev/null +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraCleanup.C @@ -0,0 +1,214 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "PrimitivePatchExtra.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +// Check/fix edges with more than two faces +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +checkEdges +( + const bool verbose +) const +{ + const labelListList& eFaces = TemplateType::edgeFaces(); + const edgeList& edgeLst = TemplateType::edges(); + + forAll(eFaces, edgeI) + { + const labelList& myFaces = eFaces[edgeI]; + + // boundary edges have one face + // interior edges have two faces + if (myFaces.size() == 0) + { + FatalErrorIn("PrimitivePatchExtra::checkEdges(bool verbose)") + << "Edge " << edgeI << " with vertices " << edgeLst[edgeI] + << " has no edgeFaces" + << exit(FatalError); + } + else if (myFaces.size() > 2) + { + WarningIn + ( + "PrimitivePatchExtra::checkEdges(bool verbose)" + ) << "Edge " << edgeI << " with vertices " << edgeLst[edgeI] + << " has more than 2 faces connected to it : " << myFaces + << endl; + } + } +} + + +// Check normals and orientation +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +Foam::boolList +Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +checkOrientation +( + const bool verbose +) const +{ + const ListType<FaceType>& faceLst = *this; + const edgeList& edgeLst = TemplateType::edges(); + const labelListList& faceEs = TemplateType::faceEdges(); + const label numEdges = TemplateType::nEdges(); + const pointField& pointLst = TemplateType::points(); + const vectorField& normLst = TemplateType::faceNormals(); + + // Check edge normals, face normals, point normals. + forAll(faceEs, faceI) + { + const labelList& edgeLabels = faceEs[faceI]; + + if (edgeLabels.size() < 3) + { + FatalErrorIn("PrimitivePatchExtra::checkOrientation(bool)") + << "face " << faceLst[faceI] + << " has fewer than 3 edges. Edges:" << edgeLabels + << exit(FatalError); + } + + bool valid = true; + forAll(edgeLabels, i) + { + if (edgeLabels[i] < 0 || edgeLabels[i] >= numEdges) + { + WarningIn + ( + "PrimitivePatchExtra::checkOrientation(bool)" + ) << "edge number " << edgeLabels[i] << " on face " << faceI + << " out-of-range\n" + << "This usually means that the input surface has " + << "edges with more than 2 faces connected.\n" + << endl; + valid = false; + } + } + if (!valid) + { + continue; + } + + + // + //- Compute normal from 3 points, use the first as the origin + // minor warpage should not be a problem + const FaceType& f = faceLst[faceI]; + const point p0(pointLst[f[0]]); + const point p1(pointLst[f[1]]); + const point p2(pointLst[f[f.size()-1]]); + + const vector pointNormal((p1 - p0) ^ (p2 - p0)); + if ((pointNormal & normLst[faceI]) < 0) + { + FatalErrorIn("PrimitivePatchExtra::checkOrientation(bool)") + << "Normal calculated from points not consistent with" + " faceNormal" << endl + << "face: " << f << endl + << "points: " << p0 << ' ' << p1 << ' ' << p2 << endl + << "pointNormal:" << pointNormal << endl + << "faceNormal:" << normLst[faceI] + << exit(FatalError); + } + } + + + const labelListList& eFaces = TemplateType::edgeFaces(); + const pointField& locPointsLst = TemplateType::localPoints(); + + // Storage for holding status of edge. True if normal flips across this + // edge + boolList borderEdge(numEdges, false); + + forAll(edgeLst, edgeI) + { + const edge& e = edgeLst[edgeI]; + const labelList& neighbours = eFaces[edgeI]; + + if (neighbours.size() == 2) + { + const FaceType& faceA = faceLst[neighbours[0]]; + const FaceType& faceB = faceLst[neighbours[1]]; + + // The edge cannot be going in the same direction if both faces + // are oriented counterclockwise. + // Thus the next face point *must* different between the faces. + if + ( + faceA[faceA.fcIndex(findIndex(faceA, e.start()))] + == faceB[faceB.fcIndex(findIndex(faceB, e.start()))] + ) + { + borderEdge[edgeI] = true; + if (verbose) + { + WarningIn("PrimitivePatchExtra::checkOrientation(bool)") + << "face orientation incorrect." << nl + << "edge[" << edgeI << "] " << e + << " between faces " << neighbours << ":" << nl + << "face[" << neighbours[0] << "] " << faceA << nl + << "face[" << neighbours[1] << "] " << faceB << endl; + } + } + } + else if (neighbours.size() != 1) + { + if (verbose) + { + WarningIn("PrimitivePatchExtra::checkOrientation(bool)") + << "Wrong number of edge neighbours." << endl + << "edge[" << edgeI << "] " << e + << "with points:" << locPointsLst[e.start()] + << ' ' << locPointsLst[e.end()] + << " has neighbours:" << neighbours << endl; + } + borderEdge[edgeI] = true; + } + } + + return borderEdge; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C new file mode 100644 index 0000000000000000000000000000000000000000..453cdd63c932391ca6a7b8ce05ad54f5b384ec3b --- /dev/null +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C @@ -0,0 +1,233 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "PrimitivePatchExtra.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +// Finds area, starting at faceI, delimited by borderEdge. Marks all visited +// faces (from face-edge-face walk) with currentZone. +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone +( + const boolList& borderEdge, + const label faceI, + const label currentZone, + labelList& faceZone +) const +{ + // List of faces whose faceZone has been set. + labelList changedFaces(1, faceI); + + const labelListList& faceEs = TemplateType::faceEdges(); + const labelListList& eFaces = TemplateType::edgeFaces(); + + while (true) + { + // Pick up neighbours of changedFaces + DynamicList<label> newChangedFaces(2*changedFaces.size()); + + forAll(changedFaces, i) + { + label faceI = changedFaces[i]; + + const labelList& fEdges = faceEs[faceI]; + + forAllfEdges, i) + { + label edgeI = fEdges[i]; + + if (!borderEdge[edgeI]) + { + const labelList& eFaceLst = eFaces[edgeI]; + + forAll(eFaceLst, j) + { + label nbrFaceI = eFaceLst[j]; + + if (faceZone[nbrFaceI] == -1) + { + faceZone[nbrFaceI] = currentZone; + newChangedFaces.append(nbrFaceI); + } + else if (faceZone[nbrFaceI] != currentZone) + { + FatalErrorIn + ( + "PrimitivePatchExtra<Face, ListType, PointField>::markZone" + "(const boolList&, const label, const label, labelList&) const" + ) + << "Zones " << faceZone[nbrFaceI] + << " at face " << nbrFaceI + << " connects to zone " << currentZone + << " at face " << faceI + << abort(FatalError); + } + } + } + } + } + + if (newChangedFaces.size() == 0) + { + break; + } + + changedFaces.transfer(newChangedFaces.shrink()); + newChangedFaces.clear(); + } +} + + +// Finds areas delimited by borderEdge (or 'real' edges). +// Fills faceZone accordingly +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +Foam::label Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +markZones +( + const boolList& borderEdge, + labelList& faceZone +) const +{ + const label numEdges = TemplateType::nEdges(); + const label numFaces = TemplateType::size(); + + faceZone.setSize(numFaces); + faceZone = -1; + + if (borderEdge.size() != numEdges) + { + FatalErrorIn + ( + "PrimitivePatchExtra<Face, ListType, PointField>::markZones" + "(const boolList&, labelList&)" + ) + << "borderEdge boolList not same size as number of edges" << endl + << "borderEdge:" << borderEdge.size() << endl + << "nEdges :" << numEdges + << exit(FatalError); + } + + label zoneI = 0; + label startFaceI = 0; + + for (;;zoneI++) + { + // Find first non-coloured face + for (; startFaceI < numFaces; startFaceI++) + { + if (faceZone[startFaceI] == -1) + { + break; + } + } + + if (startFaceI >= numFaces) + { + break; + } + + faceZone[startFaceI] = zoneI; + + markZone(borderEdge, startFaceI, zoneI, faceZone); + } + + return zoneI; +} + + + +// Finds areas delimited by borderEdge (or 'real' edges). +// Fills faceZone accordingly +template +< + class Face, + template<class> class ListType, + class PointField, + class PointType +> +void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +subsetMap +( + const boolList& include, + labelList& pointMap, + labelList& faceMap +) const +{ + const List<FaceType>& locFaces = TemplateType::localFaces(); + const label numPoints = TemplateType::nPoints(); + + label faceI = 0; + label pointI = 0; + + faceMap.setSize(locFaces.size()); + pointMap.setSize(numPoints); + + boolList pointHad(numPoints, false); + + forAll(include, oldFaceI) + { + if (include[oldFaceI]) + { + // Store new faces compact + faceMap[faceI++] = oldFaceI; + + // Renumber labels for face + const FaceType& f = locFaces[oldFaceI]; + + forAll(f, fp) + { + const label ptLabel = f[fp]; + if (!pointHad[ptLabel]) + { + pointHad[ptLabel] = true; + pointMap[pointI++] = ptLabel; + } + } + } + } + + // Trim + faceMap.setSize(faceI); + pointMap.setSize(pointI); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C index ca8f05abce595313285451cfbd7cd6302ee8f44b..542952019be11121f4f4daad931a06c5dc35133f 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C @@ -38,6 +38,12 @@ const labelListList& primitiveMesh::cellPoints() const { if (!cpPtr_) { + if (debug) + { + Pout<< "primitiveMesh::cellPoints() : " + << "calculating cellPoints" << endl; + } + // Invert pointCells cpPtr_ = new labelListList(nCells()); invertManyToMany(nCells(), pointCells(), *cpPtr_); diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeCells.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeCells.C index 8f5c912fefbd7074b0a8b44ba2d1fe8cd950d260..46173628d845b2e56c0f6e2ea490d39c79f16016 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeCells.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeCells.C @@ -38,6 +38,10 @@ const labelListList& primitiveMesh::edgeCells() const { if (!ecPtr_) { + if (debug) + { + Pout<< "primitiveMesh::edgeCells() : calculating edgeCells" << endl; + } // Invert cellEdges ecPtr_ = new labelListList(nEdges()); invertManyToMany(nEdges(), cellEdges(), *ecPtr_); diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeFaces.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeFaces.C index f5e1c27f21e2e15f24fe6723dc00868879f629f7..30390ce4ebe1e40e375bea7d6f270f814d6450b0 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeFaces.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeFaces.C @@ -38,6 +38,11 @@ const labelListList& primitiveMesh::edgeFaces() const { if (!efPtr_) { + if (debug) + { + Pout<< "primitiveMesh::edgeFaces() : calculating edgeFaces" << endl; + } + // Invert faceEdges efPtr_ = new labelListList(nEdges()); invertManyToMany(nEdges(), faceEdges(), *efPtr_); diff --git a/src/OpenFOAM/primitives/random/Random.C b/src/OpenFOAM/primitives/random/Random.C index 9a2ed1ee9149418e0b1457646740db80843a81d0..87cbbf193851725231b0b22d6d4d8491a8052ede 100644 --- a/src/OpenFOAM/primitives/random/Random.C +++ b/src/OpenFOAM/primitives/random/Random.C @@ -33,19 +33,15 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef USE_RANDOM +#if INT_MAX != 2147483647 +# error "INT_MAX != 2147483647" +# error "The random number generator may not work!" +#endif +#ifdef USE_RANDOM # include <climits> - -# if INT_MAX != 2147483647 -# error "INT_MAX != 2147483647" -# error "The random number generator random() may not work!" -# endif - #else - # include <cstdlib> - #endif @@ -77,7 +73,7 @@ int Random::bit() # ifdef USE_RANDOM if (random() > INT_MAX/2) # else - if (mrand48() > 0) + if (lrand48() > INT_MAX/2) # endif { return 1; diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H index d27eaae413946987954c4a168144fe67b1d64849..012ef08d00691d25ab9b73d29b07306fe6e226f0 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H +++ b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H @@ -570,7 +570,9 @@ public: // region and split them. autoPtr<mapPolyMesh> dupNonManifoldPoints(); - //- Create baffle for every internal face where ownPatch != -1 + //- Create baffle for every internal face where ownPatch != -1. + // External faces get repatched according to ownPatch (neiPatch + // should be -1 for these) autoPtr<mapPolyMesh> createBaffles ( const labelList& ownPatch, diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C index 9a5f6cf63379293e884c8c74fa59fa48b981c203..b8ee73b8cec7d2fbc22a9bb80ca91efce5536547 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C +++ b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C @@ -533,7 +533,7 @@ Foam::labelList Foam::meshRefinement::getRefineCandidateFaces const labelList& refineCell ) const { - labelList testFaces(mesh_.nCells()); + labelList testFaces(mesh_.nFaces()); label nTest = 0; @@ -1164,7 +1164,12 @@ Foam::labelList Foam::meshRefinement::refineCandidates // Refinement based on curvature of surface // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - if (curvatureRefinement && (curvature >= -1 && curvature <= 1)) + if + ( + curvatureRefinement + && (curvature >= -1 && curvature <= 1) + && (surfaces_.minLevel() != surfaces_.maxLevel()) + ) { label nCurv = markSurfaceCurvatureRefinement ( diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicMeshDict b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicMeshDict index 177824b65ce862784f00034c34f0d8b6c4d15052..158c0a9c2636f5d717f56ce9ccb07ec9b5b52ef4 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicMeshDict +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicMeshDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -12,7 +12,6 @@ FoamFile class dictionary; object dynamicMeshDict; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //dynamicFvMeshLib "libtopoChangerFvMesh.so"; @@ -38,7 +37,6 @@ mixerFvMeshCoeffs } } - // Refinement dynamicRefineFvMeshCoeffs { diff --git a/src/dynamicMesh/layerAdditionRemoval/removeCellLayer.C b/src/dynamicMesh/layerAdditionRemoval/removeCellLayer.C index cb141ba6459d6e7b05447126d48b222eed03aa60..c5927a61289dc3394d1ddc07b9550eba9eda0d94 100644 --- a/src/dynamicMesh/layerAdditionRemoval/removeCellLayer.C +++ b/src/dynamicMesh/layerAdditionRemoval/removeCellLayer.C @@ -235,7 +235,18 @@ void Foam::layerAdditionRemoval::removeCellLayer mesh.faceZones()[modifiedFaceZone].whichFace(curFaceID) ]; } - + + label newNei; + + if (curFaceID < mesh.nInternalFaces()) + { + newNei = nei[curFaceID]; + } + else + { + newNei = -1; + } + // Modify the face ref.setAction ( @@ -244,7 +255,7 @@ void Foam::layerAdditionRemoval::removeCellLayer newFace, // modified face curFaceID, // label of face being modified own[curFaceID], // owner - nei[curFaceID], // neighbour + newNei, // neighbour false, // face flip mesh.boundaryMesh().whichPatch(curFaceID),// patch for face false, // remove from zone diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/removeCells.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/removeCells.C index cb534ddb8347eadb3c0bf5d2f735424f22473330..589368127b9658d1b9b9027df232b86d92c12897 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/removeCells.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/removeCells.C @@ -214,6 +214,18 @@ void Foam::removeCells::setRefinement { label patchI = exposedPatchIDs[i]; + if (patchI < 0 || patchI >= patches.size()) + { + FatalErrorIn + ( + "removeCells::setRefinement(const labelList&" + ", const labelList&, const labelList&, polyTopoChange&)" + ) << "Invalid patch " << patchI + << " for exposed face " << exposedFaceLabels[i] << endl + << "Valid patches 0.." << patches.size()-1 + << abort(FatalError); + } + if (patches[patchI].coupled()) { FatalErrorIn diff --git a/src/lagrangian/basic/Cloud/CloudIO.C b/src/lagrangian/basic/Cloud/CloudIO.C index cbca096a16f6446f25023b0fec26bdfcaab28323..ea37ea27a9c9d4670e1d39faca79a4deb1ab6d4a 100644 --- a/src/lagrangian/basic/Cloud/CloudIO.C +++ b/src/lagrangian/basic/Cloud/CloudIO.C @@ -46,6 +46,13 @@ void Foam::Cloud<ParticleType>::initCloud(const bool checkClass) readFields(); } } + else + { + WarningIn("Cloud<ParticleType>::initCloud(const bool checkClass)") + << "Cannot read particle positions file " << nl + << " " << ioP.path() << nl + << " assuming the initial cloud contains 0 particles." << endl; + } } diff --git a/src/lagrangian/solidParticle/solidParticle.H b/src/lagrangian/solidParticle/solidParticle.H index 42be066ad56ce238e668b10353313b89afd92189..cd4ec4eea5205d036c9dcb2329e9046b7ad18b53 100644 --- a/src/lagrangian/solidParticle/solidParticle.H +++ b/src/lagrangian/solidParticle/solidParticle.H @@ -158,7 +158,7 @@ public: //- Return velocity inline const vector& U() const; - //- The nearest distance to a wall that + //- The nearest distance to a wall that // the particle can be in the n direction inline scalar wallImpactDistance(const vector& n) const; @@ -226,6 +226,14 @@ public: const vector& separation ); + + // I-O + + static void readFields(Cloud<solidParticle>& c); + + static void writeFields(const Cloud<solidParticle>& c); + + // Ostream Operator friend Ostream& operator<<(Ostream&, const solidParticle&); @@ -238,12 +246,6 @@ inline bool contiguous<solidParticle>() return true; } -template<> -void Cloud<solidParticle>::readFields(); - -template<> -void Cloud<solidParticle>::writeFields() const; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/solidParticle/solidParticleCloud.C b/src/lagrangian/solidParticle/solidParticleCloud.C index 7d6276033140fe199a398ac6377df658fbceac42..09c2fc63800091f36662ea117dd7a8f9919ffdd3 100644 --- a/src/lagrangian/solidParticle/solidParticleCloud.C +++ b/src/lagrangian/solidParticle/solidParticleCloud.C @@ -35,13 +35,18 @@ License namespace Foam { defineParticleTypeNameAndDebug(solidParticle, 0); + defineTemplateTypeNameAndDebug(Cloud<solidParticle>, 0); }; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::solidParticleCloud::solidParticleCloud(const fvMesh& mesh) +Foam::solidParticleCloud::solidParticleCloud +( + const fvMesh& mesh, + const word& cloudName +) : - Cloud<solidParticle>(mesh), + Cloud<solidParticle>(mesh, cloudName, false), mesh_(mesh), particleProperties_ ( @@ -57,7 +62,9 @@ Foam::solidParticleCloud::solidParticleCloud(const fvMesh& mesh) rhop_(dimensionedScalar(particleProperties_.lookup("rhop")).value()), e_(dimensionedScalar(particleProperties_.lookup("e")).value()), mu_(dimensionedScalar(particleProperties_.lookup("mu")).value()) -{} +{ + solidParticle::readFields(*this); +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -81,4 +88,10 @@ void Foam::solidParticleCloud::move(const dimensionedVector& g) } +void Foam::solidParticleCloud::writeFields() const +{ + solidParticle::writeFields(*this); +} + + // ************************************************************************* // diff --git a/src/lagrangian/solidParticle/solidParticleCloud.H b/src/lagrangian/solidParticle/solidParticleCloud.H index ace43a1f8e951d13205809fd1021b543343b1c20..ba49798361b9ea3824cab6b6cec74e645235ef3e 100644 --- a/src/lagrangian/solidParticle/solidParticleCloud.H +++ b/src/lagrangian/solidParticle/solidParticleCloud.H @@ -83,7 +83,11 @@ public: // Constructors //- Construct given mesh - solidParticleCloud(const fvMesh&); + solidParticleCloud + ( + const fvMesh&, + const word& cloudName = "defaultCloud" + ); // Member Functions @@ -97,13 +101,17 @@ public: inline scalar mu() const; - // Check - // Edit - //- Move the particles under the influence of the given - // gravitational acceleration - void move(const dimensionedVector& g); + //- Move the particles under the influence of the given + // gravitational acceleration + void move(const dimensionedVector& g); + + + // I-O + + //- Write fields + void writeFields() const; }; diff --git a/src/lagrangian/solidParticle/solidParticleIO.C b/src/lagrangian/solidParticle/solidParticleIO.C index b995c2dc1f67d0446b4130b7288acdb12fae94ed..67f4ea8db5d66c8ca7788714f43a072c87497c8e 100644 --- a/src/lagrangian/solidParticle/solidParticleIO.C +++ b/src/lagrangian/solidParticle/solidParticleIO.C @@ -36,7 +36,7 @@ Foam::solidParticle::solidParticle bool readFields ) : - Particle<solidParticle>(cloud, is) + Particle<solidParticle>(cloud, is, readFields) { if (readFields) { @@ -60,20 +60,20 @@ Foam::solidParticle::solidParticle } -namespace Foam +void Foam::solidParticle::readFields(Cloud<solidParticle>& c) { + if (!c.size()) + { + return; + } + IOField<scalar> d(c.fieldIOobject("d")); + c.checkFieldIOobject(c, d); -template<> -void Cloud<solidParticle>::readFields() -{ - IOField<scalar> d(fieldIOobject("d")); - checkFieldIOobject(*this, d); - - IOField<vector> U(fieldIOobject("U")); - checkFieldIOobject(*this, U); + IOField<vector> U(c.fieldIOobject("U")); + c.checkFieldIOobject(c, U); label i = 0; - forAllIter(Cloud<solidParticle>::iterator, *this, iter) + forAllIter(Cloud<solidParticle>::iterator, c, iter) { solidParticle& p = iter(); @@ -84,16 +84,17 @@ void Cloud<solidParticle>::readFields() } -template<> -void Cloud<solidParticle>::writeFields() const +void Foam::solidParticle::writeFields(const Cloud<solidParticle>& c) { - label np = size(); + Particle<solidParticle>::writeFields(c); + + label np = c.size(); - IOField<scalar> d(fieldIOobject("d"), np); - IOField<vector> U(fieldIOobject("U"), np); + IOField<scalar> d(c.fieldIOobject("d"), np); + IOField<vector> U(c.fieldIOobject("U"), np); label i = 0; - forAllConstIter(Cloud<solidParticle>, *this, iter) + forAllConstIter(Cloud<solidParticle>, c, iter) { const solidParticle& p = iter(); @@ -106,8 +107,6 @@ void Cloud<solidParticle>::writeFields() const U.write(); } -}; - // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // diff --git a/src/meshTools/coordinateSystems/Changes.txt b/src/meshTools/coordinateSystems/Changes.txt deleted file mode 100644 index 3fe3740b7d39d5124777d84f749bf44a82bead35..0000000000000000000000000000000000000000 --- a/src/meshTools/coordinateSystems/Changes.txt +++ /dev/null @@ -1,103 +0,0 @@ -ALL FILES: - * construct null - * allow assignment of name/origin - - * MAJOR CHANGE - - a point is a vector, but not vice versa - - previous methods toGlobal/toLocal include the origin translation - which is incorrect for vectors - - new methods with explicit names: - globalPosition, globalVector, relativePosition, relativeVector - - * change affects: - finiteVolume/fields/fvPatchFields/derivedFvPatchFields/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C - utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.C - ------------------------- - -coordinateRotation.C -coordinateRotation.H - - * coordinateRotation is a tensor with restricted contructors - - * null contructor yields the global coordinate system - - * a null dictionary corresponds to a null constructor - - * new axis/direction constructor with functionality taken from - porousZone and previous coordinateSystem implementation - - * allow any combination (e1/e2), (e2/e3), (e3,e1) of local vectors - in addition to the axis/direction specification. - - Added check for co-linear axes. - - Could possibly eliminate the non-orthogonality check. - - * allow assigment from dictionary, automatically descend in a - 'coordinateRotation' sub-dictionary - - * add hook in New() for type 'coordinateRotation' with alias 'axes' - ------------------------- - -coordinateSystem.C -coordinateSystem.H - - * remove pure virtual restriction - coordinateSystem can be used - directly and has the same properties as a cartesianCS - - * null contructor yields the global coordinate system - - * a null dictionary entry corresponds to the global coordinate system - - * dictionary constructor w/o name uses the typeName - - * the coordinateSystem now has a coordinateRotation, - use coordinateRotation constructors instead of calculating any - rotations ourselves - - * allow assigment from dictionary, automatically descend into a - 'coordinateSystem' sub-dictionary - This simplifies the addition to other dictionary constructors - (eg, porousZone) without requiring a flat structure or special - parsing within the constructor. - eg, - - Foam::porousZone::porousZone(const fvMesh& mesh, Istream& is) - : - mesh_(mesh), - name_(is), - dict_(is), - cellZoneID_(mesh_.cellZones().findZoneID(name_)), - csys_(dict_), - C0_(0), - C1_(0), - D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero), - F_("F", dimensionSet(0, -1, 0, 0, 0), tensor::zero) - { - ... - } - - * could consider eliminating Rtr_ member and just use R_.T() instead - - * add hook in New() for type 'coordinateSystem' - ------------------------- - -cartesianCS.C -cartesianCS.H - - * eliminate redundant virtual functions - ------------------------- - -cylindricalCS.H - - * include coordinateSystem.H and not cartesianCS.H - - ------------------------- - -coordinateSystems.C -coordinateSystems.H - - * provide a means to access an invariant set of coordinate systems diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C index 649013fdf10f5fc160099ef9c1d97b569da46d72..a0ff38a9ee968c1195e576e875f7653fb02e03fe 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C @@ -210,25 +210,19 @@ void Foam::coordinateRotation::operator=(const dictionary& rhs) ); vector axis1, axis2; - axisOrder order = e3e1; + axisOrder order(e3e1); - if (dict.found("e1") && dict.found("e2")) + if (dict.readIfPresent("e1", axis1) && dict.readIfPresent("e2", axis2)) { order = e1e2; - dict.lookup("e1") >> axis1; - dict.lookup("e2") >> axis2; } - else if (dict.found("e2") && dict.found("e3")) + else if (dict.readIfPresent("e2", axis1) && dict.readIfPresent("e3", axis2)) { order = e2e3; - dict.lookup("e2") >> axis1; - dict.lookup("e3") >> axis2; } - else if (dict.found("e3") && dict.found("e1")) + else if (dict.readIfPresent("e3", axis1) && dict.readIfPresent("e1", axis2)) { order = e3e1; - dict.lookup("e3") >> axis1; - dict.lookup("e1") >> axis2; } else if (dict.found("axis") || dict.found("direction")) { diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinateSystems/coordinateSystem.C index d2c57bb6669b7faa80bf94d2dfcec280acda037d..a89a507b8e8be677d7cbdc6a3e8ae60c8e304055 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.C +++ b/src/meshTools/coordinateSystems/coordinateSystem.C @@ -267,14 +267,8 @@ void Foam::coordinateSystem::operator=(const dictionary& rhs) ); // unspecified origin is (0 0 0) - if (dict.found("origin")) - { - dict.lookup("origin") >> origin_; - } - else - { - origin_ = vector::zero; - } + origin_ = vector::zero; + dict.readIfPresent("origin", origin_); // specify via coordinateRotation if (dict.found("coordinateRotation")) diff --git a/src/meshTools/coordinateSystems/newCoordinateSystem.C b/src/meshTools/coordinateSystems/newCoordinateSystem.C index 5c2570a6e22955a0a9f79869e4447111ed69140c..c4d416bd78ccb3f52e91e794f888c8332307e14a 100644 --- a/src/meshTools/coordinateSystems/newCoordinateSystem.C +++ b/src/meshTools/coordinateSystems/newCoordinateSystem.C @@ -117,10 +117,7 @@ Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New // default type is self word coordType(typeName_()); - if (dict.found("type")) - { - dict.lookup("type") >> coordType; - } + dict.readIfPresent("type", coordType); // can (must) construct base class directly if (coordType == typeName_()) diff --git a/src/meshTools/searchableSurface/searchableBox.C b/src/meshTools/searchableSurface/searchableBox.C index cb664b57575d901a583587b92fa69a1072b4f169..b1776b3c9e79323f32177cb13a6983325ceb2a0a 100644 --- a/src/meshTools/searchableSurface/searchableBox.C +++ b/src/meshTools/searchableSurface/searchableBox.C @@ -436,7 +436,13 @@ void Foam::searchableBox::findLineAll // Work array DynamicList<pointIndexHit, 1, 1> hits; - // Tolerances +//XXX + // Tolerances: + // To find all intersections we add a small vector to the last intersection + // This is chosen such that + // - it is significant (SMALL is smallest representative relative tolerance; + // we need something bigger since we're doing calculations) + // - if the start-end vector is zero we still progress const vectorField dirVec(end-start); const scalarField magSqrDirVec(magSqr(dirVec)); const vectorField smallVec @@ -447,34 +453,44 @@ void Foam::searchableBox::findLineAll forAll(start, pointI) { - hits.clear(); + // See if any intersection between pt and end + pointIndexHit inter = findLine(start[pointI], end[pointI]); - // Current starting point of ray. - point pt = start[pointI]; - - while (true) + if (inter.hit()) { - // See if any intersection between pt and end - pointIndexHit inter = findLine(pt, end[pointI]); - - if (!inter.hit()) - { - break; - } + hits.clear(); hits.append(inter); - pt = inter.hitPoint() + smallVec[pointI]; + point pt = inter.hitPoint() + smallVec[pointI]; - if (((pt-start[pointI])&dirVec[pointI]) > magSqrDirVec[pointI]) + while (((pt-start[pointI])&dirVec[pointI]) <= magSqrDirVec[pointI]) { - // Adding smallVec has taken us beyond end - break; + // See if any intersection between pt and end + pointIndexHit inter = findLine(pt, end[pointI]); + + // Check for not hit or hit same face as before (can happen + // if vector along surface of face) + if + ( + !inter.hit() + || (inter.index() == hits[hits.size()-1].index()) + ) + { + break; + } + hits.append(inter); + + pt = inter.hitPoint() + smallVec[pointI]; } - } - hits.shrink(); - info[pointI].transfer(hits); - hits.clear(); + hits.shrink(); + info[pointI].transfer(hits); + hits.clear(); + } + else + { + info[pointI].clear(); + } } } diff --git a/src/meshTools/searchableSurface/searchableSphere.C b/src/meshTools/searchableSurface/searchableSphere.C index 039be46749d05d74d07824334faf587672464df9..47abfbfff51d6f03546f30d0c2b6d748a9101abb 100644 --- a/src/meshTools/searchableSurface/searchableSphere.C +++ b/src/meshTools/searchableSurface/searchableSphere.C @@ -233,10 +233,9 @@ void Foam::searchableSphere::findLineAll { info.setSize(start.size()); - pointIndexHit near, far; - forAll(start, i) { + pointIndexHit near, far; findLineAll(start[i], end[i], near, far); if (near.hit()) @@ -260,6 +259,10 @@ void Foam::searchableSphere::findLineAll info[i].setSize(1); info[i][0] = far; } + else + { + info[i].clear(); + } } } } diff --git a/src/meshTools/searchableSurface/triSurfaceMesh.C b/src/meshTools/searchableSurface/triSurfaceMesh.C index 9751e3a3eff72fcd7f2d86b13bb964ab13f3ac6e..61b760699d88ea056c2c69670a02862f567af93a 100644 --- a/src/meshTools/searchableSurface/triSurfaceMesh.C +++ b/src/meshTools/searchableSurface/triSurfaceMesh.C @@ -443,7 +443,12 @@ void Foam::triSurfaceMesh::findLineAll // Work array DynamicList<pointIndexHit, 1, 1> hits; - // Tolerances + // Tolerances: + // To find all intersections we add a small vector to the last intersection + // This is chosen such that + // - it is significant (SMALL is smallest representative relative tolerance; + // we need something bigger since we're doing calculations) + // - if the start-end vector is zero we still progress const vectorField dirVec(end-start); const scalarField magSqrDirVec(magSqr(dirVec)); const vectorField smallVec @@ -454,34 +459,44 @@ void Foam::triSurfaceMesh::findLineAll forAll(start, pointI) { - hits.clear(); + // See if any intersection between pt and end + pointIndexHit inter = octree.findLine(start[pointI], end[pointI]); - // Current starting point of ray. - point pt = start[pointI]; - - while (true) + if (inter.hit()) { - // See if any intersection between pt and end - pointIndexHit inter = octree.findLine(pt, end[pointI]); - - if (!inter.hit()) - { - break; - } + hits.clear(); hits.append(inter); - pt = inter.hitPoint() + smallVec[pointI]; + point pt = inter.hitPoint() + smallVec[pointI]; - if (((pt-start[pointI])&dirVec[pointI]) > magSqrDirVec[pointI]) + while (((pt-start[pointI])&dirVec[pointI]) <= magSqrDirVec[pointI]) { - // Adding smallVec has taken us beyond end - break; + // See if any intersection between pt and end + pointIndexHit inter = octree.findLine(pt, end[pointI]); + + // Check for not hit or hit same triangle as before (can happen + // if vector along surface of triangle) + if + ( + !inter.hit() + || (inter.index() == hits[hits.size()-1].index()) + ) + { + break; + } + hits.append(inter); + + pt = inter.hitPoint() + smallVec[pointI]; } - } - hits.shrink(); - info[pointI].transfer(hits); - hits.clear(); + hits.shrink(); + info[pointI].transfer(hits); + hits.clear(); + } + else + { + info[pointI].clear(); + } } } diff --git a/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C b/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C index eb2d2ff261433701d65d6ae37271a7501fdfe213..f63194381136b8f89b515e81272b3aa33bc0cabe 100644 --- a/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C +++ b/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C @@ -206,10 +206,7 @@ void Foam::fieldToCell::applyToSet } else if (fieldObject.headerClassName() == "volScalarField") { - IFstream str - ( - mesh().time().path()/mesh().time().timeName()/fieldName_ - ); + IFstream str(fieldObject.filePath()); // Read dictionary dictionary fieldDict(str); @@ -220,10 +217,7 @@ void Foam::fieldToCell::applyToSet } else if (fieldObject.headerClassName() == "volVectorField") { - IFstream str - ( - mesh().time().path()/mesh().time().timeName()/fieldName_ - ); + IFstream str(fieldObject.filePath()); // Read dictionary dictionary fieldDict(str); diff --git a/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C b/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C index f7d4b6d1c881bb5e09e400f0d4f42761d772a6e6..56f8799aeca73aecbcd18379f02531eed244621f 100644 --- a/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C +++ b/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C @@ -34,12 +34,6 @@ Description #include "scalar.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -//- Not VSMALL - but smaller than SMALL -const Foam::scalar Foam::triangleFuncs::NVSMALL = Foam::sqrt(Foam::VSMALL); - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::triangleFuncs::setIntersection @@ -120,7 +114,8 @@ bool Foam::triangleFuncs::intersectAxesBundle scalar det = v2*u1 - u2*v1; - if (Foam::mag(det) < SMALL) + // Fix for V0:(-31.71428 0 -15.10714) V10:(-1.285715 8.99165e-16 -1.142858) V20:(0 0 -1.678573) i0:0 + if (Foam::mag(det)/max(max(mag(V10),mag(V20)),1) < SMALL) { // Triangle parallel to dir return false; @@ -522,7 +517,7 @@ bool Foam::triangleFuncs::classify bool hit = false; - if (Foam::mag(u1) < NVSMALL) + if (Foam::mag(u1) < ROOTVSMALL) { beta = u0/u2; diff --git a/src/meshTools/triSurface/triangleFuncs/triangleFuncs.H b/src/meshTools/triSurface/triangleFuncs/triangleFuncs.H index 4b4d202172d8d33601b2770267f203d81c016843..9ebc5c673189a777dcfaeed2443ca088ee2ff49b 100644 --- a/src/meshTools/triSurface/triangleFuncs/triangleFuncs.H +++ b/src/meshTools/triSurface/triangleFuncs/triangleFuncs.H @@ -71,11 +71,6 @@ public: private: - // Private data - - //- Not VSMALL - but smaller than SMALL - static const scalar NVSMALL; - // Private Member Functions //- Helper function for intersect. Sets pt to be anywhere on the edge diff --git a/src/postProcessing/fieldAverage/controlDict b/src/postProcessing/fieldAverage/controlDict index 40e3a2d4a72b3948c2ed2615bbd7d9344a1b8ac5..e45d47eb2638663e77a5c5b65bb7994217282db2 100644 --- a/src/postProcessing/fieldAverage/controlDict +++ b/src/postProcessing/fieldAverage/controlDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -12,7 +12,6 @@ FoamFile class dictionary; object controlDict; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application oodles; diff --git a/src/sampling/probes/probesDict b/src/sampling/probes/probesDict index 3f7679f0dedd0316db3bb3d610209b06bc77370f..f818d09bb4915d7d4278e37265c9beb0069b1173 100644 --- a/src/sampling/probes/probesDict +++ b/src/sampling/probes/probesDict @@ -1,22 +1,19 @@ -/*-------------------------------*- C++ -*---------------------------------*\ -| ========= | -| \\ / OpenFOAM 1.4.1 | -| \\ / | -| \\ / The Open Source CFD Toolbox | -| \\/ http://www.OpenFOAM.org | -\*-------------------------------------------------------------------------*/ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ FoamFile { - version 2.0; - format ascii; - class dictionary; - location system; - object probesDict; + version 2.0; + format ascii; + class dictionary; + object probesDict; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // Fields to be probed. runTime modifiable! fields ( diff --git a/src/thermophysicalModels/pdfs/pdf/newPdf.C b/src/thermophysicalModels/pdfs/pdf/newPdf.C index 7067137a1d4f34a5c3c6323a0b069decea028aaf..9dcf4a1024d4e0410244149357a27ef649a62b65 100644 --- a/src/thermophysicalModels/pdfs/pdf/newPdf.C +++ b/src/thermophysicalModels/pdfs/pdf/newPdf.C @@ -37,31 +37,23 @@ autoPtr<Foam::pdf> Foam::pdf::New Random& rndGen ) { - word pdfType - ( - dict.lookup("pdfType") - ); + word pdfType(dict.lookup("pdfType")); - Info << "Selecting pdfType " - << pdfType << endl; + Info<< "Selecting pdfType " << pdfType << endl; dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(pdfType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { - FatalError - << "pdf::New(const dictionary&, Random&) : " << endl - << " unknown pdfType type " - << pdfType - << ", constructor not in hash table" << endl << endl - << " Valid pdf types are :" << endl; - Info<< dictionaryConstructorTablePtr_->toc() << abort(FatalError); + FatalErrorIn("pdf::New(const dictionary&, Random&)") + << "unknown pdf type " << pdfType << endl << endl + << "Valid pdf types are :" << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); } return autoPtr<pdf>(cstrIter()(dict, rndGen)); - - //return autoPtr<pdf>(new pdf); } // ************************************************************************* // diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C index 4093fc32bb19a50590b91305d2101f31399b51a7..adc28176c59cbf495e15e1133dc0dd7c4941bfe0 100644 --- a/src/triSurface/triSurface/triSurface.C +++ b/src/triSurface/triSurface/triSurface.C @@ -161,7 +161,7 @@ void triSurface::printTriangle const pointField& points ) { - os + os << pre.c_str() << "vertex numbers:" << f[0] << ' ' << f[1] << ' ' << f[2] << endl << pre.c_str() << "vertex coords :" @@ -274,13 +274,13 @@ void triSurface::checkTriangles(const bool verbose) "triSurface::checkTriangles(bool verbose)" ) << "triangles share the same vertices:\n" << " face 1 :" << faceI << endl; - printTriangle(Warning, " ", f, points()); + printTriangle(Warning, " ", f, points()); Warning << endl << " face 2 :" << neighbours[neighbourI] << endl; - printTriangle(Warning, " ", n, points()); + printTriangle(Warning, " ", n, points()); } break; @@ -375,8 +375,8 @@ boolList triSurface::checkOrientation(const bool verbose) ( "triSurface::checkOrientation(bool)" ) << "edge number " << edgeLabels[i] << " on face " << facei - << " out of range" - << "\nThis usually means that the input surface has " + << " out-of-range\n" + << "This usually means that the input surface has " << "edges with more than 2 triangles connected.\n" << endl; valid = false; @@ -413,63 +413,39 @@ boolList triSurface::checkOrientation(const bool verbose) const labelListList& eFaces = edgeFaces(); - + // Storage for holding status of edge. True if normal flips across this // edge boolList borderEdge(nEdges(), false); - forAll(es, edgei) + forAll(es, edgeI) { - const labelList& neighbours = eFaces[edgei]; + const edge& e = es[edgeI]; + const labelList& neighbours = eFaces[edgeI]; if (neighbours.size() == 2) { - // Two triangles, A and B. Check if edge orientation is - // anticlockwise on both. - const labelList& fEdgesA = faceEdges()[neighbours[0]]; - - // Get next edge after edgei - label nextEdgeA = fEdgesA.fcIndex(findIndex(fEdgesA, edgei)); - - const labelList& fEdgesB = faceEdges()[neighbours[1]]; + const labelledTri& faceA = (*this)[neighbours[0]]; + const labelledTri& faceB = (*this)[neighbours[1]]; - label nextEdgeB = fEdgesB.fcIndex(findIndex(fEdgesB, edgei)); - - // Now check if nextEdgeA and nextEdgeB have any common points + // The edge cannot be going in the same direction if both faces + // are oriented counterclockwise. + // Thus the next face point *must* different between the faces. if ( - (es[nextEdgeA].start() == es[nextEdgeB].start()) - || (es[nextEdgeA].start() == es[nextEdgeB].end()) - || (es[nextEdgeA].end() == es[nextEdgeB].start()) - || (es[nextEdgeA].end() == es[nextEdgeB].end()) + faceA[faceA.fcIndex(findIndex(faceA, e.start()))] + == faceB[faceB.fcIndex(findIndex(faceB, e.start()))] ) { - borderEdge[edgei] = true; + borderEdge[edgeI] = true; if (verbose) { - WarningIn("triSurface::checkOrientation(bool)") - << "Triangle orientation incorrect." << endl - << "edge neighbours:" << neighbours << endl - << "triangle " << neighbours[0] << " has edges " - << fEdgesA << endl - << " with points " << endl - << " " << es[fEdgesA[0]].start() << ' ' - << es[fEdgesA[0]].end() << endl - << " " << es[fEdgesA[1]].start() << ' ' - << es[fEdgesA[1]].end() << endl - << " " << es[fEdgesA[2]].start() << ' ' - << es[fEdgesA[2]].end() << endl - - << "triangle " << neighbours[1] << " has edges " - << fEdgesB << endl - << " with points " << endl - << " " << es[fEdgesB[0]].start() << ' ' - << es[fEdgesB[0]].end() << endl - << " " << es[fEdgesB[1]].start() << ' ' - << es[fEdgesB[1]].end() << endl - << " " << es[fEdgesB[2]].start() << ' ' - << es[fEdgesB[2]].end() << endl - << endl; + WarningIn("PrimitivePatchExtra::checkOrientation(bool)") + << "face orientation incorrect." << nl + << "edge[" << edgeI << "] " << e + << " between faces " << neighbours << ":" << nl + << "face[" << neighbours[0] << "] " << faceA << nl + << "face[" << neighbours[1] << "] " << faceB << endl; } } } @@ -477,15 +453,14 @@ boolList triSurface::checkOrientation(const bool verbose) { if (verbose) { - const edge& e = es[edgei]; WarningIn("triSurface::checkOrientation(bool)") << "Wrong number of edge neighbours." << endl - << "Edge:" << e + << "edge[" << edgeI << "] " << e << "with points:" << localPoints()[e.start()] << ' ' << localPoints()[e.end()] << " has neighbours:" << neighbours << endl; } - borderEdge[edgei] = true; + borderEdge[edgeI] = true; } } @@ -1109,7 +1084,7 @@ void triSurface::subsetMeshMap if (!pointHad[a]) { pointHad[a] = true; - pointMap[pointI++] = a; + pointMap[pointI++] = a; } label b = tri[1]; @@ -1147,7 +1122,7 @@ triSurface triSurface::subsetMesh // Fill pointMap, faceMap subsetMeshMap(include, pointMap, faceMap); - + // Create compact coordinate list and forward mapping array pointField newPoints(pointMap.size()); diff --git a/src/turbulenceModels/RAS/compressible/LRR/LRR.C b/src/turbulenceModels/RAS/compressible/LRR/LRR.C index 9c544bc009c7829e58b74601729fec70b6651898..4a703d2c8ff29ac62e55a91081162eb0ea7c9afa 100644 --- a/src/turbulenceModels/RAS/compressible/LRR/LRR.C +++ b/src/turbulenceModels/RAS/compressible/LRR/LRR.C @@ -214,8 +214,8 @@ LRR::LRR FatalErrorIn ( "LRR::LRR" - "(const volVectorField& U, const surfaceScalarField& phi," - "incompressibleTransportModel& lamTransportModel)" + "( const volScalarField&, const volVectorField&" + ", const surfaceScalarField&, incompressibleTransportModel&)" ) << "couplingFactor = " << couplingFactor_ << " is not in range 0 - 1" << nl << exit(FatalError); diff --git a/src/turbulenceModels/RAS/compressible/LaunderGibsonRSTM/LaunderGibsonRSTM.C b/src/turbulenceModels/RAS/compressible/LaunderGibsonRSTM/LaunderGibsonRSTM.C index 47bac57df970d9dc0f9d597df08bab5b2eab3131..4b977f0809c893cd13c93c5fe8e1351ace6bf039 100644 --- a/src/turbulenceModels/RAS/compressible/LaunderGibsonRSTM/LaunderGibsonRSTM.C +++ b/src/turbulenceModels/RAS/compressible/LaunderGibsonRSTM/LaunderGibsonRSTM.C @@ -236,8 +236,8 @@ LaunderGibsonRSTM::LaunderGibsonRSTM FatalErrorIn ( "LaunderGibsonRSTM::LaunderGibsonRSTM" - "(const volVectorField& U, const surfaceScalarField& phi," - "incompressibleTransportModel& lamTransportModel)" + "(const volScalarField&, const volVectorField&" + ", const surfaceScalarField&, basicThermo&)" ) << "couplingFactor = " << couplingFactor_ << " is not in range 0 - 1" << nl << exit(FatalError); diff --git a/src/turbulenceModels/RAS/compressible/RASModel/newRASModel.C b/src/turbulenceModels/RAS/compressible/RASModel/newRASModel.C index 2d908397df1b0b93267a950043f8b80edae5f265..339e9ad2d2a930296cf65a0389c7e41ecab22b79 100644 --- a/src/turbulenceModels/RAS/compressible/RASModel/newRASModel.C +++ b/src/turbulenceModels/RAS/compressible/RASModel/newRASModel.C @@ -74,8 +74,8 @@ autoPtr<RASModel> RASModel::New { FatalErrorIn ( - "RASModel::New(const volScalarField& rho, " - "const volVectorField& U, const surfaceScalarField& phi, " + "RASModel::New(const volScalarField&, " + "const volVectorField&, const surfaceScalarField&, " "basicThermo&)" ) << "Unknown RASModel type " << RASModelTypeName << endl << endl diff --git a/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C b/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C index d2784bbc0e5cbcc0bb3f75124acbe1180542a71d..01b341748df851bffa1f87490f89a0547e79f803 100644 --- a/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C +++ b/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C @@ -35,6 +35,8 @@ License namespace Foam { +namespace compressible +{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -144,6 +146,7 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace compressible } // End namespace Foam // ************************************************************************* // diff --git a/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H b/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H index 6fbd983e32786fc67470e9280ca37f88a5bb9819..8b13df2af024c7fcbc8449588c2d3a2ecbdd2e31 100644 --- a/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H +++ b/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H @@ -23,7 +23,8 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::turbulentMixingLengthDissipationRateInletFvPatchScalarField + Foam::compressible:: + turbulentMixingLengthDissipationRateInletFvPatchScalarField Description Calculate epsilon via the mixing length [m] @@ -43,8 +44,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef turbulentMixingLengthDissipationRateInletFvPatchScalarField_H -#define turbulentMixingLengthDissipationRateInletFvPatchScalarField_H +#ifndef compressibleturbulentMixingLengthDissipationRateInletFvPatchField_H +#define compressibleturbulentMixingLengthDissipationRateInletFvPatchField_H #include "fixedValueFvPatchFields.H" @@ -52,6 +53,8 @@ SourceFiles namespace Foam { +namespace compressible +{ /*---------------------------------------------------------------------------*\ Class turbulentMixingLengthDissipationRateInletFvPatch Declaration @@ -154,6 +157,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace compressible } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C b/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C index 29e1db101720703a69d64111a1cf9716058ff7d0..92f01a9a7b4355b10ef3b6f27a1f92a1d0908ff1 100644 --- a/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +++ b/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C @@ -35,6 +35,8 @@ License namespace Foam { +namespace compressible +{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -150,6 +152,7 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace compressible } // End namespace Foam // ************************************************************************* // diff --git a/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H b/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H index a0db1440f2d2827e96ea0aab5582dbf8002e2926..ebba209f1ef0b35b274f26434cc870ca7e0ee3ce 100644 --- a/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H +++ b/src/turbulenceModels/RAS/compressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::turbulentMixingLengthFrequencyInletFvPatchScalarField + Foam::compressible::turbulentMixingLengthFrequencyInletFvPatchScalarField Description Calculate omega via the mixing length @@ -44,8 +44,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef turbulentMixingLengthFrequencyInletFvPatchScalarField_H -#define turbulentMixingLengthFrequencyInletFvPatchScalarField_H +#ifndef compressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H +#define compressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H #include "fixedValueFvPatchFields.H" @@ -53,6 +53,8 @@ SourceFiles namespace Foam { +namespace compressible +{ /*---------------------------------------------------------------------------*\ Class turbulentMixingLengthFrequencyInletFvPatchScalarField Declaration @@ -159,6 +161,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace compressible } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C index 20c44ffb2020ca9e08936841fe9aeede45a69e74..699559c2cf6cfdc10f4eeece5db2be1f6adf9d94 100644 --- a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C @@ -35,6 +35,8 @@ License namespace Foam { +namespace incompressible +{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -144,6 +146,7 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace incompressible } // End namespace Foam // ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H index 6fbd983e32786fc67470e9280ca37f88a5bb9819..63a764f2250186b61c11453e98211609cd55865b 100644 --- a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.H @@ -23,7 +23,8 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::turbulentMixingLengthDissipationRateInletFvPatchScalarField + Foam::incompressible:: + turbulentMixingLengthDissipationRateInletFvPatchScalarField Description Calculate epsilon via the mixing length [m] @@ -43,8 +44,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef turbulentMixingLengthDissipationRateInletFvPatchScalarField_H -#define turbulentMixingLengthDissipationRateInletFvPatchScalarField_H +#ifndef incompressibleturbulentMixingLengthDissipationRateInlet_H +#define incompressibleturbulentMixingLengthDissipationRateInlet_H #include "fixedValueFvPatchFields.H" @@ -52,6 +53,8 @@ SourceFiles namespace Foam { +namespace incompressible +{ /*---------------------------------------------------------------------------*\ Class turbulentMixingLengthDissipationRateInletFvPatch Declaration @@ -154,6 +157,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace incompressible } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C index b467fe2617c6932627c524db86b99b392c7181ac..465118cdbfccf065f1980fee49b2d0d4895b9006 100644 --- a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C @@ -35,6 +35,8 @@ License namespace Foam { +namespace incompressible +{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -150,6 +152,7 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace incompressible } // End namespace Foam // ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H index a0db1440f2d2827e96ea0aab5582dbf8002e2926..bdfa5e845ac0e6d08cdcba1d91cdaf928881835a 100644 --- a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::turbulentMixingLengthFrequencyInletFvPatchScalarField + Foam::incompressible::turbulentMixingLengthFrequencyInletFvPatchScalarField Description Calculate omega via the mixing length @@ -44,8 +44,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef turbulentMixingLengthFrequencyInletFvPatchScalarField_H -#define turbulentMixingLengthFrequencyInletFvPatchScalarField_H +#ifndef incompressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H +#define incompressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H #include "fixedValueFvPatchFields.H" @@ -53,6 +53,8 @@ SourceFiles namespace Foam { +namespace incompressible +{ /*---------------------------------------------------------------------------*\ Class turbulentMixingLengthFrequencyInletFvPatchScalarField Declaration @@ -159,6 +161,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace incompressible } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/Allclean b/tutorials/Allclean index ac1f12662c3d556b8dc482cc33730485815fbe1f..c72811f9fae68642d7f48847ec2d44515da5a89b 100755 --- a/tutorials/Allclean +++ b/tutorials/Allclean @@ -30,10 +30,12 @@ # #------------------------------------------------------------------------------ +cd ${0%/*} || exit 1 # run from this directory + echo "Cleaning backup files" find . -type f \( -name "*~" -o -name "*.bak" \) -exec rm {} \; find . \( -name 'core' -o -name 'core.[1-9]*' \) -exec rm {} \; -find . \( -name '*.pvs' -o -name '*.foam' \) -exec rm {} \; +find . \( -name '*.pvs' -o -name '*.OpenFOAM' \) -exec rm {} \; rm logs > /dev/null 2>&1 rm testLoopReport > /dev/null 2>&1 diff --git a/tutorials/Allrun b/tutorials/Allrun index e351dcaddaffbfa91a672012a9a57a0dc854b07d..78bdcb516ab01ee82bfa37e5bb38ad6d1d04c8e7 100755 --- a/tutorials/Allrun +++ b/tutorials/Allrun @@ -30,6 +30,8 @@ # #------------------------------------------------------------------------------ +cd ${0%/*} || exit 1 # run from this directory + # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions diff --git a/tutorials/Alltest b/tutorials/Alltest index ec3da8513b1fc09623253e12e19ade759677cac2..2b5152e8220fe16d7c181e211f53b810ca025a83 100755 --- a/tutorials/Alltest +++ b/tutorials/Alltest @@ -30,6 +30,8 @@ # #------------------------------------------------------------------------------ +cd ${0%/*} || exit 1 # run from this directory + # FUNCTIONS # printUsage () { diff --git a/tutorials/MRFSimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 b/tutorials/MRFSimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 index d1c2ffdab98cbf8ce6393ae2a75d8f42b72611ff..899b4ccbec0533e9f0037943ef14439454f12f9e 100644 --- a/tutorials/MRFSimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 +++ b/tutorials/MRFSimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 @@ -16,8 +16,7 @@ FoamFile // General macros to create 2D/extruded-2D meshes changecom(//)changequote([,]) -define(calc, [esyscmd(perl -e 'printf ($1)')]) -//define(calc, [esyscmd(echo $1 | bc | tr -d \\n)]) +define(calc, [esyscmd(perl -e 'print ($1)')]) define(VCOUNT, 0) define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) define(pi, 3.14159265) diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/K b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/K index d216becb76e453ba0dcdb89b9055aa38883c67ab..30bd554406e7100fbfd2b955eb0a75d9bd0e5133 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/K +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/K @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4.2 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -11,7 +11,6 @@ FoamFile format ascii; class volScalarField; object K; - location "0.003"; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,5 +48,4 @@ boundaryField } } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/T b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/T index 29e55ac27f1d43677cccae97e9e62dc71faa9e8b..351b19171706698e0f2f7d0af950cc0f031f172a 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/T +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/T @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4.2 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -11,7 +11,6 @@ FoamFile format ascii; class volScalarField; object T; - location "0.003"; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,5 +49,4 @@ boundaryField } } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/U b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/U index 528c16391f98a95a06e7ac8d48c9f207da9d27f2..a3e6ac2e664867c74b827b58de3375df9b9cf716 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/U +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/U @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4.2 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -11,7 +11,6 @@ FoamFile format ascii; class volVectorField; object U; - location "0.003"; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -55,5 +54,4 @@ boundaryField } } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/cp b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/cp index bc53e05c8637bc4128bf56414c64aa67f81d1f64..23768ccc1b440c7efb9d651df1f530e31dd3d274 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/cp +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/cp @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4.2 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -11,7 +11,6 @@ FoamFile format ascii; class volScalarField; object cp; - location "0.003"; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,5 +48,4 @@ boundaryField } } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/epsilon b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/epsilon index c79030383f7a92bb8ad4468216ae77fa662264f0..4f3ffc986ea9c166950c1b4a693ae6b37fea40aa 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/epsilon +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/epsilon @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4.2 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -11,7 +11,6 @@ FoamFile format ascii; class volScalarField; object epsilon; - location "0.003"; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,5 +49,4 @@ boundaryField } } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/k b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/k index c491981bf7903c2d6f0e6f6405e8c885f9e579a4..7ac77f7e69aeb0bd0efaddd0c3f0a9a1d74e67fc 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/k +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/k @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4.2 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -11,7 +11,6 @@ FoamFile format ascii; class volScalarField; object k; - location "0.003"; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,5 +49,4 @@ boundaryField } } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/p b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/p index 9605bb7ff5c2fc81c35a974330dea835be97141c..a98fc2825d0103495eea908d93fe1de81df15128 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/p +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/p @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4.2 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -11,7 +11,6 @@ FoamFile format ascii; class volScalarField; object p; - location "0.003"; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,5 +53,4 @@ boundaryField } } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/pd b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/pd index 1d0ac0a6a11798f23bcd898c208797aff7d05731..dbfc6661058517618c784bf060911ebe265b98c9 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/pd +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/pd @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4.2 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -11,7 +11,6 @@ FoamFile format ascii; class volScalarField; object p; - location "0.003"; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,5 +53,4 @@ boundaryField } } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/rho b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/rho index 24f6f2d0c0f0e5b24d6313a2f61aec4fcde807bb..f02517eab720a3e126f109b4f96f1722ef48e1b1 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/0/rho +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/0/rho @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4.2 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -11,7 +11,6 @@ FoamFile format ascii; class volScalarField; object rho; - location "0.003"; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,5 +48,4 @@ boundaryField } } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/Allclean b/tutorials/chtMultiRegionFoam/multiRegionHeater/Allclean index aeb3ee5b7be4287e65543bfa9614b70b919a52c6..2954f18bad457db6c7a7a287a2bbeaf5524e6f71 100755 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/Allclean +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/Allclean @@ -4,4 +4,7 @@ . $WM_PROJECT_DIR/bin/tools/CleanFunctions cleanCase -rm -r VTK +rm -rf VTK +rm -rf constant/cellToRegion constant/polyMesh/sets + +# ----------------------------------------------------------------------------- diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/Allrun b/tutorials/chtMultiRegionFoam/multiRegionHeater/Allrun index 3a79aca5a977e09e7ea2ba5e88d18a1a15462924..e698fc906af01916284db58338ac255c62b427b5 100755 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/Allrun +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/Allrun @@ -2,18 +2,41 @@ # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions -rm -r constant/polyMesh/sets +rm -rf constant/polyMesh/sets + runApplication blockMesh runApplication setSet -batch makeCellSets.setSet -rm constant/polyMesh/sets/*_old + +rm -f constant/polyMesh/sets/*_old + runApplication setsToZones -noFlipMap runApplication splitMeshRegions -cellZones -changeDictionary -region bottomAir -changeDictionary -region topAir -changeDictionary -region heater -changeDictionary -region leftSolid -changeDictionary -region rightSolid -runApplication chtMultiRegionFoam +for i in bottomAir topAir heater leftSolid rightSolid +do + changeDictionary -region $i +done + +# remove fluid fields from solid regions (important for post-processing) +for i in heater leftSolid rightSolid +do + rm -f 0*/$i/{epsilon,k,p,pd,U} +done + +# remove solid fields from fluid regions (important for post-processing) +for i in bottomAir topAir +do + rm -f 0*/$i/{cp,K} +done + +runApplication chtMultiRegionFoam +echo +echo "creating files for paraview post-processing" +echo +for i in bottomAir topAir heater leftSolid rightSolid +do + paraFoam -touch -region $i +done +# ----------------------------------------------------------------------------- diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/bottomAir/RASProperties b/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/bottomAir/RASProperties index 66160205bcd474745aac60abeb61f44633e1aca7..6b4cc41e7a84e17964ea8f308450c5a26a43b9b5 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/bottomAir/RASProperties +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/bottomAir/RASProperties @@ -1,25 +1,17 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object RASProperties; + version 2.0; + format ascii; + class dictionary; + object RASProperties; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // RASModel kEpsilon; @@ -101,5 +93,4 @@ wallFunctionCoeffs E 9; } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/bottomAir/environmentalProperties b/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/bottomAir/environmentalProperties index e9aee6c9b50caa4fae9f0025596b7894773d2cbb..03e0adce892c8e4fdd83c43484578d4bb486aca3 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/bottomAir/environmentalProperties +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/bottomAir/environmentalProperties @@ -1,28 +1,19 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object environmentalProperties; + version 2.0; + format ascii; + class dictionary; + object environmentalProperties; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // g g [0 1 -2 0 0 0 0] (0 -9.81 0); - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/bottomAir/thermophysicalProperties b/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/bottomAir/thermophysicalProperties index ca90242d7d51bdd737438508ea0ae9d7cd54159f..7eb3ee5b9f430e1429510ce0cf7063914b1f4f41 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/bottomAir/thermophysicalProperties +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/bottomAir/thermophysicalProperties @@ -1,30 +1,21 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object thermophysicalProperties; + version 2.0; + format ascii; + class dictionary; + object thermophysicalProperties; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // thermoType hThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>; mixture air 1 28.9 1000 0 1.8e-05 0.7; - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/polyMesh/blockMeshDict b/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/polyMesh/blockMeshDict index a0733096f968daf7c78d2039ac1463ec193e82f7..5f292d4e4952c00603559a3b216503b01b78ff46 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/polyMesh/blockMeshDict +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/polyMesh/blockMeshDict @@ -1,28 +1,19 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object blockMeshDict; + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - convertToMeters 1; vertices @@ -78,5 +69,4 @@ mergePatchPairs ( ); - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/regionProperties b/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/regionProperties index 6bff0e8cffe5d61b2b2f5fa957e507979b445753..bff96505ebefbae96c7c20ceac2628b60edea66b 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/regionProperties +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/regionProperties @@ -1,25 +1,17 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object regionProperties; + version 2.0; + format ascii; + class dictionary; + object regionProperties; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // fluidRegionNames @@ -28,7 +20,6 @@ fluidRegionNames topAir ); - solidRegionNames ( heater diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/topAir/RASProperties b/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/topAir/RASProperties index a0307ea431e968ef30d1a62211fb57853841a610..9037f279053fe08eee8d5191bb8f984e287ff50e 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/topAir/RASProperties +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/constant/topAir/RASProperties @@ -1,25 +1,17 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object RASProperties; + version 2.0; + format ascii; + class dictionary; + object RASProperties; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // RASModel kEpsilon; @@ -102,5 +94,4 @@ wallFunctionCoeffs E 9; } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/changeDictionaryDict b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/changeDictionaryDict index 1a89c964f221850352d57988a93cc7ee605ff194..285f41a8438936f0aa4945a4d1dda19ed06a48c0 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/changeDictionaryDict +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/changeDictionaryDict @@ -1,20 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ FoamFile { - version 2.0; - format ascii; - - root "/home/warhol/chris/foam/chris2.1/run/tutorials/interFoam"; - case "damBreak"; - instance "system"; - local ""; - - class dictionary; - object changePatchTypeDict; + version 2.0; + format ascii; + class dictionary; + object changeDictionaryDict; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - dictionaryReplacement { U @@ -33,7 +32,6 @@ dictionaryReplacement value uniform (0 0 0); } - bottomAir_to_leftSolid { type fixedValue; @@ -53,8 +51,6 @@ dictionaryReplacement } } - - T { boundaryField @@ -94,7 +90,6 @@ dictionaryReplacement } } - epsilon { // Set the value on all bc to non-zero. Not used in simulation @@ -154,7 +149,6 @@ dictionaryReplacement } } - k { internalField uniform 0.1; @@ -211,7 +205,6 @@ dictionaryReplacement } } - pd { boundaryField @@ -259,7 +252,6 @@ dictionaryReplacement } } - p { internalField uniform 1000000; diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSchemes b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSchemes index 73309294bf338a5f77de1847ad226fd90fab6f4e..9e792da55f1a212351fd1e5d2d26e2992642a502 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSchemes +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSchemes @@ -1,25 +1,17 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object fvSchemes; + version 2.0; + format ascii; + class dictionary; + object fvSchemes; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ddtSchemes @@ -74,5 +66,4 @@ fluxRequired pd; } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSolution b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSolution index e82c183b187df77db5517db828757c0beec3c890..b4f773aaa4b412012acf405c551618a62bdbf9d6 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSolution +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSolution @@ -1,25 +1,17 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object fvSolution; + version 2.0; + format ascii; + class dictionary; + object fvSolution; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers @@ -114,5 +106,4 @@ PISO // U 0.9; //} - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/changeDictionaryDict b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/changeDictionaryDict index 5c53b44a239928903ec866ddd08983be78f21144..56a984c7d79fe0905dadedba30cadee68ca322e6 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/changeDictionaryDict +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/changeDictionaryDict @@ -1,20 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ FoamFile { - version 2.0; - format ascii; - - root "/home/warhol/chris/foam/chris2.1/run/tutorials/interFoam"; - case "damBreak"; - instance "system"; - local ""; - - class dictionary; - object changePatchTypeDict; + version 2.0; + format ascii; + class dictionary; + object changeDictionaryDict; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - dictionaryReplacement { T @@ -115,7 +114,6 @@ dictionaryReplacement } } - K { internalField uniform 80; @@ -153,7 +151,6 @@ dictionaryReplacement } } - cp { internalField uniform 450; diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/controlDict b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/controlDict index cab5c5b147b5c965375fda658d2eff2126b72fa1..c95460bc8a0d40d4d791505acef1a4452504f8b7 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/controlDict +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/controlDict @@ -1,28 +1,20 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object controlDict; + version 2.0; + format ascii; + class dictionary; + object controlDict; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application chtFoam; +application chtMultiRegionFoam; startFrom latestTime; @@ -36,8 +28,8 @@ deltaT 0.001; writeControl adjustableRunTime; writeInterval 5; -//writeControl timeStep; -//writeInterval 20; +// writeControl timeStep; +// writeInterval 20; purgeWrite 0; @@ -57,5 +49,4 @@ maxCo 0.3; adjustTimeStep yes; - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/fvSchemes b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/fvSchemes index d628f9178e6898a428c2031491ffec6262ce7195..1c38514090a429a2e0338c814693e4917b601438 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/fvSchemes +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/fvSchemes @@ -1,25 +1,17 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object fvSchemes; + version 2.0; + format ascii; + class dictionary; + object fvSchemes; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ddtSchemes @@ -64,5 +56,4 @@ fluxRequired gamma; } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/fvSolution b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/fvSolution index 23e4e222d0711788531cd23a6e71c2afed1014c8..a77e8bcd8f196d557d62d2ffbc0ef4c393e020ce 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/fvSolution +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/fvSolution @@ -1,25 +1,17 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object fvSolution; + version 2.0; + format ascii; + class dictionary; + object fvSolution; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers @@ -128,5 +120,4 @@ PISO pdRefValue 0; } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict index 1a50cc17b977a1b44dd3a5b3d612ee437df75cc9..b4226ef4844a0fdb5eb834a3a8907bb4cde64608 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict @@ -1,20 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ FoamFile { - version 2.0; - format ascii; - - root "/home/warhol/chris/foam/chris2.1/run/tutorials/interFoam"; - case "damBreak"; - instance "system"; - local ""; - - class dictionary; - object changePatchTypeDict; + version 2.0; + format ascii; + class dictionary; + object changeDictionaryDict; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - dictionaryReplacement { T @@ -115,7 +114,6 @@ dictionaryReplacement } } - K { internalField uniform 80; @@ -153,7 +151,6 @@ dictionaryReplacement } } - cp { internalField uniform 450; diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSchemes b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSchemes index e1c5ba8e1877fa1152c7535004ef97ec926e8399..653c819be5bbf72737c34eeccec937508c2847fe 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSchemes +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSchemes @@ -1,25 +1,17 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object fvSchemes; + version 2.0; + format ascii; + class dictionary; + object fvSchemes; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ddtSchemes @@ -58,5 +50,4 @@ fluxRequired default no; } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSolution b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSolution index 648c2282b5a8eaee1cce9c2113e75bb6122bd789..e1bc5f8416d0c16cb569690f3e11f6f376062c35 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSolution +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSolution @@ -1,25 +1,17 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.4 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ - FoamFile { - version 2.0; - format ascii; - - root ""; - case ""; - instance ""; - local ""; - - class dictionary; - object fvSolution; + version 2.0; + format ascii; + class dictionary; + object fvSolution; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers @@ -37,5 +29,4 @@ PISO nNonOrthogonalCorrectors 1; } - // ************************************************************************* // diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict index a6fd49e467e61a16153a4c61cd32e576b477db80..86ac71c3cb0286947e32e15704e3a418dbd8d284 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict @@ -1,20 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ FoamFile { - version 2.0; - format ascii; - - root "/home/warhol/chris/foam/chris2.1/run/tutorials/interFoam"; - case "damBreak"; - instance "system"; - local ""; - - class dictionary; - object changePatchTypeDict; + version 2.0; + format ascii; + class dictionary; + object changeDictionaryDict; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - dictionaryReplacement { T @@ -99,7 +98,6 @@ dictionaryReplacement } } - K { internalField uniform 80; @@ -133,7 +131,6 @@ dictionaryReplacement } } - cp { internalField uniform 450; diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict index 1ad8174abb7fc9e3f8eca31ad2536f3b77952a2a..b27b29bfcdc0de7ca1e8856defe9732399f1eca9 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict @@ -1,20 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ FoamFile { - version 2.0; - format ascii; - - root "/home/warhol/chris/foam/chris2.1/run/tutorials/interFoam"; - case "damBreak"; - instance "system"; - local ""; - - class dictionary; - object changePatchTypeDict; + version 2.0; + format ascii; + class dictionary; + object changeDictionaryDict; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - dictionaryReplacement { T @@ -98,7 +97,6 @@ dictionaryReplacement } } - K { internalField uniform 80; @@ -132,7 +130,6 @@ dictionaryReplacement } } - cp { internalField uniform 450; diff --git a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/topAir/changeDictionaryDict b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/topAir/changeDictionaryDict index c24aa9244d0a94d8844f76d2021592e21c85959e..058056571ae270fc3a3a9078f991c2748bc5803f 100644 --- a/tutorials/chtMultiRegionFoam/multiRegionHeater/system/topAir/changeDictionaryDict +++ b/tutorials/chtMultiRegionFoam/multiRegionHeater/system/topAir/changeDictionaryDict @@ -1,20 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ FoamFile { - version 2.0; - format ascii; - - root "/home/warhol/chris/foam/chris2.1/run/tutorials/interFoam"; - case "damBreak"; - instance "system"; - local ""; - - class dictionary; - object changePatchTypeDict; + version 2.0; + format ascii; + class dictionary; + object changeDictionaryDict; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - dictionaryReplacement { U @@ -33,7 +32,6 @@ dictionaryReplacement inletValue uniform (0 0 0); } - topAir_to_leftSolid { type fixedValue; @@ -53,8 +51,6 @@ dictionaryReplacement } } - - T { boundaryField @@ -95,7 +91,6 @@ dictionaryReplacement } } - epsilon { // Set the value on all bc to non-zero. Not used in simulation @@ -152,7 +147,6 @@ dictionaryReplacement } } - k { internalField uniform 0.1; @@ -210,7 +204,6 @@ dictionaryReplacement } } - pd { boundaryField diff --git a/tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 b/tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 index ced5dc533e3e9b795683e33517d450678eeab2be..ad753abc5629d10e631b0b69a54495ce58509d2c 100644 --- a/tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 +++ b/tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 @@ -16,7 +16,7 @@ FoamFile // General m4 macros changecom(//)changequote([,]) -define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; printf ($1)')]) +define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; print ($1)')]) define(VCOUNT, 0) define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) diff --git a/tutorials/interDyMFoam/sloshingTank2D3DoF/constant/polyMesh/blockMeshDict.m4 b/tutorials/interDyMFoam/sloshingTank2D3DoF/constant/polyMesh/blockMeshDict.m4 index ced5dc533e3e9b795683e33517d450678eeab2be..ad753abc5629d10e631b0b69a54495ce58509d2c 100644 --- a/tutorials/interDyMFoam/sloshingTank2D3DoF/constant/polyMesh/blockMeshDict.m4 +++ b/tutorials/interDyMFoam/sloshingTank2D3DoF/constant/polyMesh/blockMeshDict.m4 @@ -16,7 +16,7 @@ FoamFile // General m4 macros changecom(//)changequote([,]) -define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; printf ($1)')]) +define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; print ($1)')]) define(VCOUNT, 0) define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) diff --git a/tutorials/interDyMFoam/sloshingTank3D3DoF/constant/polyMesh/blockMeshDict.m4 b/tutorials/interDyMFoam/sloshingTank3D3DoF/constant/polyMesh/blockMeshDict.m4 index 5e355fd7025a748a668cd3d55bfe9bd984c78869..cc851f6503f90da326a66561c0ccac74fb36f5dc 100644 --- a/tutorials/interDyMFoam/sloshingTank3D3DoF/constant/polyMesh/blockMeshDict.m4 +++ b/tutorials/interDyMFoam/sloshingTank3D3DoF/constant/polyMesh/blockMeshDict.m4 @@ -16,7 +16,7 @@ FoamFile // General m4 macros changecom(//)changequote([,]) -define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; printf ($1)')]) +define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; print ($1)')]) define(VCOUNT, 0) define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) diff --git a/tutorials/interDyMFoam/sloshingTank3D6DoF/constant/dynamicMeshDict b/tutorials/interDyMFoam/sloshingTank3D6DoF/constant/dynamicMeshDict index 5bf94e70a20343ef85e4b65e297b6a15a774de9a..639bcd053b70dd7fedda1aab03e6b236353794a6 100644 --- a/tutorials/interDyMFoam/sloshingTank3D6DoF/constant/dynamicMeshDict +++ b/tutorials/interDyMFoam/sloshingTank3D6DoF/constant/dynamicMeshDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.openfoam.org | +| \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -12,7 +12,6 @@ FoamFile class dictionary; object motionProperties; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dynamicFvMesh solidBodyMotionFvMesh; diff --git a/tutorials/interDyMFoam/sloshingTank3D6DoF/constant/polyMesh/blockMeshDict.m4 b/tutorials/interDyMFoam/sloshingTank3D6DoF/constant/polyMesh/blockMeshDict.m4 index 5e355fd7025a748a668cd3d55bfe9bd984c78869..cc851f6503f90da326a66561c0ccac74fb36f5dc 100644 --- a/tutorials/interDyMFoam/sloshingTank3D6DoF/constant/polyMesh/blockMeshDict.m4 +++ b/tutorials/interDyMFoam/sloshingTank3D6DoF/constant/polyMesh/blockMeshDict.m4 @@ -16,7 +16,7 @@ FoamFile // General m4 macros changecom(//)changequote([,]) -define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; printf ($1)')]) +define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; print ($1)')]) define(VCOUNT, 0) define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) diff --git a/tutorials/sonicTurbFoam/nacaAirfoil/system/controlDict b/tutorials/sonicTurbFoam/nacaAirfoil/system/controlDict index 31559931cf18171a8d54b924fe2f196e6cdc03ae..633ee17026fcb5e2f00b6de867e311d0713fc787 100644 --- a/tutorials/sonicTurbFoam/nacaAirfoil/system/controlDict +++ b/tutorials/sonicTurbFoam/nacaAirfoil/system/controlDict @@ -44,4 +44,60 @@ timePrecision 6; runTimeModifiable yes; +functions +( + //forces + //{ + // type forces; + // functionObjectLibs ("libforces.so"); + // + // // Patches to sample + // patches (WALL10); + // // Name of fields + // pName p; + // Uname U; + // // Dump to file + // log true; + // // Density + // rhoInf 1; + // // Centre of rotation + // CofR (0 0 0); + //} + + forces + { + type forceCoeffs; + functionObjectLibs ("libforces.so"); + + // Patches to sample + patches (WALL10); + // Name of fields + pName p; + Uname U; + // Dump to file + log true; + // Density + rhoInf 1; + // Centre of rotation + CofR (0 0 0); + + // Direction for lift + liftDir (-0.239733 0.970839 0); + // Direction for drag + dragDir ( 0.970839 0.239733 0); + + // Pitching axis + pitchAxis (0 0 1); + + magUInf 618.022; + + lRef 1.0; + Aref 1.0; + } + + +); + + + // ************************************************************************* //