From aace62a1b805d7b8214d343111a0ea18182e2a2d Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 27 Oct 2016 20:57:10 +0100 Subject: [PATCH 001/191] Revert "VectorSpace: Added printing of out-of-range index" This reverts commit d881d2afe6f31b484af629fc4c1153e7b323d590. --- .../primitives/VectorSpace/VectorSpaceI.H | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H index 3488217e07..f90adbb0ff 100644 --- a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H +++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H @@ -106,7 +106,7 @@ inline const Cmpt& VectorSpace::component if (d >= Ncmpts) { FatalErrorInFunction - << "index " << d << " out of range" + << "index out of range" << abort(FatalError); } #endif @@ -125,7 +125,7 @@ inline Cmpt& VectorSpace::component if (d >= Ncmpts) { FatalErrorInFunction - << "index " << d << "out of range" + << "index out of range" << abort(FatalError); } #endif @@ -145,7 +145,7 @@ inline void VectorSpace::component if (d >= Ncmpts) { FatalErrorInFunction - << "index " << d << " out of range" + << "index out of range" << abort(FatalError); } #endif @@ -165,7 +165,7 @@ inline void VectorSpace::replace if (d >= Ncmpts) { FatalErrorInFunction - << "index " << d << " out of range" + << "index out of range" << abort(FatalError); } #endif @@ -205,7 +205,7 @@ inline const Cmpt& VectorSpace::operator[] if (d >= Ncmpts) { FatalErrorInFunction - << "index " << d << " out of range" + << "index out of range" << abort(FatalError); } #endif @@ -224,7 +224,7 @@ inline Cmpt& VectorSpace::operator[] if (d >= Ncmpts) { FatalErrorInFunction - << "index " << d << " out of range" + << "index out of range" << abort(FatalError); } #endif @@ -246,7 +246,7 @@ ConstBlock::operator[] if (i >= Ncmpts) { FatalErrorInFunction - << "index " << d << " out of range" + << "index out of range" << abort(FatalError); } #endif @@ -269,7 +269,7 @@ ConstBlock::operator() if (i >= Ncmpts) { FatalErrorInFunction - << "index " << d << " out of range" + << "index out of range" << abort(FatalError); } From f2ce1fa9ac5d8dab586b44abbf65413a68befb3d Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 28 Oct 2016 10:50:10 +0100 Subject: [PATCH 002/191] twoPhaseEulerFoam::twoPhaseSystem: Ensure inlet flow of BOTH phases matches the BCs Previously the inlet flow of phase 1 (the phase solved for) is corrected to match the inlet specification for that phase. However, if the second phase is also constrained at inlets the inlet flux must also be corrected to match the inlet specification. --- .../twoPhaseSystem/phaseModel/phaseModel.C | 26 +++++++++++++++++++ .../twoPhaseSystem/phaseModel/phaseModel.H | 3 +++ .../twoPhaseSystem/twoPhaseSystem.C | 24 ++--------------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C index a553a01b5e..cd60d2cbb0 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C @@ -248,4 +248,30 @@ bool Foam::phaseModel::read(const dictionary& phaseProperties) } +void Foam::phaseModel::correctInflowFlux(surfaceScalarField& alphaPhi) const +{ + surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef(); + + // Ensure that the flux at inflow BCs is preserved + forAll(alphaPhiBf, patchi) + { + fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi]; + + if (!alphaPhip.coupled()) + { + const scalarField& phip = phi().boundaryField()[patchi]; + const scalarField& alphap = boundaryField()[patchi]; + + forAll(alphaPhip, facei) + { + if (phip[facei] < SMALL) + { + alphaPhip[facei] = alphap[facei]*phip[facei]; + } + } + } + } +} + + // ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H index 5fb0245513..a5ae107c90 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.H @@ -319,6 +319,9 @@ public: return alphaRhoPhi_; } + //- Ensure that the flux at inflow BCs is preserved + void correctInflowFlux(surfaceScalarField& alphaPhi) const; + //- Correct the phase properties // other than the thermodynamics and turbulence // which have special treatment diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C index 7c2323a030..808fe255f9 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -444,28 +444,7 @@ void Foam::twoPhaseSystem::solve() ) ); - surfaceScalarField::Boundary& alphaPhic1Bf = - alphaPhic1.boundaryFieldRef(); - - // Ensure that the flux at inflow BCs is preserved - forAll(alphaPhic1Bf, patchi) - { - fvsPatchScalarField& alphaPhic1p = alphaPhic1Bf[patchi]; - - if (!alphaPhic1p.coupled()) - { - const scalarField& phi1p = phi1.boundaryField()[patchi]; - const scalarField& alpha1p = alpha1.boundaryField()[patchi]; - - forAll(alphaPhic1p, facei) - { - if (phi1p[facei] < 0) - { - alphaPhic1p[facei] = alpha1p[facei]*phi1p[facei]; - } - } - } - } + phase1_.correctInflowFlux(alphaPhic1); if (nAlphaSubCycles > 1) { @@ -537,6 +516,7 @@ void Foam::twoPhaseSystem::solve() phase2_.alphaPhi() = phi_ - phase1_.alphaPhi(); alpha2 = scalar(1) - alpha1; + phase2_.correctInflowFlux(phase2_.alphaPhi()); phase2_.alphaRhoPhi() = fvc::interpolate(phase2_.rho())*phase2_.alphaPhi(); From 429ca912166af7230ec9c8c7485d24c2e1a7db23 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Sun, 30 Oct 2016 00:01:48 +0100 Subject: [PATCH 003/191] etc/config: Removed references to gcc versions < 4.8 Patch contributed by Bruno Santos Resolves bug-report http://bugs.openfoam.org/view.php?id=2312 --- etc/bashrc | 2 +- etc/config.csh/settings | 3 --- etc/config.sh/compiler | 3 --- etc/cshrc | 2 +- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/etc/bashrc b/etc/bashrc index 44ee7b8b6a..e107f57f7f 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -61,7 +61,7 @@ export FOAM_INST_DIR=$HOME/$WM_PROJECT export WM_COMPILER_TYPE=system #- Compiler: -# WM_COMPILER = Gcc | Gcc45 | Gcc46 | Gcc47 | Gcc48 | Gcc49| Clang | Icc +# WM_COMPILER = Gcc | Gcc48 ... Gcc62 | Clang | Icc export WM_COMPILER=Gcc unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH diff --git a/etc/config.csh/settings b/etc/config.csh/settings index 282558a88d..aa8243d9a4 100644 --- a/etc/config.csh/settings +++ b/etc/config.csh/settings @@ -225,9 +225,6 @@ case ThirdParty: case Gcc48: set gcc_version=gcc-4.8.5 breaksw - case Gcc47: - set gcc_version=gcc-4.7.4 - breaksw case Gcc49: set gcc_version=gcc-4.9.3 breaksw diff --git a/etc/config.sh/compiler b/etc/config.sh/compiler index 6a941352b5..9042a5f176 100644 --- a/etc/config.sh/compiler +++ b/etc/config.sh/compiler @@ -42,9 +42,6 @@ OpenFOAM | ThirdParty) Gcc | Gcc48) gcc_version=gcc-4.8.5 ;; - Gcc47) - gcc_version=gcc-4.7.4 - ;; Gcc49) gcc_version=gcc-4.9.3 ;; diff --git a/etc/cshrc b/etc/cshrc index c2f17948b1..8886777f0e 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -61,7 +61,7 @@ echo $FOAM_INST_DIR setenv WM_COMPILER_TYPE system #- Compiler: -# WM_COMPILER = Gcc | Gcc45 | Gcc46 | Gcc47 | Gcc48 | Gcc49 | Clang | Icc +# WM_COMPILER = Gcc | Gcc48 ... Gcc62 | Clang | Icc setenv WM_COMPILER Gcc setenv WM_COMPILER_ARCH # defined but empty unsetenv WM_COMPILER_LIB_ARCH From 18d2b2e0c86d99eb641e8060ffa1f5148adf3f6d Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Sun, 30 Oct 2016 09:38:23 +0000 Subject: [PATCH 004/191] etc/cshrc: Removed echo $FOAM_INST_DIR --- etc/cshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/cshrc b/etc/cshrc index 8886777f0e..044e50d076 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -43,7 +43,6 @@ setenv WM_PROJECT_VERSION dev # setenv FOAM_INST_DIR `lsof +p $$ |& grep -oE '/.*'$WM_PROJECT'[^/]*/etc/cshrc' | \ sed 's%/'$WM_PROJECT'[^/]*/etc/cshrc%%'` -echo $FOAM_INST_DIR # setenv FOAM_INST_DIR $HOME/$WM_PROJECT # setenv FOAM_INST_DIR ~$WM_PROJECT # setenv FOAM_INST_DIR /opt/$WM_PROJECT From a6918385b7caa4967ef21e679f03e4f84e31cce4 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 31 Oct 2016 08:23:51 +0000 Subject: [PATCH 005/191] reactingEulerFoam: Correct continuity error at the end of the energy correction loop to handle the change in density generated by the temperature correction. --- .../reactingMultiphaseEulerFoam/EEqns.H | 1 + .../reactingMultiphaseEulerFoam/pU/pEqn.H | 3 --- .../reactingMultiphaseEulerFoam.C | 10 +++++----- .../reactingTwoPhaseEulerFoam/EEqns.H | 1 + .../reactingTwoPhaseEulerFoam/pU/pEqn.H | 3 --- .../reactingTwoPhaseEulerFoam/pUf/pEqn.H | 3 --- .../reactingTwoPhaseEulerFoam.C | 10 +++++----- 7 files changed, 12 insertions(+), 19 deletions(-) diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/EEqns.H b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/EEqns.H index 0130a872c9..e4689efee6 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/EEqns.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/EEqns.H @@ -35,6 +35,7 @@ for (int Ecorr=0; Ecorr phiFs(phases.size()); // --- Pressure corrector loop while (pimple.correct()) { - // Update continuity errors due to temperature changes - fluid.correct(); - volScalarField rho("rho", fluid.rho()); // Correct p_rgh for consistency with p and the updated densities diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/reactingMultiphaseEulerFoam.C b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/reactingMultiphaseEulerFoam.C index 11af0415fb..870645c5c1 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/reactingMultiphaseEulerFoam.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/reactingMultiphaseEulerFoam.C @@ -74,11 +74,6 @@ int main(int argc, char *argv[]) //#include "pUf/createDDtU.H" - int nEnergyCorrectors - ( - pimple.dict().lookupOrDefault("nEnergyCorrectors", 1) - ); - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -87,6 +82,11 @@ int main(int argc, char *argv[]) { #include "readTimeControls.H" + int nEnergyCorrectors + ( + pimple.dict().lookupOrDefault("nEnergyCorrectors", 1) + ); + if (LTS) { #include "setRDeltaT.H" diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/EEqns.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/EEqns.H index 0cdbfba8b9..9d91ada887 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/EEqns.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/EEqns.H @@ -49,6 +49,7 @@ for (int Ecorr=0; Ecorr phiF2; // --- Pressure corrector loop while (pimple.correct()) { - // Update continuity errors due to temperature changes - fluid.correct(); - volScalarField rho("rho", fluid.rho()); // Correct p_rgh for consistency with p and the updated densities diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H index b27c9f4646..67374f26ee 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H @@ -93,9 +93,6 @@ tmp Ff2; while (pimple.correct()) { - // Update continuity errors due to temperature changes - fluid.correct(); - volScalarField rho("rho", fluid.rho()); // Correct p_rgh for consistency with p and the updated densities diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/reactingTwoPhaseEulerFoam.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/reactingTwoPhaseEulerFoam.C index e6fe5259de..a2ca33d51f 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/reactingTwoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/reactingTwoPhaseEulerFoam.C @@ -75,11 +75,6 @@ int main(int argc, char *argv[]) #include "pUf/createDDtU.H" - int nEnergyCorrectors - ( - pimple.dict().lookupOrDefault("nEnergyCorrectors", 1) - ); - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -88,6 +83,11 @@ int main(int argc, char *argv[]) { #include "readTimeControls.H" + int nEnergyCorrectors + ( + pimple.dict().lookupOrDefault("nEnergyCorrectors", 1) + ); + if (LTS) { #include "setRDeltaT.H" From e0574c471fc4198f8519a5e669f2c70a8354941a Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 31 Oct 2016 13:15:48 +0000 Subject: [PATCH 006/191] chemFoam: Construct fields on the mesh database for consistency --- applications/solvers/combustion/chemFoam/createFields.H | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/solvers/combustion/chemFoam/createFields.H b/applications/solvers/combustion/chemFoam/createFields.H index 62be3ce0dd..8b35089fc8 100644 --- a/applications/solvers/combustion/chemFoam/createFields.H +++ b/applications/solvers/combustion/chemFoam/createFields.H @@ -12,7 +12,7 @@ ( "initialConditions", runTime.constant(), - runTime, + mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) @@ -37,7 +37,7 @@ ( "rho", runTime.timeName(), - runTime, + mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), @@ -50,7 +50,7 @@ ( "Rspecific", runTime.timeName(), - runTime, + mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), @@ -69,7 +69,7 @@ ( "U", runTime.timeName(), - runTime, + mesh, IOobject::NO_READ, IOobject::NO_WRITE ), From 46b8bfb25faf5252d011d4a64299117d588ad818 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 31 Oct 2016 15:45:59 +0000 Subject: [PATCH 007/191] codedFunctionObject.H: Corrected docs Resolved bug-report http://bugs.openfoam.org/view.php?id=2313 --- .../utilities/codedFunctionObject/codedFunctionObject.H | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H b/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H index 21c5a6ad94..e57e241802 100644 --- a/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H +++ b/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H @@ -55,12 +55,11 @@ Description // Lookup U const volVectorField& U = mesh().lookupObject("U"); // Write - mag(U).write(); - } + mag(U)().write(); + #};" } \endverbatim - See also Foam::functionObject Foam::codedBase From d8e9decdcc7e4c9e63c14b5c41a8d41fc91e45f5 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 31 Oct 2016 15:49:19 +0000 Subject: [PATCH 008/191] etc/config.csh/paraview: avoid ParaView_DIR: Undefined variable. Patch contributed by Bruno Santos Resolves bug-report http://bugs.openfoam.org/view.php?id=2309 --- etc/config.csh/paraview | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/config.csh/paraview b/etc/config.csh/paraview index 16fa58d48a..e2d0205f8c 100644 --- a/etc/config.csh/paraview +++ b/etc/config.csh/paraview @@ -34,6 +34,8 @@ # #------------------------------------------------------------------------------ +if ( ! $?ParaView_DIR ) setenv ParaView_DIR + # Clean the PATH set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"` if ( $status == 0 ) setenv PATH $cleaned From 9a155dd0d58d13428184adac35a04fa1f6105680 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 31 Oct 2016 18:00:15 +0000 Subject: [PATCH 009/191] blockMesh: Added edge projection New functionality contributed by Mattijs Janssens: - new edge projection: projectCurve for use with new geometry 'searchableCurve' - new tutorial 'pipe' - naming of vertices and blocks (see pipe tutorial). Including back substitution for error messages. --- .../meshes/meshShapes/cellShape/cellShape.H | 10 +- .../meshes/meshShapes/cellShape/cellShapeI.H | 18 + src/mesh/blockMesh/Make/files | 9 +- src/mesh/blockMesh/Make/options | 2 + .../blockDescriptor/blockDescriptor.C | 99 +++- .../blockDescriptor/blockDescriptor.H | 26 ++ .../blockDescriptor/blockDescriptorI.H | 6 + .../blockDescriptorTemplates.C | 114 +++++ .../blockEdges/BSplineEdge/BSplineEdge.C | 4 +- .../blockEdges/BSplineEdge/BSplineEdge.H | 2 + .../blockMesh/blockEdges/arcEdge/arcEdge.C | 4 +- .../blockMesh/blockEdges/arcEdge/arcEdge.H | 2 + .../blockEdges/blockEdge/blockEdge.C | 30 +- .../blockEdges/blockEdge/blockEdge.H | 26 +- .../blockMesh/blockEdges/lineEdge/lineEdge.C | 4 +- .../blockMesh/blockEdges/lineEdge/lineEdge.H | 2 + .../blockEdges/polyLineEdge/polyLineEdge.C | 4 +- .../blockEdges/polyLineEdge/polyLineEdge.H | 2 + .../projectCurveEdge/projectCurveEdge.C | 255 +++++++++++ .../projectCurveEdge/projectCurveEdge.H | 128 ++++++ .../blockEdges/projectEdge/projectEdge.C | 131 ++++-- .../blockEdges/projectEdge/projectEdge.H | 2 + .../blockEdges/splineEdge/splineEdge.C | 4 +- .../blockEdges/splineEdge/splineEdge.H | 2 + .../blockFaces/blockFace/blockFace.C | 50 +- .../blockFaces/blockFace/blockFace.H | 26 +- .../blockFaces/projectFace/projectFace.C | 278 ++++++++++- .../blockFaces/projectFace/projectFace.H | 18 + src/mesh/blockMesh/blockMesh/blockMesh.C | 2 +- src/mesh/blockMesh/blockMesh/blockMesh.H | 2 +- src/mesh/blockMesh/blockMesh/blockMeshCheck.C | 26 +- .../blockMesh/blockMesh/blockMeshTopology.C | 31 +- .../blockVertices/blockVertex/blockVertex.C | 8 +- .../blockVertices/blockVertex/blockVertex.H | 16 +- .../blockVertices/namedVertex/namedVertex.C | 81 ++++ .../blockVertices/namedVertex/namedVertex.H | 104 +++++ .../blockVertices/pointVertex/pointVertex.C | 2 + .../blockVertices/pointVertex/pointVertex.H | 2 + .../projectVertex/projectVertex.C | 9 +- .../projectVertex/projectVertex.H | 2 + src/mesh/blockMesh/{ => blocks}/block/block.C | 55 ++- src/mesh/blockMesh/{ => blocks}/block/block.H | 50 +- .../{ => blocks}/block/blockCreate.C | 0 .../blockMesh/{ => blocks}/block/blockI.H | 0 .../blockMesh/{ => blocks}/block/blockList.H | 3 +- .../blockMesh/blocks/namedBlock/namedBlock.C | 75 +++ .../blockMesh/blocks/namedBlock/namedBlock.H | 91 ++++ .../searchableCurve/searchableCurve.C | 432 ++++++++++++++++++ .../searchableCurve/searchableCurve.H | 245 ++++++++++ tutorials/mesh/blockMesh/pipe/Allrun | 9 + .../pipe/constant/triSurface/curve.obj | 9 + .../pipe/constant/triSurface/curve2.vtk | 13 + .../mesh/blockMesh/pipe/system/blockMeshDict | 177 +++++++ .../mesh/blockMesh/pipe/system/controlDict | 58 +++ .../mesh/blockMesh/pipe/system/fvSchemes | 37 ++ .../mesh/blockMesh/pipe/system/fvSolution | 18 + 56 files changed, 2701 insertions(+), 114 deletions(-) create mode 100644 src/mesh/blockMesh/blockDescriptor/blockDescriptorTemplates.C create mode 100644 src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.C create mode 100644 src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.H create mode 100644 src/mesh/blockMesh/blockVertices/namedVertex/namedVertex.C create mode 100644 src/mesh/blockMesh/blockVertices/namedVertex/namedVertex.H rename src/mesh/blockMesh/{ => blocks}/block/block.C (61%) rename src/mesh/blockMesh/{ => blocks}/block/block.H (78%) rename src/mesh/blockMesh/{ => blocks}/block/blockCreate.C (100%) rename src/mesh/blockMesh/{ => blocks}/block/blockI.H (100%) rename src/mesh/blockMesh/{ => blocks}/block/blockList.H (95%) create mode 100644 src/mesh/blockMesh/blocks/namedBlock/namedBlock.C create mode 100644 src/mesh/blockMesh/blocks/namedBlock/namedBlock.H create mode 100644 src/mesh/blockMesh/searchableCurve/searchableCurve.C create mode 100644 src/mesh/blockMesh/searchableCurve/searchableCurve.H create mode 100755 tutorials/mesh/blockMesh/pipe/Allrun create mode 100644 tutorials/mesh/blockMesh/pipe/constant/triSurface/curve.obj create mode 100644 tutorials/mesh/blockMesh/pipe/constant/triSurface/curve2.vtk create mode 100644 tutorials/mesh/blockMesh/pipe/system/blockMeshDict create mode 100644 tutorials/mesh/blockMesh/pipe/system/controlDict create mode 100644 tutorials/mesh/blockMesh/pipe/system/fvSchemes create mode 100644 tutorials/mesh/blockMesh/pipe/system/fvSolution diff --git a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShape.H b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShape.H index 371d95a063..653da9c46d 100644 --- a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShape.H +++ b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShape.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -92,6 +92,14 @@ public: const bool doCollapse = false ); + //- Construct from components + inline cellShape + ( + const word& model, + const labelList&, + const bool doCollapse = false + ); + //- Construct from Istream inline cellShape(Istream& is); diff --git a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeI.H b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeI.H index 5120cd4dfa..42055e04c9 100644 --- a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeI.H +++ b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeI.H @@ -25,6 +25,7 @@ License #include "Istream.H" #include "cell.H" +#include "cellModeller.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -51,6 +52,23 @@ inline Foam::cellShape::cellShape } +inline Foam::cellShape::cellShape +( + const word& model, + const labelList& l, + const bool doCollapse +) +: + labelList(l), + m(cellModeller::lookup(model)) +{ + if (doCollapse) + { + collapse(); + } +} + + inline Foam::cellShape::cellShape(Istream& is) { is >> *this; diff --git a/src/mesh/blockMesh/Make/files b/src/mesh/blockMesh/Make/files index 4d1da72068..f552dec8f9 100644 --- a/src/mesh/blockMesh/Make/files +++ b/src/mesh/blockMesh/Make/files @@ -1,6 +1,7 @@ blockVertices/blockVertex/blockVertex.C blockVertices/pointVertex/pointVertex.C blockVertices/projectVertex/projectVertex.C +blockVertices/namedVertex/namedVertex.C blockEdges/blockEdge/blockEdge.C blockEdges/lineDivide/lineDivide.C @@ -13,6 +14,7 @@ blockEdges/BSplineEdge/BSplineEdge.C blockEdges/splineEdge/CatmullRomSpline.C blockEdges/splineEdge/splineEdge.C blockEdges/projectEdge/projectEdge.C +blockEdges/projectCurveEdge/projectCurveEdge.C blockFaces/blockFace/blockFace.C blockFaces/projectFace/projectFace.C @@ -23,8 +25,9 @@ gradingDescriptor/gradingDescriptors.C blockDescriptor/blockDescriptor.C blockDescriptor/blockDescriptorEdges.C -block/block.C -block/blockCreate.C +blocks/block/block.C +blocks/block/blockCreate.C +blocks/namedBlock/namedBlock.C blockMesh/blockMesh.C blockMesh/blockMeshCreate.C @@ -33,4 +36,6 @@ blockMesh/blockMeshCheck.C blockMesh/blockMeshMerge.C blockMesh/blockMeshMergeFast.C +searchableCurve/searchableCurve.C + LIB = $(FOAM_LIBBIN)/libblockMesh diff --git a/src/mesh/blockMesh/Make/options b/src/mesh/blockMesh/Make/options index bf6ca71abf..5467dc3ce3 100644 --- a/src/mesh/blockMesh/Make/options +++ b/src/mesh/blockMesh/Make/options @@ -1,9 +1,11 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/fileFormats/lnInclude \ + -I$(LIB_SRC)/edgeMesh/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude LIB_LIBS = \ -lmeshTools \ -lfileFormats \ + -ledgeMesh \ -lsurfMesh diff --git a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C index fb9a413013..ddcb9466e0 100644 --- a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C +++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C @@ -128,6 +128,90 @@ void Foam::blockDescriptor::findCurvedFaces() } +void Foam::blockDescriptor::read +( + Istream& is, + label& val, + const dictionary& dict +) +{ + token t(is); + if (t.isLabel()) + { + val = t.labelToken(); + } + else if (t.isWord()) + { + const word& varName = t.wordToken(); + const entry* ePtr = dict.lookupScopedEntryPtr + ( + varName, + true, + true + ); + if (ePtr) + { + // Read as label + val = Foam::readLabel(ePtr->stream()); + } + else + { + FatalIOErrorInFunction(is) + << "Undefined variable " + << varName << ". Valid variables are " << dict + << exit(FatalIOError); + } + } + else + { + FatalIOErrorInFunction(is) + << "Illegal token " << t.info() + << " when trying to read label" + << exit(FatalIOError); + } + + is.fatalCheck + ( + "operator>>(Istream&, List&) : reading entry" + ); +} + + +Foam::label Foam::blockDescriptor::read +( + Istream& is, + const dictionary& dict +) +{ + label val; + read(is, val, dict); + return val; +} + + +void Foam::blockDescriptor::write +( + Ostream& os, + const label val, + const dictionary& dict +) +{ + forAllConstIter(dictionary, dict, iter) + { + if (iter().isStream()) + { + label keyVal(Foam::readLabel(iter().stream())); + if (keyVal == val) + { + os << iter().keyword(); + return; + } + } + } + os << val; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::blockDescriptor::blockDescriptor @@ -164,6 +248,8 @@ Foam::blockDescriptor::blockDescriptor Foam::blockDescriptor::blockDescriptor ( + const dictionary& dict, + const label index, const pointField& vertices, const blockEdgeList& edges, const blockFaceList& faces, @@ -173,13 +259,24 @@ Foam::blockDescriptor::blockDescriptor vertices_(vertices), edges_(edges), faces_(faces), - blockShape_(is), density_(), expand_(12, gradingDescriptors()), zoneName_(), curvedFaces_(-1), nCurvedFaces_(0) { + // Read cell model and list of vertices (potentially with variables) + word model(is); + blockShape_ = cellShape + ( + model, + read