diff --git a/applications/solvers/DNS/dnsFoam/Make/options b/applications/solvers/DNS/dnsFoam/Make/options index 34c3503a51737b0cbe058747a1b9a55fc0ed0282..e0e7a30d72df5ee6b9f4fdc6b4c44aa8724edb50 100644 --- a/applications/solvers/DNS/dnsFoam/Make/options +++ b/applications/solvers/DNS/dnsFoam/Make/options @@ -1,10 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/randomProcesses/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/randomProcesses/lnInclude EXE_LIBS = \ -lfiniteVolume \ - -lrandomProcesses \ - -lsampling \ - -lmeshTools + -lrandomProcesses diff --git a/applications/solvers/combustion/PDRFoam/Make/options b/applications/solvers/combustion/PDRFoam/Make/options index 135659c2766cb7ec98124f7969e95a8fad1d6f48..b6c6398fdea5b27262b932e70ebb32a5cf5dc078 100644 --- a/applications/solvers/combustion/PDRFoam/Make/options +++ b/applications/solvers/combustion/PDRFoam/Make/options @@ -5,7 +5,6 @@ EXE_INC = \ -IPDRModels/dragModels/PDRDragModel \ -IlaminarFlameSpeed/SCOPE \ -I$(LIB_SRC)/engine/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C index 44c4f6052fbc03448ee8a5f34e9f7b9875578cc0..fb61460facf54a6f03625b2fb9e0046b3aed6e6d 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C @@ -116,7 +116,7 @@ void PDRkEpsilon::correct() } tmp<volTensorField> tgradU = fvc::grad(U_); - volScalarField G("RASModel.G", mut_*(tgradU() && dev(twoSymm(tgradU())))); + volScalarField G(type() + ".G", mut_*(tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); // Update espsilon and G at the wall diff --git a/applications/solvers/combustion/XiFoam/Make/options b/applications/solvers/combustion/XiFoam/Make/options index 0812df5e3bf3bb3979d1bde18c97acb35b91583d..3a07a7de587f6b8951465bc598356c4e5a5cb0d3 100644 --- a/applications/solvers/combustion/XiFoam/Make/options +++ b/applications/solvers/combustion/XiFoam/Make/options @@ -5,7 +5,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ @@ -17,5 +17,5 @@ EXE_LIBS = \ -lreactionThermophysicalModels \ -lspecie \ -llaminarFlameSpeedModels \ - -lfiniteVolume \ - -lmeshTools + -lmeshTools \ + -lfiniteVolume diff --git a/applications/solvers/combustion/coldEngineFoam/Make/options b/applications/solvers/combustion/coldEngineFoam/Make/options index 25217ab23f79c72d9f81c2aba8eb51c0ae138c30..2eaea744b0c5e93ec6a199f72e5463679da2333d 100644 --- a/applications/solvers/combustion/coldEngineFoam/Make/options +++ b/applications/solvers/combustion/coldEngineFoam/Make/options @@ -20,6 +20,5 @@ EXE_LIBS = \ -lfluidThermophysicalModels \ -lspecie \ -lfiniteVolume \ - -lsampling \ -lmeshTools \ -lfieldSources diff --git a/applications/solvers/combustion/fireFoam/fireFoam.C b/applications/solvers/combustion/fireFoam/fireFoam.C index 9f97843a96b8b86dbf60b9886bc1817c3931e2ab..021ed3c6f0ba93a357e753e8162029f1020e3c6a 100644 --- a/applications/solvers/combustion/fireFoam/fireFoam.C +++ b/applications/solvers/combustion/fireFoam/fireFoam.C @@ -30,7 +30,6 @@ Description \*---------------------------------------------------------------------------*/ -#include "mapDistribute.H" #include "fvCFD.H" #include "turbulenceModel.H" #include "basicReactingCloud.H" diff --git a/applications/solvers/incompressible/icoFoam/Make/options b/applications/solvers/incompressible/icoFoam/Make/options index fa15f124528ebfcaf279a88a73a0d7954f2e9dc1..d38cd8b1801b429e5f42c7b0ba2ab58ba2cd1d11 100644 --- a/applications/solvers/incompressible/icoFoam/Make/options +++ b/applications/solvers/incompressible/icoFoam/Make/options @@ -1,5 +1,7 @@ EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ - -lfiniteVolume + -lfiniteVolume \ + -lsampling diff --git a/applications/solvers/incompressible/pimpleFoam/UEqn.H b/applications/solvers/incompressible/pimpleFoam/UEqn.H index a6aef51dafb35a9fee2033b0a07a38f8404f2296..c274f6a2e8e59182c83e37bf308f30acb6946fd2 100644 --- a/applications/solvers/incompressible/pimpleFoam/UEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/UEqn.H @@ -7,6 +7,10 @@ tmp<fvVectorMatrix> UEqn + turbulence->divDevReff(U) ); +mrfZones.addCoriolis(UEqn()); + +pZones.addResistance(UEqn()); + UEqn().relax(); sources.constrain(UEqn()); diff --git a/applications/solvers/incompressible/pimpleFoam/createZones.H b/applications/solvers/incompressible/pimpleFoam/createZones.H new file mode 100644 index 0000000000000000000000000000000000000000..fcd02024d58b1b5be8e36f935e2ca70b4ba8bbaf --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/createZones.H @@ -0,0 +1,4 @@ + IOMRFZoneList mrfZones(mesh); + mrfZones.correctBoundaryVelocity(U); + + IOporosityModelList pZones(mesh); diff --git a/applications/solvers/incompressible/pimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pEqn.H index 444ad4450359fccd04531fdede2261c68f33c68f..1eb8590552ba896d94634784fd98e9f857db731c 100644 --- a/applications/solvers/incompressible/pimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pEqn.H @@ -15,6 +15,8 @@ surfaceScalarField phiHbyA adjustPhi(phiHbyA, U, p); +mrfZones.relativeFlux(phiHbyA); + // Non-orthogonal pressure corrector loop while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C index 8d581934fb2fb15fcacc52964ddf0493f80abef4..d55af57e34dc3a812ce8e157d76b0927fc67f634 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,7 +28,10 @@ Description Large time-step transient solver for incompressible, flow using the PIMPLE (merged PISO-SIMPLE) algorithm. - Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected. + Sub-models include: + - turbulence modelling, i.e. laminar, RAS or LES + - porosity (explicit treatment) + - Multiple Reference Frame (MRF) \*---------------------------------------------------------------------------*/ @@ -37,6 +40,8 @@ Description #include "turbulenceModel.H" #include "pimpleControl.H" #include "IObasicSourceList.H" +#include "IOporosityModelList.H" +#include "IOMRFZoneList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,6 +51,7 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" #include "createFields.H" + #include "createZones.H" #include "initContinuityErrs.H" pimpleControl pimple(mesh); diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/UEqn.H b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/UEqn.H index 8c39a839f71f232d21ade27671e2b2fd3e3fa08a..d595a64c8f1eaac60f5e7c1526a9c8ff49c77479 100644 --- a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/UEqn.H +++ b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/UEqn.H @@ -10,8 +10,8 @@ mrfZones.addCoriolis(UEqn()); - sources.constrain(UEqn()); - UEqn().relax(); + sources.constrain(UEqn()); + solve(UEqn() == -fvc::grad(p)); diff --git a/applications/test/reconstruct/Make/files b/applications/test/reconstruct/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..5dd557e6f885d11423f248b6c9b6928c7aafcba4 --- /dev/null +++ b/applications/test/reconstruct/Make/files @@ -0,0 +1,3 @@ +Test-reconstruct.C + +EXE = $(FOAM_USER_APPBIN)/Test-reconstruct diff --git a/applications/test/reconstruct/Make/options b/applications/test/reconstruct/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..1a8bb549927bbf347ede932e6b39cd75067a322b --- /dev/null +++ b/applications/test/reconstruct/Make/options @@ -0,0 +1,4 @@ +EXE_INC = -g \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +EXE_LIBS = -lfiniteVolume diff --git a/applications/test/reconstruct/Test-reconstruct.C b/applications/test/reconstruct/Test-reconstruct.C new file mode 100644 index 0000000000000000000000000000000000000000..59e9a03bb6ee60d96591dd20c4fa03f1b3c6e8df --- /dev/null +++ b/applications/test/reconstruct/Test-reconstruct.C @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Application + Test-reconstruct + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + + #include "createTime.H" + #include "createMesh.H" + + surfaceScalarField phi(vector(1, 0, 0) & mesh.Sf()); + + volVectorField Uphi + ( + IOobject + ( + "Uphi", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + fvc::reconstruct(phi) + ); + + Uphi.write(); + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/Make/options b/applications/utilities/mesh/generation/cvMesh/Make/options index 2228fc2b121966cd0063aa3a5afeadd2f4a31202..27241b29656f8f37f263f53f2697d4b8251cabda 100644 --- a/applications/utilities/mesh/generation/cvMesh/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/Make/options @@ -17,7 +17,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude @@ -30,6 +30,6 @@ EXE_LIBS = \ -ldecompositionMethods \ -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \ -ledgeMesh \ - -lsampling \ + -lfileFormats \ -ltriSurface \ -ldynamicMesh diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options index 62649cf23282eb467b02bbc51b116c928b76e4c8..2082f88ff045c1cff3ff1238ebcba1a4a0af978d 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options @@ -17,7 +17,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I../vectorTools @@ -25,5 +25,6 @@ EXE_INC = \ EXE_LIBS = \ -lmeshTools \ -ledgeMesh \ + -lfileFormats \ -ltriSurface \ -ldynamicMesh diff --git a/applications/utilities/mesh/generation/cvMesh/cvMeshBackgroundMesh/Make/options b/applications/utilities/mesh/generation/cvMesh/cvMeshBackgroundMesh/Make/options index 2d1ad7bfdae88ad8cc5e9c295859aacad27d7198..ed71a800294b791b6968359c38a257306d79da23 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMeshBackgroundMesh/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/cvMeshBackgroundMesh/Make/options @@ -11,10 +11,11 @@ EXE_INC = \ -I../conformalVoronoiMesh/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude EXE_LIBS = \ @@ -24,8 +25,9 @@ EXE_LIBS = \ -lconformalVoronoiMesh \ -ldecompositionMethods /* -L$(FOAM_LIBBIN)/dummy -lscotchDecomp */ \ -ledgeMesh \ - -lsampling \ -ltriSurface \ -lmeshTools \ + -lfileFormats \ + -lsampling \ -ldynamicMesh \ -lfiniteVolume diff --git a/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options b/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options index 35c90b1f48a814892bce172cb3a1a4d31152b163..7bd92a24abf566234ee02a26c3615c10151286a1 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options @@ -9,7 +9,7 @@ EXE_INC = \ -I$(FASTDUALOCTREE_SRC_PATH) \ -I../conformalVoronoiMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude @@ -22,7 +22,7 @@ EXE_LIBS = \ -lconformalVoronoiMesh \ -ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lscotchDecomp \ -ledgeMesh \ - -lsampling \ + -lfileFormats \ -ltriSurface \ -lmeshTools \ -ldynamicMesh diff --git a/applications/utilities/mesh/generation/snappyHexMesh/Make/options b/applications/utilities/mesh/generation/snappyHexMesh/Make/options index 94ff17ee9979e9c63d98f3513d7d24a564277430..af056ec7cb640728dde3af9003c460d860c4bbb7 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/Make/options +++ b/applications/utilities/mesh/generation/snappyHexMesh/Make/options @@ -3,7 +3,7 @@ EXE_INC = \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/mesh/autoMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ @@ -14,6 +14,6 @@ EXE_LIBS = \ -ldecompositionMethods \ -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \ -lmeshTools \ - -lsampling \ + -lfileFormats \ -ldynamicMesh \ -lautoMesh diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 050204d8a8718a798f844e14f98b2344ade54800..78cdb47ad0534c6cde38c6ff4df65ef435724552 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -337,7 +337,7 @@ addLayersControls // Advanced settings // When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // are perpendicular featureAngle 60; // At non-patched sides allow mesh to slip if extrusion direction makes diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index e64f6cb78ffd432c3c521de2b0c997003b05856a..7eede94626c2d1359869252e3be2e3d8e939f945 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -471,6 +471,47 @@ autoPtr<mapPolyMesh> reorderMesh true ); + + // Re-do the faceZones + { + faceZoneMesh& faceZones = mesh.faceZones(); + faceZones.clearAddressing(); + forAll(faceZones, zoneI) + { + faceZone& fZone = faceZones[zoneI]; + labelList newAddressing(fZone.size()); + boolList newFlipMap(fZone.size()); + forAll(fZone, i) + { + label oldFaceI = fZone[i]; + newAddressing[i] = reverseFaceOrder[oldFaceI]; + if (flipFaceFlux.found(newAddressing[i])) + { + newFlipMap[i] = !fZone.flipMap()[i]; + } + else + { + newFlipMap[i] = fZone.flipMap()[i]; + } + } + fZone.resetAddressing(newAddressing, newFlipMap); + } + } + // Re-do the cellZones + { + cellZoneMesh& cellZones = mesh.cellZones(); + cellZones.clearAddressing(); + forAll(cellZones, zoneI) + { + cellZones[zoneI] = UIndirectList<label> + ( + reverseCellOrder, + cellZones[zoneI] + )(); + } + } + + return autoPtr<mapPolyMesh> ( new mapPolyMesh diff --git a/applications/utilities/mesh/manipulation/subsetMesh/Make/files b/applications/utilities/mesh/manipulation/subsetMesh/Make/files index 79552b3264a5605584d7474474d4c855fa0d56cb..d8856b5f26cafa0b216fe3836c8350f4ab526720 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/Make/files +++ b/applications/utilities/mesh/manipulation/subsetMesh/Make/files @@ -1,3 +1,6 @@ +cellSelection/cellSelection.C +cellSelection/badQualityCellSelection.C +cellSelection/outsideCellSelection.C subsetMesh.C EXE = $(FOAM_APPBIN)/subsetMesh diff --git a/applications/utilities/mesh/manipulation/subsetMesh/Make/options b/applications/utilities/mesh/manipulation/subsetMesh/Make/options index 969020c4afaf5d784299462b9e1af282040ba6b4..52519d4f3b39906bbae2403ceff8169a07c822fa 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/Make/options +++ b/applications/utilities/mesh/manipulation/subsetMesh/Make/options @@ -1,8 +1,11 @@ EXE_INC = \ + -IcellSelection \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ -lfiniteVolume \ + -ldynamicMesh \ -lmeshTools \ -lgenericPatchFields diff --git a/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/badQualityCellSelection.C b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/badQualityCellSelection.C new file mode 100644 index 0000000000000000000000000000000000000000..fdd73a303463a97907e4fe66cb978e59384a395d --- /dev/null +++ b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/badQualityCellSelection.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "badQualityCellSelection.H" +#include "addToRunTimeSelectionTable.H" +#include "faceSet.H" +#include "polyMesh.H" +#include "motionSmoother.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace cellSelections +{ + defineTypeNameAndDebug(badQualityCellSelection, 0); + addToRunTimeSelectionTable + ( + cellSelection, + badQualityCellSelection, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellSelections::badQualityCellSelection::badQualityCellSelection +( + const word& name, + const polyMesh& mesh, + const dictionary& dict +) +: + cellSelection(name, mesh, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellSelections::badQualityCellSelection::~badQualityCellSelection() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::cellSelections::badQualityCellSelection::select +( + boolList& selectedCell +) const +{ + //- Delete cell of any face in error + faceSet faces(mesh_, "meshQualityFaces", mesh_.nFaces()/100+1); + motionSmoother::checkMesh(false, mesh_, dict_, faces); + label nFaces = returnReduce(faces.size(), sumOp<label>()); + if (nFaces > 0) + { + faces.sync(mesh_); + forAllConstIter(faceSet, faces, iter) + { + label faceI = iter.key(); + selectedCell[mesh_.faceOwner()[faceI]] = false; + if (mesh_.isInternalFace(faceI)) + { + selectedCell[mesh_.faceNeighbour()[faceI]] = false; + } + } + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/badQualityCellSelection.H b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/badQualityCellSelection.H new file mode 100644 index 0000000000000000000000000000000000000000..67b17e83be71e9ff2e7cdd0a5b0b3135b702ac1c --- /dev/null +++ b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/badQualityCellSelection.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::cellSelections::badQualityCellSelection + +Description + Deselect bad quality cells + +SourceFiles + badQualityCellSelection.C + +\*---------------------------------------------------------------------------*/ + +#ifndef badQualityCellSelection_H +#define badQualityCellSelection_H + +#include "cellSelection.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace cellSelections +{ + +/*---------------------------------------------------------------------------*\ + Class badQualityCellSelection Declaration +\*---------------------------------------------------------------------------*/ + +class badQualityCellSelection +: + public cellSelection +{ + +public: + + //- Runtime type information + TypeName("badQuality"); + + + // Constructors + + //- Construct from dictionary + badQualityCellSelection + ( + const word& name, + const polyMesh& mesh, + const dictionary& dict + ); + + //- Clone + autoPtr<cellSelection> clone() const + { + notImplemented("autoPtr<cellSelection> clone() const"); + return autoPtr<cellSelection>(NULL); + } + + + //- Destructor + virtual ~badQualityCellSelection(); + + + // Member Functions + + virtual void select(boolList&) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace cellSelections +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/cellSelection.C b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/cellSelection.C new file mode 100644 index 0000000000000000000000000000000000000000..b1d6c9b5f148f6c45ebe0ebb0a3e56a26aee9289 --- /dev/null +++ b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/cellSelection.C @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "cellSelection.H" +#include "polyMesh.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(cellSelection, 0); + defineRunTimeSelectionTable(cellSelection, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellSelection::cellSelection +( + const word& name, + const polyMesh& mesh, + const dictionary& dict +) +: + name_(name), + mesh_(mesh), + dict_(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellSelection::~cellSelection() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::cellSelection> Foam::cellSelection::New +( + const word& name, + const polyMesh& mesh, + const dictionary& dict +) +{ + const word sampleType(dict.lookup("type")); + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(sampleType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "cellSelection::New" + "(const word&, const polyMesh&, const dictionary&)" + ) << "Unknown cellSelection type " + << sampleType << nl << nl + << "Valid cellSelection types : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr<cellSelection>(cstrIter()(name, mesh, dict)); +} + + +Foam::label Foam::cellSelection::count(const boolList& lst) +{ + label n = 0; + forAll(lst, i) + { + if (lst[i]) + { + n++; + } + } + return returnReduce(n, sumOp<label>()); +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/cellSelection.H b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/cellSelection.H new file mode 100644 index 0000000000000000000000000000000000000000..656d052d828610fb20e4a5aa20b7b4026db4e631 --- /dev/null +++ b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/cellSelection.H @@ -0,0 +1,149 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::cellSelection + +Description + Cell selection methods in subsetMesh + +SourceFiles + cellSelection.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellSelection_H +#define cellSelection_H + +#include "dictionary.H" +#include "typeInfo.H" +#include "runTimeSelectionTables.H" +#include "autoPtr.H" +#include "boolList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class polyMesh; + +/*---------------------------------------------------------------------------*\ + Class cellSelection Declaration +\*---------------------------------------------------------------------------*/ + +class cellSelection +{ +protected: + + // Protected data + + //- Name + const word name_; + + //- Reference to mesh + const polyMesh& mesh_; + + //- Input dictionary + const dictionary dict_; + +public: + + //- Runtime type information + TypeName("cellSelection"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + cellSelection, + dictionary, + ( + const word& name, + const polyMesh& mesh, + const dictionary& dict + ), + (name, mesh, dict) + ); + + + // Constructors + + //- Construct from dictionary + cellSelection + ( + const word& name, + const polyMesh& mesh, + const dictionary& dict + ); + + //- Clone + autoPtr<cellSelection> clone() const + { + notImplemented("autoPtr<cellSelection> clone() const"); + return autoPtr<cellSelection>(NULL); + } + + + // Selectors + + //- Return a reference to the selected cellSelection + static autoPtr<cellSelection> New + ( + const word& name, + const polyMesh& mesh, + const dictionary& dict + ); + + + //- Destructor + virtual ~cellSelection(); + + + // Member Functions + + //- Count global number of selected elements + static label count(const boolList&); + + const word& name() const + { + return name_; + } + + virtual void select(boolList&) const = 0; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.C b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.C new file mode 100644 index 0000000000000000000000000000000000000000..556ae4e07e5d9553aa0d0e571c6cd70f9f793e8b --- /dev/null +++ b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.C @@ -0,0 +1,406 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "outsideCellSelection.H" +#include "addToRunTimeSelectionTable.H" +#include "faceSet.H" +#include "polyMesh.H" +#include "motionSmoother.H" +#include "regionSplit.H" +#include "syncTools.H" +#include "zeroGradientFvPatchFields.H" + + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace cellSelections +{ + defineTypeNameAndDebug(outsideCellSelection, 0); + addToRunTimeSelectionTable(cellSelection, outsideCellSelection, dictionary); +} +} + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::tmp<Foam::volScalarField> +Foam::cellSelections::outsideCellSelection::generateField +( + const word& name, + const boolList& lst +) const +{ + const fvMesh& mesh = dynamic_cast<const fvMesh&>(mesh_); + + tmp<volScalarField> tfld + ( + new volScalarField + ( + IOobject + ( + name, + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar(name, dimless, 0), + zeroGradientFvPatchScalarField::typeName + ) + ); + scalarField& fld = tfld().internalField(); + + forAll(fld, celli) + { + fld[celli] = 1.0*lst[celli]; + } + tfld().correctBoundaryConditions(); + + return tfld; +} + + +void Foam::cellSelections::outsideCellSelection::markRegionFaces +( + const boolList& selectedCell, + boolList& regionFace +) const +{ + // Internal faces + const labelList& faceOwner = mesh_.faceOwner(); + const labelList& faceNeighbour = mesh_.faceNeighbour(); + forAll(faceNeighbour, faceI) + { + if + ( + selectedCell[faceOwner[faceI]] + != selectedCell[faceNeighbour[faceI]] + ) + { + regionFace[faceI] = true; + } + } + + // Swap neighbour selectedCell state + boolList nbrSelected; + syncTools::swapBoundaryCellList(mesh_, selectedCell, nbrSelected); + + // Boundary faces + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + const labelUList& faceCells = pp.faceCells(); + forAll(faceCells, i) + { + label faceI = pp.start()+i; + label bFaceI = faceI-mesh_.nInternalFaces(); + if + ( + selectedCell[faceCells[i]] + != selectedCell[nbrSelected[bFaceI]] + ) + { + regionFace[faceI] = true; + } + } + } +} + + +Foam::boolList Foam::cellSelections::outsideCellSelection::findRegions +( + const bool verbose, + const regionSplit& cellRegion +) const +{ + boolList keepRegion(cellRegion.nRegions(), false); + + forAll(locationsInMesh_, i) + { + // Find the region containing the insidePoint + + label cellI = mesh_.findCell(locationsInMesh_[i]); + + label keepRegionI = -1; + label keepProcI = -1; + if (cellI != -1) + { + keepRegionI = cellRegion[cellI]; + keepProcI = Pstream::myProcNo(); + } + reduce(keepRegionI, maxOp<label>()); + keepRegion[keepRegionI] = true; + + if (verbose) + { + reduce(keepProcI, maxOp<label>()); + + Info<< "Found location " << locationsInMesh_[i] + << " in cell " << cellI << " on processor " << keepProcI + << " in global region " << keepRegionI + << " out of " << cellRegion.nRegions() << " regions." << endl; + } + } + + return keepRegion; +} + + +void Foam::cellSelections::outsideCellSelection::unselectOutsideRegions +( + boolList& selectedCell +) const +{ + // Determine faces on the edge of selectedCell + boolList blockedFace(mesh_.nFaces(), false); + markRegionFaces(selectedCell, blockedFace); + + // Determine regions + regionSplit cellRegion(mesh_, blockedFace); + + // Determine regions containing locationsInMesh_ + boolList keepRegion(findRegions(true, cellRegion)); + + // Go back to bool per cell + forAll(cellRegion, cellI) + { + if (!keepRegion[cellRegion[cellI]]) + { + selectedCell[cellI] = false; + } + } +} + + +void Foam::cellSelections::outsideCellSelection::shrinkRegions +( + boolList& selectedCell +) const +{ + // Select points on unselected cells and boundary + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + boolList boundaryPoint(mesh_.nPoints(), false); + + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + + if (!pp.coupled() && !isA<emptyPolyPatch>(pp)) + { + forAll(pp, i) + { + const face& f = pp[i]; + forAll(f, fp) + { + boundaryPoint[f[fp]] = true; + } + } + } + } + + forAll(selectedCell, cellI) + { + if (!selectedCell[cellI]) + { + const labelList& cPoints = mesh_.cellPoints(cellI); + forAll(cPoints, i) + { + boundaryPoint[cPoints[i]] = true; + } + } + } + + syncTools::syncPointList(mesh_, boundaryPoint, orEqOp<bool>(), false); + + + // Select all cells using these points + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + label nChanged = 0; + forAll(boundaryPoint, pointI) + { + if (boundaryPoint[pointI]) + { + const labelList& pCells = mesh_.pointCells(pointI); + forAll(pCells, i) + { + label cellI = pCells[i]; + if (selectedCell[cellI]) + { + selectedCell[cellI] = false; + nChanged++; + } + } + } + } +} + + +void Foam::cellSelections::outsideCellSelection::erode +( + boolList& selectedCell +) const +{ + //Info<< "Entering shrinkRegions:" << count(selectedCell) << endl; + //generateField("selectedCell_before", selectedCell)().write(); + + // Now erode and see which regions get disconnected + boolList shrunkSelectedCell(selectedCell); + + for (label iter = 0; iter < nErode_; iter++) + { + shrinkRegions(shrunkSelectedCell); + } + + //Info<< "After shrinking:" << count(shrunkSelectedCell) << endl; + //generateField("shrunkSelectedCell", shrunkSelectedCell)().write(); + + + + // Determine faces on the edge of shrunkSelectedCell + boolList blockedFace(mesh_.nFaces(), false); + markRegionFaces(shrunkSelectedCell, blockedFace); + + // Find disconnected regions + regionSplit cellRegion(mesh_, blockedFace); + + // Determine regions containing insidePoints + boolList keepRegion(findRegions(true, cellRegion)); + + + // Extract cells in regions that are not to be kept. + boolList removeCell(mesh_.nCells(), false); + forAll(cellRegion, cellI) + { + if (shrunkSelectedCell[cellI] && !keepRegion[cellRegion[cellI]]) + { + removeCell[cellI] = true; + } + } + + //Info<< "removeCell before:" << count(removeCell) << endl; + //generateField("removeCell_before", removeCell)().write(); + + + + // Grow removeCell + for (label iter = 0; iter < nErode_; iter++) + { + // Grow selected cell in regions that are not for keeping + boolList boundaryPoint(mesh_.nPoints(), false); + forAll(removeCell, cellI) + { + if (removeCell[cellI]) + { + const labelList& cPoints = mesh_.cellPoints(cellI); + forAll(cPoints, i) + { + boundaryPoint[cPoints[i]] = true; + } + } + } + syncTools::syncPointList(mesh_, boundaryPoint, orEqOp<bool>(), false); + + // Select all cells using these points + + label nChanged = 0; + forAll(boundaryPoint, pointI) + { + if (boundaryPoint[pointI]) + { + const labelList& pCells = mesh_.pointCells(pointI); + forAll(pCells, i) + { + label cellI = pCells[i]; + if (!removeCell[cellI]) + { + removeCell[cellI] = true; + nChanged++; + } + } + } + } + } + + //Info<< "removeCell after:" << count(removeCell) << endl; + //generateField("removeCell_after", removeCell)().write(); + + + // Unmark removeCell + forAll(removeCell, cellI) + { + if (removeCell[cellI]) + { + selectedCell[cellI] = false; + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellSelections::outsideCellSelection::outsideCellSelection +( + const word& name, + const polyMesh& mesh, + const dictionary& dict +) +: + cellSelection(name, mesh, dict), + locationsInMesh_(dict.lookup("locationsInMesh")), + nErode_(readLabel(dict.lookup("nErodeLayers"))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellSelections::outsideCellSelection::~outsideCellSelection() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::cellSelections::outsideCellSelection::select +( + boolList& selectedCell +) const +{ + // Unselect all disconnected regions + unselectOutsideRegions(selectedCell); + + if (nErode_ > 0) + { + erode(selectedCell); + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.H b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.H new file mode 100644 index 0000000000000000000000000000000000000000..9d7c600c232b7bf7e5ec1ef17759dc08287c40b9 --- /dev/null +++ b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.H @@ -0,0 +1,145 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::cellSelections::outsideCellSelection + +Description + Deselect cells not reachable from 'inside' points + +SourceFiles + outsideCellSelection.C + +\*---------------------------------------------------------------------------*/ + +#ifndef outsideCellSelection_H +#define outsideCellSelection_H + +#include "cellSelection.H" +#include "pointField.H" +#include "boolList.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class regionSplit; + +namespace cellSelections +{ + +/*---------------------------------------------------------------------------*\ + Class outsideCellSelection Declaration +\*---------------------------------------------------------------------------*/ + +class outsideCellSelection +: + public cellSelection +{ + // Private data + + //- Locations to keep + const pointField locationsInMesh_; + + //- Number of layers to erode + const label nErode_; + + + // Private Member Functions + + //- For debugging: generate volScalarField with 1.0 for all true + tmp<volScalarField> generateField + ( + const word& name, + const boolList& lst + ) const; + + //- Mark faces inbetween selected and unselected elements + void markRegionFaces + ( + const boolList& selectedCell, + boolList& regionFace + ) const; + + //- Determine for every disconnected region in the mesh whether + // it contains a locationInMesh + boolList findRegions(const bool verbose, const regionSplit&) const; + + //- Unselect regions not containing a locationInMesh + void unselectOutsideRegions(boolList& selectedCell) const; + + //- Unselect one layer of cells from selectedCell + void shrinkRegions(boolList& selectedCell) const; + + //- Erode a given number of layers from selectedCell. Remove any + // region that gets disconnected that way. + void erode(boolList& selectedCell) const; + +public: + + //- Runtime type information + TypeName("outside"); + + + // Constructors + + //- Construct from dictionary + outsideCellSelection + ( + const word& name, + const polyMesh& mesh, + const dictionary& dict + ); + + //- Clone + autoPtr<cellSelection> clone() const + { + notImplemented("autoPtr<cellSelection> clone() const"); + return autoPtr<cellSelection>(NULL); + } + + + //- Destructor + virtual ~outsideCellSelection(); + + + // Member Functions + + //- Apply this selector + virtual void select(boolList&) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace cellSelections +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C index f95b906f5f7ee0e6ce319b11575203d444887aaa..e1cc69aa7e22f6c8a4ad0999b3ced2b1d1689c8c 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C +++ b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,12 +37,12 @@ Description #include "cellSet.H" #include "IOobjectList.H" #include "volFields.H" +#include "cellSelection.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - template<class Type> void subsetVolFields ( @@ -152,12 +152,21 @@ int main(int argc, char *argv[]) { argList::addNote ( - "select a mesh subset based on a cellSet" + "select a mesh subset based on a provided cellSet and/or" + " selection criteria" + ); + argList::addBoolOption + ( + "dict", + "read mesh subset selection criteria" + " from system/subsetMeshDict" + ); + argList::addOption + ( + "cellSet", + "name", + "operates on specified cellSet name" ); - - #include "addOverwriteOption.H" - #include "addRegionOption.H" - argList::validArgs.append("cellSet"); argList::addOption ( "patch", @@ -165,23 +174,81 @@ int main(int argc, char *argv[]) "add exposed internal faces to specified patch instead of to " "'oldInternalFaces'" ); + + #include "addOverwriteOption.H" + #include "addRegionOption.H" #include "setRootCase.H" #include "createTime.H" runTime.functionObjects().off(); - Foam::word meshRegionName = polyMesh::defaultRegion; - args.optionReadIfPresent("region", meshRegionName); + word setName; + const bool useCellSet = args.optionReadIfPresent("cellSet", setName); + const bool useDict = args.optionFound("dict"); + const bool overwrite = args.optionFound("overwrite"); - #include "createNamedMesh.H" + if (!useCellSet && !useDict) + { + FatalErrorIn(args.executable()) + << "No cells to operate on selected. Please supply at least one of " + << "'-cellSet', '-dict'" + << exit(FatalError); + } + #include "createNamedMesh.H" + const word oldInstance = mesh.pointsInstance(); - const word setName = args[1]; - const bool overwrite = args.optionFound("overwrite"); + autoPtr<cellSet> currentSet; + if (useCellSet) + { + // Load the cellSet + Info<< "Operating on cell set " << setName << nl << endl; + currentSet.reset(new cellSet(mesh, setName)); + } + + PtrList<cellSelection> selectors; + if (useDict) + { + Info<< "Reading selection criteria from subsetMeshDict" << nl << endl; + IOdictionary dict + ( + IOobject + ( + "subsetMeshDict", + mesh.time().system(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + const dictionary& selectionsDict = dict.subDict("selections"); + + label n = 0; + forAllConstIter(dictionary, selectionsDict, iter) + { + if (iter().isDict()) + { + n++; + } + } + selectors.setSize(n); + n = 0; + forAllConstIter(dictionary, selectionsDict, iter) + { + if (iter().isDict()) + { + selectors.set + ( + n++, + cellSelection::New(iter().keyword(), mesh, iter().dict()) + ); + } + } + } - Info<< "Reading cell set from " << setName << endl << endl; // Create mesh subsetting engine fvMeshSubset subsetter(mesh); @@ -212,9 +279,54 @@ int main(int argc, char *argv[]) } - cellSet currentSet(mesh, setName); + // Select cells to operate on + // ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + boolList selectedCell(mesh.nCells(), false); + if (currentSet.valid()) + { + const cellSet& set = currentSet(); + forAllConstIter(cellSet, set, iter) + { + selectedCell[iter.key()] = true; + } + } + else + { + selectedCell = true; + } + + + // Manipulate selectedCell according to dictionary + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + forAll(selectors, i) + { + Info<< "Applying cellSelector " << selectors[i].name() << endl; + selectors[i].select(selectedCell); + + Info<< "After applying cellSelector " << selectors[i].name() + << " have " << cellSelection::count(selectedCell) + << " cells" << nl << endl; + } + + + // Back from selectedCells to region + { + Info<< "Final selection : " << cellSelection::count(selectedCell) + << " cells" << nl << endl; + + labelList cellRegion(mesh.nCells(), -1); + forAll(selectedCell, cellI) + { + if (selectedCell[cellI]) + { + cellRegion[cellI] = 0; + } + } + subsetter.setLargeCellSubset(cellRegion, 0, patchI, true); + } - subsetter.setLargeCellSubset(currentSet, patchI, true); IOobjectList objects(mesh, runTime.timeName()); diff --git a/applications/utilities/mesh/manipulation/subsetMesh/subsetMeshDict b/applications/utilities/mesh/manipulation/subsetMesh/subsetMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..0f725142a36ee97658d07a6001b1c08bd32a26b1 --- /dev/null +++ b/applications/utilities/mesh/manipulation/subsetMesh/subsetMeshDict @@ -0,0 +1,50 @@ +/*--------------------------------*- 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; + class dictionary; + location "system"; + object subsetMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Load snappyHexMeshDict settings so we can use some entries below. +#include "./snappyHexMeshDict" + + +selections +{ + badQuality + { + // Remove any cells using a 'bad quality' face. Uses the mesh checks + // used by snappyHexMesh, cvMesh. + type badQuality; + // Use the quality criteria from the snappyHexMeshDict + ${.meshQualityControls} + } + + outside + { + // Remove any cells not reachable from provided locations + type outside; + + //- Number of cell layers to erode mesh to detect holes in the mesh + // Set to 0 if not used. + nErodeLayers 3; + + //- Define mesh location for keeping. + // In this case use the one from snappyHexMeshDict. This can + // optionally be a list of locations. + locationsInMesh (${.castellatedMeshControls.locationInMesh}); + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/Make/options b/applications/utilities/postProcessing/dataConversion/foamToGMV/Make/options index 5c515d8f95b74b2155dc0d75f0fda4bc389a7130..87b432481021cc47b9d9dcbbbfc4be342bd1ac53 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/Make/options +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/Make/options @@ -1,15 +1,9 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/turbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ - -I$(LIB_SRC)/lagrangian/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ - -I$(LIB_SRC)/browser/lnInclude \ - -I$(LIB_SRC)/foam/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude EXE_LIBS = \ diff --git a/applications/utilities/postProcessing/lagrangian/particleTracks/Make/options b/applications/utilities/postProcessing/lagrangian/particleTracks/Make/options index 3bcea78b3b21c4981a3fc3b20014411934fbb380..b653926f93a610c3f724d7b7a4e3855f9492d145 100644 --- a/applications/utilities/postProcessing/lagrangian/particleTracks/Make/options +++ b/applications/utilities/postProcessing/lagrangian/particleTracks/Make/options @@ -1,12 +1,12 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude EXE_LIBS = \ -lfiniteVolume \ -lmeshTools \ - -lsampling \ + -lfileFormats \ -lgenericPatchFields \ -llagrangian diff --git a/applications/utilities/postProcessing/sampling/sample/Make/options b/applications/utilities/postProcessing/sampling/sample/Make/options index 88c6039b4e048acf84a463e29ff47746419c9d85..4de726a20fe6d4836f6aa33f3576202aec07fcdc 100644 --- a/applications/utilities/postProcessing/sampling/sample/Make/options +++ b/applications/utilities/postProcessing/sampling/sample/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude @@ -9,6 +10,7 @@ EXE_LIBS = \ -lfiniteVolume \ -lgenericPatchFields \ -lmeshTools \ + -lfileFormats \ -lsampling \ -lsurfMesh \ -llagrangian diff --git a/applications/utilities/postProcessing/velocityField/Pe/Make/options b/applications/utilities/postProcessing/velocityField/Pe/Make/options index 29d9b4d8c303aacfa11a0947d384d103d21923e4..1d984aa9b559049112c465682139fcf44dcd7daf 100644 --- a/applications/utilities/postProcessing/velocityField/Pe/Make/options +++ b/applications/utilities/postProcessing/velocityField/Pe/Make/options @@ -5,8 +5,7 @@ EXE_INC = \ -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ $(FOAM_LIBBIN)/postCalc.o \ diff --git a/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C b/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C index 2f8b1503418c5b08bfb13033618f93960e3a0e12..58f6a7b063aaf037615e8fe4e4c70126ce30be26 100644 --- a/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C +++ b/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C @@ -55,7 +55,7 @@ void calcIncompressibleYPlus volScalarField& yPlus ) { - typedef incompressible::RASModels::nutWallFunctionFvPatchScalarField + typedef incompressible::nutWallFunctionFvPatchScalarField wallFunctionPatchField; #include "createPhi.H" @@ -107,7 +107,7 @@ void calcCompressibleYPlus volScalarField& yPlus ) { - typedef compressible::RASModels::mutWallFunctionFvPatchScalarField + typedef compressible::mutWallFunctionFvPatchScalarField wallFunctionPatchField; IOobject rhoHeader diff --git a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C index 13c5841c3aeb2f1c7f52cbd8fd1acf129f78849e..b4a83722e6e3205d4bf57a2e18487ea9234f9af0 100644 --- a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C +++ b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) } // Create G field - used by RAS wall functions - volScalarField G("RASModel.G", nut*2*sqr(S)); + volScalarField G(turbulence().type() + ".G", nut*2*sqr(S)); //--- Read and modify turbulence fields diff --git a/applications/utilities/preProcessing/applyWallFunctionBoundaryConditions/applyWallFunctionBoundaryConditions.C b/applications/utilities/preProcessing/applyWallFunctionBoundaryConditions/applyWallFunctionBoundaryConditions.C index 9b89af1c4de67beb66dfebe184fdf66982234f9b..38b0bf0eb73e95dcfb9c96840bc2fc41c278cb6f 100644 --- a/applications/utilities/preProcessing/applyWallFunctionBoundaryConditions/applyWallFunctionBoundaryConditions.C +++ b/applications/utilities/preProcessing/applyWallFunctionBoundaryConditions/applyWallFunctionBoundaryConditions.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -232,43 +232,42 @@ void updateCompressibleCase(const fvMesh& mesh) ( mesh, "mut", - compressible::RASModels::mutkWallFunctionFvPatchScalarField::typeName, + compressible::mutkWallFunctionFvPatchScalarField::typeName, "0" ); replaceBoundaryType ( mesh, "epsilon", - compressible::RASModels::epsilonWallFunctionFvPatchScalarField:: - typeName, + compressible::epsilonWallFunctionFvPatchScalarField::typeName, "0" ); replaceBoundaryType ( mesh, "omega", - compressible::RASModels::omegaWallFunctionFvPatchScalarField::typeName, + compressible::omegaWallFunctionFvPatchScalarField::typeName, "0" ); replaceBoundaryType ( mesh, "k", - compressible::RASModels::kqRWallFunctionFvPatchField<scalar>::typeName, + compressible::kqRWallFunctionFvPatchField<scalar>::typeName, "0" ); replaceBoundaryType ( mesh, "q", - compressible::RASModels::kqRWallFunctionFvPatchField<scalar>::typeName, + compressible::kqRWallFunctionFvPatchField<scalar>::typeName, "0" ); replaceBoundaryType ( mesh, "R", - compressible::RASModels::kqRWallFunctionFvPatchField<symmTensor>:: + compressible::kqRWallFunctionFvPatchField<symmTensor>:: typeName, "(0 0 0 0 0 0)" ); @@ -284,14 +283,14 @@ void updateIncompressibleCase(const fvMesh& mesh) ( mesh, "nut", - incompressible::RASModels::nutkWallFunctionFvPatchScalarField::typeName, + incompressible::nutkWallFunctionFvPatchScalarField::typeName, "0" ); replaceBoundaryType ( mesh, "epsilon", - incompressible::RASModels::epsilonWallFunctionFvPatchScalarField:: + incompressible::epsilonWallFunctionFvPatchScalarField:: typeName, "0" ); @@ -299,7 +298,7 @@ void updateIncompressibleCase(const fvMesh& mesh) ( mesh, "omega", - incompressible::RASModels::omegaWallFunctionFvPatchScalarField:: + incompressible::omegaWallFunctionFvPatchScalarField:: typeName, "0" ); @@ -307,24 +306,21 @@ void updateIncompressibleCase(const fvMesh& mesh) ( mesh, "k", - incompressible::RASModels::kqRWallFunctionFvPatchField<scalar>:: - typeName, + incompressible::kqRWallFunctionFvPatchField<scalar>::typeName, "0" ); replaceBoundaryType ( mesh, "q", - incompressible::RASModels::kqRWallFunctionFvPatchField<scalar>:: - typeName, + incompressible::kqRWallFunctionFvPatchField<scalar>::typeName, "0" ); replaceBoundaryType ( mesh, "R", - incompressible::RASModels::kqRWallFunctionFvPatchField<symmTensor>:: - typeName, + incompressible::kqRWallFunctionFvPatchField<symmTensor>::typeName, "(0 0 0 0 0 0)" ); } diff --git a/applications/utilities/preProcessing/boxTurb/Make/options b/applications/utilities/preProcessing/boxTurb/Make/options index 749a3d512477c50731fad604faf65992b488f76e..e24cee9cb9d235b1870e28189a8633d7352dbe7c 100644 --- a/applications/utilities/preProcessing/boxTurb/Make/options +++ b/applications/utilities/preProcessing/boxTurb/Make/options @@ -1,10 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/randomProcesses/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ -lrandomProcesses \ - -lsampling \ - -lmeshTools \ -lfiniteVolume diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index ebc43d84f23e2dbf09c01ac2536c5f6f993e1ae2..3f1f628a75b5d96c8d3de66690781c41f688246a 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -359,9 +359,10 @@ public: int main(int argc, char *argv[]) { -# include "setRootCase.H" -# include "createTime.H" -# include "createMesh.H" + #include "addRegionOption.H" + #include "setRootCase.H" + #include "createTime.H" + #include "createNamedMesh.H" Info<< "Reading setFieldsDict\n" << endl; diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index 8a6301a545de836aaad39d9f412b4a618d6730c9..bd1659e6fc56e2676b406f0b0ba32be4e7f8c3a7 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -74,6 +74,7 @@ cleanCase() cleanDynamicCode rm -rf processor* > /dev/null 2>&1 + rm -rf postProcessing > /dev/null 2>&1 rm -rf probes* > /dev/null 2>&1 rm -rf forces* > /dev/null 2>&1 rm -rf graphs* > /dev/null 2>&1 diff --git a/etc/controlDict b/etc/controlDict index d5c1fdb7550ab76543aa8968befec02ad8d8a19a..a34d4a1977323fbb95a64e4d5d7e67bb259298a0 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -112,7 +112,7 @@ DebugSwitches ConeInjection 0; Constant 0; ConstantRateDevolatilisation 0; - CrankNicholson 0; + CrankNicolson 0; CrossPowerLaw 0; Cs 0; DIC 0; diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H index d0689b0eb1955f82bb2ffee45f8d72e846a49fa0..86fdc7ba5140b4841587c24e0f4be3649b91b30d 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H @@ -245,6 +245,15 @@ template<class Container, class T, int nRows, int nColumns> List<Container> initListList(const T[nRows][nColumns]); +//- Helper class for list to append y onto the end of x +template<class T> +class ListAppendEqOp +{ +public: + void operator()(List<T>& x, const List<T>& y) const; +}; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C index be6337a4283e6e5f039ba9a8fc5e6ee9cb52fb87..49daa408c1b6c3775b71bfec2566f1321b69ce4c 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C @@ -684,4 +684,26 @@ Foam::List<Container> Foam::initListList(const T elems[nRows][nColumns]) } +template<class T> +void Foam::ListAppendEqOp<T>::operator()(List<T>& x, const List<T>& y) const +{ + if (y.size()) + { + if (x.size()) + { + label sz = x.size(); + x.setSize(sz + y.size()); + forAll(y, i) + { + x[sz++] = y[i]; + } + } + else + { + x = y; + } + } +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 155c4c2eb48456ef366aa43b7de061321f16dca6..8619e2da91669622d1a06bba18bdc9415368e234 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -324,6 +324,7 @@ Foam::Time::Time secondaryWriteControl_(wcTimeStep), secondaryWriteInterval_(labelMax/10.0), // bit less to allow calculations purgeWrite_(0), + secondaryPurgeWrite_(0), writeOnce_(false), subCycling_(false), sigWriteNow_(true, *this), @@ -416,6 +417,7 @@ Foam::Time::Time secondaryWriteControl_(wcTimeStep), secondaryWriteInterval_(labelMax/10.0), purgeWrite_(0), + secondaryPurgeWrite_(0), writeOnce_(false), subCycling_(false), sigWriteNow_(true, *this), @@ -511,6 +513,7 @@ Foam::Time::Time secondaryWriteControl_(wcTimeStep), secondaryWriteInterval_(labelMax/10.0), purgeWrite_(0), + secondaryPurgeWrite_(0), writeOnce_(false), subCycling_(false), sigWriteNow_(true, *this), @@ -608,6 +611,7 @@ Foam::Time::Time secondaryWriteControl_(wcTimeStep), secondaryWriteInterval_(labelMax/10.0), purgeWrite_(0), + secondaryPurgeWrite_(0), writeOnce_(false), subCycling_(false), @@ -1070,11 +1074,13 @@ Foam::Time& Foam::Time::operator++() outputTime_ = false; + primaryOutputTime_ = false; + secondaryOutputTime_ = false; switch (writeControl_) { case wcTimeStep: - outputTime_ = !(timeIndex_ % label(writeInterval_)); + primaryOutputTime_ = !(timeIndex_ % label(writeInterval_)); break; case wcRunTime: @@ -1088,7 +1094,7 @@ Foam::Time& Foam::Time::operator++() if (outputIndex > outputTimeIndex_) { - outputTime_ = true; + primaryOutputTime_ = true; outputTimeIndex_ = outputIndex; } } @@ -1103,7 +1109,7 @@ Foam::Time& Foam::Time::operator++() ); if (outputIndex > outputTimeIndex_) { - outputTime_ = true; + primaryOutputTime_ = true; outputTimeIndex_ = outputIndex; } } @@ -1118,7 +1124,7 @@ Foam::Time& Foam::Time::operator++() ); if (outputIndex > outputTimeIndex_) { - outputTime_ = true; + primaryOutputTime_ = true; outputTimeIndex_ = outputIndex; } } @@ -1130,9 +1136,8 @@ Foam::Time& Foam::Time::operator++() switch (secondaryWriteControl_) { case wcTimeStep: - outputTime_ = - outputTime_ - || !(timeIndex_ % label(secondaryWriteInterval_)); + secondaryOutputTime_ = + !(timeIndex_ % label(secondaryWriteInterval_)); break; case wcRunTime: @@ -1146,7 +1151,7 @@ Foam::Time& Foam::Time::operator++() if (outputIndex > secondaryOutputTimeIndex_) { - outputTime_ = true; + secondaryOutputTime_ = true; secondaryOutputTimeIndex_ = outputIndex; } } @@ -1161,7 +1166,7 @@ Foam::Time& Foam::Time::operator++() ); if (outputIndex > secondaryOutputTimeIndex_) { - outputTime_ = true; + secondaryOutputTime_ = true; secondaryOutputTimeIndex_ = outputIndex; } } @@ -1176,7 +1181,7 @@ Foam::Time& Foam::Time::operator++() ); if (outputIndex > secondaryOutputTimeIndex_) { - outputTime_ = true; + secondaryOutputTime_ = true; secondaryOutputTimeIndex_ = outputIndex; } } @@ -1184,6 +1189,9 @@ Foam::Time& Foam::Time::operator++() } + outputTime_ = primaryOutputTime_ || secondaryOutputTime_; + + // see if endTime needs adjustment to stop at the next run()/end() check if (!end()) { @@ -1195,6 +1203,7 @@ Foam::Time& Foam::Time::operator++() { endTime_ = value(); outputTime_ = true; + primaryOutputTime_ = true; } else if (stopAt_ == saNextWrite && outputTime_ == true) { @@ -1205,6 +1214,7 @@ Foam::Time& Foam::Time::operator++() // Override outputTime if one-shot writing if (writeOnce_) { + primaryOutputTime_ = true; outputTime_ = true; writeOnce_ = false; } diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 26e6b21bc7bbeef91186169940c056d17dc68153..1e761cd73eaaff3d81b4a27d15c996d885bbd19c 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -138,10 +138,15 @@ protected: scalar secondaryWriteInterval_; - label purgeWrite_; mutable FIFOStack<word> previousOutputTimes_; + // Additional purging + + label secondaryPurgeWrite_; + mutable FIFOStack<word> previousSecondaryOutputTimes_; + + // One-shot writing bool writeOnce_; diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C index 6a80618404ef323e9b9a2d1cfa79fed6fd1e75ae..1637d35bfcfe598fc4effec0f94f9b9798550059 100644 --- a/src/OpenFOAM/db/Time/TimeIO.C +++ b/src/OpenFOAM/db/Time/TimeIO.C @@ -160,6 +160,20 @@ void Foam::Time::readDict() } } + if (controlDict_.readIfPresent("secondaryPurgeWrite", secondaryPurgeWrite_)) + { + if (secondaryPurgeWrite_ < 0) + { + WarningIn("Time::readDict()") + << "invalid value for secondaryPurgeWrite " + << secondaryPurgeWrite_ + << ", should be >= 0, setting to 0" + << endl; + + secondaryPurgeWrite_ = 0; + } + } + if (controlDict_.found("timeFormat")) { const word formatName(controlDict_.lookup("timeFormat")); @@ -347,13 +361,45 @@ bool Foam::Time::writeObject timeDict.regIOobject::writeObject(fmt, ver, cmp); bool writeOK = objectRegistry::writeObject(fmt, ver, cmp); - if (writeOK && purgeWrite_) + if (writeOK) { - previousOutputTimes_.push(tmName); + // Does primary or secondary time trigger purging? + // Note that primary times can only be purged by primary + // purging. Secondary times can be purged by either primary + // or secondary purging. + if (primaryOutputTime_ && purgeWrite_) + { + previousOutputTimes_.push(tmName); - while (previousOutputTimes_.size() > purgeWrite_) + while (previousOutputTimes_.size() > purgeWrite_) + { + rmDir(objectRegistry::path(previousOutputTimes_.pop())); + } + } + if + ( + !primaryOutputTime_ + && secondaryOutputTime_ + && secondaryPurgeWrite_ + ) { - rmDir(objectRegistry::path(previousOutputTimes_.pop())); + // Writing due to secondary + previousSecondaryOutputTimes_.push(tmName); + + while + ( + previousSecondaryOutputTimes_.size() + > secondaryPurgeWrite_ + ) + { + rmDir + ( + objectRegistry::path + ( + previousSecondaryOutputTimes_.pop() + ) + ); + } } } @@ -368,6 +414,7 @@ bool Foam::Time::writeObject bool Foam::Time::writeNow() { + primaryOutputTime_ = true; outputTime_ = true; return write(); } diff --git a/src/OpenFOAM/db/Time/TimeState.C b/src/OpenFOAM/db/Time/TimeState.C index 500ca47d43ffb35c6d761886b1741dfd8dc6bf6e..f3e37401076380ceea06cc3220d24e25115f1a18 100644 --- a/src/OpenFOAM/db/Time/TimeState.C +++ b/src/OpenFOAM/db/Time/TimeState.C @@ -37,7 +37,9 @@ Foam::TimeState::TimeState() deltaT0_(0), deltaTchanged_(false), outputTimeIndex_(0), + primaryOutputTime_(false), secondaryOutputTimeIndex_(0), + secondaryOutputTime_(false), outputTime_(false) {} diff --git a/src/OpenFOAM/db/Time/TimeState.H b/src/OpenFOAM/db/Time/TimeState.H index d721529480ea79ce2de2b9f4cca74875ea11502b..b055d439f0f8389c8f4183d84e7259ef4040f2f1 100644 --- a/src/OpenFOAM/db/Time/TimeState.H +++ b/src/OpenFOAM/db/Time/TimeState.H @@ -61,8 +61,14 @@ protected: bool deltaTchanged_; label outputTimeIndex_; + //- Is outputTime because of primary? + bool primaryOutputTime_; + label secondaryOutputTimeIndex_; - bool outputTime_; + //- Is outputTime because of secondary? + bool secondaryOutputTime_; + + bool outputTime_; public: @@ -112,7 +118,7 @@ public: // Check - //- Return true if this is an output time + //- Return true if this is an output time (primary or secondary) bool outputTime() const; }; diff --git a/src/OpenFOAM/db/Time/findInstance.C b/src/OpenFOAM/db/Time/findInstance.C index 54d64fcf4c95167acbf7fab8e7edfb6694064160..556de4c98b52e8262a44b9cfec691b10b0b103d3 100644 --- a/src/OpenFOAM/db/Time/findInstance.C +++ b/src/OpenFOAM/db/Time/findInstance.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -132,15 +132,30 @@ Foam::word Foam::Time::findInstance || rOpt == IOobject::MUST_READ_IF_MODIFIED ) { - FatalErrorIn - ( - "Time::findInstance" - "(const fileName&, const word&" - ", const IOobject::readOption, const word&)" - ) << "Cannot find file \"" << name << "\" in directory " - << dir << " in times " << timeName() - << " down to " << stopInstance - << exit(FatalError); + if (name.empty()) + { + FatalErrorIn + ( + "Time::findInstance" + "(const fileName&, const word&" + ", const IOobject::readOption, const word&)" + ) << "Cannot find directory " + << dir << " in times " << timeName() + << " down to " << stopInstance + << exit(FatalError); + } + else + { + FatalErrorIn + ( + "Time::findInstance" + "(const fileName&, const word&" + ", const IOobject::readOption, const word&)" + ) << "Cannot find file \"" << name << "\" in directory " + << dir << " in times " << timeName() + << " down to " << stopInstance + << exit(FatalError); + } } return ts[instanceI].name(); diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C index 19fb67d4e38917a6579109e2dda04e0a38d9abc8..ffad0cc4e6b2e39f7ef494c79ff22aec139fee9a 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C @@ -168,7 +168,7 @@ Foam::functionObjectFile::functionObjectFile names_.insert(name); filePtrs_.clear(); - filePtrs_.setSize(names_.toc().size()); + filePtrs_.setSize(1); // cannot create files - need to access virtual function } @@ -193,7 +193,7 @@ Foam::functionObjectFile::functionObjectFile names_.insert(names); filePtrs_.clear(); - filePtrs_.setSize(names_.toc().size()); + filePtrs_.setSize(names_.size()); // cannot create files - need to access virtual function } diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H index 8710b92b7ae2ceb9ff019721e11875517e5a6a73..f4c0ab11782e45dad3424bac6f13e14d77db7efa 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H @@ -64,7 +64,7 @@ private: const objectRegistry& obr_; //- Prefix - const word& prefix_; + const word prefix_; //- File names wordHashSet names_; diff --git a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C index 34b9da0da1b77341e41ee5e77413466a26a5e774..e282ff8c21575d56d3e1f40c219e1652a98380c2 100644 --- a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C +++ b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,11 +30,8 @@ License namespace Foam { template<> - const char* Foam::NamedEnum - < - Foam::outputFilterOutputControl::outputControls, - 2 - >::names[] = + const char* NamedEnum<outputFilterOutputControl::outputControls, 2>:: + names[] = { "timeStep", "outputTime" diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C index 5117f8cb23f5112aca4351c7ce8223ecde894c45..c1b516e97cefb1319594da61f0c0838c010f48b7 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C @@ -28,8 +28,151 @@ License #include "globalMeshData.H" #include "cyclicPolyPatch.H" +template<class Type, template<class> class PatchField, class GeoMesh> +void Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField:: +readField +( + const DimensionedField<Type, GeoMesh>& field, + const dictionary& dict +) +{ + this->setSize(bmesh_.size()); + + if (debug) + { + Info<< "GeometricField<Type, PatchField, GeoMesh>::" + "GeometricBoundaryField::readField" + "(" + "const DimensionedField<Type, GeoMesh>&, " + "const dictionary&" + ")" + << endl; + } + + // Patch or patch-groups. (using non-wild card entries of dictionaries) + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict() && !iter().keyword().isPattern()) + { + const labelList patchIDs = bmesh_.findIndices + ( + iter().keyword(), + true + ); + + forAll(patchIDs, i) + { + label patchi = patchIDs[i]; + + this->set + ( + patchi, + PatchField<Type>::New + ( + bmesh_[patchi], + field, + iter().dict() + ) + ); + } + } + } + + // Check for wildcard patch overrides + forAll(bmesh_, patchi) + { + if (!this->set(patchi)) + { + if (bmesh_[patchi].type() == emptyPolyPatch::typeName) + { + this->set + ( + patchi, + PatchField<Type>::New + ( + emptyPolyPatch::typeName, + bmesh_[patchi], + field + ) + ); + } + else + { + bool found = dict.found(bmesh_[patchi].name()); + + if (found) + { + this->set + ( + patchi, + PatchField<Type>::New + ( + bmesh_[patchi], + field, + dict.subDict(bmesh_[patchi].name()) + ) + ); + } + } + } + } + + + // Check for any unset patches + forAll(bmesh_, patchi) + { + if (!this->set(patchi)) + { + if (bmesh_[patchi].type() == cyclicPolyPatch::typeName) + { + FatalIOErrorIn + ( + "GeometricField<Type, PatchField, GeoMesh>::" + "GeometricBoundaryField::readField" + "(" + "const DimensionedField<Type, GeoMesh>&, " + "const dictionary&" + ")", + dict + ) << "Cannot find patchField entry for cyclic " + << bmesh_[patchi].name() << endl + << "Is your field uptodate with split cyclics?" << endl + << "Run foamUpgradeCyclics to convert mesh and fields" + << " to split cyclics." << exit(FatalIOError); + } + else + { + FatalIOErrorIn + ( + "GeometricField<Type, PatchField, GeoMesh>::" + "GeometricBoundaryField::readField" + "(" + "const DimensionedField<Type, GeoMesh>&, " + "const dictionary&" + ")", + dict + ) << "Cannot find patchField entry for " + << bmesh_[patchi].name() << exit(FatalIOError); + } + } + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +template<class Type, template<class> class PatchField, class GeoMesh> +Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField:: +GeometricBoundaryField +( + const BoundaryMesh& bmesh +) +: + FieldField<PatchField, Type>(bmesh.size()), + bmesh_(bmesh) +{} + + template<class Type, template<class> class PatchField, class GeoMesh> Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField:: GeometricBoundaryField @@ -47,7 +190,7 @@ GeometricBoundaryField Info<< "GeometricField<Type, PatchField, GeoMesh>::" "GeometricBoundaryField::" "GeometricBoundaryField(const BoundaryMesh&, " - "const Field<Type>&, const word&)" + "const DimensionedField<Type>&, const word&)" << endl; } @@ -84,8 +227,13 @@ GeometricBoundaryField { Info<< "GeometricField<Type, PatchField, GeoMesh>::" "GeometricBoundaryField::" - "GeometricBoundaryField(const BoundaryMesh&, " - "const Field<Type>&, const wordList&, const wordList&)" + "GeometricBoundaryField" + "(" + "const BoundaryMesh&, " + "const DimensionedField<Type>&, " + "const wordList&, " + "const wordList&" + ")" << endl; } @@ -99,8 +247,13 @@ GeometricBoundaryField ( "GeometricField<Type, PatchField, GeoMesh>::" "GeometricBoundaryField::" - "GeometricBoundaryField(const BoundaryMesh&, " - "const Field<Type>&, const wordList&, const wordList&)" + "GeometricBoundaryField" + "(" + "const BoundaryMesh&, " + "const DimensionedField<Type>&, " + "const wordList&, " + "const wordList&" + ")" ) << "Incorrect number of patch type specifications given" << nl << " Number of patches in mesh = " << bmesh.size() << " number of patch type specifications = " @@ -160,8 +313,12 @@ GeometricBoundaryField { Info<< "GeometricField<Type, PatchField, GeoMesh>::" "GeometricBoundaryField::" - "GeometricBoundaryField(const BoundaryMesh&, " - "const Field<Type>&, const PatchField<Type>List&)" + "GeometricBoundaryField" + "(" + "const BoundaryMesh&, " + "const DimensionedField<Type, GeoMesh>&, " + "const PtrLIst<PatchField<Type> >&" + ")" << endl; } @@ -188,8 +345,12 @@ GeometricBoundaryField { Info<< "GeometricField<Type, PatchField, GeoMesh>::" "GeometricBoundaryField::" - "GeometricBoundaryField(const GeometricBoundaryField<Type, " - "PatchField, BoundaryMesh>&)" + "GeometricBoundaryField" + "(" + "const DimensionedField<Type, GeoMesh>&, " + "const typename GeometricField<Type, PatchField, GeoMesh>::" + "GeometricBoundaryField&" + ")" << endl; } @@ -220,8 +381,11 @@ GeometricBoundaryField { Info<< "GeometricField<Type, PatchField, GeoMesh>::" "GeometricBoundaryField::" - "GeometricBoundaryField(const GeometricBoundaryField<Type, " - "PatchField, BoundaryMesh>&)" + "GeometricBoundaryField" + "(" + "const GeometricField<Type, PatchField, GeoMesh>::" + "GeometricBoundaryField&" + ")" << endl; } } @@ -239,124 +403,7 @@ GeometricBoundaryField FieldField<PatchField, Type>(bmesh.size()), bmesh_(bmesh) { - if (debug) - { - Info<< "GeometricField<Type, PatchField, GeoMesh>::" - "GeometricBoundaryField::" - "GeometricBoundaryField" - "(const BoundaryMesh&, const Field<Type>&, const dictionary&)" - << endl; - } - - - // Patch or patch-groups. (using non-wild card entries of dictionaries) - forAllConstIter(dictionary, dict, iter) - { - if (iter().isDict() && !iter().keyword().isPattern()) - { - const labelList patchIDs = bmesh_.findIndices - ( - iter().keyword(), - true - ); - - forAll(patchIDs, i) - { - label patchi = patchIDs[i]; - this->set - ( - patchi, - PatchField<Type>::New - ( - bmesh_[patchi], - field, - iter().dict() - ) - ); - } - } - } - - // Check for wildcard patch overrides - forAll(bmesh_, patchi) - { - if (!this->set(patchi)) - { - if (bmesh_[patchi].type() == emptyPolyPatch::typeName) - { - this->set - ( - patchi, - PatchField<Type>::New - ( - emptyPolyPatch::typeName, - bmesh_[patchi], - field - ) - ); - } - else - { - bool found = dict.found(bmesh_[patchi].name()); - - if (found) - { - this->set - ( - patchi, - PatchField<Type>::New - ( - bmesh_[patchi], - field, - dict.subDict(bmesh_[patchi].name()) - ) - ); - } - } - } - } - - - // Check for any unset patches - forAll(bmesh_, patchi) - { - if (!this->set(patchi)) - { - if (bmesh_[patchi].type() == cyclicPolyPatch::typeName) - { - FatalIOErrorIn - ( - "GeometricField<Type, PatchField, GeoMesh>::\n" - "GeometricBoundaryField::GeometricBoundaryField\n" - "(\n" - " const BoundaryMesh&,\n" - " const DimensionedField<Type, GeoMesh>&,\n" - " const dictionary&\n" - ")", - dict - ) << "Cannot find patchField entry for cyclic " - << bmesh_[patchi].name() << endl - << "Is your field uptodate with split cyclics?" << endl - << "Run foamUpgradeCyclics to convert mesh and fields" - << " to split cyclics." << exit(FatalIOError); - } - else - { - FatalIOErrorIn - ( - "GeometricField<Type, PatchField, GeoMesh>::\n" - "GeometricBoundaryField::GeometricBoundaryField\n" - "(\n" - " const BoundaryMesh&,\n" - " const DimensionedField<Type, GeoMesh>&,\n" - " const dictionary&\n" - ")", - dict - ) << "Cannot find patchField entry for " - << bmesh_[patchi].name() << exit(FatalIOError); - } - } - } + readField(field, dict); } diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index 8898b162f44dbe436538ed9dddb951cf7d42d3f7..2b8216956161bb4aad0998c80d3b16c4c21cb634 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,70 +47,49 @@ if ((gf1).mesh() != (gf2).mesh()) \ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // template<class Type, template<class> class PatchField, class GeoMesh> -Foam::tmp -< - typename Foam::GeometricField<Type, PatchField, GeoMesh>:: - GeometricBoundaryField -> -Foam::GeometricField<Type, PatchField, GeoMesh>::readField +void Foam::GeometricField<Type, PatchField, GeoMesh>::readFields ( - const dictionary& fieldDict + const dictionary& dict ) { - DimensionedField<Type, GeoMesh>::readField(fieldDict, "internalField"); + DimensionedField<Type, GeoMesh>::readField(dict, "internalField"); - tmp<GeometricBoundaryField> tboundaryField - ( - new GeometricBoundaryField - ( - this->mesh().boundary(), - *this, - fieldDict.subDict("boundaryField") - ) - ); + boundaryField_.readField(*this, dict.subDict("boundaryField")); - if (fieldDict.found("referenceLevel")) + if (dict.found("referenceLevel")) { - Type fieldAverage(pTraits<Type>(fieldDict.lookup("referenceLevel"))); + Type fieldAverage(pTraits<Type>(dict.lookup("referenceLevel"))); Field<Type>::operator+=(fieldAverage); - GeometricBoundaryField& boundaryField = tboundaryField(); - - forAll(boundaryField, patchi) + forAll(boundaryField_, patchi) { - boundaryField[patchi] == boundaryField[patchi] + fieldAverage; + boundaryField_[patchi] == boundaryField_[patchi] + fieldAverage; } } - - return tboundaryField; } template<class Type, template<class> class PatchField, class GeoMesh> -Foam::tmp -< - typename Foam::GeometricField<Type, PatchField, GeoMesh>:: - GeometricBoundaryField -> -Foam::GeometricField<Type, PatchField, GeoMesh>::readField(Istream& is) +void Foam::GeometricField<Type, PatchField, GeoMesh>::readFields() { - return readField + const IOdictionary dict ( - IOdictionary + IOobject ( - IOobject - ( - this->name(), - this->time().timeName(), - this->db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - is - ) + this->name(), + this->time().timeName(), + this->db(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + this->readStream(typeName) ); + + this->close(); + + readFields(dict); } @@ -132,8 +111,7 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::readIfPresent() } else if (this->readOpt() == IOobject::READ_IF_PRESENT && this->headerOk()) { - boundaryField_.transfer(readField(this->readStream(typeName))()); - this->close(); + readFields(); // Check compatibility between field and mesh if (this->size() != GeoMesh::size(this->mesh())) @@ -360,9 +338,9 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField timeIndex_(this->time().timeIndex()), field0Ptr_(NULL), fieldPrevIterPtr_(NULL), - boundaryField_(*this, readField(this->readStream(typeName))) + boundaryField_(mesh.boundary()) { - this->close(); + readFields(); // Check compatibility between field and mesh @@ -401,8 +379,10 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField timeIndex_(this->time().timeIndex()), field0Ptr_(NULL), fieldPrevIterPtr_(NULL), - boundaryField_(*this, readField(dict)) + boundaryField_(mesh.boundary()) { + readFields(dict); + // Check compatibility between field and mesh if (this->size() != GeoMesh::size(this->mesh())) diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 5aef9e0fb819c61bf75c7e5122b3f30d35dc6733..ba510d77e86f5109fed052770affe935315d5ecf 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -117,6 +117,9 @@ public: // Constructors + //- Construct from a BoundaryMesh + GeometricBoundaryField(const BoundaryMesh&); + //- Construct from a BoundaryMesh, // reference to the internal field // and a patch type @@ -177,6 +180,13 @@ public: // Member functions + //- Read the boundary field + void readField + ( + const DimensionedField<Type, GeoMesh>& field, + const dictionary& dict + ); + //- Update the boundary condition coefficients void updateCoeffs(); @@ -247,10 +257,10 @@ private: // Private Member Functions //- Read the field from the dictionary - tmp<GeometricBoundaryField> readField(const dictionary&); + void readFields(const dictionary&); - //- Read the field from the given stream - tmp<GeometricBoundaryField> readField(Istream& is); + //- Read the field - create the field dictionary on-the-fly + void readFields(); public: diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H index ebc4ba60c3dda8edaf21b15b338ccf62e29e4597..3eb6e713880647aba59986b9ef6e215c8021e0ab 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -481,6 +481,15 @@ public: ); } + //- Swap to obtain neighbour cell values for all boundary faces + template <class T> + static void swapBoundaryCellList + ( + const polyMesh& mesh, + const UList<T>& cellData, + List<T>& neighbourCellData + ); + // Sparse versions //- Synchronize values on selected points. diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C index 7db1a14178d6711248e8c022eabb1e9cd0ca46e6..4be6afcf2dfb9bbe1ae0d87c18e17f92a3d8901f 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -1553,6 +1553,45 @@ void Foam::syncTools::syncFaceList } +template <class T> +void Foam::syncTools::swapBoundaryCellList +( + const polyMesh& mesh, + const UList<T>& cellData, + List<T>& neighbourCellData +) +{ + if (cellData.size() != mesh.nCells()) + { + FatalErrorIn + ( + "syncTools<class T>::swapBoundaryCellList" + "(const polyMesh&, const UList<T>&, List<T>&)" + ) << "Number of cell values " << cellData.size() + << " is not equal to the number of cells in the mesh " + << mesh.nCells() << abort(FatalError); + } + + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + label nBnd = mesh.nFaces()-mesh.nInternalFaces(); + + neighbourCellData.setSize(nBnd); + + forAll(patches, patchI) + { + const polyPatch& pp = patches[patchI]; + const labelUList& faceCells = pp.faceCells(); + forAll(faceCells, i) + { + label bFaceI = pp.start()+i-mesh.nInternalFaces(); + neighbourCellData[bFaceI] = cellData[faceCells[i]]; + } + } + syncTools::swapBoundaryFaceList(mesh, neighbourCellData); +} + + template <unsigned nBits> void Foam::syncTools::swapFaceList ( diff --git a/src/OpenFOAM/primitives/ops/ops.H b/src/OpenFOAM/primitives/ops/ops.H index 66d793084962f6706f6bf5eb20abc7c3a64f215a..cab91fcfb5eee81d71a4cb8280b8d21e0c25e1a0 100644 --- a/src/OpenFOAM/primitives/ops/ops.H +++ b/src/OpenFOAM/primitives/ops/ops.H @@ -90,40 +90,68 @@ EqOp(nopEq, (void)x) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define Op(opName, op) \ - \ -template<class T, class T1, class T2> \ -class opName##Op3 \ -{ \ -public: \ - \ - T operator()(const T1& x, const T2& y) const \ - { \ - return op; \ - } \ -}; \ - \ -template<class T1, class T2> \ -class opName##Op2 \ -{ \ -public: \ - \ - T1 operator()(const T1& x, const T2& y) const \ - { \ - return op; \ - } \ -}; \ - \ -template<class T> \ -class opName##Op \ -{ \ -public: \ - \ - T operator()(const T& x, const T& y) const \ - { \ - return op; \ - } \ -}; +#define Op(opName, op) \ + \ + template<class T, class T1, class T2> \ + class opName##Op3 \ + { \ + public: \ + \ + T operator()(const T1& x, const T2& y) const \ + { \ + return op; \ + } \ + }; \ + \ + template<class T1, class T2> \ + class opName##Op2 \ + { \ + public: \ + \ + T1 operator()(const T1& x, const T2& y) const \ + { \ + return op; \ + } \ + }; \ + \ + template<class T> \ + class opName##Op \ + { \ + public: \ + \ + T operator()(const T& x, const T& y) const \ + { \ + return op; \ + } \ + }; + + +#define weightedOp(opName, op) \ + \ + template<class Type, class CombineOp> \ + class opName##WeightedOp \ + { \ + const CombineOp& cop_; \ + \ + public: \ + \ + opName##WeightedOp(const CombineOp& cop) \ + : \ + cop_(cop) \ + {} \ + \ + void operator() \ + ( \ + Type& x, \ + const label index, \ + const Type& y, \ + const scalar weight \ + ) const \ + { \ + cop_(x, op); \ + } \ + }; \ + Op(sum, x + y) @@ -147,6 +175,8 @@ Op(lessEq, x <= y) Op(greater, x > y) Op(greaterEq, x >= y) +weightedOp(multiply, weight * y) + #undef Op diff --git a/src/dynamicMesh/motionSmoother/motionSmootherCheck.C b/src/dynamicMesh/motionSmoother/motionSmootherCheck.C index da20ea741e306333f00f793828f6e25f991a1f6a..77ce89ca71e2a7d238d973b5af6c13a766a59b37 100644 --- a/src/dynamicMesh/motionSmoother/motionSmootherCheck.C +++ b/src/dynamicMesh/motionSmoother/motionSmootherCheck.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -104,6 +104,8 @@ bool Foam::motionSmoother::checkMesh ( readScalar(dict.lookup("minTriangleTwist", true)) ); + scalar minFaceFlatness = -1.0; + dict.readIfPresent("minFaceFlatness", minFaceFlatness, true); const scalar minDet ( readScalar(dict.lookup("minDeterminant", true)) @@ -356,6 +358,30 @@ bool Foam::motionSmoother::checkMesh nWrongFaces = nNewWrongFaces; } + if (minFaceFlatness > -SMALL) + { + polyMeshGeometry::checkFaceFlatness + ( + report, + minFaceFlatness, + mesh, + mesh.faceAreas(), + mesh.faceCentres(), + mesh.points(), + checkFaces, + &wrongFaces + ); + + label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>()); + + Info<< " faces with flatness < " + << setw(5) << minFaceFlatness + << " : " + << nNewWrongFaces-nWrongFaces << endl; + + nWrongFaces = nNewWrongFaces; + } + if (minDet > -1) { polyMeshGeometry::checkCellDeterminant @@ -479,6 +505,8 @@ bool Foam::motionSmoother::checkMesh ( readScalar(dict.lookup("minTriangleTwist", true)) ); + scalar minFaceFlatness = -1.0; + dict.readIfPresent("minFaceFlatness", minFaceFlatness, true); const scalar minDet ( readScalar(dict.lookup("minDeterminant", true)) @@ -697,6 +725,27 @@ bool Foam::motionSmoother::checkMesh nWrongFaces = nNewWrongFaces; } + if (minFaceFlatness > -1) + { + meshGeom.checkFaceFlatness + ( + report, + minFaceFlatness, + meshGeom.mesh().points(), + checkFaces, + &wrongFaces + ); + + label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>()); + + Info<< " faces with flatness < " + << setw(5) << minFaceFlatness + << " : " + << nNewWrongFaces-nWrongFaces << endl; + + nWrongFaces = nNewWrongFaces; + } + if (minDet > -1) { meshGeom.checkCellDeterminant diff --git a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C index 1670de1c9237f194b283ce13e4d636fa554fb40c..13786a1c1cb901c07d9925f7aa1e8cbed99d2f04 100644 --- a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C +++ b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C @@ -341,8 +341,8 @@ bool Foam::polyMeshGeometry::checkFaceTet { Pout<< "bool polyMeshGeometry::checkFaceTets(" << "const bool, const scalar, const pointField&" - << ", const pointField&, const labelList&," - << " labelHashSet*): " + << ", const pointField&" + << ", const labelList&, labelHashSet*) : " << "face " << faceI << " has a triangle that points the wrong way." << endl @@ -373,9 +373,6 @@ Foam::polyMeshGeometry::polyMeshGeometry(const polyMesh& mesh) } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // //- Take over properties from mesh @@ -2014,6 +2011,113 @@ bool Foam::polyMeshGeometry::checkTriangleTwist } +bool Foam::polyMeshGeometry::checkFaceFlatness +( + const bool report, + const scalar minFlatness, + const polyMesh& mesh, + const vectorField& faceAreas, + const vectorField& faceCentres, + const pointField& p, + const labelList& checkFaces, + labelHashSet* setPtr +) +{ + if (minFlatness < -SMALL || minFlatness > 1+SMALL) + { + FatalErrorIn + ( + "polyMeshGeometry::checkFaceFlatness" + "(const bool, const scalar, const polyMesh&, const pointField&" + ", const pointField&, const labelList&, labelHashSet*)" + ) << "minFlatness should be [0..1] but is now " << minFlatness + << abort(FatalError); + } + + const faceList& fcs = mesh.faces(); + + label nWarped = 0; + + forAll(checkFaces, i) + { + label faceI = checkFaces[i]; + + const face& f = fcs[faceI]; + + if (f.size() > 3) + { + const point& fc = faceCentres[faceI]; + + // Sum triangle areas + scalar sumArea = 0.0; + + forAll(f, fp) + { + sumArea += triPointRef + ( + p[f[fp]], + p[f.nextLabel(fp)], + fc + ).mag(); + } + + if (sumArea/mag(faceAreas[faceI]) < minFlatness) + { + nWarped++; + + if (setPtr) + { + setPtr->insert(faceI); + } + } + } + } + + reduce(nWarped, sumOp<label>()); + + if (report) + { + if (nWarped> 0) + { + Info<< "There are " << nWarped + << " faces with area of invidual triangles" + << " compared to overall area less than " + << minFlatness << nl << endl; + } + else + { + Info<< "All faces are flat in that the area of invidual triangles" + << " compared to overall area is less than " + << minFlatness << nl << endl; + } + } + + if (nWarped > 0) + { + if (report) + { + WarningIn + ( + "polyMeshGeometry::checkFaceFlatness" + "(const bool, const scalar, const polyMesh&" + ", const pointField&, const pointField&, const labelList&" + ", labelHashSet*)" + ) << nWarped << " non-flat faces " + << "(area of invidual triangles" + << " compared to overall area" + << " < " << minFlatness << ") found.\n" + << endl; + } + + return true; + } + else + { + return false; + } +} + + bool Foam::polyMeshGeometry::checkFaceArea ( const bool report, @@ -2398,6 +2502,29 @@ bool Foam::polyMeshGeometry::checkTriangleTwist } +bool Foam::polyMeshGeometry::checkFaceFlatness +( + const bool report, + const scalar minFlatness, + const pointField& p, + const labelList& checkFaces, + labelHashSet* setPtr +) const +{ + return checkFaceFlatness + ( + report, + minFlatness, + mesh_, + faceAreas_, + faceCentres_, + p, + checkFaces, + setPtr + ); +} + + bool Foam::polyMeshGeometry::checkFaceArea ( const bool report, diff --git a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.H b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.H index 149fca822a79c8acc072bb9d856b6478440475e7..2ef8604cac8714a45711323d82f2cbc4f475d574 100644 --- a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.H +++ b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -303,6 +303,19 @@ public: labelHashSet* setPtr ); + //- Area of faces v.s. sum of triangle areas + static bool checkFaceFlatness + ( + const bool report, + const scalar minFlatness, + const polyMesh&, + const vectorField& faceAreas, + const vectorField& faceCentres, + const pointField& p, + const labelList& checkFaces, + labelHashSet* setPtr + ); + //- Small faces static bool checkFaceArea ( @@ -314,6 +327,7 @@ public: labelHashSet* setPtr ); + //- Area of internal faces v.s. boundary faces static bool checkCellDeterminant ( const bool report, @@ -413,6 +427,15 @@ public: labelHashSet* setPtr ) const; + bool checkFaceFlatness + ( + const bool report, + const scalar minFlatness, + const pointField& p, + const labelList& checkFaces, + labelHashSet* setPtr + ) const; + bool checkFaceArea ( const bool report, diff --git a/src/engine/Make/options b/src/engine/Make/options index 6862a106f683621de8c2e3b57f566c6e27cd1714..0929e2bc8f16444baec5e7d3b051594b0a20e031 100644 --- a/src/engine/Make/options +++ b/src/engine/Make/options @@ -2,12 +2,10 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/fvMotionSolver/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/fvMotionSolver/lnInclude LIB_LIBS = \ -lfiniteVolume \ -lmeshTools \ -ldynamicMesh \ - -lfvMotionSolvers \ - -lsampling + -lfvMotionSolvers diff --git a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C index bef68f3c4e927ddba13685181a863bd26f66c3bd..26dff507d3bdc07cd1bc447c096b9f6008973b57 100644 --- a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C +++ b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C @@ -41,8 +41,18 @@ namespace Foam fixedTemperatureSource, dictionary ); + + template<> + const char* NamedEnum<fixedTemperatureSource::temperatureMode, 2>::names[] = + { + "uniform", + "lookup" + }; } +const Foam::NamedEnum<Foam::fixedTemperatureSource::temperatureMode, 2> + Foam::fixedTemperatureSource::temperatureModeNames_; + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -55,8 +65,32 @@ Foam::fixedTemperatureSource::fixedTemperatureSource ) : basicSource(name, modelType, dict, mesh), - T_(readScalar(coeffs_.lookup("temperature"))) + mode_(temperatureModeNames_.read(coeffs_.lookup("mode"))), + Tuniform_(NULL), + TName_("T") { + switch (mode_) + { + case tmUniform: + { + Tuniform_.reset + ( + DataEntry<scalar>::New("temperature", coeffs_).ptr() + ); + break; + } + case tmLookup: + { + TName_ = coeffs_.lookupOrDefault<word>("TName", "T"); + break; + } + default: + { + // error handling done by NamedEnum + } + } + + fieldNames_.setSize(1, "energy"); applied_.setSize(1, false); } @@ -81,8 +115,32 @@ void Foam::fixedTemperatureSource::setValue if (eqn.psi().name() == thermo.he().name()) { - const scalarField Tfield(cells_.size(), T_); - eqn.setValues(cells_, thermo.he(thermo.p(), Tfield, cells_)); + switch (mode_) + { + case tmUniform: + { + const scalar t = mesh_.time().value(); + scalarField Tuni(cells_.size(), Tuniform_->value(t)); + eqn.setValues(cells_, thermo.he(thermo.p(), Tuni, cells_)); + + break; + } + case tmLookup: + { + const volScalarField& T = + mesh().lookupObject<volScalarField>(TName_); + + scalarField Tlkp(T, cells_); + eqn.setValues(cells_, thermo.he(thermo.p(), Tlkp, cells_)); + + break; + } + default: + { + // error handling done by NamedEnum + } + } + } } @@ -98,7 +156,15 @@ bool Foam::fixedTemperatureSource::read(const dictionary& dict) { if (basicSource::read(dict)) { - coeffs_.readIfPresent("T", T_); + if (coeffs_.found(Tuniform_->name())) + { + Tuniform_.reset + ( + DataEntry<scalar>::New(Tuniform_->name(), dict).ptr() + ); + } + + coeffs_.readIfPresent("TName", TName_); return true; } diff --git a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H index 4281a38e2ccc5990db25be28b7b447c0e120889f..755293403823bc4be733b9bca90f3ba483217a6c 100644 --- a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H +++ b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H @@ -33,9 +33,18 @@ Description fixedTemperatureSourceCoeffs { fieldNames (h e hs); // names of fields to apply source - temperature 500; // fixed temperature [K] + mode uniform; // constant or lookup + + // uniform option + temperature constant 500; // fixed temperature [K] + + // loolup option + // TName T; // optional temperature field name } +Note: + The 'uniform' option allows the use of a time-varying uniform temperature + by means of the DataEntry type. SourceFiles basicSource.C @@ -46,6 +55,8 @@ SourceFiles #define fixedTemperatureSource_H #include "basicSource.H" +#include "NamedEnum.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,12 +72,32 @@ class fixedTemperatureSource public basicSource { +public: + + //- Temperature mode + enum temperatureMode + { + tmUniform, + tmLookup + }; + + + //- String representation of temperatureMode enums + static const NamedEnum<temperatureMode, 2> temperatureModeNames_; + + protected: // Protected data - //- Fixed temperature [K] - scalar T_; + //- Operation mode + temperatureMode mode_; + + //- Uniform temperature [K] + autoPtr<DataEntry<scalar> > Tuniform_; + + //- Temperature field name + word TName_; private: diff --git a/src/fieldSources/general/explicitSetValue/ExplicitSetValue.C b/src/fieldSources/general/explicitSetValue/ExplicitSetValue.C index de957994d27c86c8c1d8cc01e81c522fa256db32..7285e80305e2dd6f927b35d065153319902c3f80 100644 --- a/src/fieldSources/general/explicitSetValue/ExplicitSetValue.C +++ b/src/fieldSources/general/explicitSetValue/ExplicitSetValue.C @@ -81,9 +81,7 @@ void Foam::ExplicitSetValue<Type>::setValue << ">::setValue for source " << name_ << endl; } - List<Type> values(cells_.size()); - - UIndirectList<Type>(values, cells_) = injectionRate_[fieldI]; + List<Type> values(cells_.size(), injectionRate_[fieldI]); eqn.setValues(cells_, values); } diff --git a/src/fileFormats/Make/files b/src/fileFormats/Make/files index 7845ac93129e2050a0e8ffef4d61625bc1e96a85..37f3bc00985d82b0917bf2d4c607a57f438851b9 100644 --- a/src/fileFormats/Make/files +++ b/src/fileFormats/Make/files @@ -2,4 +2,17 @@ vtk/vtkUnstructuredReader.C nas/NASCore.C starcd/STARCDCore.C +coordSet/coordSet.C + +setWriters = sampledSetWriters + +$(setWriters)/writers.C +$(setWriters)/ensight/ensightSetWriterRunTime.C +$(setWriters)/gnuplot/gnuplotSetWriterRunTime.C +$(setWriters)/jplot/jplotSetWriterRunTime.C +$(setWriters)/raw/rawSetWriterRunTime.C +$(setWriters)/vtk/vtkSetWriterRunTime.C +$(setWriters)/xmgrace/xmgraceSetWriterRunTime.C +$(setWriters)/csv/csvSetWriterRunTime.C + LIB = $(FOAM_LIBBIN)/libfileFormats diff --git a/src/sampling/sampledSet/coordSet/coordSet.C b/src/fileFormats/coordSet/coordSet.C similarity index 97% rename from src/sampling/sampledSet/coordSet/coordSet.C rename to src/fileFormats/coordSet/coordSet.C index fed58fc86fc66536f581c28d5dd217224b36d342..d8b37c5fdd81b864fd0622c3e6f0371db329e4ab 100644 --- a/src/sampling/sampledSet/coordSet/coordSet.C +++ b/src/fileFormats/coordSet/coordSet.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/coordSet/coordSet.H b/src/fileFormats/coordSet/coordSet.H similarity index 97% rename from src/sampling/sampledSet/coordSet/coordSet.H rename to src/fileFormats/coordSet/coordSet.H index 8629f78bbe46fac480ba3f7bc3c033eead6c8116..5492f37b4351f98bbb1395118d2efd836f44a11d 100644 --- a/src/sampling/sampledSet/coordSet/coordSet.H +++ b/src/fileFormats/coordSet/coordSet.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/csv/csvSetWriter.C b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.C similarity index 98% rename from src/sampling/sampledSet/writers/csv/csvSetWriter.C rename to src/fileFormats/sampledSetWriters/csv/csvSetWriter.C index 4cbb51a597881f58f707d55c0e0863e8b0da3ddd..c1ed54b1cd84d8e05b19fdc425f04883d55f857b 100644 --- a/src/sampling/sampledSet/writers/csv/csvSetWriter.C +++ b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/csv/csvSetWriter.H b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/csv/csvSetWriter.H rename to src/fileFormats/sampledSetWriters/csv/csvSetWriter.H index 9c494320cb8abfc48fd6c07e08d371670df90458..8e4b9c7d70beb9bc5d159fcb49da7fdaffc37563 100644 --- a/src/sampling/sampledSet/writers/csv/csvSetWriter.H +++ b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/csv/csvSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/csv/csvSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/csv/csvSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/csv/csvSetWriterRunTime.C index 2d326f8efaee4f14b363a265a0ef19302102d0f2..ac588e395722133f986b3c75cbacd87fe4b9eaf2 100644 --- a/src/sampling/sampledSet/writers/csv/csvSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/csv/csvSetWriterRunTime.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/ensight/ensightSetWriter.C b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C similarity index 99% rename from src/sampling/sampledSet/writers/ensight/ensightSetWriter.C rename to src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C index d481a4153206f9bdbcba3bb35bd360474e1d8fa7..4b874e201dfcc3e991f838780211a9551a5a2983 100644 --- a/src/sampling/sampledSet/writers/ensight/ensightSetWriter.C +++ b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/ensight/ensightSetWriter.H b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/ensight/ensightSetWriter.H rename to src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.H index 5118c85faa79fbc268592aa0b37efb7c614d5608..14a735b2edc1595223369854b20204eff5895438 100644 --- a/src/sampling/sampledSet/writers/ensight/ensightSetWriter.H +++ b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/ensight/ensightSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/ensight/ensightSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/ensight/ensightSetWriterRunTime.C index b987035b332e4c01e1cb1d33f391956ff6ccb392..c529cb02e48546e2b4a12166e91ced81e87086e2 100644 --- a/src/sampling/sampledSet/writers/ensight/ensightSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriterRunTime.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriter.C b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C similarity index 97% rename from src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriter.C rename to src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C index f6198d3f5ab4b49d44a9090dff2f96e8c8f49922..2679e1e70231f7b826fc7dabd229660499216a06 100644 --- a/src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriter.C +++ b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "gnuplotSetWriter.H" -#include "clock.H" #include "coordSet.H" #include "fileName.H" #include "OFstream.H" diff --git a/src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriter.H b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriter.H rename to src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.H index 88e9414c85553374020cbda538433fa62425b839..74688771e87b568fe90efe6b8ffc98118c48d04f 100644 --- a/src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriter.H +++ b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriterRunTime.C index 90ee2198887d5fc9e6771fdf375c654d9344632f..4e57426359ce2dedae771297aae63ba674dfa3e9 100644 --- a/src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriterRunTime.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/jplot/jplotSetWriter.C b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C similarity index 97% rename from src/sampling/sampledSet/writers/jplot/jplotSetWriter.C rename to src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C index 98dc34bad93c55de2324cb5b0b1c4aab0d5d0f49..d71d860a26b74275ff2f35db5476602e44c8b9d8 100644 --- a/src/sampling/sampledSet/writers/jplot/jplotSetWriter.C +++ b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/jplot/jplotSetWriter.H b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/jplot/jplotSetWriter.H rename to src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.H index bd7bc8c7834f8efd0220a35c38653e42b6c778ba..5b0945664293b4df69920a58ea913e1626e5f3f5 100644 --- a/src/sampling/sampledSet/writers/jplot/jplotSetWriter.H +++ b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/jplot/jplotSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/jplot/jplotSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/jplot/jplotSetWriterRunTime.C index e0e9ac2b5267b870de516e1ee5a9e5d263887517..7e54146fe7f7f661a0ae472ca870c1c81e57eacb 100644 --- a/src/sampling/sampledSet/writers/jplot/jplotSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriterRunTime.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/raw/rawSetWriter.C b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.C similarity index 97% rename from src/sampling/sampledSet/writers/raw/rawSetWriter.C rename to src/fileFormats/sampledSetWriters/raw/rawSetWriter.C index e259c78eaae1794e5919e6bac66478a0ec30f7e2..403b9e71116c884ba5331acc0f9806b8b9c93340 100644 --- a/src/sampling/sampledSet/writers/raw/rawSetWriter.C +++ b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/raw/rawSetWriter.H b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/raw/rawSetWriter.H rename to src/fileFormats/sampledSetWriters/raw/rawSetWriter.H index 418549d01b6a2a42727d18314badb0d89aa83db0..89c857d779c979a76fcebf24a7198f4a844fe474 100644 --- a/src/sampling/sampledSet/writers/raw/rawSetWriter.H +++ b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/raw/rawSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/raw/rawSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/raw/rawSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/raw/rawSetWriterRunTime.C index c4376c9140c1f294dc4fee32b0f75d7ee68b59f6..92a8a83354dd3d194f36d1141cea1f1f91f51f4f 100644 --- a/src/sampling/sampledSet/writers/raw/rawSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/raw/rawSetWriterRunTime.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/vtk/vtkSetWriter.C b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C similarity index 98% rename from src/sampling/sampledSet/writers/vtk/vtkSetWriter.C rename to src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C index b865e704d496dda72bb67ef8ec24b9771ac42fea..3ab273617500d74d57bea3b7d7f677e9ce00cc7c 100644 --- a/src/sampling/sampledSet/writers/vtk/vtkSetWriter.C +++ b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/vtk/vtkSetWriter.H b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/vtk/vtkSetWriter.H rename to src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.H index 9507fd1dc78f59618c20489cfccc480fc98a4a43..21bd80ef1e7dad0c5c49c911cdf9a09152b1e684 100644 --- a/src/sampling/sampledSet/writers/vtk/vtkSetWriter.H +++ b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/vtk/vtkSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/vtk/vtkSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/vtk/vtkSetWriterRunTime.C index 3c30764d86abf2bffd75745f2845ccc13cb1f533..e9320e5b5589bbeaee00f80c7f0b110214ee83cc 100644 --- a/src/sampling/sampledSet/writers/vtk/vtkSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriterRunTime.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/writer.C b/src/fileFormats/sampledSetWriters/writer.C similarity index 99% rename from src/sampling/sampledSet/writers/writer.C rename to src/fileFormats/sampledSetWriters/writer.C index 69dbdec6fe7a14c5b7ec1c5834682b8f6396a316..e031615ff69acc407599b1917d1964cba6cd472a 100644 --- a/src/sampling/sampledSet/writers/writer.C +++ b/src/fileFormats/sampledSetWriters/writer.C @@ -166,7 +166,6 @@ void Foam::writer<Type>::write { valueSetPtrs[i] = &valueSets[i]; } - write(points, valueSetNames, valueSetPtrs, os); } diff --git a/src/sampling/sampledSet/writers/writer.H b/src/fileFormats/sampledSetWriters/writer.H similarity index 100% rename from src/sampling/sampledSet/writers/writer.H rename to src/fileFormats/sampledSetWriters/writer.H diff --git a/src/sampling/sampledSet/writers/writers.C b/src/fileFormats/sampledSetWriters/writers.C similarity index 96% rename from src/sampling/sampledSet/writers/writers.C rename to src/fileFormats/sampledSetWriters/writers.C index 2815bcda039f04011815a281b1d5561d244b3cd1..4bcc1b39b28b1911509a8d76a90caad28bb200c2 100644 --- a/src/sampling/sampledSet/writers/writers.C +++ b/src/fileFormats/sampledSetWriters/writers.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/writers.H b/src/fileFormats/sampledSetWriters/writers.H similarity index 97% rename from src/sampling/sampledSet/writers/writers.H rename to src/fileFormats/sampledSetWriters/writers.H index 3adaab13fa028985d3a0552121aa6aa064a62df1..601e7bcd16108f6be6d2e74d9fb524dee6ea62b2 100644 --- a/src/sampling/sampledSet/writers/writers.H +++ b/src/fileFormats/sampledSetWriters/writers.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriter.C b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C similarity index 98% rename from src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriter.C rename to src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C index 9cc44a10c38e15963fc5979711b33f0ab85bc80e..3825868196d4c6c7b256c541c3b5649b8daf5d56 100644 --- a/src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriter.C +++ b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriter.H b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriter.H rename to src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.H index 8e8dc67ead500e2859613b6cc9c57b1f0f96bfcc..47c36289366591a65af2a14bc0da1247c89a1e6c 100644 --- a/src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriter.H +++ b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriterRunTime.C index 8e7ab61c8e2bc2b0ad489c22050c107a3c93b77a..583855fc8331b54844b07bf1bb069106e3ee11dd 100644 --- a/src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriterRunTime.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index cdd6a185733bd9fb2c17e089076c27d91fdefeb1..b982734e8bc4d6ddd8a631a61e3342db949e4973 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -311,7 +311,7 @@ $(ddtSchemes)/localEulerDdtScheme/localEulerDdtSchemes.C $(ddtSchemes)/backwardDdtScheme/backwardDdtSchemes.C $(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C $(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C -$(ddtSchemes)/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C +$(ddtSchemes)/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C $(ddtSchemes)/boundedDdtScheme/boundedDdtSchemes.C d2dt2Schemes = finiteVolume/d2dt2Schemes diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C index e1d2a1f11e15653966d52f6b9e246455aa689622..9d111be38073b67ea9110d9d0de5bad1161a2410 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C @@ -39,7 +39,7 @@ Foam::MRFZoneList::MRFZoneList { reset(dict); - active(); + active(true); } @@ -51,7 +51,7 @@ Foam::MRFZoneList::~MRFZoneList() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::MRFZoneList::active() const +bool Foam::MRFZoneList::active(const bool warn) const { bool a = false; forAll(*this, i) @@ -59,7 +59,7 @@ bool Foam::MRFZoneList::active() const a = a || this->operator[](i).active(); } - if (!a) + if (warn && this->size() && !a) { Info<< " No MRF zones active" << endl; } diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H index e956f6e0e05c2965b8f090a2a99cbab2ba7aa0eb..a2311c52c892686f445fdbbafc4efc919539c4fb 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H @@ -88,7 +88,7 @@ public: // Member Functions //- Return active status - bool active() const; + bool active(const bool warn = false) const; //- Reset the source list void reset(const dictionary& dict); diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C index 9cccc1f7f4057230fe1bfbb5bb5674419c23b22d..df3028547cb2c9e835cb4727af38cb90f6f7e24d 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C @@ -38,6 +38,8 @@ Foam::porosityModelList::porosityModelList mesh_(mesh) { reset(dict); + + active(true); } @@ -49,7 +51,7 @@ Foam::porosityModelList::~porosityModelList() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::porosityModelList::active() const +bool Foam::porosityModelList::active(const bool warn) const { bool a = false; forAll(*this, i) @@ -57,7 +59,7 @@ bool Foam::porosityModelList::active() const a = a || this->operator[](i).active(); } - if (!a) + if (warn && this->size() && !a) { Info<< "No porosity models active" << endl; } diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H index e580a2d0fadd7c46a0df99d1acc83f4c00e203a0..3d0d015923957f2923eebed5e7625c74acb9bdab 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H @@ -88,7 +88,7 @@ public: // Member Functions //- Return active status - bool active() const; + bool active(const bool active = false) const; //- Reset the source list void reset(const dictionary& dict); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C index 5764676b2a896686cbf4a85d6faf8605b1807608..86c7aaa146310fe6be44602c9ad9fe041e1ad52a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C @@ -28,7 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "volFields.H" #include "EulerDdtScheme.H" -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "backwardDdtScheme.H" @@ -229,7 +229,7 @@ void Foam::advectiveFvPatchField<Type>::updateCoeffs() if ( ddtScheme == fv::EulerDdtScheme<scalar>::typeName - || ddtScheme == fv::CrankNicholsonDdtScheme<scalar>::typeName + || ddtScheme == fv::CrankNicolsonDdtScheme<scalar>::typeName ) { this->refValue() = @@ -266,7 +266,7 @@ void Foam::advectiveFvPatchField<Type>::updateCoeffs() if ( ddtScheme == fv::EulerDdtScheme<scalar>::typeName - || ddtScheme == fv::CrankNicholsonDdtScheme<scalar>::typeName + || ddtScheme == fv::CrankNicolsonDdtScheme<scalar>::typeName ) { this->refValue() = field.oldTime().boundaryField()[patchi]; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.H index 5c62df1049fee116021c0d744b2751ab70533425..3b4e0f1b5c2d8e686c2648d80450bdd2562ec3d2 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.H @@ -31,7 +31,7 @@ Description This boundary condition provides an advective outflow condition, based on solving DDt(psi, U) = 0 at the boundary. - The standard (Euler, backward, CrankNicholson) time schemes are + The standard (Euler, backward, CrankNicolson) time schemes are supported. Additionally an optional mechanism to relax the value at the boundary to a specified far-field value is provided which is switched on by specifying the relaxation length-scale \c lInf and the diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C index 9ef4be21a407f055c7f5831627e1e14a4120e49f..c9d6e367cc8f9035481031807d2dc44510c37432 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C @@ -62,8 +62,25 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField ) : jumpCyclicFvPatchField<Type>(p, iF), - jump_("jump", dict, p.size()) -{} + jump_(p.size(), pTraits<Type>::zero) +{ + if (this->cyclicPatch().owner()) + { + jump_ = Field<Type>("jump", dict, p.size()); + } + + if (dict.found("value")) + { + fvPatchField<Type>::operator= + ( + Field<Type>("value", dict, p.size()) + ); + } + else + { + this->evaluate(Pstream::blocking); + } +} template<class Type> @@ -140,7 +157,12 @@ void Foam::fixedJumpFvPatchField<Type>::write(Ostream& os) const fvPatchField<Type>::write(os); os.writeKeyword("patchType") << this->interfaceFieldType() << token::END_STATEMENT << nl; - jump_.writeEntry("jump", os); + + if (this->cyclicPatch().owner()) + { + jump_.writeEntry("jump", os); + } + this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C index 4c3290cf2d7e1d5a8b4c5006cd9c69601bab82fe..cc9717ffac9736ea2fcbebc77de604206835d2f6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C @@ -62,8 +62,25 @@ Foam::fixedJumpAMIFvPatchField<Type>::fixedJumpAMIFvPatchField ) : jumpCyclicAMIFvPatchField<Type>(p, iF), - jump_("jump", dict, p.size()) -{} + jump_(p.size(), pTraits<Type>::zero) +{ + if (this->cyclicAMIPatch().owner()) + { + jump_ = Field<Type>("jump", dict, p.size()); + } + + if (dict.found("value")) + { + fvPatchField<Type>::operator= + ( + Field<Type>("value", dict, p.size()) + ); + } + else + { + this->evaluate(Pstream::blocking); + } +} template<class Type> @@ -143,7 +160,12 @@ void Foam::fixedJumpAMIFvPatchField<Type>::write(Ostream& os) const fvPatchField<Type>::write(os); os.writeKeyword("patchType") << this->interfaceFieldType() << token::END_STATEMENT << nl; - jump_.writeEntry("jump", os); + + if (this->cyclicAMIPatch().owner()) + { + jump_.writeEntry("jump", os); + } + this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C index 2d0c3d4735908ebaa99bc81fba83a38d9f8aa449..9ce17a2025eb251598ac6600470859b15625bb54 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,8 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(p, iF), phiName_("phi"), - rhoName_("rho") + rhoName_("rho"), + UName_("U") { refValue() = *this; refGrad() = vector::zero; @@ -60,7 +61,8 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(ptf, p, iF, mapper), phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_) + rhoName_(ptf.rhoName_), + UName_(ptf.UName_) {} @@ -74,7 +76,8 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(p, iF), phiName_(dict.lookupOrDefault<word>("phi", "phi")), - rhoName_(dict.lookupOrDefault<word>("rho", "rho")) + rhoName_(dict.lookupOrDefault<word>("rho", "rho")), + UName_(dict.lookupOrDefault<word>("U", "U")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); refValue() = *this; @@ -91,7 +94,8 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(pivpvf), phiName_(pivpvf.phiName_), - rhoName_(pivpvf.rhoName_) + rhoName_(pivpvf.rhoName_), + UName_(pivpvf.UName_) {} @@ -104,7 +108,8 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(pivpvf, iF), phiName_(pivpvf.phiName_), - rhoName_(pivpvf.rhoName_) + rhoName_(pivpvf.rhoName_), + UName_(pivpvf.UName_) {} @@ -128,7 +133,7 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs() tmp<vectorField> n = patch().nf(); const Field<scalar>& magS = patch().magSf(); - const volVectorField& U = db().lookupObject<volVectorField>("U"); + const volVectorField& U = db().lookupObject<volVectorField>(UName_); vectorField Uc(U.boundaryField()[patchI].patchInternalField()); Uc -= n()*(Uc & n()); @@ -169,8 +174,9 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::write ) const { fvPatchVectorField::write(os); - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); + writeEntryIfDifferent<word>(os, "U", "U", UName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H index f1f2f3a9d3325ad0bf989a056ec46999a0660756..5a485362d59ccef07936cb892b5fa6199c1fc10d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H @@ -41,6 +41,7 @@ Description Property | Description | Required | Default value phi | flux field name | no | phi rho | density field name | no | rho + U | velocity field name | no | U \endtable Example of the boundary condition specification: @@ -48,8 +49,6 @@ Description myPatch { type pressureInletOutletParSlipVelocity; - phi phi; - rho rho; value uniform 0; } \endverbatim @@ -96,6 +95,9 @@ class pressureInletOutletParSlipVelocityFvPatchVectorField //- Density field name word rhoName_; + //- Velocity field name + word UName_; + public: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index fbfc5eb96a48b49e6d31e4343386dc6eb0a91330..f613a7e6a2c13e47c86947d186d18bd5e3cbefe7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -53,7 +53,7 @@ timeVaryingMappedFixedValueFvPatchField endSampleTime_(-1), endSampledValues_(0), endAverage_(pTraits<Type>::zero), - offSet_() + offset_() {} @@ -79,7 +79,7 @@ timeVaryingMappedFixedValueFvPatchField endSampleTime_(-1), endSampledValues_(0), endAverage_(pTraits<Type>::zero), - offSet_() + offset_(ptf.offset_().clone().ptr()) {} @@ -104,7 +104,7 @@ timeVaryingMappedFixedValueFvPatchField endSampleTime_(-1), endSampledValues_(0), endAverage_(pTraits<Type>::zero), - offSet_(DataEntry<Type>::New("offSet", dict)) + offset_(DataEntry<Type>::New("offset", dict)) { dict.readIfPresent("fieldTableName", fieldTableName_); @@ -138,7 +138,7 @@ timeVaryingMappedFixedValueFvPatchField endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), endAverage_(ptf.endAverage_), - offSet_(ptf.offSet_().clone().ptr()) + offset_(ptf.offset_().clone().ptr()) {} @@ -163,7 +163,7 @@ timeVaryingMappedFixedValueFvPatchField endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), endAverage_(ptf.endAverage_), - offSet_(ptf.offSet_().clone().ptr()) + offset_(ptf.offset_().clone().ptr()) {} @@ -487,7 +487,7 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::updateCoeffs() // apply offset to mapped values const scalar t = this->db().time().timeOutputValue(); - this->operator==(*this + offSet_->value(t)); + this->operator==(*this + offset_->value(t)); if (debug) { @@ -512,7 +512,7 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::write(Ostream& os) const << token::END_STATEMENT << nl; } - offSet_->writeData(os); + offset_->writeData(os); this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H index 01e61301eb15d89c1c6ecae4125ac017618b678f..aec6c322b982ab265adae64eaee149e9ec0b7b93 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H @@ -132,7 +132,7 @@ class timeVaryingMappedFixedValueFvPatchField Type endAverage_; //- Time varying offset values to interpolated data - autoPtr<DataEntry<Type> > offSet_; + autoPtr<DataEntry<Type> > offset_; public: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C index 06f4e3c13457a484a4d525cdb5e645818099d090..0670119ab0cee9d0cb147564ace121a063c39860 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C @@ -73,6 +73,10 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField { fvPatchField<Type>::operator=(Field<Type>("value", dict, p.size())); } + else + { + this->evaluate(Pstream::blocking); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C index 81498552352f61f2f21f046d5c9cd5c886fc0743..9451e4bc269f97fc35a8be5b1eee7964a3e864e0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C @@ -30,7 +30,7 @@ License #include "surfaceFields.H" #include "uniformDimensionedFields.H" #include "EulerDdtScheme.H" -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "backwardDdtScheme.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -45,7 +45,7 @@ namespace Foam >::names[] = { fv::EulerDdtScheme<scalar>::typeName_(), - fv::CrankNicholsonDdtScheme<scalar>::typeName_(), + fv::CrankNicolsonDdtScheme<scalar>::typeName_(), fv::backwardDdtScheme<scalar>::typeName_() }; } @@ -183,7 +183,7 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs() switch (timeScheme) { case tsEuler: - case tsCrankNicholson: + case tsCrankNicolson: { zetap = zeta.oldTime().boundaryField()[patchI] + dZetap; @@ -197,7 +197,7 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs() scalar c00 = dt*dt/(dt0*(dt + dt0)); scalar c0 = c + c00; - zetap = + zetap = ( c0*zeta.oldTime().boundaryField()[patchI] - c00*zeta.oldTime().oldTime().boundaryField()[patchI] @@ -239,7 +239,7 @@ void Foam::waveSurfacePressureFvPatchScalarField::write(Ostream& os) const fvPatchScalarField::write(os); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); writeEntryIfDifferent<word>(os, "zeta", "zeta", zetaName_); - writeEntryIfDifferent<word>(os, "rho", "rho", zetaName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H index 3babe28eff8bf90ea5801cd5c5d9669aa1d9765f..858c6f690cf727ac4d624c84ca2253629e3a9d9e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H @@ -45,7 +45,7 @@ Description local volumetric flux. \heading Patch usage - + \table Property | Description | Required | Default value phi | flux field name | no | phi @@ -103,7 +103,7 @@ public: enum timeSchemeType { tsEuler, - tsCrankNicholson, + tsCrankNicolson, tsBackward }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C index 00bd7e339f46af087cf47f58c55fb2775265e9ed..ca19c5d8abc386d06b8313ff7971c82b9e00cc0a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C @@ -28,7 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "volFields.H" #include "EulerDdtScheme.H" -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "backwardDdtScheme.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.H index 867951946c94881c08901d74359efeccbff7ea86..52401609fab97c38f3aecba22b1ddb5b239df2e0 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,7 +31,7 @@ Description does not exceed the specified value. This scheme should only be used for steady-state computations - using transient codes where local time-stepping is preferably to + using transient codes where local time-stepping is preferable to under-relaxation for transport consistency reasons. SourceFiles diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C similarity index 95% rename from src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C rename to src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C index dfd7c878ff8a445b581f91604c656cf4a5af9224..53d106a75d3896cc2e2563f1fb168edf7f7a2c7b 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "surfaceInterpolate.H" #include "fvcDiv.H" #include "fvMatrices.H" @@ -42,7 +42,7 @@ namespace fv template<class Type> template<class GeoField> -CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field +CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field ( const IOobject& io, const fvMesh& mesh @@ -60,7 +60,7 @@ CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field template<class Type> template<class GeoField> -CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field +CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field ( const IOobject& io, const fvMesh& mesh, @@ -74,7 +74,7 @@ CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field template<class Type> template<class GeoField> -label CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>:: +label CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>:: startTimeIndex() const { return startTimeIndex_; @@ -83,7 +83,7 @@ startTimeIndex() const template<class Type> template<class GeoField> -GeoField& CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>:: +GeoField& CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>:: operator()() { return *this; @@ -92,7 +92,7 @@ operator()() template<class Type> template<class GeoField> -void CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>:: +void CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>:: operator=(const GeoField& gf) { GeoField::operator=(gf); @@ -101,8 +101,8 @@ operator=(const GeoField& gf) template<class Type> template<class GeoField> -CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>& -CrankNicholsonDdtScheme<Type>::ddt0_ +CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>& +CrankNicolsonDdtScheme<Type>::ddt0_ ( const word& name, const dimensionSet& dims @@ -183,7 +183,7 @@ CrankNicholsonDdtScheme<Type>::ddt0_ template<class Type> template<class GeoField> -bool CrankNicholsonDdtScheme<Type>::evaluate +bool CrankNicolsonDdtScheme<Type>::evaluate ( const DDt0Field<GeoField>& ddt0 ) const @@ -193,7 +193,7 @@ bool CrankNicholsonDdtScheme<Type>::evaluate template<class Type> template<class GeoField> -scalar CrankNicholsonDdtScheme<Type>::coef_ +scalar CrankNicolsonDdtScheme<Type>::coef_ ( const DDt0Field<GeoField>& ddt0 ) const @@ -211,7 +211,7 @@ scalar CrankNicholsonDdtScheme<Type>::coef_ template<class Type> template<class GeoField> -scalar CrankNicholsonDdtScheme<Type>::coef0_ +scalar CrankNicolsonDdtScheme<Type>::coef0_ ( const DDt0Field<GeoField>& ddt0 ) const @@ -229,7 +229,7 @@ scalar CrankNicholsonDdtScheme<Type>::coef0_ template<class Type> template<class GeoField> -dimensionedScalar CrankNicholsonDdtScheme<Type>::rDtCoef_ +dimensionedScalar CrankNicolsonDdtScheme<Type>::rDtCoef_ ( const DDt0Field<GeoField>& ddt0 ) const @@ -240,7 +240,7 @@ dimensionedScalar CrankNicholsonDdtScheme<Type>::rDtCoef_ template<class Type> template<class GeoField> -dimensionedScalar CrankNicholsonDdtScheme<Type>::rDtCoef0_ +dimensionedScalar CrankNicolsonDdtScheme<Type>::rDtCoef0_ ( const DDt0Field<GeoField>& ddt0 ) const @@ -251,7 +251,7 @@ dimensionedScalar CrankNicholsonDdtScheme<Type>::rDtCoef0_ template<class Type> template<class GeoField> -tmp<GeoField> CrankNicholsonDdtScheme<Type>::offCentre_ +tmp<GeoField> CrankNicolsonDdtScheme<Type>::offCentre_ ( const GeoField& ddt0 ) const @@ -281,7 +281,7 @@ const FieldField<fvPatchField, Type>& ff template<class Type> tmp<GeometricField<Type, fvPatchField, volMesh> > -CrankNicholsonDdtScheme<Type>::fvcDdt +CrankNicolsonDdtScheme<Type>::fvcDdt ( const dimensioned<Type>& dt ) @@ -343,7 +343,7 @@ CrankNicholsonDdtScheme<Type>::fvcDdt template<class Type> tmp<GeometricField<Type, fvPatchField, volMesh> > -CrankNicholsonDdtScheme<Type>::fvcDdt +CrankNicolsonDdtScheme<Type>::fvcDdt ( const GeometricField<Type, fvPatchField, volMesh>& vf ) @@ -432,7 +432,7 @@ CrankNicholsonDdtScheme<Type>::fvcDdt template<class Type> tmp<GeometricField<Type, fvPatchField, volMesh> > -CrankNicholsonDdtScheme<Type>::fvcDdt +CrankNicolsonDdtScheme<Type>::fvcDdt ( const dimensionedScalar& rho, const GeometricField<Type, fvPatchField, volMesh>& vf @@ -522,7 +522,7 @@ CrankNicholsonDdtScheme<Type>::fvcDdt template<class Type> tmp<GeometricField<Type, fvPatchField, volMesh> > -CrankNicholsonDdtScheme<Type>::fvcDdt +CrankNicolsonDdtScheme<Type>::fvcDdt ( const volScalarField& rho, const GeometricField<Type, fvPatchField, volMesh>& vf @@ -622,7 +622,7 @@ CrankNicholsonDdtScheme<Type>::fvcDdt template<class Type> tmp<fvMatrix<Type> > -CrankNicholsonDdtScheme<Type>::fvmDdt +CrankNicolsonDdtScheme<Type>::fvmDdt ( const GeometricField<Type, fvPatchField, volMesh>& vf ) @@ -705,7 +705,7 @@ CrankNicholsonDdtScheme<Type>::fvmDdt template<class Type> tmp<fvMatrix<Type> > -CrankNicholsonDdtScheme<Type>::fvmDdt +CrankNicolsonDdtScheme<Type>::fvmDdt ( const dimensionedScalar& rho, const GeometricField<Type, fvPatchField, volMesh>& vf @@ -787,7 +787,7 @@ CrankNicholsonDdtScheme<Type>::fvmDdt template<class Type> tmp<fvMatrix<Type> > -CrankNicholsonDdtScheme<Type>::fvmDdt +CrankNicolsonDdtScheme<Type>::fvmDdt ( const volScalarField& rho, const GeometricField<Type, fvPatchField, volMesh>& vf @@ -877,8 +877,8 @@ CrankNicholsonDdtScheme<Type>::fvmDdt template<class Type> -tmp<typename CrankNicholsonDdtScheme<Type>::fluxFieldType> -CrankNicholsonDdtScheme<Type>::fvcDdtPhiCorr +tmp<typename CrankNicolsonDdtScheme<Type>::fluxFieldType> +CrankNicolsonDdtScheme<Type>::fvcDdtPhiCorr ( const volScalarField& rA, const GeometricField<Type, fvPatchField, volMesh>& U, @@ -964,8 +964,8 @@ CrankNicholsonDdtScheme<Type>::fvcDdtPhiCorr template<class Type> -tmp<typename CrankNicholsonDdtScheme<Type>::fluxFieldType> -CrankNicholsonDdtScheme<Type>::fvcDdtPhiCorr +tmp<typename CrankNicolsonDdtScheme<Type>::fluxFieldType> +CrankNicolsonDdtScheme<Type>::fvcDdtPhiCorr ( const volScalarField& rA, const volScalarField& rho, @@ -1158,7 +1158,7 @@ CrankNicholsonDdtScheme<Type>::fvcDdtPhiCorr { FatalErrorIn ( - "CrankNicholsonDdtScheme<Type>::fvcDdtPhiCorr" + "CrankNicolsonDdtScheme<Type>::fvcDdtPhiCorr" ) << "dimensions of phi are not correct" << abort(FatalError); @@ -1169,7 +1169,7 @@ CrankNicholsonDdtScheme<Type>::fvcDdtPhiCorr template<class Type> -tmp<surfaceScalarField> CrankNicholsonDdtScheme<Type>::meshPhi +tmp<surfaceScalarField> CrankNicolsonDdtScheme<Type>::meshPhi ( const GeometricField<Type, fvPatchField, volMesh>& vf ) diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.H similarity index 90% rename from src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H rename to src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.H index 7c994364015e5e8f0a3717c93ebd9405ec4ead0a..315072306c7c16539c405c1f4ad812f0f0354c6c 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.H @@ -22,19 +22,19 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::fv::CrankNicholsonDdtScheme + Foam::fv::CrankNicolsonDdtScheme Description - Second-oder CrankNicholson implicit ddt using the current and + Second-oder CrankNicolson implicit ddt using the current and previous time-step fields as well as the previous time-step ddt. SourceFiles - CrankNicholsonDdtScheme.C + CrankNicolsonDdtScheme.C \*---------------------------------------------------------------------------*/ -#ifndef CrankNicholsonDdtScheme_H -#define CrankNicholsonDdtScheme_H +#ifndef CrankNicolsonDdtScheme_H +#define CrankNicolsonDdtScheme_H #include "ddtScheme.H" @@ -49,11 +49,11 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class CrankNicholsonDdtScheme Declaration + Class CrankNicolsonDdtScheme Declaration \*---------------------------------------------------------------------------*/ template<class Type> -class CrankNicholsonDdtScheme +class CrankNicolsonDdtScheme : public fv::ddtScheme<Type> { @@ -105,10 +105,10 @@ class CrankNicholsonDdtScheme // Private Member Functions //- Disallow default bitwise copy construct - CrankNicholsonDdtScheme(const CrankNicholsonDdtScheme&); + CrankNicolsonDdtScheme(const CrankNicolsonDdtScheme&); //- Disallow default bitwise assignment - void operator=(const CrankNicholsonDdtScheme&); + void operator=(const CrankNicolsonDdtScheme&); template<class GeoField> DDt0Field<GeoField>& ddt0_ @@ -149,20 +149,20 @@ class CrankNicholsonDdtScheme public: //- Runtime type information - TypeName("CrankNicholson"); + TypeName("CrankNicolson"); // Constructors //- Construct from mesh - CrankNicholsonDdtScheme(const fvMesh& mesh) + CrankNicolsonDdtScheme(const fvMesh& mesh) : ddtScheme<Type>(mesh), ocCoeff_(1.0) {} //- Construct from mesh and Istream - CrankNicholsonDdtScheme(const fvMesh& mesh, Istream& is) + CrankNicolsonDdtScheme(const fvMesh& mesh, Istream& is) : ddtScheme<Type>(mesh, is), ocCoeff_(readScalar(is)) @@ -171,7 +171,7 @@ public: { FatalIOErrorIn ( - "CrankNicholsonDdtScheme(const fvMesh& mesh, Istream& is)", + "CrankNicolsonDdtScheme(const fvMesh& mesh, Istream& is)", is ) << "coefficient = " << ocCoeff_ << " should be >= 0 and <= 1" @@ -253,7 +253,7 @@ public: template<> -tmp<surfaceScalarField> CrankNicholsonDdtScheme<scalar>::fvcDdtPhiCorr +tmp<surfaceScalarField> CrankNicolsonDdtScheme<scalar>::fvcDdtPhiCorr ( const volScalarField& rA, const volScalarField& U, @@ -262,7 +262,7 @@ tmp<surfaceScalarField> CrankNicholsonDdtScheme<scalar>::fvcDdtPhiCorr template<> -tmp<surfaceScalarField> CrankNicholsonDdtScheme<scalar>::fvcDdtPhiCorr +tmp<surfaceScalarField> CrankNicolsonDdtScheme<scalar>::fvcDdtPhiCorr ( const volScalarField& rA, const volScalarField& rho, @@ -282,7 +282,7 @@ tmp<surfaceScalarField> CrankNicholsonDdtScheme<scalar>::fvcDdtPhiCorr // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "CrankNicholsonDdtScheme.C" +# include "CrankNicolsonDdtScheme.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C similarity index 94% rename from src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C rename to src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C index 2b101831a33b5d2368afaa22c7b46c78ed9004da..3166243a9cc8a4053b803c06760f9959d87d21d2 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "fvMesh.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -32,7 +32,7 @@ namespace Foam { namespace fv { - makeFvDdtScheme(CrankNicholsonDdtScheme) + makeFvDdtScheme(CrankNicolsonDdtScheme) } } diff --git a/src/finiteVolume/finiteVolume/fvm/fvm.H b/src/finiteVolume/finiteVolume/fvm/fvm.H index 2f7ba08f03e9443b0694ac73a5a7ce2663020dd1..b1363a11aeb0775b20f5015780e5006e003fabab 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvm.H +++ b/src/finiteVolume/finiteVolume/fvm/fvm.H @@ -29,7 +29,7 @@ Description matrix. Temporal derivatives are calculated using Euler-implicit, backward - differencing or Crank-Nicholson. Spatial derivatives are calculated + differencing or Crank-Nicolson. Spatial derivatives are calculated using Gauss' Theorem. diff --git a/src/fvMotionSolver/Make/options b/src/fvMotionSolver/Make/options index fa13513b50fbf34e09087c06eb56bc413d357a5e..29e4469610118cb4f0468cba7f80f5aacbf7a1fd 100644 --- a/src/fvMotionSolver/Make/options +++ b/src/fvMotionSolver/Make/options @@ -3,7 +3,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \ LIB_LIBS = \ @@ -11,4 +11,5 @@ LIB_LIBS = \ -lmeshTools \ -ldynamicMesh \ -lfiniteVolume \ + -lfileFormats /*-lforces include in controlDict if needed */ diff --git a/src/lagrangian/coalCombustion/Make/options b/src/lagrangian/coalCombustion/Make/options index 34a2babd735d8e8a6b2e69c447755c3660058595..0d7eb0e13ba648b92847e780c1bed3fa70b8e7c2 100644 --- a/src/lagrangian/coalCombustion/Make/options +++ b/src/lagrangian/coalCombustion/Make/options @@ -17,8 +17,7 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/dynamicFvMesh/lnInclude LIB_LIBS = \ -lfiniteVolume \ @@ -42,5 +41,4 @@ LIB_LIBS = \ -lincompressibleTransportModels \ -lregionModels \ -lsurfaceFilmModels \ - -ldynamicFvMesh \ - -lsampling + -ldynamicFvMesh diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 58217adbf55b736182d6c5942ae348426bb147ef..7ec52b1ee8ad96fb81cd43dd8093ebe4f8b6f63f 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -326,7 +326,7 @@ bool Foam::KinematicParcel<ParcelType>::move p.age() += dt; - td.cloud().functions().postMove(p, cellI, dt); + td.cloud().functions().postMove(p, cellI, dt, td.keepParticle); } return td.keepParticle; @@ -340,7 +340,7 @@ void Foam::KinematicParcel<ParcelType>::hitFace(TrackData& td) typename TrackData::cloudType::parcelType& p = static_cast<typename TrackData::cloudType::parcelType&>(*this); - td.cloud().functions().postFace(p, p.face()); + td.cloud().functions().postFace(p, p.face(), td.keepParticle); } @@ -364,7 +364,14 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch static_cast<typename TrackData::cloudType::parcelType&>(*this); // Invoke post-processing model - td.cloud().functions().postPatch(p, pp, trackFraction, tetIs); + td.cloud().functions().postPatch + ( + p, + pp, + trackFraction, + tetIs, + td.keepParticle + ); // Invoke surface film model if (td.cloud().surfaceFilm().transferParcel(p, pp, td.keepParticle)) diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H index 9e19beae3498a11eba4646ae707fbfe1b6083001..783878f4800683e15a785d2dddc3b2f69ff4b6ba 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,6 +29,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "FacePostProcessing.H" +#include "ParticleCollector.H" #include "ParticleErosion.H" #include "ParticleTracks.H" #include "ParticleTrap.H" @@ -42,6 +43,7 @@ License makeCloudFunctionObject(CloudType); \ \ makeCloudFunctionObjectType(FacePostProcessing, CloudType); \ + makeCloudFunctionObjectType(ParticleCollector, CloudType); \ makeCloudFunctionObjectType(ParticleErosion, CloudType); \ makeCloudFunctionObjectType(ParticleTracks, CloudType); \ makeCloudFunctionObjectType(ParticleTrap, CloudType); \ diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C index dbc359ae9a582ddee6d43be0c4efb5ad1f46431e..5a208a4ca86e388a99284e8b3848c72569ad8996 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C @@ -96,7 +96,8 @@ void Foam::CloudFunctionObject<CloudType>::postMove ( const typename CloudType::parcelType&, const label, - const scalar + const scalar, + bool& ) { // do nothing @@ -109,7 +110,8 @@ void Foam::CloudFunctionObject<CloudType>::postPatch const typename CloudType::parcelType&, const polyPatch&, const scalar, - const tetIndices& + const tetIndices&, + bool& ) { // do nothing @@ -120,7 +122,8 @@ template<class CloudType> void Foam::CloudFunctionObject<CloudType>::postFace ( const typename CloudType::parcelType&, - const label + const label, + bool& ) { // do nothing diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H index 5baf0f7ae95fd82cfcc635db6c84e47633c162b1..976fd3867fff2efadf98f5b144a4df23b1899f48 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H @@ -46,6 +46,9 @@ SourceFiles namespace Foam { +class polyPatch; +class tetIndices; + /*---------------------------------------------------------------------------*\ Class CloudFunctionObject Declaration \*---------------------------------------------------------------------------*/ @@ -134,7 +137,8 @@ public: ( const typename CloudType::parcelType& p, const label cellI, - const scalar dt + const scalar dt, + bool& keepParticle ); //- Post-patch hook @@ -143,14 +147,16 @@ public: const typename CloudType::parcelType& p, const polyPatch& pp, const scalar trackFraction, - const tetIndices& testIs + const tetIndices& testIs, + bool& keepParticle ); //- Post-face hook virtual void postFace ( const typename CloudType::parcelType& p, - const label faceI + const label faceI, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C index 2f97468e36c15e6e191228c9b288b711049915f9..e0d57b60570e1cf923f2f3050fbf056d571c166f 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C @@ -132,12 +132,18 @@ void Foam::CloudFunctionObjectList<CloudType>::postMove ( const typename CloudType::parcelType& p, const label cellI, - const scalar dt + const scalar dt, + bool& keepParticle ) { forAll(*this, i) { - this->operator[](i).postMove(p, cellI, dt); + this->operator[](i).postMove(p, cellI, dt, keepParticle); + + if (!keepParticle) + { + return; + } } } @@ -148,12 +154,25 @@ void Foam::CloudFunctionObjectList<CloudType>::postPatch const typename CloudType::parcelType& p, const polyPatch& pp, const scalar trackFraction, - const tetIndices& tetIs + const tetIndices& tetIs, + bool& keepParticle ) { forAll(*this, i) { - this->operator[](i).postPatch(p, pp, trackFraction, tetIs); + this->operator[](i).postPatch + ( + p, + pp, + trackFraction, + tetIs, + keepParticle + ); + + if (!keepParticle) + { + return; + } } } @@ -162,12 +181,18 @@ template<class CloudType> void Foam::CloudFunctionObjectList<CloudType>::postFace ( const typename CloudType::parcelType& p, - const label faceI + const label faceI, + bool& keepParticle ) { forAll(*this, i) { - this->operator[](i).postFace(p, faceI); + this->operator[](i).postFace(p, faceI, keepParticle); + + if (!keepParticle) + { + return; + } } } diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H index 5daeab9f297249b120877c75594c01555c659725..de9c3afc025a28e9b0bf945bdffe3cfc9058b601 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H @@ -114,7 +114,8 @@ public: ( const typename CloudType::parcelType& p, const label cellI, - const scalar dt + const scalar dt, + bool& keepParticle ); //- Post-patch hook @@ -123,14 +124,16 @@ public: const typename CloudType::parcelType& p, const polyPatch& pp, const scalar trackFraction, - const tetIndices& tetIs + const tetIndices& tetIs, + bool& keepParticle ); //- Post-face hook virtual void postFace ( const typename CloudType::parcelType& p, - const label faceI + const label faceI, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C index ae02927bbdba1e53fd8f51eec3245f3640170103..8c64e1b62fef66bfaed86e6f48f2c0ede8c40dcb 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -133,7 +133,7 @@ void Foam::FacePostProcessing<CloudType>::write() { OFstream& os = outputFilePtr_[zoneI]; os << time.timeName() << token::TAB << sumMassTotal << token::TAB - << sumMassFlowRate<< endl; + << sumMassFlowRate<< endl; } } @@ -376,7 +376,8 @@ template<class CloudType> void Foam::FacePostProcessing<CloudType>::postFace ( const parcelType& p, - const label faceI + const label faceI, + bool& ) { if diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H index 06387d234b26d1a99bb2b29262b8704af877fc28..3195b9fc575df39227da5c6a226edc4727d3007a 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H @@ -160,7 +160,8 @@ public: virtual void postFace ( const parcelType& p, - const label faceI + const label faceI, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C new file mode 100644 index 0000000000000000000000000000000000000000..06f836a3d5740d29ebc38d730ae8d16497a424ea --- /dev/null +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C @@ -0,0 +1,677 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "ParticleCollector.H" +#include "Pstream.H" +#include "surfaceWriter.H" +#include "unitConversion.H" +#include "Random.H" +#include "triangle.H" +#include "cloud.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<class CloudType> +void Foam::ParticleCollector<CloudType>::makeLogFile +( + const faceList& faces, + const Field<point>& points, + const Field<scalar>& area +) +{ + // Create the output file if not already created + if (log_) + { + if (debug) + { + Info<< "Creating output file" << endl; + } + + if (Pstream::master()) + { + const fileName logDir = outputDir_/this->owner().time().timeName(); + + // Create directory if does not exist + mkDir(logDir); + + // Open new file at start up + outputFilePtr_.reset + ( + new OFstream(logDir/(type() + ".dat")) + ); + + outputFilePtr_() + << "# Source : " << type() << nl + << "# Total area : " << sum(area) << nl + << "# Time"; + + forAll(faces, i) + { + word id = Foam::name(i); + + outputFilePtr_() + << tab << "area[" << id << "]" + << tab << "mass[" << id << "]" + << tab << "massFlowRate[" << id << "]" + << endl; + } + } + } +} + + +template<class CloudType> +void Foam::ParticleCollector<CloudType>::initPolygons() +{ + mode_ = mtPolygon; + + List<Field<point> > polygons(this->coeffDict().lookup("polygons")); + label nPoints = 0; + forAll(polygons, polyI) + { + label np = polygons[polyI].size(); + if (np < 3) + { + FatalIOErrorIn + ( + "Foam::ParticleCollector<CloudType>::initPolygons()", + this->coeffDict() + ) + << "polygons must consist of at least 3 points" + << exit(FatalIOError); + } + + nPoints += np; + } + + label pointOffset = 0; + points_.setSize(nPoints); + faces_.setSize(polygons.size()); + faceTris_.setSize(polygons.size()); + area_.setSize(polygons.size()); + forAll(faces_, faceI) + { + const Field<point>& polyPoints = polygons[faceI]; + face f(identity(polyPoints.size()) + pointOffset); + UIndirectList<point>(points_, f) = polyPoints; + area_[faceI] = f.mag(points_); + + DynamicList<face> tris; + f.triangles(points_, tris); + faceTris_[faceI].transfer(tris); + + faces_[faceI].transfer(f); + + pointOffset += polyPoints.size(); + } +} + + +template<class CloudType> +void Foam::ParticleCollector<CloudType>::initConcentricCircles() +{ + mode_ = mtConcentricCircle; + + vector origin(this->coeffDict().lookup("origin")); + + radius_ = this->coeffDict().lookup("radius"); + nSector_ = readLabel(this->coeffDict().lookup("nSector")); + + label nS = nSector_; + + vector refDir; + if (nSector_ > 1) + { + refDir = this->coeffDict().lookup("refDir"); + refDir -= normal_*(normal_ & refDir); + refDir /= mag(refDir); + } + else + { + // set 4 quadrants for single sector cases + nS = 4; + + vector tangent = vector::zero; + scalar magTangent = 0.0; + + Random rnd(1234); + while (magTangent < SMALL) + { + vector v = rnd.vector01(); + + tangent = v - (v & normal_)*normal_; + magTangent = mag(tangent); + } + + refDir = tangent/magTangent; + } + + scalar dTheta = 5.0; + scalar dThetaSector = 360.0/scalar(nS); + label intervalPerSector = max(1, ceil(dThetaSector/dTheta)); + dTheta = dThetaSector/scalar(intervalPerSector); + + label nPointPerSector = intervalPerSector + 1; + + label nPointPerRadius = nS*(nPointPerSector - 1); + label nPoint = radius_.size()*nPointPerRadius; + label nFace = radius_.size()*nS; + + // add origin + nPoint++; + + points_.setSize(nPoint); + faces_.setSize(nFace); + area_.setSize(nFace); + + coordSys_ = cylindricalCS("coordSys", origin, normal_, refDir, false); + + List<label> ptIDs(identity(nPointPerRadius)); + + points_[0] = origin; + + // points + forAll(radius_, radI) + { + label pointOffset = radI*nPointPerRadius + 1; + + for (label i = 0; i < nPointPerRadius; i++) + { + label pI = i + pointOffset; + point pCyl(radius_[radI], degToRad(i*dTheta), 0.0); + points_[pI] = coordSys_.globalPosition(pCyl); + } + } + + // faces + DynamicList<label> facePts(2*nPointPerSector); + forAll(radius_, radI) + { + if (radI == 0) + { + for (label secI = 0; secI < nS; secI++) + { + facePts.clear(); + + // append origin point + facePts.append(0); + + for (label ptI = 0; ptI < nPointPerSector; ptI++) + { + label i = ptI + secI*(nPointPerSector - 1); + label id = ptIDs.fcIndex(i - 1) + 1; + facePts.append(id); + } + + label faceI = secI + radI*nS; + + faces_[faceI] = face(facePts); + area_[faceI] = faces_[faceI].mag(points_); + } + } + else + { + for (label secI = 0; secI < nS; secI++) + { + facePts.clear(); + + label offset = (radI - 1)*nPointPerRadius + 1; + + for (label ptI = 0; ptI < nPointPerSector; ptI++) + { + label i = ptI + secI*(nPointPerSector - 1); + label id = offset + ptIDs.fcIndex(i - 1); + facePts.append(id); + } + for (label ptI = nPointPerSector-1; ptI >= 0; ptI--) + { + label i = ptI + secI*(nPointPerSector - 1); + label id = offset + nPointPerRadius + ptIDs.fcIndex(i - 1); + facePts.append(id); + } + + label faceI = secI + radI*nS; + + faces_[faceI] = face(facePts); + area_[faceI] = faces_[faceI].mag(points_); + } + } + } +} + + +template<class CloudType> +Foam::label Foam::ParticleCollector<CloudType>::collectParcelPolygon +( + const point& position, + const vector& U +) const +{ + scalar dt = this->owner().db().time().deltaTValue(); + + point end(position + dt*U); + + label dummyNearType = -1; + label dummyNearLabel = -1; + + forAll(faces_, faceI) + { + const label facePoint0 = faces_[faceI][0]; + + const point p0 = points_[facePoint0]; + + const scalar d1 = normal_ & (position - p0); + const scalar d2 = normal_ & (end - p0); + + if (sign(d1) == sign(d2)) + { + // did not cross polygon plane + continue; + } + + // intersection point + point pIntersect = position + (d1/(d1 - d2))*dt*U; + + const List<face>& tris = faceTris_[faceI]; + + // identify if point is within poly bounds + forAll(tris, triI) + { + const face& tri = tris[triI]; + triPointRef t + ( + points_[tri[0]], + points_[tri[1]], + points_[tri[2]] + ); + + if (t.classify(pIntersect, dummyNearType, dummyNearLabel)) + { + return faceI; + } + } + } + + return -1; +} + + +template<class CloudType> +Foam::label Foam::ParticleCollector<CloudType>::collectParcelConcentricCircles +( + const point& position, + const vector& U +) const +{ + label secI = -1; + + scalar dt = this->owner().db().time().deltaTValue(); + + point end(position + dt*U); + + const scalar d1 = normal_ & (position - coordSys_.origin()); + const scalar d2 = normal_ & (end - coordSys_.origin()); + + if (sign(d1) == sign(d2)) + { + // did not cross plane + return secI; + } + + // intersection point in cylindrical co-ordinate system + point pCyl = coordSys_.localPosition(position + (d1/(d1 - d2))*dt*U); + + scalar r = pCyl[0]; + + if (r < radius_.last()) + { + label radI = 0; + while (r > radius_[radI]) + { + radI++; + } + + if (nSector_ == 1) + { + secI = 4*radI; + } + else + { + scalar theta = pCyl[1] + constant::mathematical::pi; + + secI = + nSector_*radI + + floor + ( + scalar(nSector_)*theta/constant::mathematical::twoPi + ); + } + } + + return secI; +} + + +template<class CloudType> +void Foam::ParticleCollector<CloudType>::write() +{ + const fvMesh& mesh = this->owner().mesh(); + const Time& time = mesh.time(); + scalar timeNew = time.value(); + scalar timeElapsed = timeNew - timeOld_; + + totalTime_ += timeElapsed; + + const scalar alpha = (totalTime_ - timeElapsed)/totalTime_; + const scalar beta = timeElapsed/totalTime_; + + forAll(faces_, faceI) + { + massFlowRate_[faceI] = + alpha*massFlowRate_[faceI] + beta*mass_[faceI]/timeElapsed; + massTotal_[faceI] += mass_[faceI]; + } + + const label procI = Pstream::myProcNo(); + + Info<< type() << " output:" << nl; + + if (outputFilePtr_.valid()) + { + outputFilePtr_() << time.timeName(); + } + + + Field<scalar> faceMassTotal(mass_.size()); + Field<scalar> faceMassFlowRate(massFlowRate_.size()); + + forAll(faces_, faceI) + { + scalarList allProcMass(Pstream::nProcs()); + allProcMass[procI] = massTotal_[faceI]; + Pstream::gatherList(allProcMass); + faceMassTotal[faceI] = sum(allProcMass); + + scalarList allProcMassFlowRate(Pstream::nProcs()); + allProcMassFlowRate[procI] = massFlowRate_[faceI]; + Pstream::gatherList(allProcMassFlowRate); + faceMassFlowRate[faceI] = sum(allProcMassFlowRate); + + Info<< " face " << faceI + << ": total mass = " << faceMassTotal[faceI] + << "; average mass flow rate = " << faceMassFlowRate[faceI] + << nl; + + if (outputFilePtr_.valid()) + { + outputFilePtr_() + << tab << area_[faceI] + << tab << faceMassTotal[faceI] + << tab << faceMassFlowRate[faceI] + << endl; + } + } + + Info<< endl; + + + if (surfaceFormat_ != "none") + { + if (Pstream::master()) + { + autoPtr<surfaceWriter> writer(surfaceWriter::New(surfaceFormat_)); + + writer->write + ( + outputDir_/time.timeName(), + "collector", + points_, + faces_, + "massTotal", + faceMassTotal, + false + ); + + writer->write + ( + outputDir_/time.timeName(), + "collector", + points_, + faces_, + "massFlowRate", + faceMassFlowRate, + false + ); + } + } + + + if (resetOnWrite_) + { + forAll(faces_, faceI) + { + massFlowRate_[faceI] = 0.0; + } + timeOld_ = timeNew; + totalTime_ = 0.0; + } + + forAll(faces_, faceI) + { + mass_[faceI] = 0.0; + } + + // writeProperties(); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::ParticleCollector<CloudType>::ParticleCollector +( + const dictionary& dict, + CloudType& owner +) +: + CloudFunctionObject<CloudType>(dict, owner, typeName), + mode_(mtUnknown), + parcelType_(this->coeffDict().lookupOrDefault("parcelType", -1)), + removeCollected_(this->coeffDict().lookup("removeCollected")), + points_(), + faces_(), + faceTris_(), + nSector_(0), + radius_(), + coordSys_(false), + normal_(this->coeffDict().lookup("normal")), + negateParcelsOppositeNormal_ + ( + readBool(this->coeffDict().lookup("negateParcelsOppositeNormal")) + ), + surfaceFormat_(this->coeffDict().lookup("surfaceFormat")), + resetOnWrite_(this->coeffDict().lookup("resetOnWrite")), + totalTime_(0.0), + mass_(), + massTotal_(), + massFlowRate_(), + log_(this->coeffDict().lookup("log")), + outputFilePtr_(), + outputDir_(owner.mesh().time().path()), + timeOld_(owner.mesh().time().value()) +{ + if (Pstream::parRun()) + { + // Put in undecomposed case (Note: gives problems for + // distributed data running) + outputDir_ = + outputDir_/".."/"postProcessing"/cloud::prefix/owner.name(); + } + else + { + outputDir_ = + outputDir_/"postProcessing"/cloud::prefix/owner.name(); + } + + normal_ /= mag(normal_); + + word mode(this->coeffDict().lookup("mode")); + if (mode == "polygon") + { + initPolygons(); + } + else if (mode == "concentricCircle") + { + initConcentricCircles(); + } + else + { + FatalErrorIn + ( + "Foam::ParticleCollector<CloudType>::ParticleCollector" + "(" + "const dictionary& dict," + "CloudType& owner" + ")" + ) + << "Unknown mode " << mode << ". Available options are " + << "polygon and concentricCircle" << exit(FatalError); + } + + mass_.setSize(faces_.size(), 0.0); + massTotal_.setSize(faces_.size(), 0.0); + massFlowRate_.setSize(faces_.size(), 0.0); + + makeLogFile(faces_, points_, area_); + + // readProperties(); AND initialise mass... fields +} + + +template<class CloudType> +Foam::ParticleCollector<CloudType>::ParticleCollector +( + const ParticleCollector<CloudType>& pc +) +: + CloudFunctionObject<CloudType>(pc), + mode_(pc.mode_), + parcelType_(pc.parcelType_), + points_(pc.points_), + faces_(pc.faces_), + faceTris_(pc.faceTris_), + nSector_(pc.nSector_), + radius_(pc.radius_), + coordSys_(pc.coordSys_), + normal_(pc.normal_), + negateParcelsOppositeNormal_(pc.negateParcelsOppositeNormal_), + surfaceFormat_(pc.surfaceFormat_), + resetOnWrite_(pc.resetOnWrite_), + totalTime_(pc.totalTime_), + mass_(pc.mass_), + massTotal_(pc.massTotal_), + massFlowRate_(pc.massFlowRate_), + log_(pc.log_), + outputFilePtr_(), + outputDir_(pc.outputDir_), + timeOld_(0.0) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::ParticleCollector<CloudType>::~ParticleCollector() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class CloudType> +void Foam::ParticleCollector<CloudType>::postMove +( + const parcelType& p, + const label cellI, + const scalar dt, + bool& keepParticle +) +{ + if ((parcelType_ != -1) && (parcelType_ != p.typeId())) + { + return; + } + + label faceI = -1; + + switch (mode_) + { + case mtPolygon: + { + faceI = collectParcelPolygon(p.position(), p.U()); + break; + } + case mtConcentricCircle: + { + faceI = collectParcelConcentricCircles(p.position(), p.U()); + break; + } + default: + { + } + } + + if (faceI != -1) + { + scalar m = p.nParticle()*p.mass(); + + if (negateParcelsOppositeNormal_) + { + vector Uhat = p.U(); + Uhat /= mag(Uhat) + ROOTVSMALL; + if ((Uhat & normal_) < 0) + { + m *= -1.0; + } + } + + // add mass contribution + mass_[faceI] += m; + + if (nSector_ == 1) + { + mass_[faceI + 1] += m; + mass_[faceI + 2] += m; + mass_[faceI + 3] += m; + } + + if (removeCollected_) + { + keepParticle = false; + } + } +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.H new file mode 100644 index 0000000000000000000000000000000000000000..283246cfec8f1fb6ba2cf93bc10b693d9777cb8c --- /dev/null +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.H @@ -0,0 +1,259 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::ParticleCollector + +Description + Function object to collect the parcel mass- and mass flow rate over a + set of polygons. The polygons are defined as lists of points. If a + parcel is 'collected', it is subsequently flagged to be removed from the + domain. + +SourceFiles + ParticleCollector.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ParticleCollector_H +#define ParticleCollector_H + +#include "CloudFunctionObject.H" +#include "cylindricalCS.H" +#include "face.H" +#include "Switch.H" +#include "OFstream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class ParticleCollector Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class ParticleCollector +: + public CloudFunctionObject<CloudType> +{ +public: + + enum modeType + { + mtPolygon, + mtConcentricCircle, + mtUnknown + }; + + +private: + + // Private Data + + // Typedefs + + //- Convenience typedef for parcel type + typedef typename CloudType::parcelType parcelType; + + //- Collector mode type + modeType mode_; + + //- Index of parcel types to collect (-1 by default = all particles) + const label parcelType_; + + //- Flag to remove collected particles + Switch removeCollected_; + + //- List of points + Field<point> points_; + + //- List of faces + List<face> faces_; + + + // Polygon collector + + //- Triangulation of faces + List<List<face> > faceTris_; + + // Concentric circles collector + + //- Number of sectors per circle + label nSector_; + + //- List of radii + List<scalar> radius_; + + //- Cylindrical co-ordinate system + cylindricalCS coordSys_; + + + //- Face areas + Field<scalar> area_; + + //- Polygon normal vector + vector normal_; + + //- Remove mass of parcel travelling in opposite direction to normal_ + bool negateParcelsOppositeNormal_; + + //- Surface output format + const word surfaceFormat_; + + //- Flag to indicate whether data should be reset/cleared on writing + Switch resetOnWrite_; + + //- Total time + scalar totalTime_; + + //- Mass storage + List<scalar> mass_; + + //- Mass total storage + List<scalar> massTotal_; + + //- Mass flow rate storage + List<scalar> massFlowRate_; + + //- Flag to indicate whether data should be written to file + Switch log_; + + //- Output file pointer + autoPtr<OFstream> outputFilePtr_; + + //- Output directory + fileName outputDir_; + + //- Last calculation time + scalar timeOld_; + + + // Private Member Functions + + //- Helper function to create log files + void makeLogFile + ( + const faceList& faces, + const Field<point>& points, + const Field<scalar>& area + ); + + //- Initialise polygon collectors + void initPolygons(); + + //- Initialise concentric circle collectors + void initConcentricCircles(); + + //- Collect parcels in polygon collectors + label collectParcelPolygon + ( + const point& position, + const vector& U + ) const; + + //- Collect parcels in concentric circle collectors + label collectParcelConcentricCircles + ( + const point& position, + const vector& U + ) const; + + +protected: + + // Protected Member Functions + + //- Write post-processing info + void write(); + + +public: + + //- Runtime type information + TypeName("particleCollector"); + + + // Constructors + + //- Construct from dictionary + ParticleCollector(const dictionary& dict, CloudType& owner); + + //- Construct copy + ParticleCollector(const ParticleCollector<CloudType>& pc); + + //- Construct and return a clone + virtual autoPtr<CloudFunctionObject<CloudType> > clone() const + { + return autoPtr<CloudFunctionObject<CloudType> > + ( + new ParticleCollector<CloudType>(*this) + ); + } + + + //- Destructor + virtual ~ParticleCollector(); + + + // Member Functions + + // Access + + //- Return const access to the reset on write flag + inline const Switch& resetOnWrite() const; + + + // Evaluation + + //- Post-move hook + virtual void postMove + ( + const parcelType& p, + const label cellI, + const scalar dt, + bool& keepParticle + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "ParticleCollectorI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ParticleCollector.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollectorI.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollectorI.H new file mode 100644 index 0000000000000000000000000000000000000000..019deba51a6a9a918c716e33949247a5eae2202f --- /dev/null +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollectorI.H @@ -0,0 +1,34 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +inline const Foam::Switch& +Foam::ParticleCollector<CloudType>::resetOnWrite() const +{ + return resetOnWrite_; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C index 81772debfe22e2bf8722a5b9cbf465901ee383d3..c0683d0dbfe0d7e8e82541c2e9bccbf1b13da075 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C @@ -168,7 +168,8 @@ void Foam::ParticleErosion<CloudType>::postPatch const parcelType& p, const polyPatch& pp, const scalar trackFraction, - const tetIndices& tetIs + const tetIndices& tetIs, + bool& ) { const label patchI = pp.index(); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.H index c741bd40044b8df1a7a42537984b8ae321eb4f6c..bedc447188af470d5fb6ada346eb9a693fb969b1 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.H @@ -128,7 +128,8 @@ public: const parcelType& p, const polyPatch& pp, const scalar trackFraction, - const tetIndices& tetIs + const tetIndices& tetIs, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C index 9721a5a55d400106bf9c17d87224f188ac3b99c4..69f48bf5e039f3c0b898493095d9e17ad2a194ec 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C @@ -112,7 +112,8 @@ template<class CloudType> void Foam::ParticleTracks<CloudType>::postFace ( const parcelType& p, - const label + const label, + bool& ) { if diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H index 9a9939dbb25e5ac5474f2a57371e228cde979985..1eeda7bcb82facb7b37483ec488498d03a04da8c 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H @@ -143,7 +143,8 @@ public: virtual void postFace ( const parcelType& p, - const label faceI + const label faceI, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.C index f1b19bde59132264d37d9527387e16944a35de6c..0a5ff091230d3935666e3a8205a3cb645c23e8c4 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.C @@ -104,7 +104,8 @@ void Foam::ParticleTrap<CloudType>::postMove ( parcelType& p, const label cellI, - const scalar + const scalar, + bool& ) { if (alphaPtr_->internalField()[cellI] < threshold_) diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.H index 39321af3c0886a409936aaa6d0556eaf93d0d4e9..43fac16c583cd40f19de0927f9513774ccf9ac2f 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.H @@ -125,7 +125,8 @@ public: ( typename CloudType::parcelType& p, const label cellI, - const scalar dt + const scalar dt, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C index f66a872cfcf5d6ee735ba6a24cbf4b987f7af0a9..a267b86266ce4252837b10daffa9f88d561fa4ed 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C @@ -220,7 +220,8 @@ void Foam::PatchPostProcessing<CloudType>::postPatch const parcelType& p, const polyPatch& pp, const scalar, - const tetIndices& tetIs + const tetIndices& tetIs, + bool& ) { const label patchI = pp.index(); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H index f7d618e6ce8b1a448c22f502ceee137a2257f845..cb4605e666adbe8de4439409e2e1433a960062c7 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H @@ -129,7 +129,8 @@ public: const parcelType& p, const polyPatch& pp, const scalar trackFraction, - const tetIndices& tetIs + const tetIndices& tetIs, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C index dfef9f4835e4e5fe82104216139940aade8b9b33..e5b64f65caa9d94eee3c388c62680bda395ac70e 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -125,7 +125,8 @@ void Foam::VoidFraction<CloudType>::postMove ( const parcelType& p, const label cellI, - const scalar dt + const scalar dt, + bool& ) { volScalarField& theta = thetaPtr_(); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.H index 26f0f65018cdf63c876d3f7f0fb25b73d2e57e1e..e8ed507f7dfefecca188deafa084b6940ed070b8 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.H @@ -115,7 +115,8 @@ public: ( const parcelType& p, const label cellI, - const scalar dt + const scalar dt, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C index 6315eac8278c977f6a4a8f16e79f6f169929c137..8804fb6759f311489640c704c7ff0220acc48d04 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C @@ -302,13 +302,15 @@ void Foam::PairCollision<CloudType>::wallInteraction() if (particleHit) { - this->owner().functions().postFace(p, realFaceI); + bool keep = true; + this->owner().functions().postFace(p, realFaceI, keep); this->owner().functions().postPatch ( p, mesh.boundaryMesh()[patchI], 1.0, - p.currentTetIndices() + p.currentTetIndices(), + keep ); } } diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C index 4eee7d990c5a6020f7298877c962e90268c9a49a..3e1a29e988a3fd7dee54e634acba0bee5c94f08a 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C @@ -398,13 +398,15 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction // surface energy of secondary parcels [J] scalar ESigmaSec = 0; - // sample splash distribution to detrmine secondary parcel diameters + // sample splash distribution to determine secondary parcel diameters scalarList dNew(parcelsPerSplash_); + scalarList npNew(parcelsPerSplash_); forAll(dNew, i) { const scalar y = rndGen_.sample01<scalar>(); dNew[i] = -dBarSplash*log(exp(-dMin/dBarSplash) - y*K); - ESigmaSec += sigma*p.areaS(dNew[i]); + npNew[i] = mRatio*np*pow3(d)/pow3(dNew[i])/parcelsPerSplash_; + ESigmaSec += npNew[i]*sigma*p.areaS(dNew[i]); } // incident kinetic energy [J] @@ -459,7 +461,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction // perturb new parcels towards the owner cell centre pPtr->position() += 0.5*rndGen_.sample01<scalar>()*(posC - posCf); - pPtr->nParticle() = mRatio*np*pow3(d)/pow3(dNew[i])/parcelsPerSplash_; + pPtr->nParticle() = npNew[i]; pPtr->d() = dNew[i]; diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C index 27a050a3d5656c2b487dd2bc45b3fbd525613d7c..bf418468bd9d7ec3190c6f2e69683a50d09a323d 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C @@ -344,11 +344,13 @@ void Foam::SprayCloud<CloudType>::motion(TrackData& td) i++; } - // remove coalesced particles (diameter set to 0) + // remove coalesced parcels that fall below minimum mass threshold forAllIter(typename SprayCloud<CloudType>, *this, iter) { parcelType& p = iter(); - if (p.mass() < VSMALL) + scalar mass = p.nParticle()*p.mass(); + + if (mass < td.cloud().constProps().minParticleMass()) { this->deleteParticle(p); } diff --git a/src/mesh/autoMesh/Make/options b/src/mesh/autoMesh/Make/options index 0ee4f07bb039ccdf6b15f6182b77b60c47d89ec0..d37a26a9dd460742d9203623e4ddf6f69a4c99de 100644 --- a/src/mesh/autoMesh/Make/options +++ b/src/mesh/autoMesh/Make/options @@ -4,7 +4,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude @@ -14,6 +14,7 @@ LIB_LIBS = \ -lfiniteVolume \ -llagrangian \ -lmeshTools \ + -lfileFormats \ -ledgeMesh \ -lsurfMesh \ -ltriSurface \ diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index 2890577c24b01fc80a96fc092a785248966a5dba..26a40327d6f610118c88c560b43419e7b8c86587 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C @@ -2295,13 +2295,6 @@ void Foam::meshRefinement::dumpIntersections(const fileName& prefix) const } } - // Convert to vtk format - string cmd - ( - "objToVTK " + prefix + "_edges.obj " + prefix + "_edges.vtk > /dev/null" - ); - system(cmd.c_str()); - Pout<< endl; } diff --git a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H index 2f685ed4ff3c569ee95059e1ba87716d06c0b7ef..aed21821b5cb1ea994617490a919f694becc39c2 100644 --- a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H +++ b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H @@ -168,7 +168,8 @@ public: return names_; } - //- Per 'interface' surface : name of faceZone to put faces into + //- Per 'interface' surface : empty or name of faceZone to put + // faces into const wordList& faceZoneNames() const { return faceZoneNames_; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 1f9f4c66ec68de7c06a16114e741bd9d5449a2f0..fc60cd2fbba5c8d30cac94380afff83e05c7a7c9 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -27,63 +27,6 @@ License #include "meshTools.H" #include "mapDistribute.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - //- Helper class for list - template<class T> - class ListPlusEqOp - { - public: - void operator()(List<T>& x, const List<T> y) const - { - if (y.size()) - { - if (x.size()) - { - label sz = x.size(); - x.setSize(sz + y.size()); - forAll(y, i) - { - x[sz++] = y[i]; - } - } - else - { - x = y; - } - } - } - }; - - //- Combine operator for interpolateToSource/Target - template<class Type, class CombineOp> - class combineBinaryOp - { - const CombineOp& cop_; - - public: - - combineBinaryOp(const CombineOp& cop) - : - cop_(cop) - {} - - void operator() - ( - Type& x, - const label faceI, - const Type& y, - const scalar weight - ) const - { - cop_(x, weight*y); - } - }; -} - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template<class SourcePatch, class TargetPatch> @@ -1550,7 +1493,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update } // send data back to originating procs. Note that contributions - // from different processors get added (ListPlusEqOp) + // from different processors get added (ListAppendEqOp) mapDistribute::distribute ( @@ -1560,7 +1503,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update map.constructMap(), map.subMap(), tgtAddress_, - ListPlusEqOp<label>(), + ListAppendEqOp<label>(), labelList() ); @@ -1572,7 +1515,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update map.constructMap(), map.subMap(), tgtWeights_, - ListPlusEqOp<scalar>(), + ListAppendEqOp<scalar>(), scalarList() ); @@ -1787,7 +1730,12 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource ) ); - interpolateToSource(fld, combineBinaryOp<Type, CombineOp>(cop), tresult()); + interpolateToSource + ( + fld, + multiplyWeightedOp<Type, CombineOp>(cop), + tresult() + ); return tresult; } @@ -1824,7 +1772,12 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget ) ); - interpolateToTarget(fld, combineBinaryOp<Type, CombineOp>(cop), tresult()); + interpolateToTarget + ( + fld, + multiplyWeightedOp<Type, CombineOp>(cop), + tresult() + ); return tresult; } diff --git a/src/meshTools/Make/options b/src/meshTools/Make/options index ac717c75165175856a5b5d27b056357166ed0956..1b22dab2a0fd8549e981e74b454bd985bdb45c3a 100644 --- a/src/meshTools/Make/options +++ b/src/meshTools/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/triSurface/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/fileFormats/lnInclude LIB_LIBS = \ - -ltriSurface + -ltriSurface \ + -lfileFormats diff --git a/src/postProcessing/functionObjects/IO/Make/options b/src/postProcessing/functionObjects/IO/Make/options index 5166bcc9e32f547f48a5f87c9c60d7210409967f..a3ae8da833177387e9eecf75b5e2675fc7b481f5 100644 --- a/src/postProcessing/functionObjects/IO/Make/options +++ b/src/postProcessing/functionObjects/IO/Make/options @@ -1,9 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude LIB_LIBS = \ -lfiniteVolume \ - -lmeshTools \ - -lsampling + -lmeshTools diff --git a/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.C b/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.C index c98ae3696b75148edc4fcffc026033a718acdde8..368f01da58be7690c5da3cab57f883a8108ea85b 100644 --- a/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.C +++ b/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.C @@ -46,7 +46,9 @@ bool Foam::writeDictionary::tryFolder dictNames_[dictI], location, obr_, - IOobject::MUST_READ + IOobject::MUST_READ, + IOobject::NO_WRITE, + false ); if (dictIO.headerOk()) diff --git a/src/postProcessing/functionObjects/doc/functionObjects.dox b/src/postProcessing/functionObjects/doc/functionObjects.dox index 098b7ae12dd1546426fc7051e9a0497daace53d0..64073c2a3ff37c0764d52b82212ceadc1b16b2cc 100644 --- a/src/postProcessing/functionObjects/doc/functionObjects.dox +++ b/src/postProcessing/functionObjects/doc/functionObjects.dox @@ -39,6 +39,7 @@ The current range of features comprises of: - \ref grpCloudFunctionObjects - \ref grpFieldFunctionObjects - \ref grpForcesFunctionObjects +- \ref grpFVFunctionObjects - \ref grpIOFunctionObjects - \ref grpJobControlFunctionObjects - \ref grpUtilitiesFunctionObjects diff --git a/src/postProcessing/functionObjects/field/Make/files b/src/postProcessing/functionObjects/field/Make/files index 0abf314f96739f68133c1013b8f81ead28c17116..cba907676ad10502b6ad11e0ce243facc4cc2cd4 100644 --- a/src/postProcessing/functionObjects/field/Make/files +++ b/src/postProcessing/functionObjects/field/Make/files @@ -10,6 +10,9 @@ fieldMinMax/fieldMinMax.C fieldMinMax/fieldMinMaxFunctionObject.C fieldValues/fieldValue/fieldValue.C +fieldValues/fieldValue/fieldValueNew.C +fieldValues/fieldValueDelta/fieldValueDelta.C +fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.C fieldValues/faceSource/faceSource.C fieldValues/faceSource/faceSourceFunctionObject.C fieldValues/cellSource/cellSource.C diff --git a/src/postProcessing/functionObjects/field/Make/options b/src/postProcessing/functionObjects/field/Make/options index d7c5f944c60caad1eb365309b14a6bb6e6913c9f..e95ea37c7876c2daeafaf58798c39db0e616abc7 100644 --- a/src/postProcessing/functionObjects/field/Make/options +++ b/src/postProcessing/functionObjects/field/Make/options @@ -2,6 +2,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/turbulenceModels \ @@ -11,6 +12,7 @@ LIB_LIBS = \ -lfiniteVolume \ -lmeshTools \ -llagrangian \ + -lfileFormats \ -lsampling \ -lincompressibleTransportModels \ -lcompressibleTurbulenceModel \ diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index 33564024b1c13146cacebe7e0add6ccb3005b64e..6bd6102b2e124a3aa64a60f6de2f0bcdf2967566 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C @@ -75,20 +75,23 @@ void Foam::fieldMinMax::calcMinMaxFields forAll(magFieldBoundary, patchI) { const scalarField& mfp = magFieldBoundary[patchI]; - const vectorField& Cfp = CfBoundary[patchI]; - - label minPI = findMin(mfp); - if (mfp[minPI] < minVs[procI]) + if (mfp.size()) { - minVs[procI] = mfp[minPI]; - minCs[procI] = Cfp[minPI]; - } + const vectorField& Cfp = CfBoundary[patchI]; - label maxPI = findMax(mfp); - if (mfp[maxPI] > maxVs[procI]) - { - maxVs[procI] = mfp[maxPI]; - maxCs[procI] = Cfp[maxPI]; + label minPI = findMin(mfp); + if (mfp[minPI] < minVs[procI]) + { + minVs[procI] = mfp[minPI]; + minCs[procI] = Cfp[minPI]; + } + + label maxPI = findMax(mfp); + if (mfp[maxPI] > maxVs[procI]) + { + maxVs[procI] = mfp[maxPI]; + maxCs[procI] = Cfp[maxPI]; + } } } @@ -173,20 +176,23 @@ void Foam::fieldMinMax::calcMinMaxFields forAll(fieldBoundary, patchI) { const Field<Type>& fp = fieldBoundary[patchI]; - const vectorField& Cfp = CfBoundary[patchI]; - - label minPI = findMin(fp); - if (fp[minPI] < minVs[procI]) + if (fp.size()) { - minVs[procI] = fp[minPI]; - minCs[procI] = Cfp[minPI]; - } + const vectorField& Cfp = CfBoundary[patchI]; - label maxPI = findMax(fp); - if (fp[maxPI] > maxVs[procI]) - { - maxVs[procI] = fp[maxPI]; - maxCs[procI] = Cfp[maxPI]; + label minPI = findMin(fp); + if (fp[minPI] < minVs[procI]) + { + minVs[procI] = fp[minPI]; + minCs[procI] = Cfp[minPI]; + } + + label maxPI = findMax(fp); + if (fp[maxPI] > maxVs[procI]) + { + maxVs[procI] = fp[maxPI]; + maxCs[procI] = Cfp[maxPI]; + } } } @@ -250,7 +256,14 @@ void Foam::fieldMinMax::calcMinMaxFields } default: { - FatalErrorIn("Foam::fieldMinMax::calcMinMaxFields(const word&)") + FatalErrorIn + ( + "Foam::fieldMinMax::calcMinMaxFields" + "(" + "const word&, " + "const modeType&" + ")" + ) << "Unknown min/max mode: " << modeTypeNames_[mode_] << exit(FatalError); } diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C index 488f690ca414d2a846a3bde665e6d9ecd94686b2..3d7977c488db8b7a3807bec026378c201edfeeb4 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C @@ -26,20 +26,14 @@ License #include "cellSource.H" #include "fvMesh.H" #include "volFields.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::fieldValues::cellSource, 0); - namespace Foam { - template<> - const char* Foam::NamedEnum - < - Foam::fieldValues::cellSource::sourceType, - 2 - >::names[] = + const char* NamedEnum<fieldValues::cellSource::sourceType, 2>::names[] = { "cellZone", "all" @@ -47,11 +41,7 @@ namespace Foam template<> - const char* Foam::NamedEnum - < - Foam::fieldValues::cellSource::operationType, - 9 - >::names[] = + const char* NamedEnum<fieldValues::cellSource::operationType, 9>::names[] = { "none", "sum", @@ -63,6 +53,12 @@ namespace Foam "max", "CoV" }; + + namespace fieldValues + { + defineTypeNameAndDebug(cellSource, 0); + addToRunTimeSelectionTable(fieldValue, cellSource, dictionary); + } } @@ -185,7 +181,8 @@ Foam::fieldValues::cellSource::cellSource source_(sourceTypeNames_.read(dict.lookup("source"))), operation_(operationTypeNames_.read(dict.lookup("operation"))), nCells_(0), - cellId_() + cellId_(), + weightFieldName_("none") { read(dict); } diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C index ab59cf13b8ee2b9aca486db21f19475fbd196930..bdeccc6dd0ad79a485e6baf4a3d3cb3f0dd1ce13 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C @@ -177,6 +177,9 @@ bool Foam::fieldValues::cellSource::writeValues(const word& fieldName) { Type result = processValues(values, V, weightField); + // add to result dictionary, over-writing any previous entry + resultDict_.add(fieldName, result, true); + if (valueOutput_) { IOField<Type> diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C index d9f822dde5bd7c31d87a2087cacdd54047ae45c3..14a6fa310e7d7cad49c36119fc7d1a1b8eeec0f4 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C @@ -32,19 +32,14 @@ License #include "mergePoints.H" #include "indirectPrimitivePatch.H" #include "PatchTools.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::fieldValues::faceSource, 0); - namespace Foam { template<> - const char* Foam::NamedEnum - < - Foam::fieldValues::faceSource::sourceType, - 3 - >::names[] = + const char* NamedEnum<fieldValues::faceSource::sourceType, 3>::names[] = { "faceZone", "patch", @@ -53,11 +48,7 @@ namespace Foam template<> - const char* Foam::NamedEnum - < - Foam::fieldValues::faceSource::operationType, - 11 - >::names[] = + const char* NamedEnum<fieldValues::faceSource::operationType, 11>::names[] = { "none", "sum", @@ -72,6 +63,11 @@ namespace Foam "areaNormalIntegrate" }; + namespace fieldValues + { + defineTypeNameAndDebug(faceSource, 0); + addToRunTimeSelectionTable(fieldValue, faceSource, dictionary); + } } diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C index 4092bf44008bcedccdfb2a9c1c11c3b8b3a24075..a82f4890361b3de7284e28a9606fdddaf14fc844 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C @@ -291,6 +291,9 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) { Type result = processValues(values, Sf, weightField); + // add to result dictionary, over-writing any previous entry + resultDict_.add(fieldName, result, true); + file()<< tab << result; if (log_) diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C index cc2aeb0423a852972e4b4bb12911bf7d2c7ef484..dc37c6909d31853966d8910c731453b916e480f1 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C @@ -26,12 +26,14 @@ License #include "fieldValue.H" #include "fvMesh.H" #include "Time.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(fieldValue, 0); + defineRunTimeSelectionTable(fieldValue, dictionary); } @@ -92,7 +94,8 @@ Foam::fieldValue::fieldValue log_(false), sourceName_(dict.lookupOrDefault<word>("sourceName", "sampledSurface")), fields_(dict.lookup("fields")), - valueOutput_(dict.lookup("valueOutput")) + valueOutput_(dict.lookup("valueOutput")), + resultDict_(fileName("name"), dictionary::null) { // Only active if obr is an fvMesh if (isA<fvMesh>(obr_)) diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H index 8e52e3ee45452dd0c8094c96f6b3cb935c78d67e..1d6befa9ce9e757575a92d5b0a5a77c07caa8070 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H @@ -42,6 +42,8 @@ SourceFiles #include "Switch.H" #include "pointFieldFwd.H" #include "OFstream.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,7 +51,6 @@ namespace Foam { // Forward declaration of classes -class dictionary; class objectRegistry; class fvMesh; class mapPolyMesh; @@ -88,6 +89,9 @@ protected: //- Output field values flag Switch valueOutput_; + //- Results dictionary for external access of results + dictionary resultDict_; + // Functions to be over-ridden from IOoutputFilter class @@ -103,6 +107,21 @@ public: //- Run-time type information TypeName("fieldValue"); + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + fieldValue, + dictionary, + ( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles + ), + (name, obr, dict, loadFromFiles) + ); //- Construct from components fieldValue @@ -114,6 +133,15 @@ public: const bool loadFromFiles = false ); + //- Return a reference to the selected fieldValue + static autoPtr<fieldValue> New + ( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles = false, + const bool output = true + ); //- Destructor virtual ~fieldValue(); @@ -147,6 +175,9 @@ public: //- Helper function to return the reference to the mesh inline const fvMesh& mesh() const; + //- Return access to the latest set of results + inline const dictionary& resultDict() const; + // Function object functions diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueI.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueI.H index c29a7b918afd776d8dbfb09e176eeca2c15bab9f..aaee816af205747697031b269fc8e62c63044d52 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueI.H +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "fieldValue.H" +#include "fvMesh.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -75,4 +76,10 @@ inline const Foam::fvMesh& Foam::fieldValue::mesh() const } +inline const Foam::dictionary& Foam::fieldValue::resultDict() const +{ + return resultDict_; +} + + // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueNew.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueNew.C new file mode 100644 index 0000000000000000000000000000000000000000..f418ad02156352df8061f7fd96fcc28c24599c00 --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueNew.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fieldValue.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::fieldValue> Foam::fieldValue::New +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles, + const bool output +) +{ + const word modelType(dict.lookup("type")); + + if (output) + { + Info<< "Selecting " << typeName << " " << modelType << endl; + } + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "fieldValue::New" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "Unknown " << typeName << " type " + << modelType << nl << nl + << "Valid " << typeName << " types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr<fieldValue> + ( + cstrIter() + ( + name, + obr, + dict, + loadFromFiles + ) + ); +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/IOfieldValueDelta.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/IOfieldValueDelta.H new file mode 100644 index 0000000000000000000000000000000000000000..7c316e926eb4be619d88395767fc6074933a26f8 --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/IOfieldValueDelta.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOfieldValueDelta + + +Description + Instance of the generic IOOutputFilter for fieldValueDelta. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOfieldValueDelta_H +#define IOfieldValueDelta_H + +#include "fieldValueDelta.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<fieldValueDelta> IOfieldValueDelta; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C new file mode 100644 index 0000000000000000000000000000000000000000..ebcaaf2430a1c8e528c8ff763c4b3608262cdd0d --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C @@ -0,0 +1,213 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fieldValueDelta.H" +#include "ListOps.H" +#include "Time.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(Foam::fieldValues::fieldValueDelta, 0); + + template<> + const char* + NamedEnum<fieldValues::fieldValueDelta::operationType, 4>::names[] = + { + "add", + "subtract", + "min", + "max" + }; + + const Foam::NamedEnum<Foam::fieldValues::fieldValueDelta::operationType, 4> + Foam::fieldValues::fieldValueDelta::operationTypeNames_; +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void Foam::fieldValues::fieldValueDelta::updateMesh(const mapPolyMesh&) +{ + // Do nothing +} + + +void Foam::fieldValues::fieldValueDelta::movePoints(const Field<point>&) +{ + // Do nothing +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fieldValues::fieldValueDelta::fieldValueDelta +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + functionObjectFile(obr, name, typeName), + name_(name), + obr_(obr), + loadFromFiles_(loadFromFiles), + log_(false), + operation_(opSubtract), + source1Ptr_(NULL), + source2Ptr_(NULL) +{ + read(dict); +} + + +void Foam::fieldValues::fieldValueDelta::writeFileHeader(const label i) +{ + const wordList& fields1 = source1Ptr_->fields(); + const wordList& fields2 = source2Ptr_->fields(); + + DynamicList<word> commonFields(fields1.size()); + forAll(fields1, i) + { + label index = findIndex(fields2, fields1[i]); + if (index != -1) + { + commonFields.append(fields1[i]); + } + } + + Ostream& os = file(); + + os << "# Source1 : " << source1Ptr_->name() << nl + << "# Source2 : " << source2Ptr_->name() << nl + << "# Operation : " << operationTypeNames_[operation_] << nl; + + os << "# Time"; + + forAll(commonFields, i) + { + os << tab << commonFields[i]; + } + + os << endl; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::fieldValues::fieldValueDelta::~fieldValueDelta() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fieldValues::fieldValueDelta::read(const dictionary& dict) +{ + log_ = dict.lookupOrDefault<Switch>("log", false); + source1Ptr_.reset + ( + fieldValue::New + ( + name_ + ".source1", + obr_, + dict.subDict("source1"), + loadFromFiles_, + false + ).ptr() + ); + source2Ptr_.reset + ( + fieldValue::New + ( + name_ + ".source2", + obr_, + dict.subDict("source2"), + loadFromFiles_, + false + ).ptr() + ); + + operation_ = operationTypeNames_.read(dict.lookup("operation")); +} + + +void Foam::fieldValues::fieldValueDelta::write() +{ + functionObjectFile::write(); + + source1Ptr_->write(); + source2Ptr_->write(); + + if (Pstream::master()) + { + file()<< obr_.time().timeName(); + } + + if (log_) + { + Info<< type() << " output:" << endl; + } + + bool found = false; + processFields<scalar>(found); + processFields<vector>(found); + processFields<sphericalTensor>(found); + processFields<symmTensor>(found); + processFields<tensor>(found); + + if (Pstream::master()) + { + file()<< endl; + } + + if (log_) + { + if (!found) + { + Info<< " none" << endl; + } + else + { + Info<< endl; + } + } +} + + +void Foam::fieldValues::fieldValueDelta::execute() +{ + // Do nothing +} + + +void Foam::fieldValues::fieldValueDelta::end() +{ + // Do nothing +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H new file mode 100644 index 0000000000000000000000000000000000000000..916fa6d3b032c38d6efbe8502226cfdcec2a7021 --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H @@ -0,0 +1,206 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::fieldValues::fieldValueDelta + +Group + grpFieldFunctionObjects + +Description + This function object provides a differencing option between two 'field + value' function objects. + + Example of function object specification: + \verbatim + fieldValueDelta1 + { + type fieldValueDelta; + functionObjectLibs ("libfieldFunctionObjects.so"); + fieldValue1 + { + ... + } + fieldValue2 + { + ... + } + } + \endverbatim + + \heading Function object usage + \table + Property | Description | Required | Default value + type | type name: fieldValueDelta | yes | + \endtable + +SeeAlso + Foam::fieldValue + +SourceFiles + fieldValueDelta.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fieldValueDelta_H +#define fieldValueDelta_H + +#include "functionObjectFile.H" +#include "fieldValue.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace fieldValues +{ + +/*---------------------------------------------------------------------------*\ + Class fieldValueDelta Declaration +\*---------------------------------------------------------------------------*/ + +class fieldValueDelta +: + public functionObjectFile +{ +public: + //- Operation type enumeration + enum operationType + { + opAdd, + opSubtract, + opMin, + opMax + }; + + //- Operation type names + static const NamedEnum<operationType, 4> operationTypeNames_; + + +private: + + // Private data + + //- Name of this fieldValue object + word name_; + + //- Database this class is registered to + const objectRegistry& obr_; + + //- Flag to indicate to load from files + bool loadFromFiles_; + + //- Switch to send output to Info as well as to file + Switch log_; + + //- Operation to apply to values + operationType operation_; + + //- Field value source object 1 + autoPtr<fieldValue> source1Ptr_; + + //- Field value source object 2 + autoPtr<fieldValue> source2Ptr_; + + + // Private Member Functions + + //- Templated function to process common fields + template<class Type> + void processFields(bool& found); + + //- Templated function to apply the operation + template<class Type> + Type applyOperation(const Type& value1, const Type& value2) const; + + +protected: + + // Functions to be over-ridden from IOoutputFilter class + + //- Update mesh + virtual void updateMesh(const mapPolyMesh&); + + //- Move points + virtual void movePoints(const Field<point>&); + + //- Output file header information + virtual void writeFileHeader(const label i); + + +public: + + //- Run-time type information + TypeName("fieldValueDelta"); + + + //- Construct from components + fieldValueDelta + ( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~fieldValueDelta(); + + + // Public Member Functions + + // Function object functions + + //- Read from dictionary + virtual void read(const dictionary&); + + //- Calculate and write + virtual void write(); + + //- Execute + virtual void execute(); + + //- Execute the at the final time-loop, currently does nothing + virtual void end(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fieldValues +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "fieldValueDeltaTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..7d093c37818aa9a9fd45d2018447500d57fcee1a --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.C @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fieldValueDeltaFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug + ( + fieldValueDeltaFunctionObject, + 0 + ); + + addToRunTimeSelectionTable + ( + functionObject, + fieldValueDeltaFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..120d5991bcb3845f8a13f2a66e9b107e9a614ac2 --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.H @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::fieldValueDeltaFunctionObject + +Description + FunctionObject wrapper around fieldValueDelta to allow it to be + created via the functions entry within controlDict. + +SourceFiles + fieldValueDeltaFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fieldValueDeltaFunctionObject_H +#define fieldValueDeltaFunctionObject_H + +#include "fieldValueDelta.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<fieldValues::fieldValueDelta> + fieldValueDeltaFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..6b757fc2df391d3e393690c1de2708432be15c86 --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "GeometricField.H" +#include "volMesh.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +Type Foam::fieldValues::fieldValueDelta::applyOperation +( + const Type& value1, + const Type& value2 +) const +{ + Type result = pTraits<Type>::zero; + + switch (operation_) + { + case opAdd: + { + result = value1 + value2; + break; + } + case opSubtract: + { + result = value1 - value2; + break; + } + case opMin: + { + result = min(value1, value2); + break; + } + case opMax: + { + result = max(value1, value2); + break; + } + default: + { + FatalErrorIn + ( + "Type Foam::fieldValues::fieldValueDelta::applyOperation" + "(" + "const Type&, " + "const Type&" + ") const" + ) + << "Unable to process operation " + << operationTypeNames_[operation_] + << abort(FatalError); + } + } + + return result; +} + + +template<class Type> +void Foam::fieldValues::fieldValueDelta::processFields(bool& found) +{ + typedef GeometricField<Type, fvPatchField, volMesh> vf; + + const wordList& fields1 = source1Ptr_->fields(); + + const dictionary& results1 = source1Ptr_->resultDict(); + const dictionary& results2 = source2Ptr_->resultDict(); + + Type r1(pTraits<Type>::zero); + Type r2(pTraits<Type>::zero); + + forAll(fields1, i) + { + const word& fieldName = fields1[i]; + if (obr_.foundObject<vf>(fieldName) && results2.found(fieldName)) + { + results1.lookup(fieldName) >> r1; + results2.lookup(fieldName) >> r2; + + Type result = applyOperation(r1, r2); + + if (log_) + { + Info<< " " << operationTypeNames_[operation_] + << "(" << fieldName << ") = " << result + << endl; + } + + if (Pstream::master()) + { + file()<< tab << result; + } + + found = true; + } + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/forces/Make/options b/src/postProcessing/functionObjects/forces/Make/options index afc10fb1aad15a165291f66c0861d7362061da13..5952c6b6cb5f66e783d7dddeaccce7bdf5f89f25 100644 --- a/src/postProcessing/functionObjects/forces/Make/options +++ b/src/postProcessing/functionObjects/forces/Make/options @@ -1,7 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \ @@ -17,4 +17,4 @@ LIB_LIBS = \ -lcompressibleLESModels \ -lfiniteVolume \ -lmeshTools \ - -lsampling + -lfileFormats diff --git a/src/postProcessing/functionObjects/fvTools/Make/files b/src/postProcessing/functionObjects/fvTools/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..f5940e8ce3bc4928c8cef7f60d9666f5576f370d --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/Make/files @@ -0,0 +1,10 @@ +calcFvcDiv/calcFvcDiv.C +calcFvcDiv/calcFvcDivFunctionObject.C + +calcFvcGrad/calcFvcGrad.C +calcFvcGrad/calcFvcGradFunctionObject.C + +calcMag/calcMag.C +calcMag/calcMagFunctionObject.C + +LIB = $(FOAM_LIBBIN)/libFVFunctionObjects diff --git a/src/postProcessing/functionObjects/fvTools/Make/options b/src/postProcessing/functionObjects/fvTools/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..71b7873964d544eddf96d22aa40f4c3372c23c9c --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +LIB_LIBS = \ + -lfiniteVolume diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/IOcalcFvcDiv.H b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/IOcalcFvcDiv.H new file mode 100644 index 0000000000000000000000000000000000000000..245aae6e2bf89adc3b50197cd94687d2cdeac8ad --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/IOcalcFvcDiv.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOcalcFvcDiv + +Description + Instance of the generic IOOutputFilter for calcFvcDiv. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOcalcFvcDiv_H +#define IOcalcFvcDiv_H + +#include "calcFvcDiv.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<calcFvcDiv> IOcalcFvcDiv; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.C b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.C new file mode 100644 index 0000000000000000000000000000000000000000..934fb58d75097dc0621f7c6294ebb4f4943cda4f --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.C @@ -0,0 +1,158 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "calcFvcDiv.H" +#include "volFields.H" +#include "dictionary.H" +#include "calcFvcDiv.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::calcFvcDiv, 0); + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::volScalarField& Foam::calcFvcDiv::divField +( + const word& divName, + const dimensionSet& dims +) +{ + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + if (!mesh.foundObject<volScalarField>(divName)) + { + volScalarField* divFieldPtr + ( + new volScalarField + ( + IOobject + ( + divName, + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("zero", dims/dimLength, 0.0) + ) + ); + + mesh.objectRegistry::store(divFieldPtr); + } + + const volScalarField& field = mesh.lookupObject<volScalarField>(divName); + + return const_cast<volScalarField&>(field); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::calcFvcDiv::calcFvcDiv +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + fieldName_("undefined-fieldName"), + resultName_("undefined-resultName") +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "calcFvcDiv::calcFvcDiv" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::calcFvcDiv::~calcFvcDiv() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::calcFvcDiv::read(const dictionary& dict) +{ + if (active_) + { + dict.lookup("fieldName") >> fieldName_; + dict.lookup("resultName") >> resultName_; + } +} + + +void Foam::calcFvcDiv::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::calcFvcDiv::end() +{ + // Do nothing - only valid on write +} + + +void Foam::calcFvcDiv::write() +{ + if (active_) + { + bool processed = false; + + calcDiv<surfaceScalarField>(fieldName_, resultName_, processed); + calcDiv<volVectorField>(fieldName_, resultName_, processed); + + if (!processed) + { + WarningIn("void Foam::calcFvcDiv::write()") + << "Unprocessed field " << fieldName_ << endl; + } + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.H b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.H new file mode 100644 index 0000000000000000000000000000000000000000..bc07e0fab0ae037cab4d1b6909deaffee5078c17 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.H @@ -0,0 +1,177 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::calcFvcDiv + +Group + grpFVFunctionObjects + +Description + This function object calculates the divergence of a field. The operation is + limited to surfaceScalarFields and volumeVector fields, and the output is a + volume scalar field. + +SourceFiles + calcFvcDiv.C + IOcalcFvcDiv.H + +\*---------------------------------------------------------------------------*/ + +#ifndef calcFvcDiv_H +#define calcFvcDiv_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "pointFieldFwd.H" +#include "OFstream.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; +class dimensionSet; + +/*---------------------------------------------------------------------------*\ + Class calcFvcDiv Declaration +\*---------------------------------------------------------------------------*/ + +class calcFvcDiv +{ + // Private data + + //- Name of this calcFvcDiv object + word name_; + + //- Reference to the database + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + //- Name of field to process + word fieldName_; + + //- Name of result field + word resultName_; + + + // Private Member Functions + + //- Helper function to create/store/return the divergence field + volScalarField& divField + ( + const word& gradName, + const dimensionSet& dims + ); + + //- Helper function to calculate the divergence of different field types + template<class FieldType> + void calcDiv + ( + const word& fieldName, + const word& resultName, + bool& processed + ); + + //- Disallow default bitwise copy construct + calcFvcDiv(const calcFvcDiv&); + + //- Disallow default bitwise assignment + void operator=(const calcFvcDiv&); + + +public: + + //- Runtime type information + TypeName("calcFvcDiv"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + calcFvcDiv + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~calcFvcDiv(); + + + // Member Functions + + //- Return name of the set of calcFvcDiv + virtual const word& name() const + { + return name_; + } + + //- Read the calcFvcDiv data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the calcFvcDiv and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "calcFvcDivTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivFunctionObject.C b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..32f990ec09f6f7e54596d0efe261727e66f2ca5e --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "calcFvcDivFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(calcFvcDivFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + calcFvcDivFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivFunctionObject.H b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..5cc8af7332b65cdb8fdd4b6fa2ec6c2d8d6179d1 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivFunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::calcFvcDivFunctionObject + +Description + FunctionObject wrapper around calcFvcDiv to allow it to be created + via the functions entry within controlDict. + +SourceFiles + calcFvcDivFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef calcFvcDivFunctionObject_H +#define calcFvcDivFunctionObject_H + +#include "calcFvcDiv.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<calcFvcDiv> calcFvcDivFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivTemplates.C b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..cfdf55f1bfbeae20c7dea2f7f420bd1b16eca475 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivTemplates.C @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fvMesh.H" +#include "fvcDiv.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class FieldType> +void Foam::calcFvcDiv::calcDiv +( + const word& fieldName, + const word& resultName, + bool& processed +) +{ + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + word divName = resultName; + if (divName == "none") + { + divName = "fvc::div(" + fieldName + ")"; + } + + if (mesh.foundObject<FieldType>(fieldName)) + { + const FieldType& vf = mesh.lookupObject<FieldType>(fieldName); + + volScalarField& field = divField(divName, vf.dimensions()); + + field = fvc::div(vf); + + Info<< type() << " output:" << nl + << " writing " << field.name() << " field" << nl << endl; + + field.write(); + + processed = true; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/IOcalcFvcGrad.H b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/IOcalcFvcGrad.H new file mode 100644 index 0000000000000000000000000000000000000000..2e97ac645958b8bbd106f91ad3826df47e6c79b0 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/IOcalcFvcGrad.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOcalcFvcGrad + +Description + Instance of the generic IOOutputFilter for calcFvcGrad. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOcalcFvcGrad_H +#define IOcalcFvcGrad_H + +#include "calcFvcGrad.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<calcFvcGrad> IOcalcFvcGrad; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.C b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.C new file mode 100644 index 0000000000000000000000000000000000000000..de97652e5e5d7898d2666c1fecbad4fab17c41de --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.C @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "calcFvcGrad.H" +#include "volFields.H" +#include "dictionary.H" +#include "calcFvcGrad.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::calcFvcGrad, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::calcFvcGrad::calcFvcGrad +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + fieldName_("undefined-fieldName"), + resultName_("undefined-resultName") +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "calcFvcGrad::calcFvcGrad" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::calcFvcGrad::~calcFvcGrad() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::calcFvcGrad::read(const dictionary& dict) +{ + if (active_) + { + dict.lookup("fieldName") >> fieldName_; + dict.lookup("resultName") >> resultName_; + } +} + + +void Foam::calcFvcGrad::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::calcFvcGrad::end() +{ + // Do nothing - only valid on write +} + + +void Foam::calcFvcGrad::write() +{ + if (active_) + { + bool processed = false; + + calcGrad<scalar>(fieldName_, resultName_, processed); + calcGrad<vector>(fieldName_, resultName_, processed); + + if (!processed) + { + WarningIn("void Foam::calcFvcGrad::write()") + << "Unprocessed field " << fieldName_ << endl; + } + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.H b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.H new file mode 100644 index 0000000000000000000000000000000000000000..c7422eca4bdf18843ed0aa45c2485fc6f3f95f35 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.H @@ -0,0 +1,180 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::calcFvcGrad + +Group + grpFVFunctionObjects + +Description + This function object calculates the gradient of a field. The operation is + limited to scalar and vector volume or surface fields, and the output is a + volume vector or tensor field. + +SourceFiles + calcFvcGrad.C + IOcalcFvcGrad.H + +\*---------------------------------------------------------------------------*/ + +#ifndef calcFvcGrad_H +#define calcFvcGrad_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "pointFieldFwd.H" +#include "OFstream.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; +class dimensionSet; + +/*---------------------------------------------------------------------------*\ + Class calcFvcGrad Declaration +\*---------------------------------------------------------------------------*/ + +class calcFvcGrad +{ + // Private data + + //- Name of this calcFvcGrad object + word name_; + + //- Reference to the database + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + //- Name of field to process + word fieldName_; + + //- Name of result field + word resultName_; + + + // Private Member Functions + + //- Helper function to create/store/return the gradient field + template<class Type> + GeometricField + < + typename outerProduct<vector, Type>::type, + fvPatchField, + volMesh + >& + gradField(const word& gradName, const dimensionSet& dims); + + //- Helper function to calculate the gradient of different field types + template<class Type> + void calcGrad + ( + const word& fieldName, + const word& resultName, + bool& processed + ); + + //- Disallow default bitwise copy construct + calcFvcGrad(const calcFvcGrad&); + + //- Disallow default bitwise assignment + void operator=(const calcFvcGrad&); + + +public: + + //- Runtime type information + TypeName("calcFvcGrad"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + calcFvcGrad + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~calcFvcGrad(); + + + // Member Functions + + //- Return name of the set of calcFvcGrad + virtual const word& name() const + { + return name_; + } + + //- Read the calcFvcGrad data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the calcFvcGrad and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "calcFvcGradTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradFunctionObject.C b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..3e2d1e669858928dd84dd49e7f4e4db3c7aa4edc --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "calcFvcGradFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(calcFvcGradFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + calcFvcGradFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradFunctionObject.H b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..0c3f5806976dd07ed117f016a94d6cbe70ec94b3 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradFunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::calcFvcGradFunctionObject + +Description + FunctionObject wrapper around calcFvcGrad to allow it to be created + via the functions entry within controlDict. + +SourceFiles + calcFvcGradFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef calcFvcGradFunctionObject_H +#define calcFvcGradFunctionObject_H + +#include "calcFvcGrad.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<calcFvcGrad> calcFvcGradFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradTemplates.C b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..3e95bbd4245ff912279cfb4d959d522bb14cb0a4 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradTemplates.C @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fvMesh.H" +#include "fvcGrad.H" + +template<class Type> +Foam::GeometricField +< + typename Foam::outerProduct<Foam::vector, Type>::type, + Foam::fvPatchField, + Foam::volMesh +>& +Foam::calcFvcGrad::gradField(const word& gradName, const dimensionSet& dims) +{ + typedef typename outerProduct<vector, Type>::type gradType; + typedef GeometricField<gradType, fvPatchField, volMesh> vfGradType; + + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + if (!mesh.foundObject<vfGradType>(gradName)) + { + vfGradType* gradFieldPtr + ( + new vfGradType + ( + IOobject + ( + gradName, + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensioned<gradType> + ( + "zero", + dims/dimLength, + pTraits<gradType>::zero + ) + ) + ); + + mesh.objectRegistry::store(gradFieldPtr); + } + + const vfGradType& field = mesh.lookupObject<vfGradType>(gradName); + + return const_cast<vfGradType&>(field); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +void Foam::calcFvcGrad::calcGrad +( + const word& fieldName, + const word& resultName, + bool& processed +) +{ + typedef GeometricField<Type, fvPatchField, volMesh> vfType; + typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType; + + typedef typename outerProduct<vector, Type>::type gradType; + typedef GeometricField<gradType, fvPatchField, volMesh> vfGradType; + + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + word gradName = resultName; + if (gradName == "none") + { + gradName = "fvc::grad(" + fieldName + ")"; + } + + if (mesh.foundObject<vfType>(fieldName)) + { + const vfType& vf = mesh.lookupObject<vfType>(fieldName); + + vfGradType& field = gradField<Type>(gradName, vf.dimensions()); + + field = fvc::grad(vf); + + Info<< type() << " output:" << nl + << " writing " << field.name() << " field" << nl << endl; + + field.write(); + + processed = true; + } + else if (mesh.foundObject<sfType>(fieldName)) + { + const sfType& sf = mesh.lookupObject<sfType>(fieldName); + + vfGradType& field = gradField<Type>(gradName, sf.dimensions()); + + field = fvc::grad(sf); + + Info<< type() << " output:" << nl + << " writing " << field.name() << " field" << nl << endl; + + field.write(); + + processed = true; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/IOcalcMag.H b/src/postProcessing/functionObjects/fvTools/calcMag/IOcalcMag.H new file mode 100644 index 0000000000000000000000000000000000000000..3f0a584d14959a980fa8ad47111b4d362d6c21b4 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcMag/IOcalcMag.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOcalcMag + +Description + Instance of the generic IOOutputFilter for calcMag. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOcalcMag_H +#define IOcalcMag_H + +#include "calcMag.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<calcMag> IOcalcMag; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.C b/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.C new file mode 100644 index 0000000000000000000000000000000000000000..47705025dea7002992abc270f042525f44de8939 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.C @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "calcMag.H" +#include "volFields.H" +#include "dictionary.H" +#include "calcMag.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::calcMag, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::calcMag::calcMag +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + fieldName_("undefined-fieldName"), + resultName_("undefined-resultName") +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "calcMag::calcMag" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::calcMag::~calcMag() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::calcMag::read(const dictionary& dict) +{ + if (active_) + { + dict.lookup("fieldName") >> fieldName_; + dict.lookup("resultName") >> resultName_; + } +} + + +void Foam::calcMag::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::calcMag::end() +{ + // Do nothing - only valid on write +} + + +void Foam::calcMag::write() +{ + if (active_) + { + bool processed = false; + + calc<scalar>(fieldName_, resultName_, processed); + calc<vector>(fieldName_, resultName_, processed); + calc<sphericalTensor>(fieldName_, resultName_, processed); + calc<symmTensor>(fieldName_, resultName_, processed); + calc<tensor>(fieldName_, resultName_, processed); + + if (!processed) + { + WarningIn("void Foam::calcMag::write()") + << "Unprocessed field " << fieldName_ << endl; + } + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.H b/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.H new file mode 100644 index 0000000000000000000000000000000000000000..1360e303cd6f475bb15fa2c2fa6a9f88fae0ac06 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.H @@ -0,0 +1,174 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::calcMag + +Group + grpFVFunctionObjects + +Description + This function object calculates the magnitude of a field. The operation + can be applied to any volume or surface fieldsm and the output is a + volume or surface scalar field. + +SourceFiles + calcMag.C + IOcalcMag.H + +\*---------------------------------------------------------------------------*/ + +#ifndef calcMag_H +#define calcMag_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "pointFieldFwd.H" +#include "OFstream.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; +class dimensionSet; + +/*---------------------------------------------------------------------------*\ + Class calcMag Declaration +\*---------------------------------------------------------------------------*/ + +class calcMag +{ + // Private data + + //- Name of this calcMag object + word name_; + + //- Reference to the database + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + //- Name of field to process + word fieldName_; + + //- Name of result field + word resultName_; + + + // Private Member Functions + + //- Helper function to create/store/return the mag field + template<class FieldType> + FieldType& magField(const word& magName, const dimensionSet& dims); + + //- Helper function to calculate the magnitude of different field types + template<class Type> + void calc + ( + const word& fieldName, + const word& resultName, + bool& processed + ); + + //- Disallow default bitwise copy construct + calcMag(const calcMag&); + + //- Disallow default bitwise assignment + void operator=(const calcMag&); + + +public: + + //- Runtime type information + TypeName("calcMag"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + calcMag + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~calcMag(); + + + // Member Functions + + //- Return name of the set of calcMag + virtual const word& name() const + { + return name_; + } + + //- Read the calcMag data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the calcMag and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "calcMagTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMagFunctionObject.C b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..61aded1e61fbe58fc97e1149b750c1066f629afa --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "calcMagFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(calcMagFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + calcMagFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMagFunctionObject.H b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..ea143666e13716be46d6aa79ad5812a940d52f3f --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagFunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::calcMagFunctionObject + +Description + FunctionObject wrapper around calcMag to allow it to be created + via the functions entry within controlDict. + +SourceFiles + calcMagFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef calcMagFunctionObject_H +#define calcMagFunctionObject_H + +#include "calcMag.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<calcMag> calcMagFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMagTemplates.C b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..4435b64f1bec51001bc109e69384b1e6b2083363 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagTemplates.C @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fvMesh.H" +#include "Time.H" +#include "volFields.H" +#include "surfaceFields.H" + +template<class FieldType> +FieldType& Foam::calcMag::magField +( + const word& magName, + const dimensionSet& dims +) +{ + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + if (!mesh.foundObject<FieldType>(magName)) + { + FieldType* magFieldPtr + ( + new FieldType + ( + IOobject + ( + magName, + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("zero", dims, 0.0) + ) + ); + + mesh.objectRegistry::store(magFieldPtr); + } + + const FieldType& f = mesh.lookupObject<FieldType>(magName); + + return const_cast<FieldType&>(f); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +void Foam::calcMag::calc +( + const word& fieldName, + const word& resultName, + bool& processed +) +{ + typedef GeometricField<Type, fvPatchField, volMesh> vfType; + typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType; + + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + word magName = resultName; + if (magName == "none") + { + magName = "mag(" + fieldName + ")"; + } + + if (mesh.foundObject<vfType>(fieldName)) + { + const vfType& vf = mesh.lookupObject<vfType>(fieldName); + + volScalarField& field = + magField<volScalarField>(magName, vf.dimensions()); + + field = mag(vf); + + Info<< type() << " output:" << nl + << " writing " << field.name() << " field" << nl << endl; + + field.write(); + + processed = true; + } + else if (mesh.foundObject<sfType>(fieldName)) + { + const sfType& sf = mesh.lookupObject<sfType>(fieldName); + + surfaceScalarField& field = + magField<surfaceScalarField>(magName, sf.dimensions()); + + field = mag(sf); + + Info<< type() << " output:" << nl + << " writing " << field.name() << " field" << nl << endl; + + field.write(); + + processed = true; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/jobControl/Make/options b/src/postProcessing/functionObjects/jobControl/Make/options index 5166bcc9e32f547f48a5f87c9c60d7210409967f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/src/postProcessing/functionObjects/jobControl/Make/options +++ b/src/postProcessing/functionObjects/jobControl/Make/options @@ -1,9 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude - -LIB_LIBS = \ - -lfiniteVolume \ - -lmeshTools \ - -lsampling diff --git a/src/postProcessing/functionObjects/systemCall/Make/options b/src/postProcessing/functionObjects/systemCall/Make/options index 5166bcc9e32f547f48a5f87c9c60d7210409967f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/src/postProcessing/functionObjects/systemCall/Make/options +++ b/src/postProcessing/functionObjects/systemCall/Make/options @@ -1,9 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude - -LIB_LIBS = \ - -lfiniteVolume \ - -lmeshTools \ - -lsampling diff --git a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C index 538fb1040d32a312c417857c3d86db668faac372..b76cdeb206f5dca46770d8806904da2cafb9b8d2 100644 --- a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C +++ b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C @@ -58,7 +58,9 @@ Foam::tmp<Foam::volScalarField> Foam::CourantNo::rho ( "rho", mesh.time().timeName(), - mesh + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE ), mesh, dimensionedScalar("rho", dimless, 1.0) @@ -116,7 +118,8 @@ Foam::CourantNo::CourantNo type(), mesh.time().timeName(), mesh, - IOobject::NO_READ + IOobject::NO_READ, + IOobject::NO_WRITE ), mesh, dimensionedScalar("0", dimless, 0.0), @@ -189,7 +192,7 @@ void Foam::CourantNo::write() CourantNo.write(); Info<< type() << " output:" << nl - << " writing " << CourantNo.name() << "field" << nl << endl; + << " writing " << CourantNo.name() << " field" << nl << endl; } } diff --git a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.H b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.H index d1235f446f91465436cbd8920f965f126f40aab4..319de39c16fe15a3d31ac40d99b867e293098b2a 100644 --- a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.H +++ b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.H @@ -24,6 +24,9 @@ License Class Foam::CourantNo +Group + grpUtilitiesFunctionObjects + Description This function object calculates and outputs the Courant number as a volScalarField. The field is stored on the mesh database so that it can diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C index 94e375304aa0c3b05c760f2e1b180332361302e0..6d5c2f7eaa76f94e164dfd5382b94a9e787b4c5e 100644 --- a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C +++ b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C @@ -130,7 +130,7 @@ void Foam::DESModelRegions::write() Info<< type() << " output:" << nl; } - tmp<volScalarField> result; + tmp<volScalarField> tresult; label DESpresent = false; if (mesh.foundObject<icoModel>("turbulenceModel")) @@ -142,7 +142,7 @@ void Foam::DESModelRegions::write() { const icoDESModel& des = dynamic_cast<const icoDESModel&>(model); - result = des.LESRegion(); + tresult = des.LESRegion(); DESpresent = true; } } @@ -155,15 +155,17 @@ void Foam::DESModelRegions::write() { const cmpDESModel& des = dynamic_cast<const cmpDESModel&>(model); - result = des.LESRegion(); + tresult = des.LESRegion(); DESpresent = true; } } if (DESpresent) { + const volScalarField& result = tresult(); + scalar prc = - gSum(result().internalField()*mesh.V())/gSum(mesh.V())*100.0; + gSum(result.internalField()*mesh.V())/gSum(mesh.V())*100.0; if (Pstream::master()) { @@ -174,9 +176,11 @@ void Foam::DESModelRegions::write() if (log_) { Info<< " LES = " << prc << " % (volume)" << nl - << " RES = " << 100.0 - prc << " % (volume)" << nl + << " RAS = " << 100.0 - prc << " % (volume)" << nl << endl; } + + result.write(); } else { diff --git a/src/postProcessing/functionObjects/utilities/Lambda2/IOLambda2.H b/src/postProcessing/functionObjects/utilities/Lambda2/IOLambda2.H new file mode 100644 index 0000000000000000000000000000000000000000..0aacf47e94ca018fc96f4895622e9b14b5890985 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Lambda2/IOLambda2.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOLambda2 + +Description + Instance of the generic IOOutputFilter for Lambda2. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOLambda2_H +#define IOLambda2_H + +#include "Lambda2.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<Lambda2> IOLambda2; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.C b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.C new file mode 100644 index 0000000000000000000000000000000000000000..04c8ddefb9ce1c26821644889666c3f7aa4fc86c --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.C @@ -0,0 +1,159 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "Lambda2.H" +#include "volFields.H" +#include "dictionary.H" +#include "zeroGradientFvPatchFields.H" +#include "fvcGrad.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::Lambda2, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::Lambda2::Lambda2 +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + UName_("U") +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "Lambda2::Lambda2" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + read(dict); + + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + volScalarField* Lambda2Ptr + ( + new volScalarField + ( + IOobject + ( + type(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimless/sqr(dimTime), 0.0) + ) + ); + + mesh.objectRegistry::store(Lambda2Ptr); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::Lambda2::~Lambda2() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::Lambda2::read(const dictionary& dict) +{ + if (active_) + { + UName_ = dict.lookupOrDefault<word>("UName", "U"); + } +} + + +void Foam::Lambda2::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::Lambda2::end() +{ + // Do nothing - only valid on write +} + + +void Foam::Lambda2::write() +{ + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + const volVectorField& U = + mesh.lookupObject<volVectorField>(UName_); + + const volTensorField gradU(fvc::grad(U)); + + const volTensorField SSplusWW + ( + (symm(gradU) & symm(gradU)) + + (skew(gradU) & skew(gradU)) + ); + + volScalarField& Lambda2 = + const_cast<volScalarField&> + ( + mesh.lookupObject<volScalarField>(type()) + ); + + Lambda2 = -eigenValues(SSplusWW)().component(vector::Y); + + Lambda2.write(); + + Info<< type() << " output:" << nl + << " writing " << Lambda2.name() << " field" << nl << endl; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.H b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.H new file mode 100644 index 0000000000000000000000000000000000000000..d1865c7cfe981eef8f44c9b9295af539f78bfeb1 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.H @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::Lambda2 + +Group + grpUtilitiesFunctionObjects + +Description + This function object calculates and outputs the second largest eigenvalue + of the sum of the square of the symmetrical and anti-symmetrical parts of + the velocity gradient tensor. + +SourceFiles + Lambda2.C + IOLambda2.H + +\*---------------------------------------------------------------------------*/ + +#ifndef Lambda2_H +#define Lambda2_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "pointFieldFwd.H" +#include "OFstream.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class Lambda2 Declaration +\*---------------------------------------------------------------------------*/ + +class Lambda2 +{ + // Private data + + //- Name of this set of Lambda2 objects + word name_; + + //- Reference to the database + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + //- Name of velocity field, default is "U" + word UName_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + Lambda2(const Lambda2&); + + //- Disallow default bitwise assignment + void operator=(const Lambda2&); + + +public: + + //- Runtime type information + TypeName("Lambda2"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + Lambda2 + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~Lambda2(); + + + // Member Functions + + //- Return name of the set of Lambda2 + virtual const word& name() const + { + return name_; + } + + //- Read the Lambda2 data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the Lambda2 and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2FunctionObject.C b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2FunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..ced087ce9bb9684d9333733f8d95eb72ac6ac9d5 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2FunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "Lambda2FunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(Lambda2FunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + Lambda2FunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2FunctionObject.H b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2FunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..e63d04a721dc2992e270aa4bf5d9d17d708495a4 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2FunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::Lambda2FunctionObject + +Description + FunctionObject wrapper around Lambda2 to allow it to be created + via the functions entry within controlDict. + +SourceFiles + Lambda2FunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Lambda2FunctionObject_H +#define Lambda2FunctionObject_H + +#include "Lambda2.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<Lambda2> Lambda2FunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Make/files b/src/postProcessing/functionObjects/utilities/Make/files index 362f24a0e7e7ef93aa9bb2ef264c2b710d0c045b..01b4d0c4c9172f4d985513ac234c6dc7fbef16db 100644 --- a/src/postProcessing/functionObjects/utilities/Make/files +++ b/src/postProcessing/functionObjects/utilities/Make/files @@ -3,6 +3,15 @@ codedFunctionObject/codedFunctionObject.C CourantNo/CourantNo.C CourantNo/CourantNoFunctionObject.C +Lambda2/Lambda2.C +Lambda2/Lambda2FunctionObject.C + +Peclet/Peclet.C +Peclet/PecletFunctionObject.C + +Q/Q.C +Q/QFunctionObject.C + DESModelRegions/DESModelRegions.C DESModelRegions/DESModelRegionsFunctionObject.C diff --git a/src/postProcessing/functionObjects/utilities/Peclet/IOPeclet.H b/src/postProcessing/functionObjects/utilities/Peclet/IOPeclet.H new file mode 100644 index 0000000000000000000000000000000000000000..ea49009d559ed41bcc7902208851ef0b1e1b345f --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Peclet/IOPeclet.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOPeclet + +Description + Instance of the generic IOOutputFilter for Peclet. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOPeclet_H +#define IOPeclet_H + +#include "Peclet.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<Peclet> IOPeclet; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C b/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C new file mode 100644 index 0000000000000000000000000000000000000000..3c6731babd5d7c24fe9eca8bda71c7d3b4750337 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C @@ -0,0 +1,196 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "Peclet.H" +#include "volFields.H" +#include "dictionary.H" +#include "surfaceFields.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" +#include "surfaceInterpolate.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::Peclet, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::Peclet::Peclet +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + phiName_("phi"), + rhoName_("rho") +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "Peclet::Peclet" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + read(dict); + + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + surfaceScalarField* PecletPtr + ( + new surfaceScalarField + ( + IOobject + ( + type(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimless, 0.0) + ) + ); + + mesh.objectRegistry::store(PecletPtr); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::Peclet::~Peclet() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::Peclet::read(const dictionary& dict) +{ + if (active_) + { + phiName_ = dict.lookupOrDefault<word>("phiName", "phi"); + rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho"); + } +} + + +void Foam::Peclet::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::Peclet::end() +{ + // Do nothing - only valid on write +} + + +void Foam::Peclet::write() +{ + typedef compressible::turbulenceModel cmpTurbModel; + typedef incompressible::turbulenceModel icoTurbModel; + + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + tmp<volScalarField> nuEff; + if (mesh.foundObject<cmpTurbModel>("turbulenceModel")) + { + const cmpTurbModel& model = + mesh.lookupObject<cmpTurbModel>("turbulenceModel"); + + const volScalarField& rho = + mesh.lookupObject<volScalarField>(rhoName_); + + nuEff = model.muEff()/rho; + } + else if (mesh.foundObject<icoTurbModel>("turbulenceModel")) + { + const icoTurbModel& model = + mesh.lookupObject<icoTurbModel>("turbulenceModel"); + + nuEff = model.nuEff(); + } + else if (mesh.foundObject<transportModel>("transportProperties")) + { + const transportModel& model = + mesh.lookupObject<transportModel>("transportProperties"); + + nuEff = model.nu(); + } + else + { + FatalErrorIn("void Foam::wallShearStress::write()") + << "Unable to determine the viscosity" + << exit(FatalError); + } + + const surfaceScalarField& phi = + mesh.lookupObject<surfaceScalarField>(phiName_); + + surfaceScalarField& Peclet = + const_cast<surfaceScalarField&> + ( + mesh.lookupObject<surfaceScalarField>(type()) + ); + + Peclet = + mag(phi) + /( + mesh.magSf() + *mesh.surfaceInterpolation::deltaCoeffs() + *fvc::interpolate(nuEff) + ); + + Peclet.write(); + + Info<< type() << " output:" << nl + << " writing " << Peclet.name() << " field" << nl << endl; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Peclet/Peclet.H b/src/postProcessing/functionObjects/utilities/Peclet/Peclet.H new file mode 100644 index 0000000000000000000000000000000000000000..1445e8377b9ed13706360cfb89b9593a4c0b4f9f --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Peclet/Peclet.H @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::Peclet + +Group + grpUtilitiesFunctionObjects + +Description + This function object calculates and outputs the Peclet number as a + surfaceScalarField. + +SourceFiles + Peclet.C + IOPeclet.H + +\*---------------------------------------------------------------------------*/ + +#ifndef Peclet_H +#define Peclet_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "pointFieldFwd.H" +#include "OFstream.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class Peclet Declaration +\*---------------------------------------------------------------------------*/ + +class Peclet +{ + // Private data + + //- Name of this set of Peclet objects + word name_; + + //- Reference to the database + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + //- Name of flux field, default is "phi" + word phiName_; + + //- Name of density field (compressible cases only), default is "rho" + word rhoName_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + Peclet(const Peclet&); + + //- Disallow default bitwise assignment + void operator=(const Peclet&); + + +public: + + //- Runtime type information + TypeName("Peclet"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + Peclet + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~Peclet(); + + + // Member Functions + + //- Return name of the set of Peclet + virtual const word& name() const + { + return name_; + } + + //- Read the Peclet data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the Peclet and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Peclet/PecletFunctionObject.C b/src/postProcessing/functionObjects/utilities/Peclet/PecletFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..fdb247703cf93447ef7443649c06aa92626b5c8f --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Peclet/PecletFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "PecletFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(PecletFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + PecletFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Peclet/PecletFunctionObject.H b/src/postProcessing/functionObjects/utilities/Peclet/PecletFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..fdeca7e571739bc36c4e34751a3452add4bb186b --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Peclet/PecletFunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::PecletFunctionObject + +Description + FunctionObject wrapper around Peclet to allow it to be created + via the functions entry within controlDict. + +SourceFiles + PecletFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef PecletFunctionObject_H +#define PecletFunctionObject_H + +#include "Peclet.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<Peclet> PecletFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Q/IOQ.H b/src/postProcessing/functionObjects/utilities/Q/IOQ.H new file mode 100644 index 0000000000000000000000000000000000000000..f4739a087695d6d2c70731d449315f420c3ba77f --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Q/IOQ.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOQ + +Description + Instance of the generic IOOutputFilter for Q. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOQ_H +#define IOQ_H + +#include "Q.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<Q> IOQ; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Q/Q.C b/src/postProcessing/functionObjects/utilities/Q/Q.C new file mode 100644 index 0000000000000000000000000000000000000000..ffce5efc56e5f701072a8664a194fe902fabc0e5 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Q/Q.C @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "Q.H" +#include "volFields.H" +#include "dictionary.H" +#include "fvcGrad.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::Q, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::Q::Q +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + UName_("U") +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "Q::Q" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + read(dict); + + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + volScalarField* QPtr + ( + new volScalarField + ( + IOobject + ( + type(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimless/sqr(dimTime), 0.0) + ) + ); + + mesh.objectRegistry::store(QPtr); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::Q::~Q() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::Q::read(const dictionary& dict) +{ + if (active_) + { + UName_ = dict.lookupOrDefault<word>("UName", "U"); + } +} + + +void Foam::Q::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::Q::end() +{ + // Do nothing - only valid on write +} + + +void Foam::Q::write() +{ + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + const volVectorField& U = + mesh.lookupObject<volVectorField>(UName_); + + const volTensorField gradU(fvc::grad(U)); + + volScalarField& Q = + const_cast<volScalarField&> + ( + mesh.lookupObject<volScalarField>(type()) + ); + + Q = 0.5*(sqr(tr(gradU)) - tr(((gradU) & (gradU)))); + + Q.write(); + + Info<< type() << " output:" << nl + << " writing " << Q.name() << " field" << nl << endl; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Q/Q.H b/src/postProcessing/functionObjects/utilities/Q/Q.H new file mode 100644 index 0000000000000000000000000000000000000000..c42099dac75e80a063d0829d4d36190a6e222e45 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Q/Q.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::Q + +Group + grpUtilitiesFunctionObjects + +Description + This function object calculates and outputs the second invariant of the + velocity gradient tensor [1/s^2]. + + \f[ + Q = 0.5(sqr(tr(\nabla U)) - tr(((\nabla U) \cdot (\nabla U)))) + \f] + +SourceFiles + Q.C + IOQ.H + +\*---------------------------------------------------------------------------*/ + +#ifndef Q_H +#define Q_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "pointFieldFwd.H" +#include "OFstream.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class Q Declaration +\*---------------------------------------------------------------------------*/ + +class Q +{ + // Private data + + //- Name of this set of Q objects + word name_; + + //- Reference to the database + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + //- Name of velocity field, default is "U" + word UName_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + Q(const Q&); + + //- Disallow default bitwise assignment + void operator=(const Q&); + + +public: + + //- Runtime type information + TypeName("Q"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + Q + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~Q(); + + + // Member Functions + + //- Return name of the set of Q + virtual const word& name() const + { + return name_; + } + + //- Read the Q data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the Q and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Q/QFunctionObject.C b/src/postProcessing/functionObjects/utilities/Q/QFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..0fa525f0b6020edc244e981eadfbbfbf85f238a3 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Q/QFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "QFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(QFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + QFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Q/QFunctionObject.H b/src/postProcessing/functionObjects/utilities/Q/QFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..4c96aac505475107ae423e482e2ebcadcd300dd6 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Q/QFunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::QFunctionObject + +Description + FunctionObject wrapper around Q to allow it to be created + via the functions entry within controlDict. + +SourceFiles + QFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef QFunctionObject_H +#define QFunctionObject_H + +#include "Q.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<Q> QFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C index 6d70be969a2fe6caad71d16a572890783a28a747..f560914e06aaac3577843746c99be5369eed3725 100644 --- a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C +++ b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C @@ -56,7 +56,7 @@ Foam::word Foam::pressureTools::pName() const } -Foam::dimensionedScalar Foam::pressureTools::rho +Foam::dimensionedScalar Foam::pressureTools::rhoScale ( const volScalarField& p ) const @@ -72,6 +72,38 @@ Foam::dimensionedScalar Foam::pressureTools::rho } +Foam::tmp<Foam::volScalarField> Foam::pressureTools::rho +( + const volScalarField& p +) const +{ + if (p.dimensions() == dimPressure) + { + return p.mesh().lookupObject<volScalarField>(rhoName_); + } + else + { + return + tmp<volScalarField> + ( + new volScalarField + ( + IOobject + ( + "rho", + p.mesh().time().timeName(), + p.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + p.mesh(), + dimensionedScalar("zero", dimDensity, rhoRef_) + ) + ); + } +} + + Foam::dimensionedScalar Foam::pressureTools::pRef() const { dimensionedScalar value("pRef", dimPressure, 0.0); @@ -81,11 +113,14 @@ Foam::dimensionedScalar Foam::pressureTools::pRef() const value.value() += pRef_; } - return pRef(); + return value; } -Foam::tmp<Foam::volScalarField> Foam::pressureTools::pDyn() const +Foam::tmp<Foam::volScalarField> Foam::pressureTools::pDyn +( + const volScalarField& p +) const { const fvMesh& mesh = refCast<const fvMesh>(obr_); @@ -110,7 +145,7 @@ Foam::tmp<Foam::volScalarField> Foam::pressureTools::pDyn() const { const volVectorField& U = obr_.lookupObject<volVectorField>(UName_); - tpDyn() == 0.5*magSqr(U); + tpDyn() == rho(p)*0.5*magSqr(U); } return tpDyn; @@ -126,7 +161,13 @@ Foam::tmp<Foam::volScalarField> Foam::pressureTools::convertToCoeff if (calcCoeff_) { - tCoeff() /= pDyn(); + tCoeff() -= dimensionedScalar("pInf", dimPressure, pInf_); + + const dimensionedScalar p0("p0", dimPressure, SMALL); + const dimensionedVector U("U", dimVelocity, UInf_); + const dimensionedScalar rho("rho", dimDensity, rhoInf_); + + tCoeff() /= 0.5*rho*magSqr(U) + p0; } return tCoeff; @@ -146,12 +187,16 @@ Foam::pressureTools::pressureTools name_(name), obr_(obr), active_(true), - calcTotal_(false), - calcCoeff_(false), pName_("p"), UName_("U"), + rhoName_("rho"), + rhoRef_(1.0), + calcTotal_(false), pRef_(0.0), - rhoRef_(1.0) + calcCoeff_(false), + pInf_(0.0), + UInf_(vector::zero), + rhoInf_(0.0) { // Check if the available mesh is an fvMesh, otherwise deactivate if (!isA<fvMesh>(obr_)) @@ -188,10 +233,11 @@ void Foam::pressureTools::read(const dictionary& dict) { dict.readIfPresent("pName", pName_); dict.readIfPresent("UName", UName_); + dict.readIfPresent("rhoName", rhoName_); const volScalarField& p = obr_.lookupObject<volScalarField>(pName_); - if (p.dimensions() != p.dimensions()) + if (p.dimensions() != dimPressure) { dict.lookup("rhoRef") >> rhoRef_; } @@ -203,6 +249,12 @@ void Foam::pressureTools::read(const dictionary& dict) } dict.lookup("calcCoeff") >> calcCoeff_; + if (calcCoeff_) + { + dict.lookup("pInf") >> pInf_; + dict.lookup("UInf") >> UInf_; + dict.lookup("rhoInf") >> rhoInf_; + } } } @@ -234,7 +286,7 @@ void Foam::pressureTools::write() obr_, IOobject::NO_READ ), - convertToCoeff(rho(p)*(p + pDyn()) + pRef()) + convertToCoeff(rhoScale(p)*p + pDyn(p) + pRef()) ); pResult.write(); diff --git a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.H b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.H index 702d4961995f24d7856c619b7804304bc18cfd6e..4a1866821a63e4081fd0f9f5e2fb14448dbcaeda 100644 --- a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.H +++ b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.H @@ -24,28 +24,82 @@ License Class Foam::pressureTools +Group + grpUtilitiesFunctionObjects + Description This function object includes tools to manipulate the pressure into different forms. These currently include: - static pressure - - p_s = rho*p_k - + \f[ + p_s = \rho p_k + \f] - total pressure - - p_T = pRef + p_s + 0.5 rho |U|^2 - + \f[ + p_T = p_{ref} + p_s + 0.5 \rho |U|^2 + \f] - static pressure coefficient - - Cp_s = p_s / (0.5 rho |U|^2) - + \f[ + Cp_s = \frac{p_s - p_{\inf}}{0.5 \rho_{\inf} |U_{\inf}|^2} + \f] - total pressure coefficient - - Cp_T = p_T / (0.5 rho |U|^2) - - The function object will operate on both kinematic (p_k) and static - pressure (p_s) fields, and the result is written as a volScalarField. + \f[ + Cp_T = \frac{p_T - p_{\inf}}{0.5 \rho_{\inf} |U_{\inf}|^2} + \f] + + where + \vartable + \rho | density [kg/m3] + U | velocity [m/s] + \rho_{\inf} | freestream density [kg/m3] + p_{\inf} | freestream pressure [Pa] + U_{\inf} | freestream velocity [m/s] + p_k | kinematic pressure (p/rho)[m2/s2] + p_s | pressure [Pa] + p_T | total pressure [Pa] + p_{ref} | reference pressure level [Pa] + Cp_{s} | pressure coefficient + Cp_{T} | total pressure coefficient + \endvartable + + The function object will operate on both kinematic (\f$ p_k \f$) and static + pressure (\f$ p_s \f$) fields, and the result is written as a + volScalarField. + + The modes of operation are: + \table + Mode | calcTotal | calcCoeff + static pressure | no | no + total pressure | yes | no + pressure coefficient | no | yes + total pressure coefficient | yes | yes + \endtable + + Example of function object specification to calculate pressure coefficient: + \verbatim + pressureTools1 + { + type pressureTools; + functionObjectLibs ("libutilityFunctionObjects.so"); + ... + calcTotal no; + calcCoeff yes; + } + \endverbatim + + \heading Function object usage + \table + Property | Description | Required | Default value + type | type name: pressureTools| yes | + rhoRef | Reference density for incompressible cases | no | 1 + calcTotal | Calculate total coefficient | yes | + pRef | Reference pressure for total pressure | no | 0.0 + calcCoeff | Calculate pressure coefficient | yes | + pInf | Freestream pressure for coefficient calculation | no | + UInf | Freestream velocity for coefficient calculation | no | + rhoInf | Freestream density for coefficient calculation | no | + \endtable SourceFiles pressureTools.C @@ -87,40 +141,61 @@ class pressureTools //- On/off switch bool active_; - //- Flag to calculate total pressure - bool calcTotal_; - - //- Flag to calculate pressure coefficient - bool calcCoeff_; - //- Name of pressure field, default is "p" word pName_; //- Name of velocity field, default is "U" word UName_; - //- Reference pressure level (used for total pressure) - scalar pRef_; + //- Name of density field, default is "rho" + word rhoName_; - //- Reference density value + //- Reference density employed for incompressible cases scalar rhoRef_; + // Total pressure calculation + + //- Flag to calculate total pressure + bool calcTotal_; + + //- Reference pressure level + scalar pRef_; + + + // Pressure coefficient calculation + + //- Flag to calculate pressure coefficient + bool calcCoeff_; + + //- Freestream pressure + scalar pInf_; + + //- Freestream velocity + vector UInf_; + + //- Freestream density + scalar rhoInf_; + + // Private Member Functions //- Return the name of the derived pressure field word pName() const; //- Return the density scaling if supplied with kinematic pressure - dimensionedScalar rho(const volScalarField& p) const; + dimensionedScalar rhoScale(const volScalarField& p) const; + + //- Return the density field + tmp<volScalarField> rho(const volScalarField& p) const; //- Return the reference pressure dimensionedScalar pRef() const; - //- Calculate and return the (kinematic) dynamic pressure - tmp<volScalarField> pDyn() const; + //- Calculate and return the dynamic pressure + tmp<volScalarField> pDyn(const volScalarField& p) const; - //- Convert to coeff data by applying the pDyn scaling + //- Convert to coeff by applying the freestream dynamic pressure scaling tmp<volScalarField> convertToCoeff(const volScalarField& p) const; //- Disallow default bitwise copy construct diff --git a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H index e08e40943a6de36f5a1686e87c1905020965267f..35a872f59e463f866a0a5dc391053c50f2d416e3 100644 --- a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H +++ b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H @@ -24,6 +24,9 @@ License Class Foam::scalarTransport +Group + grpUtilitiesFunctionObjects + Description This function object evolves a passive scalar transport equation. The field in ininitially zero, to which sources are added. The field name diff --git a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C index a7e5e1ee094e361fff15ffe7c9f921a577e080b2..7e096c6a70e486ca056f32d13e498e5fc1851ddf 100644 --- a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C +++ b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C @@ -53,34 +53,32 @@ void Foam::wallShearStress::calcShearStress volVectorField& shearStress ) { - forAll(shearStress.boundaryField(), patchI) + forAllConstIter(labelHashSet, patchSet_, iter) { + label patchI = iter.key(); const polyPatch& pp = mesh.boundaryMesh()[patchI]; - if (isA<wallPolyPatch>(pp)) - { - vectorField& ssp = shearStress.boundaryField()[patchI]; - const vectorField& Sfp = mesh.Sf().boundaryField()[patchI]; - const scalarField& magSfp = mesh.magSf().boundaryField()[patchI]; - const symmTensorField& Reffp = Reff.boundaryField()[patchI]; + vectorField& ssp = shearStress.boundaryField()[patchI]; + const vectorField& Sfp = mesh.Sf().boundaryField()[patchI]; + const scalarField& magSfp = mesh.magSf().boundaryField()[patchI]; + const symmTensorField& Reffp = Reff.boundaryField()[patchI]; - ssp = (-Sfp/magSfp) & Reffp; + ssp = (-Sfp/magSfp) & Reffp; - vector minSsp = gMin(ssp); - vector maxSsp = gMax(ssp); + vector minSsp = gMin(ssp); + vector maxSsp = gMax(ssp); - if (Pstream::master()) - { - file() << mesh.time().timeName() << token::TAB - << pp.name() << token::TAB << minSsp - << token::TAB << maxSsp << endl; - } + if (Pstream::master()) + { + file() << mesh.time().timeName() << token::TAB + << pp.name() << token::TAB << minSsp + << token::TAB << maxSsp << endl; + } - if (log_) - { - Info<< " min/max(" << pp.name() << ") = " - << minSsp << ", " << maxSsp << endl; - } + if (log_) + { + Info<< " min/max(" << pp.name() << ") = " + << minSsp << ", " << maxSsp << endl; } } } @@ -101,7 +99,7 @@ Foam::wallShearStress::wallShearStress obr_(obr), active_(true), log_(false), - phiName_("phi") + patchSet_() { // Check if the available mesh is an fvMesh, otherwise deactivate if (!isA<fvMesh>(obr_)) @@ -137,7 +135,54 @@ void Foam::wallShearStress::read(const dictionary& dict) if (active_) { log_ = dict.lookupOrDefault<Switch>("log", false); - phiName_ = dict.lookupOrDefault<word>("phiName", "phi"); + + const fvMesh& mesh = refCast<const fvMesh>(obr_); + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + + patchSet_ = + mesh.boundaryMesh().patchSet + ( + wordReList(dict.lookupOrDefault("patches", wordReList())) + ); + + Info<< type() << " output:" << nl; + + if (patchSet_.empty()) + { + forAll(pbm, patchI) + { + if (isA<wallPolyPatch>(pbm[patchI])) + { + patchSet_.insert(patchI); + } + } + + Info<< " processing all wall patches" << nl << endl; + } + else + { + Info<< " processing wall patches: " << nl; + labelHashSet filteredPatchSet; + forAllConstIter(labelHashSet, patchSet_, iter) + { + label patchI = iter.key(); + if (isA<wallPolyPatch>(pbm[patchI])) + { + filteredPatchSet.insert(patchI); + Info<< " " << pbm[patchI].name() << endl; + } + else + { + WarningIn("void wallShearStress::read(const dictionary&)") + << "Requested wall shear stress on non-wall boundary " + << "type patch: " << pbm[patchI].name() << endl; + } + } + + Info<< endl; + + patchSet_ = filteredPatchSet; + } } } @@ -184,38 +229,27 @@ void Foam::wallShearStress::write() } - const surfaceScalarField& phi = - obr_.lookupObject<surfaceScalarField>(phiName_); - tmp<volSymmTensorField> Reff; - if (phi.dimensions() == dimMass/dimTime) + if (mesh.foundObject<cmpModel>("turbulenceModel")) { - if (!mesh.foundObject<cmpModel>("turbulenceModel")) - { - FatalErrorIn("void Foam::wallShearStress::write()") - << "Unable to find compressible turbulence model in the " - << "database" << exit(FatalError); - } - const cmpModel& model = mesh.lookupObject<cmpModel>("turbulenceModel"); Reff = model.devRhoReff(); } - else + else if (mesh.foundObject<icoModel>("turbulenceModel")) { - if (!mesh.foundObject<icoModel>("turbulenceModel")) - { - FatalErrorIn("void Foam::wallShearStress::write()") - << "Unable to find incompressible turbulence model in the " - << "database" << exit(FatalError); - } - const icoModel& model = mesh.lookupObject<icoModel>("turbulenceModel"); Reff = model.devReff(); } + else + { + FatalErrorIn("void Foam::wallShearStress::write()") + << "Unable to find incompressible turbulence model in the " + << "database" << exit(FatalError); + } calcShearStress(mesh, Reff(), wallShearStress); diff --git a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.H b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.H index 80f12d0c24d6f134dbdf4e738e5519627a5efb1a..6b31c9f6123f67c6c7427bb37a48db2e4b2eca7a 100644 --- a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.H +++ b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.H @@ -36,15 +36,34 @@ Description Stress = R \dot n \f] - The shear stress (symmetrical) tensor field is retrieved from the - turbulence model. - where \vartable R | stress tensor n | patch normal vector (into the domain) \endvartable + The shear stress (symmetrical) tensor field is retrieved from the + turbulence model. All wall patches are included by default; to restrict + the calculation to certain patches, use the optional 'patches' entry. + + Example of function object specification: + \verbatim + wallShearStress1 + { + type wallShearStress; + functionObjectLibs ("libutilityFunctionObjects.so"); + ... + patches (".*Wall"); + } + \endverbatim + + \heading Function object usage + \table + Property | Description | Required | Default value + type | type name: wallShearStress | yes | + patches | list of patches to process | no | all wall patches + \endtable + SourceFiles wallShearStress.C IOwallShearStress.H @@ -94,8 +113,8 @@ protected: //- Switch to send output to Info as well as to file Switch log_; - //- Name of mass/volume flux field (optional, default = phi) - word phiName_; + //- Optional list of patches to process + labelHashSet patchSet_; // Protected Member Functions diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C index 8d81c05bfe165d107c4e841ab98a432ea9949590..de584f6105a6f2a4aa358d48cb55027c1eaf4c17 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C @@ -56,7 +56,7 @@ void Foam::yPlusRAS::calcIncompressibleYPlus volScalarField& yPlus ) { - typedef incompressible::RASModels::nutWallFunctionFvPatchScalarField + typedef incompressible::nutWallFunctionFvPatchScalarField wallFunctionPatchField; const incompressible::RASModel& model = @@ -114,7 +114,7 @@ void Foam::yPlusRAS::calcCompressibleYPlus volScalarField& yPlus ) { - typedef compressible::RASModels::mutWallFunctionFvPatchScalarField + typedef compressible::mutWallFunctionFvPatchScalarField wallFunctionPatchField; const compressible::RASModel& model = diff --git a/src/randomProcesses/Make/options b/src/randomProcesses/Make/options index 61fc018ad930d8d5dda59891e9e59e52ff1ecba6..71b7873964d544eddf96d22aa40f4c3372c23c9c 100644 --- a/src/randomProcesses/Make/options +++ b/src/randomProcesses/Make/options @@ -1,7 +1,5 @@ EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude LIB_LIBS = \ - -lfiniteVolume \ - -lsampling + -lfiniteVolume diff --git a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C index b64afa0be661e17ce5bcc904be0229c95b683dc5..cfa52c3e80ef223ffe0e15d4b1d591e6db1de4f6 100644 --- a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C +++ b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,61 +42,11 @@ defineTypeNameAndDebug(pyrolysisModel, 0); defineRunTimeSelectionTable(pyrolysisModel, mesh); defineRunTimeSelectionTable(pyrolysisModel, dictionary); -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // - -void pyrolysisModel::constructMeshObjects() -{ - // construct filmDelta field if coupled to film model - if (filmCoupled_) - { - filmDeltaPtr_.reset - ( - new volScalarField - ( - IOobject - ( - "filmDelta", - time_.timeName(), - regionMesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - regionMesh() - ) - ); - - const volScalarField& filmDelta = filmDeltaPtr_(); - - bool foundCoupledPatch = false; - forAll(filmDelta.boundaryField(), patchI) - { - const fvPatchField<scalar>& fvp = filmDelta.boundaryField()[patchI]; - if (isA<mappedFieldFvPatchField<scalar> >(fvp)) - { - foundCoupledPatch = true; - break; - } - } - - if (!foundCoupledPatch) - { - WarningIn("void pyrolysisModels::constructMeshObjects()") - << "filmCoupled flag set to true, but no " - << mappedFieldFvPatchField<scalar>::typeName - << " patches found on " << filmDelta.name() << " field" - << endl; - } - } -} - - // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // void pyrolysisModel::readPyrolysisControls() { - filmCoupled_ = readBool(coeffs_.lookup("filmCoupled")); - reactionDeltaMin_ = - coeffs_.lookupOrDefault<scalar>("reactionDeltaMin", 0.0); + // do nothing } @@ -132,24 +82,17 @@ bool pyrolysisModel::read(const dictionary& dict) pyrolysisModel::pyrolysisModel(const fvMesh& mesh) : - regionModel1D(mesh), - filmCoupled_(false), - filmDeltaPtr_(NULL), - reactionDeltaMin_(0.0) + regionModel1D(mesh) {} pyrolysisModel::pyrolysisModel(const word& modelType, const fvMesh& mesh) : - regionModel1D(mesh, "pyrolysis", modelType), - filmCoupled_(false), - filmDeltaPtr_(NULL), - reactionDeltaMin_(0.0) + regionModel1D(mesh, "pyrolysis", modelType) { if (active_) { read(); - constructMeshObjects(); } } @@ -161,15 +104,11 @@ pyrolysisModel::pyrolysisModel const dictionary& dict ) : - regionModel1D(mesh, "pyrolysis", modelType, dict), - filmCoupled_(false), - filmDeltaPtr_(NULL), - reactionDeltaMin_(0.0) + regionModel1D(mesh, "pyrolysis", modelType, dict) { if (active_) { read(dict); - constructMeshObjects(); } } @@ -192,15 +131,6 @@ scalar pyrolysisModel::addMassSources } -void pyrolysisModel::preEvolveRegion() -{ - if (filmCoupled_) - { - filmDeltaPtr_->correctBoundaryConditions(); - } -} - - scalar pyrolysisModel::solidRegionDiffNo() const { return -GREAT; diff --git a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H index 57d8caa3c4fc2d98b3a19f6cf0effedafc1ba8c3..98da338d9a8b6f01c9740db483698db08ab01312 100644 --- a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H +++ b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H @@ -80,18 +80,6 @@ private: protected: - // Protected Data - - //- Flag to indicate whether pyrolysis region coupled to a film region - bool filmCoupled_; - - //- Pointer to film thickness field - autoPtr<volScalarField> filmDeltaPtr_; - - //- Film height below which reactions can occur [m] - scalar reactionDeltaMin_; - - // Protected Member Functions //- Read control parameters @@ -115,8 +103,8 @@ public: pyrolysisModel, mesh, ( - const word& modelType, - const fvMesh& mesh + const word& modelType, + const fvMesh& mesh ), (modelType, mesh) ); @@ -127,9 +115,9 @@ public: pyrolysisModel, dictionary, ( - const word& modelType, - const fvMesh& mesh, - const dictionary& dict + const word& modelType, + const fvMesh& mesh, + const dictionary& dict ), (modelType, mesh, dict) ); @@ -234,12 +222,6 @@ public: ); - // Evolution - - //- Pre-evolve region - virtual void preEvolveRegion(); - - // Helper function //- Mean diffusion number of the solid region diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index 5c36e4ad53e61d265fffea43c589855ea965e23c..3588060c726705688bf4cd90224e37454bea4de8 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -90,58 +90,6 @@ bool reactingOneDim::read(const dictionary& dict) } -void reactingOneDim::updateQr() -{ - // Retrieve field from coupled region using mapped boundary conditions - QrCoupled_.correctBoundaryConditions(); - - // Update local Qr from coupled Qr field - Qr_ == dimensionedScalar("zero", Qr_.dimensions(), 0.0); - forAll(intCoupledPatchIDs_, i) - { - const label patchI = intCoupledPatchIDs_[i]; - - scalarField& Qrp = Qr_.boundaryField()[patchI]; - - // Qr is negative going out the solid - // If the surface is emitting the radiative flux is set to zero - Qrp = max(Qrp, scalar(0.0)); - } - - const volScalarField kappaRad_(kappaRad()); - - // Propagate Qr through 1-D regions - label totalFaceId = 0; - forAll(intCoupledPatchIDs_, i) - { - const label patchI = intCoupledPatchIDs_[i]; - - const scalarField& Qrp = Qr_.boundaryField()[patchI]; - const vectorField& Cf = regionMesh().Cf().boundaryField()[patchI]; - - forAll(Qrp, faceI) - { - const scalar Qr0 = Qrp[faceI]; - point Cf0 = Cf[faceI]; - const labelList& cells = boundaryFaceCells_[totalFaceId]; - scalar kappaInt = 0.0; - forAll(cells, k) - { - const label cellI = cells[k]; - const point& Cf1 = regionMesh().cellCentres()[cellI]; - const scalar delta = mag(Cf1 - Cf0); - kappaInt += kappaRad_[cellI]*delta; - Qr_[cellI] = Qr0*exp(-kappaInt); - Cf0 = Cf1; - } - totalFaceId ++; - } - } - - Qr_.correctBoundaryConditions(); -} - - void reactingOneDim::updatePhiGas() { phiHsGas_ == dimensionedScalar("zero", phiHsGas_.dimensions(), 0.0); @@ -198,8 +146,6 @@ void reactingOneDim::updatePhiGas() void reactingOneDim::updateFields() { - updateQr(); - updatePhiGas(); } @@ -305,8 +251,6 @@ void reactingOneDim::solveEnergy() tmp<volScalarField> alpha(solidThermo_.alpha()); - const surfaceScalarField phiQr(fvc::interpolate(Qr_)*nMagSf()); - const surfaceScalarField phiGas(fvc::interpolate(phiHsGas_)); fvScalarMatrix hEqn @@ -315,7 +259,6 @@ void reactingOneDim::solveEnergy() - fvm::laplacian(alpha, h_) == chemistrySh_ - + fvc::div(phiQr) + fvc::div(phiGas) ); @@ -380,7 +323,6 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh) ), Ys_(solidThermo_.composition().Y()), h_(solidThermo_.he()), - primaryRadFluxName_(coeffs().lookupOrDefault<word>("radFluxName", "Qr")), nNonOrthCorr_(-1), maxDiff_(10), minimumDelta_(1e-4), @@ -427,34 +369,6 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh) dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0) ), - QrCoupled_ - ( - IOobject - ( - primaryRadFluxName_, - time().timeName(), - regionMesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - regionMesh() - ), - - Qr_ - ( - IOobject - ( - "QrPyr", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimEnergy/dimArea/dimTime, 0.0), - zeroGradientFvPatchVectorField::typeName - ), - lostSolidMass_(dimensionedScalar("zero", dimMass, 0.0)), addedGasMass_(dimensionedScalar("zero", dimMass, 0.0)), totalGasMassFlux_(0.0), @@ -492,7 +406,6 @@ reactingOneDim::reactingOneDim ), Ys_(solidThermo_.composition().Y()), h_(solidThermo_.he()), - primaryRadFluxName_(dict.lookupOrDefault<word>("radFluxName", "Qr")), nNonOrthCorr_(-1), maxDiff_(10), minimumDelta_(1e-4), @@ -539,34 +452,6 @@ reactingOneDim::reactingOneDim dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0) ), - QrCoupled_ - ( - IOobject - ( - primaryRadFluxName_, - time().timeName(), - regionMesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - regionMesh() - ), - - Qr_ - ( - IOobject - ( - "QrPyr", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimEnergy/dimArea/dimTime, 0.0), - zeroGradientFvPatchVectorField::typeName - ), - lostSolidMass_(dimensionedScalar("zero", dimMass, 0.0)), addedGasMass_(dimensionedScalar("zero", dimMass, 0.0)), totalGasMassFlux_(0.0), @@ -684,36 +569,6 @@ void reactingOneDim::preEvolveRegion() { solidChemistry_->setCellReacting(cellI, true); } - - // De-activate reactions if pyrolysis region coupled to (valid) film - if (filmCoupled_) - { - const volScalarField& filmDelta = filmDeltaPtr_(); - - forAll(intCoupledPatchIDs_, i) - { - const label patchI = intCoupledPatchIDs_[i]; - const scalarField& filmDeltap = filmDelta.boundaryField()[patchI]; - - forAll(filmDeltap, faceI) - { - const scalar filmDelta0 = filmDeltap[faceI]; - if (filmDelta0 > reactionDeltaMin_) - { - const labelList& cells = boundaryFaceCells_[faceI]; - - // TODO: only limit cell adjacent to film? - //solidChemistry_->setCellNoReacting(cells[0]) - - // Propagate flag through 1-D region - forAll(cells, k) - { - solidChemistry_->setCellReacting(cells[k], false); - } - } - } - } - } } diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H index 76cf66a60feec70bf07c7f539f79cefea6609280..104e56c34e82b1598fa324c66602812601047482 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -125,16 +125,6 @@ protected: volScalarField chemistrySh_; - // Source term fields - - //- Coupled region radiative heat flux [W/m2] - // Requires user to input mapping info for coupled patches - volScalarField QrCoupled_; - - //- In depth radiative heat flux [W/m2] - volScalarField Qr_; - - // Checks //- Cumulative lost mass of the condensed phase [kg] @@ -164,9 +154,6 @@ protected: //- Update/move mesh based on change in mass void updateMesh(const scalarField& mass0); - //- Update radiative flux in pyrolysis region - void updateQr(); - //- Update enthalpy flux for pyrolysis gases void updatePhiGas(); @@ -259,12 +246,6 @@ public: virtual scalar solidRegionDiffNo() const; - // Source fields (read/write access) - - //- In depth radiative heat flux - inline const volScalarField& Qr() const; - - // Evolution //- Pre-evolve region diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H index eec1e7fa0a046491eee3de7b5555b0925a3c4b7e..375c3780804337ddef0cf5c0129a680e1df0954a 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,11 +34,4 @@ Foam::regionModels::pyrolysisModels::reactingOneDim::nNonOrthCorr() const } -inline const Foam::volScalarField& -Foam::regionModels::pyrolysisModels::reactingOneDim::Qr() const -{ - return Qr_; -} - - // ************************************************************************* // diff --git a/src/regionModels/regionCoupling/Make/options b/src/regionModels/regionCoupling/Make/options index 4eaef77e23fdb8a64cf01f11691b13a6f70283ad..28569ccda68e500c6b26cfab904e9507bd6fa120 100644 --- a/src/regionModels/regionCoupling/Make/options +++ b/src/regionModels/regionCoupling/Make/options @@ -1,6 +1,5 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/AMIInterpolation/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C index b0f8d1629a919d008f1267e6dcb99cc5562aef3b..1ffe2ae82f034af094ffa5ea933b9eb9dad4b8f0 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,8 +40,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(p, iF), phiName_("phi"), - rhoName_("rho"), - deltaWet_(1e-6) + rhoName_("rho") {} @@ -56,8 +55,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(ptf, p, iF, mapper), phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_), - deltaWet_(ptf.deltaWet_) + rhoName_(ptf.rhoName_) {} @@ -71,8 +69,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(p, iF), phiName_(dict.lookupOrDefault<word>("phi", "phi")), - rhoName_(dict.lookupOrDefault<word>("rho", "rho")), - deltaWet_(dict.lookupOrDefault<scalar>("deltaWet", 1e-6)) + rhoName_(dict.lookupOrDefault<word>("rho", "rho")) { fvPatchScalarField::operator=(scalarField("value", dict, p.size())); } @@ -86,8 +83,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(fptpsf), phiName_(fptpsf.phiName_), - rhoName_(fptpsf.rhoName_), - deltaWet_(fptpsf.deltaWet_) + rhoName_(fptpsf.rhoName_) {} @@ -100,8 +96,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(fptpsf, iF), phiName_(fptpsf.phiName_), - rhoName_(fptpsf.rhoName_), - deltaWet_(fptpsf.deltaWet_) + rhoName_(fptpsf.rhoName_) {} @@ -151,13 +146,12 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs() const label filmPatchI = filmModel.regionPatchID(patchI); - scalarField deltaFilm = filmModel.delta().boundaryField()[filmPatchI]; - filmModel.toPrimary(filmPatchI, deltaFilm); + scalarField alphaFilm = filmModel.alpha().boundaryField()[filmPatchI]; + filmModel.toPrimary(filmPatchI, alphaFilm); scalarField TFilm = filmModel.Ts().boundaryField()[filmPatchI]; filmModel.toPrimary(filmPatchI, TFilm); - // Retrieve pyrolysis model const pyrModelType& pyrModel = db().lookupObject<pyrModelType>("pyrolysisProperties"); @@ -168,19 +162,8 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs() pyrModel.toPrimary(pyrPatchI, TPyr); - forAll(deltaFilm, i) - { - if (deltaFilm[i] > deltaWet_) - { - // temperature set by film - Tp[i] = TFilm[i]; - } - else - { - // temperature set by pyrolysis model - Tp[i] = TPyr[i]; - } - } + // Evaluate temperature + Tp = alphaFilm*TFilm + (1.0 - alphaFilm)*TPyr; // Restore tag UPstream::msgType() = oldTag; @@ -197,7 +180,6 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::write fvPatchScalarField::write(os); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); - os.writeKeyword("deltaWet") << deltaWet_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.H b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.H index 503b023f955c89dccc683a0311766352aaf38413..bc4ace8abdfcdcd7b84b36af1d481f5af8f7e27a 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.H +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.H @@ -28,15 +28,7 @@ Description This boundary condition is designed to be used in conjunction with surface film and pyrolysis modelling. It provides a temperature boundary condition for patches on the primary region based on whether the patch is seen to - be 'wet', specified by: - - \f[ - delta > delta_wet - \f] - - where - \var delta = film height [m] - \var delta_wet = film height above which the surface is considered wet + be 'wet', retrieved from the film alpha field. \li if the patch is wet, the temperature is set using the film temperature \li otherwise, it is set using pyrolysis temperature @@ -84,9 +76,6 @@ class filmPyrolysisTemperatureCoupledFvPatchScalarField //- Name of density field word rhoName_; - //- Film height threshold beyond which it is considered 'wet' [m] - scalar deltaWet_; - public: diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C index 29b3e345868bcc112d33535b76bb42e1f89448f6..9210d30e576f1b7ba86518265760cf5764a60045 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,8 +40,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(p, iF), phiName_("phi"), - rhoName_("rho"), - deltaWet_(1e-6) + rhoName_("rho") {} @@ -56,8 +55,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(ptf, p, iF, mapper), phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_), - deltaWet_(ptf.deltaWet_) + rhoName_(ptf.rhoName_) {} @@ -71,8 +69,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(p, iF), phiName_(dict.lookupOrDefault<word>("phi", "phi")), - rhoName_(dict.lookupOrDefault<word>("rho", "rho")), - deltaWet_(dict.lookupOrDefault<scalar>("deltaWet", 1e-6)) + rhoName_(dict.lookupOrDefault<word>("rho", "rho")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); } @@ -86,8 +83,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(fpvpvf), phiName_(fpvpvf.phiName_), - rhoName_(fpvpvf.rhoName_), - deltaWet_(fpvpvf.deltaWet_) + rhoName_(fpvpvf.rhoName_) {} @@ -100,8 +96,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(fpvpvf, iF), phiName_(fpvpvf.phiName_), - rhoName_(fpvpvf.rhoName_), - deltaWet_(fpvpvf.deltaWet_) + rhoName_(fpvpvf.rhoName_) {} @@ -154,13 +149,12 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs() const label filmPatchI = filmModel.regionPatchID(patchI); - scalarField deltaFilm = filmModel.delta().boundaryField()[filmPatchI]; - filmModel.toPrimary(filmPatchI, deltaFilm); + scalarField alphaFilm = filmModel.alpha().boundaryField()[filmPatchI]; + filmModel.toPrimary(filmPatchI, alphaFilm); vectorField UFilm = filmModel.Us().boundaryField()[filmPatchI]; filmModel.toPrimary(filmPatchI, UFilm); - // Retrieve pyrolysis model const pyrModelType& pyrModel = db().objectRegistry::lookupObject<pyrModelType> @@ -203,19 +197,9 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs() const scalarField UAvePyr(-phiPyr/patch().magSf()); const vectorField& nf = patch().nf(); - forAll(deltaFilm, i) - { - if (deltaFilm[i] > deltaWet_) - { - // velocity set by film - Up[i] = UFilm[i]; - } - else - { - // velocity set by pyrolysis model - Up[i] = UAvePyr[i]*nf[i]; - } - } + + // Evaluate velocity + Up = alphaFilm*UFilm + (1.0 - alphaFilm)*UAvePyr*nf; // Restore tag UPstream::msgType() = oldTag; @@ -232,7 +216,6 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::write fvPatchVectorField::write(os); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); - os.writeKeyword("deltaWet") << deltaWet_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.H b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.H index c7c4c5d24be220b83c3bb478b61b40148895b104..b37157ddf0251f6e1a7d0c8a8169c153d7fa0f80 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.H +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.H @@ -28,15 +28,7 @@ Description This boundary condition is designed to be used in conjunction with surface film and pyrolysis modelling. It provides a velocity boundary condition for patches on the primary region based on whether the patch is seen to - be 'wet', specified by: - - \f[ - delta > delta_wet - \f] - - where - \var delta = film height [m] - \var delta_wet = film height above which the surface is considered wet + be 'wet', retrieved from the film alpha field. \li if the patch is wet, the velocity is set using the film velocity \li otherwise, it is set using pyrolysis out-gassing velocity @@ -84,9 +76,6 @@ class filmPyrolysisVelocityCoupledFvPatchVectorField //- Name of density field word rhoName_; - //- Film height threshold beyond which it is considered 'wet' - scalar deltaWet_; - public: diff --git a/src/regionModels/regionModel/Make/files b/src/regionModels/regionModel/Make/files index ab1853089066055765a022cbbe3249f36fc23f3e..11002e0a2902e40bf3b778df3145e988cf4ff937 100644 --- a/src/regionModels/regionModel/Make/files +++ b/src/regionModels/regionModel/Make/files @@ -8,4 +8,8 @@ derivedFvPatches/mappedVariableThicknessWall/mappedVariableThicknessWallFvPatch. regionProperties/regionProperties.C +regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C +regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C +regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C + LIB = $(FOAM_LIBBIN)/libregionModels diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index 98e152c3f1784818c406da85352ebf0651f012e9..227af0adb4f0566918520a662dabb3e52916b943 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -190,6 +190,66 @@ bool Foam::regionModels::regionModel::read(const dictionary& dict) } +Foam::label Foam::regionModels::regionModel::nbrCoupledPatchID +( + const regionModel& nbrRegion, + const label regionPatchI +) const +{ + label nbrPatchI = -1; + + // region + const fvMesh& nbrRegionMesh = nbrRegion.regionMesh(); + + // boundary mesh + const polyBoundaryMesh& nbrPbm = nbrRegionMesh.boundaryMesh(); + + const mappedPatchBase& mpb = + refCast<const mappedPatchBase> + ( + regionMesh().boundaryMesh()[regionPatchI] + ); + + // sample patch name on the primary region + const word& primaryPatchName = mpb.samplePatch(); + + // find patch on nbr region that has the same sample patch name + forAll(nbrRegion.intCoupledPatchIDs(), j) + { + const label nbrRegionPatchI = nbrRegion.intCoupledPatchIDs()[j]; + + const mappedPatchBase& mpb = + refCast<const mappedPatchBase>(nbrPbm[nbrRegionPatchI]); + + if (mpb.samplePatch() == primaryPatchName) + { + nbrPatchI = nbrRegionPatchI; + break; + } + } + + if (nbrPatchI == -1) + { + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + + FatalErrorIn + ( + "Foam::tmp<Foam::Field<Type> > " + "Foam::regionModels::regionModel::nbrCoupledPatchID" + "(" + "const regionModel& , " + "const label" + ") const" + ) + << "Unable to find patch pair for local patch " + << p.name() << " and region " << nbrRegion.name() + << abort(FatalError); + } + + return nbrPatchI; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::regionModels::regionModel::regionModel(const fvMesh& mesh) @@ -214,7 +274,8 @@ Foam::regionModels::regionModel::regionModel(const fvMesh& mesh) coeffs_(dictionary::null), primaryPatchIDs_(), intCoupledPatchIDs_(), - regionName_("none") + regionName_("none"), + functions_(*this) {} @@ -246,7 +307,8 @@ Foam::regionModels::regionModel::regionModel coeffs_(subOrEmptyDict(modelName + "Coeffs")), primaryPatchIDs_(), intCoupledPatchIDs_(), - regionName_(lookup("regionName")) + regionName_(lookup("regionName")), + functions_(*this, subOrEmptyDict("functions")) { if (active_) { @@ -274,7 +336,7 @@ Foam::regionModels::regionModel::regionModel ( IOobject ( - regionType, + regionType + "Properties", mesh.time().constant(), mesh, IOobject::NO_READ, @@ -292,7 +354,8 @@ Foam::regionModels::regionModel::regionModel coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")), primaryPatchIDs_(), intCoupledPatchIDs_(), - regionName_(dict.lookup("regionName")) + regionName_(dict.lookup("regionName")), + functions_(*this, subOrEmptyDict("functions")) { if (active_) { @@ -315,18 +378,6 @@ Foam::regionModels::regionModel::~regionModel() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -void Foam::regionModels::regionModel::preEvolveRegion() -{ - // do nothing -} - - -void Foam::regionModels::regionModel::evolveRegion() -{ - // do nothing -} - - void Foam::regionModels::regionModel::evolve() { if (active_) @@ -334,15 +385,14 @@ void Foam::regionModels::regionModel::evolve() Info<< "\nEvolving " << modelName_ << " for region " << regionMesh().name() << endl; - // Update any input information //read(); - // Pre-evolve preEvolveRegion(); - // Increment the region equations up to the new time level evolveRegion(); + postEvolveRegion(); + // Provide some feedback if (infoOutput_) { @@ -354,6 +404,24 @@ void Foam::regionModels::regionModel::evolve() } +void Foam::regionModels::regionModel::preEvolveRegion() +{ + functions_.preEvolveRegion(); +} + + +void Foam::regionModels::regionModel::evolveRegion() +{ + // do nothing +} + + +void Foam::regionModels::regionModel::postEvolveRegion() +{ + functions_.postEvolveRegion(); +} + + void Foam::regionModels::regionModel::info() const { // do nothing diff --git a/src/regionModels/regionModel/regionModel/regionModel.H b/src/regionModels/regionModel/regionModel/regionModel.H index 6fbad3d3720465d69cba391df69e7f67dba61a2e..9f2ec23e67a4112eb612c14cad5bdbfa7298c29a 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.H +++ b/src/regionModels/regionModel/regionModel/regionModel.H @@ -41,16 +41,13 @@ SourceFiles #include "labelList.H" #include "volFields.H" #include "mappedPatchBase.H" +#include "regionModelFunctionObjectList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// Forward declaration of classes -//class fvMesh; -//class Time; - namespace regionModels { @@ -121,6 +118,9 @@ protected: //- Region name word regionName_; + //- Region model function objects + regionModelFunctionObjectList functions_; + // Protected member functions @@ -219,6 +219,46 @@ public: // Helper + //- Return the coupled patch ID paired with coupled patch + // regionPatchI + label nbrCoupledPatchID + ( + const regionModel& nbrRegion, + const label regionPatchI + ) const; + + //- Map patch field from another region model to local patch + template<class Type> + tmp<Foam::Field<Type> > mapRegionPatchField + ( + const regionModel& nbrRegion, + const label regionPatchI, + const label nbrPatchI, + const Field<Type>& nbrField, + const bool flip = false + ) const; + + //- Map patch field from another region model to local patch + template<class Type> + tmp<Field<Type> > mapRegionPatchField + ( + const word& regionModelName, + const word& fieldName, + const label regionPatchI, + const bool flip = false + ) const; + + //- Map patch internal field from another region model to local + // patch + template<class Type> + tmp<Field<Type> > mapRegionPatchInternalField + ( + const word& regionModelName, + const word& fieldName, + const label regionPatchI, + const bool flip = false + ) const; + //- Convert a local region field to the primary region template<class Type> void toPrimary @@ -256,14 +296,17 @@ public: // Evolution + //- Main driver routing to evolve the region - calls other evolves + virtual void evolve(); + //- Pre-evolve region virtual void preEvolveRegion(); //- Evolve the region virtual void evolveRegion(); - //- Evolve the region - virtual void evolve(); + //- Post-evolve region + virtual void postEvolveRegion(); // I-O diff --git a/src/regionModels/regionModel/regionModel/regionModelTemplates.C b/src/regionModels/regionModel/regionModel/regionModelTemplates.C index b78772de017f34dd966b8e6df1be4bab0a9490ce..4e98b2e2fb2ba13fe00631bcd7d47d4ee7960417 100644 --- a/src/regionModels/regionModel/regionModel/regionModelTemplates.C +++ b/src/regionModels/regionModel/regionModel/regionModelTemplates.C @@ -23,6 +23,164 @@ License \*---------------------------------------------------------------------------*/ +template<class Type> +Foam::tmp<Foam::Field<Type> > +Foam::regionModels::regionModel::mapRegionPatchField +( + const regionModel& nbrRegion, + const label regionPatchI, + const label nbrPatchI, + const Field<Type>& nbrField, + const bool flip +) const +{ + const fvMesh& nbrRegionMesh = nbrRegion.regionMesh(); + + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + + const polyPatch& nbrP = nbrRegionMesh.boundaryMesh()[nbrPatchI]; + + int oldTag = UPstream::msgType(); + UPstream::msgType() = oldTag + 1; + + AMIPatchToPatchInterpolation ami(p, nbrP, faceAreaIntersect::tmMesh, flip); + + tmp<Field<Type> > tresult(ami.interpolateToSource(nbrField)); + + UPstream::msgType() = oldTag; + + return tresult; +} + + +template<class Type> +Foam::tmp<Foam::Field<Type> > +Foam::regionModels::regionModel::mapRegionPatchField +( + const word& regionModelName, + const word& fieldName, + const label regionPatchI, + const bool flip +) const +{ + typedef GeometricField<Type, fvPatchField, volMesh> fieldType; + + const regionModel& nbrRegion = + this->primaryMesh_.lookupObject<regionModel>(regionModelName); + + const fvMesh& nbrRegionMesh = nbrRegion.regionMesh(); + + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + + if (nbrRegionMesh.foundObject<fieldType>(fieldName)) + { + const fieldType& nbrField = + nbrRegionMesh.lookupObject<fieldType>(fieldName); + + const label nbrPatchI = nbrCoupledPatchID(nbrRegion, regionPatchI); + + const polyPatch& nbrP = nbrRegionMesh.boundaryMesh()[nbrPatchI]; + + int oldTag = UPstream::msgType(); + UPstream::msgType() = oldTag + 1; + + AMIPatchToPatchInterpolation ami + ( + p, + nbrP, + faceAreaIntersect::tmMesh, + flip + ); + + const Field<Type>& nbrFieldp = nbrField.boundaryField()[nbrPatchI]; + + tmp<Field<Type> > tresult(ami.interpolateToSource(nbrFieldp)); + + UPstream::msgType() = oldTag; + + return tresult; + } + else + { + return + tmp<Field<Type> > + ( + new Field<Type> + ( + p.size(), + pTraits<Type>::zero + ) + ); + } +} + + +template<class Type> +Foam::tmp<Foam::Field<Type> > +Foam::regionModels::regionModel::mapRegionPatchInternalField +( + const word& regionModelName, + const word& fieldName, + const label regionPatchI, + const bool flip +) const +{ + typedef GeometricField<Type, fvPatchField, volMesh> fieldType; + + const regionModel& nbrRegion = + this->primaryMesh_.lookupObject<regionModel>(regionModelName); + + const fvMesh& nbrRegionMesh = nbrRegion.regionMesh(); + + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + + if (nbrRegionMesh.foundObject<fieldType>(fieldName)) + { + const fieldType& nbrField = + nbrRegionMesh.lookupObject<fieldType>(fieldName); + + const label nbrPatchI = nbrCoupledPatchID(nbrRegion, regionPatchI); + + const polyPatch& nbrP = nbrRegionMesh.boundaryMesh()[nbrPatchI]; + + int oldTag = UPstream::msgType(); + UPstream::msgType() = oldTag + 1; + + AMIPatchToPatchInterpolation ami + ( + p, + nbrP, + faceAreaIntersect::tmMesh, + flip + ); + + const fvPatchField<Type>& nbrFieldp = + nbrField.boundaryField()[nbrPatchI]; + + tmp<Field<Type> > tresult + ( + ami.interpolateToSource(nbrFieldp.patchInternalField()) + ); + + UPstream::msgType() = oldTag; + + return tresult; + } + else + { + return + tmp<Field<Type> > + ( + new Field<Type> + ( + p.size(), + pTraits<Type>::zero + ) + ); + } +} + + template<class Type> void Foam::regionModels::regionModel::toPrimary ( diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..182258b6379418e08eb06c85eec5125ee246c589 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionModelFunctionObject.H" +#include "regionModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ + defineTypeNameAndDebug(regionModelFunctionObject, 0); + defineRunTimeSelectionTable(regionModelFunctionObject, dictionary); +} +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject +( + regionModel& owner +) +: + dict_(dictionary::null), + owner_(owner), + modelType_("modelType") +{} + + +Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject +( + const dictionary& dict, + regionModel& owner, + const word& type +) +: + dict_(dict), + owner_(owner), + modelType_(type) +{} + + +Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject +( + const regionModelFunctionObject& rmfo +) +: + dict_(rmfo.dict_), + owner_(rmfo.owner_), + modelType_(rmfo.modelType_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::regionModels::regionModelFunctionObject::~regionModelFunctionObject() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::regionModels::regionModelFunctionObject::preEvolveRegion() +{ + // do nothing +} + + +void Foam::regionModels::regionModelFunctionObject::postEvolveRegion() +{ + if (owner_.regionMesh().time().outputTime()) + { + write(); + } +} + + +void Foam::regionModels::regionModelFunctionObject::write() const +{ + // do nothing +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.H b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..77e56b14d19b329dd880ff0c3425ee7432392545 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::regionModelFunctionObject + +Description + Region model function object base class + +SourceFiles + regionModelFunctionObject.C + regionModelFunctionObjectNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionModelFunctionObject_H +#define regionModelFunctionObject_H + +#include "IOdictionary.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace regionModels +{ + +class regionModel; + +/*---------------------------------------------------------------------------*\ + Class regionModelFunctionObject Declaration +\*---------------------------------------------------------------------------*/ + +class regionModelFunctionObject +{ +protected: + + // Protected data + + //- Dictionary + dictionary dict_; + + //- Reference to the region model + regionModel& owner_; + + //- Model type name + word modelType_; + + +public: + + //- Runtime type information + TypeName("regionModelFunctionObject"); + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + regionModelFunctionObject, + dictionary, + ( + const dictionary& dict, + regionModel& owner + ), + (dict, owner) + ); + + + // Constructors + + //- Construct null from owner + regionModelFunctionObject(regionModel& owner); + + //- Construct from dictionary + regionModelFunctionObject + ( + const dictionary& dict, + regionModel& owner, + const word& modelType + ); + + //- Construct copy + regionModelFunctionObject(const regionModelFunctionObject& ppm); + + //- Construct and return a clone + virtual autoPtr<regionModelFunctionObject> clone() const + { + return autoPtr<regionModelFunctionObject> + ( + new regionModelFunctionObject(*this) + ); + } + + + //- Destructor + virtual ~regionModelFunctionObject(); + + + //- Selector + static autoPtr<regionModelFunctionObject> New + ( + const dictionary& dict, + regionModel& owner, + const word& modelType + ); + + + // Member Functions + + // Evaluation + + //- Pre-evolve region hook + virtual void preEvolveRegion(); + + //- Post-evolve region hook + virtual void postEvolveRegion(); + + // I-O + + //- write + virtual void write() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C new file mode 100644 index 0000000000000000000000000000000000000000..366ec496badd36fd3371b245115346e6b0129e3b --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionModelFunctionObjectList.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList +( + regionModel& owner +) +: + PtrList<regionModelFunctionObject>(), + owner_(owner), + dict_(dictionary::null) +{} + + +Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList +( + regionModel& owner, + const dictionary& dict, + const bool readFields +) +: + PtrList<regionModelFunctionObject>(), + owner_(owner), + dict_(dict) +{ + if (readFields) + { + wordList modelNames(dict.toc()); + + Info<< " Selecting region model functions" << endl; + + if (modelNames.size() > 0) + { + this->setSize(modelNames.size()); + + forAll(modelNames, i) + { + const word& modelName = modelNames[i]; + + this->set + ( + i, + regionModelFunctionObject::New + ( + dict, + owner, + modelName + ) + ); + } + } + else + { + Info<< " none" << endl; + } + } +} + + +Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList +( + const regionModelFunctionObjectList& cfol +) +: + PtrList<regionModelFunctionObject>(cfol), + owner_(cfol.owner_), + dict_(cfol.dict_) +{} + + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +Foam::regionModels::regionModelFunctionObjectList:: +~regionModelFunctionObjectList() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::regionModels::regionModelFunctionObjectList::preEvolveRegion() +{ + forAll(*this, i) + { + this->operator[](i).preEvolveRegion(); + } +} + + +void Foam::regionModels::regionModelFunctionObjectList::postEvolveRegion() +{ + forAll(*this, i) + { + this->operator[](i).postEvolveRegion(); + } +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.H b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.H new file mode 100644 index 0000000000000000000000000000000000000000..22488f18c8f4527a0c883c9c78a00ffe6a08a332 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.H @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::regionModelFunctionObjectList + +Description + List of cloud function objects + +SourceFiles + regionModelFunctionObjectListI.H + regionModelFunctionObjectList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionModelFunctionObjectList_H +#define regionModelFunctionObjectList_H + +#include "PtrList.H" +#include "regionModelFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ + +class regionModel; + +/*---------------------------------------------------------------------------*\ + Class regionModelFunctionObjectList Declaration +\*---------------------------------------------------------------------------*/ + +class regionModelFunctionObjectList +: + public PtrList<regionModelFunctionObject> +{ +protected: + + // Protected Data + + //- Reference to the owner region model + regionModel& owner_; + + //- Dictionary + const dictionary dict_; + + +public: + + // Constructors + + //- Null constructor + regionModelFunctionObjectList(regionModel& owner); + + //- Construct from mesh + regionModelFunctionObjectList + ( + regionModel& owner, + const dictionary& dict, + const bool readFields = true + ); + + //- Construct copy + regionModelFunctionObjectList + ( + const regionModelFunctionObjectList& rmfol + ); + + + //- Destructor + virtual ~regionModelFunctionObjectList(); + + + // Member Functions + + // Access + + //- Return const access to the cloud owner + inline const regionModel& owner() const; + + //- Return refernce to the cloud owner + inline regionModel& owner(); + + //- Return the forces dictionary + inline const dictionary& dict() const; + + + // Evaluation + + //- Pre-evolve hook + virtual void preEvolveRegion(); + + //- Post-evolve hook + virtual void postEvolveRegion(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "regionModelFunctionObjectListI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectListI.H b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectListI.H new file mode 100644 index 0000000000000000000000000000000000000000..a0a90d0f67535a0852fef3cc7a8675d1034b2782 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectListI.H @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +inline const Foam::regionModels::regionModel& +Foam::regionModels::regionModelFunctionObjectList::owner() const +{ + return owner_; +} + + +inline Foam::regionModels::regionModel& +Foam::regionModels::regionModelFunctionObjectList::owner() +{ + return owner_; +} + + +inline const Foam::dictionary& +Foam::regionModels::regionModelFunctionObjectList::dict() const +{ + return dict_; +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C new file mode 100644 index 0000000000000000000000000000000000000000..11371b1f7967525c31669fbcdb26ad4707d3859e --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionModelFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::regionModels::regionModelFunctionObject> +Foam::regionModels::regionModelFunctionObject::New +( + const dictionary& dict, + regionModel& owner, + const word& modelName +) +{ + const word modelType = dict.subDict(modelName).lookup("type"); + + Info<< " " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "regionModelFunctionObject::New" + "(" + "const dictionary&, " + "regionModel&, " + "const word&" + ")" + ) << "Unknown region model function type " + << modelType << nl << nl + << "Valid region model function types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return + autoPtr<regionModelFunctionObject> + ( + cstrIter() + ( + dict.subDict(modelName), + owner + ) + ); +} + + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/Make/files b/src/regionModels/surfaceFilmModels/Make/files index 12f80a7ce78a673b74feb8a81651f9450fa1161c..1151e2f7fd380386fc5c10bd64f921f3e068f24c 100644 --- a/src/regionModels/surfaceFilmModels/Make/files +++ b/src/regionModels/surfaceFilmModels/Make/files @@ -38,12 +38,16 @@ $(THERMOMODELS)/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveH $(THERMOMODELS)/filmRadiationModel/filmRadiationModel/filmRadiationModel.C $(THERMOMODELS)/filmRadiationModel/filmRadiationModel/filmRadiationModelNew.C $(THERMOMODELS)/filmRadiationModel/noRadiation/noRadiation.C +$(THERMOMODELS)/filmRadiationModel/constantRadiation/constantRadiation.C +$(THERMOMODELS)/filmRadiationModel/primaryRadiation/primaryRadiation.C $(THERMOMODELS)/filmRadiationModel/standardRadiation/standardRadiation.C /* Boundary conditions */ PATCHFIELDS=derivedFvPatchFields $(PATCHFIELDS)/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C +$(PATCHFIELDS)/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C +$(PATCHFIELDS)/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C /* Wall functions for primary region */ WALLFUNCS=$(PATCHFIELDS)/wallFunctions diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..b36832a1d35a0bdd234a0dbbdbaa9b1ff6a20e06 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C @@ -0,0 +1,213 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "inclinedFilmNusseltHeightFvPatchScalarField.H" +#include "volFields.H" +#include "kinematicSingleLayer.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchScalarField(p, iF), + GammaMean_(), + a_(), + omega_() +{} + + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const inclinedFilmNusseltHeightFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + GammaMean_(ptf.GammaMean_().clone().ptr()), + a_(ptf.a_().clone().ptr()), + omega_(ptf.omega_().clone().ptr()) +{} + + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF), + GammaMean_(DataEntry<scalar>::New("GammaMean", dict)), + a_(DataEntry<scalar>::New("a", dict)), + omega_(DataEntry<scalar>::New("omega", dict)) +{ + fvPatchScalarField::operator=(scalarField("value", dict, p.size())); +} + + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const inclinedFilmNusseltHeightFvPatchScalarField& wmfrhpsf +) +: + fixedValueFvPatchScalarField(wmfrhpsf), + GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()), + a_(wmfrhpsf.a_().clone().ptr()), + omega_(wmfrhpsf.omega_().clone().ptr()) +{} + + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const inclinedFilmNusseltHeightFvPatchScalarField& wmfrhpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchScalarField(wmfrhpsf, iF), + GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()), + a_(wmfrhpsf.a_().clone().ptr()), + omega_(wmfrhpsf.omega_().clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::inclinedFilmNusseltHeightFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const scalar t = db().time().timeOutputValue(); + + // retrieve the film region from the database + + const regionModels::regionModel& region = + db().lookupObject<regionModels::regionModel>("surfaceFilmProperties"); + + const regionModels::surfaceFilmModels::kinematicSingleLayer& film = + dynamic_cast + < + const regionModels::surfaceFilmModels::kinematicSingleLayer& + >(region); + + // calculate the vector tangential to the patch + + const vectorField n(patch().nf()); + + const volVectorField& nHat = film.nHat(); + + const vectorField nHatp(nHat.boundaryField()[patchI].patchInternalField()); + + vectorField nTan(nHatp ^ n); + nTan /= mag(nTan) + ROOTVSMALL; + + // calculate distance in patch tangential direction + + const vectorField& Cf = patch().Cf(); + scalarField d(nTan & Cf); + + // calculate the wavy film height + + const scalar GMean = GammaMean_->value(t); + const scalar a = a_->value(t); + const scalar omega = omega_->value(t); + + const scalarField G(GMean + a*sin(omega*constant::mathematical::twoPi*d)); + + const volScalarField& mu = film.mu(); + const scalarField mup(mu.boundaryField()[patchI].patchInternalField()); + + const volScalarField& rho = film.rho(); + const scalarField rhop(rho.boundaryField()[patchI].patchInternalField()); + + const scalarField Re(max(G, 0.0)/mup); + + // TODO: currently re-evaluating the entire gTan field to return this patch + const scalarField gTan(film.gTan()().boundaryField()[patchI] & n); + + if (max(mag(gTan)) < SMALL) + { + WarningIn + ( + "void Foam::inclinedFilmNusseltHeightFvPatchScalarField::" + "updateCoeffs()" + ) + << "Tangential gravity component is zero. This boundary condition " + << "is designed to operate on patches inclined with respect to " + << "gravity" + << endl; + } + + operator== + ( + pow(3.0*sqr(mup/rhop)/(gTan + ROOTVSMALL), 0.333)*pow(Re, 0.333) + ); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void Foam::inclinedFilmNusseltHeightFvPatchScalarField::write +( + Ostream& os +) const +{ + fixedValueFvPatchScalarField::write(os); + GammaMean_->writeData(os); + a_->writeData(os); + omega_->writeData(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + inclinedFilmNusseltHeightFvPatchScalarField + ); +} + + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.H b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..cb9f9992373d86e637627d909cdcec47acccdbbd --- /dev/null +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.H @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::inclinedFilmNusseltHeightFvPatchScalarField + +Description + Film height boundary condition for inclined films that imposes a + sinusoidal perturbation on top of a mean flow rate, where the height is + calculated using the Nusselt solution. + +SourceFiles + inclinedFilmNusseltHeightFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef inclinedFilmNusseltHeightFvPatchScalarField_H +#define inclinedFilmNusseltHeightFvPatchScalarField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" +#include "DataEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class inclinedFilmNusseltHeightFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class inclinedFilmNusseltHeightFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private data + + //- Mean mass flow rate per unit length [kg/s/m] + autoPtr<DataEntry<scalar> > GammaMean_; + + //- Perturbation amplitude [m] + autoPtr<DataEntry<scalar> > a_; + + //- Perturbation frequency [rad/s/m] + autoPtr<DataEntry<scalar> > omega_; + + +public: + + //- Runtime type information + TypeName("inclinedFilmNusseltHeight"); + + + // Constructors + + //- Construct from patch and internal field + inclinedFilmNusseltHeightFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + inclinedFilmNusseltHeightFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // inclinedFilmNusseltHeightFvPatchScalarField onto a new patch + inclinedFilmNusseltHeightFvPatchScalarField + ( + const inclinedFilmNusseltHeightFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + inclinedFilmNusseltHeightFvPatchScalarField + ( + const inclinedFilmNusseltHeightFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new inclinedFilmNusseltHeightFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + inclinedFilmNusseltHeightFvPatchScalarField + ( + const inclinedFilmNusseltHeightFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new inclinedFilmNusseltHeightFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C new file mode 100644 index 0000000000000000000000000000000000000000..7f21d9a2e43c6056aedb65cb216c10c6b40e37fa --- /dev/null +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "inclinedFilmNusseltInletVelocityFvPatchVectorField.H" +#include "volFields.H" +#include "kinematicSingleLayer.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF +) +: + fixedValueFvPatchVectorField(p, iF), + GammaMean_(), + a_(), + omega_() +{} + + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const inclinedFilmNusseltInletVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(ptf, p, iF, mapper), + GammaMean_(ptf.GammaMean_().clone().ptr()), + a_(ptf.a_().clone().ptr()), + omega_(ptf.omega_().clone().ptr()) +{} + + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF), + GammaMean_(DataEntry<scalar>::New("GammaMean", dict)), + a_(DataEntry<scalar>::New("a", dict)), + omega_(DataEntry<scalar>::New("omega", dict)) +{ + fvPatchVectorField::operator=(vectorField("value", dict, p.size())); +} + + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const inclinedFilmNusseltInletVelocityFvPatchVectorField& fmfrpvf +) +: + fixedValueFvPatchVectorField(fmfrpvf), + GammaMean_(fmfrpvf.GammaMean_().clone().ptr()), + a_(fmfrpvf.a_().clone().ptr()), + omega_(fmfrpvf.omega_().clone().ptr()) +{} + + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const inclinedFilmNusseltInletVelocityFvPatchVectorField& fmfrpvf, + const DimensionedField<vector, volMesh>& iF +) +: + fixedValueFvPatchVectorField(fmfrpvf, iF), + GammaMean_(fmfrpvf.GammaMean_().clone().ptr()), + a_(fmfrpvf.a_().clone().ptr()), + omega_(fmfrpvf.omega_().clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const scalar t = db().time().timeOutputValue(); + + // retrieve the film region from the database + + const regionModels::regionModel& region = + db().lookupObject<regionModels::regionModel>("surfaceFilmProperties"); + + const regionModels::surfaceFilmModels::kinematicSingleLayer& film = + dynamic_cast + < + const regionModels::surfaceFilmModels::kinematicSingleLayer& + >(region); + + // calculate the vector tangential to the patch + + const vectorField n(patch().nf()); + + const volVectorField& nHat = film.nHat(); + + const vectorField nHatp(nHat.boundaryField()[patchI].patchInternalField()); + + vectorField nTan(nHatp ^ n); + nTan /= mag(nTan) + ROOTVSMALL; + + // calculate distance in patch tangential direction + + const vectorField& Cf = patch().Cf(); + scalarField d(nTan & Cf); + + // calculate the wavy film height + + const scalar GMean = GammaMean_->value(t); + const scalar a = a_->value(t); + const scalar omega = omega_->value(t); + + const scalarField G(GMean + a*sin(omega*constant::mathematical::twoPi*d)); + + const volScalarField& mu = film.mu(); + const scalarField mup(mu.boundaryField()[patchI].patchInternalField()); + + const volScalarField& rho = film.rho(); + const scalarField rhop(rho.boundaryField()[patchI].patchInternalField()); + + const scalarField Re(max(G, 0.0)/mup); + + // TODO: currently re-evaluating the entire gTan field to return this patch + const scalarField gTan(film.gTan()().boundaryField()[patchI] & n); + + if (max(mag(gTan)) < SMALL) + { + WarningIn + ( + "void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::" + "updateCoeffs()" + ) + << "Tangential gravity component is zero. This boundary condition " + << "is designed to operate on patches inclined with respect to " + << "gravity" + << endl; + } + + operator==(n*pow(gTan*mup/(3.0*rhop), 0.333)*pow(Re, 0.666)); + + fixedValueFvPatchVectorField::updateCoeffs(); +} + + +void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::write +( + Ostream& os +) const +{ + fvPatchVectorField::write(os); + GammaMean_->writeData(os); + a_->writeData(os); + omega_->writeData(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + inclinedFilmNusseltInletVelocityFvPatchVectorField + ); +} + + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.H b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.H new file mode 100644 index 0000000000000000000000000000000000000000..211ea77561df22f3910bc90c0895c22fc11b65b6 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.H @@ -0,0 +1,158 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField + +Description + Film velocity boundary condition for inclined films that imposes a + sinusoidal perturbation on top of a mean flow rate, where the velocity is + calculated using the Nusselt solution. + +SourceFiles + inclinedFilmNusseltInletVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef inclinedFilmNusseltInletVelocityFvPatchVectorField_H +#define inclinedFilmNusseltInletVelocityFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" +#include "DataEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class inclinedFilmNusseltInletVelocityFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class inclinedFilmNusseltInletVelocityFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + //- Mean mass flow rate per unit length [kg/s/m] + autoPtr<DataEntry<scalar> > GammaMean_; + + //- Perturbation amplitude [m] + autoPtr<DataEntry<scalar> > a_; + + //- Perturbation frequency [rad/s/m] + autoPtr<DataEntry<scalar> > omega_; + + +public: + + //- Runtime type information + TypeName("inclinedFilmNusseltInletVelocity"); + + + // Constructors + + //- Construct from patch and internal field + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // inclinedFilmNusseltInletVelocityFvPatchVectorField onto a new patch + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const inclinedFilmNusseltInletVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const inclinedFilmNusseltInletVelocityFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchVectorField> clone() const + { + return tmp<fvPatchVectorField> + ( + new inclinedFilmNusseltInletVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const inclinedFilmNusseltInletVelocityFvPatchVectorField&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchVectorField> clone + ( + const DimensionedField<vector, volMesh>& iF + ) const + { + return tmp<fvPatchVectorField> + ( + new inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + *this, iF + ) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index 86f5b34b63e550dac6fe049fc115522262d87433..430d3883036972e6de14064c3df5fbab09ae04e0 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -61,7 +61,7 @@ bool kinematicSingleLayer::read() { const dictionary& solution = this->solution().subDict("PISO"); solution.lookup("momentumPredictor") >> momentumPredictor_; - solution.lookup("nOuterCorr") >> nOuterCorr_; + solution.readIfPresent("nOuterCorr", nOuterCorr_); solution.lookup("nCorr") >> nCorr_; solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; @@ -197,6 +197,12 @@ tmp<volScalarField> kinematicSingleLayer::pp() } +void kinematicSingleLayer::correctAlpha() +{ + alpha_ == pos(delta_ - dimensionedScalar("SMALL", dimLength, SMALL)); +} + + void kinematicSingleLayer::updateSubmodels() { if (debug) @@ -276,8 +282,8 @@ void kinematicSingleLayer::updateSurfaceVelocities() Uw_ -= nHat()*(Uw_ & nHat()); Uw_.correctBoundaryConditions(); - // TODO: apply quadratic profile to determine surface velocity - Us_ = U_; + // apply quadratic profile to surface velocity + Us_ = 2.0*U_; Us_.correctBoundaryConditions(); } @@ -439,7 +445,7 @@ kinematicSingleLayer::kinematicSingleLayer surfaceFilmModel(modelType, mesh, g), momentumPredictor_(solution().subDict("PISO").lookup("momentumPredictor")), - nOuterCorr_(readLabel(solution().subDict("PISO").lookup("nOuterCorr"))), + nOuterCorr_(solution().subDict("PISO").lookupOrDefault("nOuterCorr", 1)), nCorr_(readLabel(solution().subDict("PISO").lookup("nCorr"))), nNonOrthCorr_ ( @@ -503,6 +509,19 @@ kinematicSingleLayer::kinematicSingleLayer ), regionMesh() ), + alpha_ + ( + IOobject + ( + "alpha", + time().timeName(), + regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimless, 0.0) + ), U_ ( IOobject @@ -817,6 +836,8 @@ void kinematicSingleLayer::preEvolveRegion() Info<< "kinematicSingleLayer::preEvolveRegion()" << endl; } + surfaceFilmModel::preEvolveRegion(); + transferPrimaryRegionThermoFields(); correctThermoFields(); @@ -838,6 +859,8 @@ void kinematicSingleLayer::evolveRegion() Info<< "kinematicSingleLayer::evolveRegion()" << endl; } + correctAlpha(); + updateSubmodels(); // Solve continuity for deltaRho_ @@ -846,7 +869,7 @@ void kinematicSingleLayer::evolveRegion() // Implicit pressure source coefficient - constant tmp<volScalarField> tpp(this->pp()); - for (int oCorr=0; oCorr<nOuterCorr_; oCorr++) + for (int oCorr=1; oCorr<=nOuterCorr_; oCorr++) { // Explicit pressure source contribution - varies with delta_ tmp<volScalarField> tpu(this->pu()); @@ -1025,14 +1048,18 @@ void kinematicSingleLayer::info() const { Info<< "\nSurface film: " << type() << endl; + const vectorField& Uinternal = U_.internalField(); + Info<< indent << "added mass = " << returnReduce<scalar>(addedMassTotal_, sumOp<scalar>()) << nl << indent << "current mass = " << gSum((deltaRho_*magSf())()) << nl - << indent << "min/max(mag(U)) = " << min(mag(U_)).value() << ", " - << max(mag(U_)).value() << nl + << indent << "min/max(mag(U)) = " << gMin(mag(Uinternal)) << ", " + << gMax(mag(Uinternal)) << nl << indent << "min/max(delta) = " << min(delta_).value() << ", " - << max(delta_).value() << nl; + << max(delta_).value() << nl + << indent << "coverage = " + << gSum(alpha_.internalField()*magSf())/gSum(magSf()) << nl; injection_.info(Info); } diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H index b084f885d48905bd801862d658605745658a203f..079999d0cd4e835674f5aef5839a91cc61666e5d 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -113,6 +113,9 @@ protected: //- Film thickness / [m] volScalarField delta_; + //- Film coverage indicator, 1 = covered, 0 = uncovered / [] + volScalarField alpha_; + //- Velocity - mean / [m/s] volVectorField U_; @@ -221,12 +224,15 @@ protected: //- Transfer source fields from the primary region to the film region virtual void transferPrimaryRegionSourceFields(); - // Explicit pressure source contribution + //- Explicit pressure source contribution virtual tmp<volScalarField> pu(); - // Implicit pressure source coefficient + //- Implicit pressure source coefficient virtual tmp<volScalarField> pp(); + //- Correct film coverage field + virtual void correctAlpha(); + //- Update the film sub-models virtual void updateSubmodels(); @@ -323,6 +329,9 @@ public: //- Return const access to the film thickness / [m] inline const volScalarField& delta() const; + //- Return the film coverage, 1 = covered, 0 = uncovered / [] + inline const volScalarField& alpha() const; + //- Return the film velocity [m/s] virtual const volVectorField& U() const; diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H index e717acc430be46b2929e903844263c8f4ec8f124..6a77b614bcad146deb45f56c7546e9d208bbf9ee 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,6 +79,12 @@ inline const volScalarField& kinematicSingleLayer::delta() const } +inline const volScalarField& kinematicSingleLayer::alpha() const +{ + return alpha_; +} + + inline volVectorField& kinematicSingleLayer::USpPrimary() { return USpPrimary_; @@ -173,7 +179,8 @@ inline tmp<volScalarField> kinematicSingleLayer::netMass() const { dimensionedScalar d0("SMALL", dimLength, ROOTVSMALL); return - fvc::surfaceSum(phi_/(fvc::interpolate(delta_) + d0))*time().deltaT() + fvc::surfaceSum(pos(phi_)*phi_/(fvc::interpolate(delta_) + d0)) + *time().deltaT() + rho_*delta_*magSf(); } diff --git a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C b/src/regionModels/surfaceFilmModels/noFilm/noFilm.C index 1c267307ec7204794b37823c8706bfdf3e66cdf3..82f3d0afc999ae21d91a7652e748aed4c21e21e8 100644 --- a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C +++ b/src/regionModels/surfaceFilmModels/noFilm/noFilm.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -102,10 +102,10 @@ const volScalarField& noFilm::delta() const } -const volScalarField& noFilm::sigma() const +const volScalarField& noFilm::alpha() const { - FatalErrorIn("const volScalarField& noFilm::sigma() const") - << "sigma field not available for " << type() << abort(FatalError); + FatalErrorIn("const volScalarField& noFilm::alpha() const") + << "alpha field not available for " << type() << abort(FatalError); return volScalarField::null(); } @@ -192,6 +192,15 @@ const volScalarField& noFilm::kappa() const } +const volScalarField& noFilm::sigma() const +{ + FatalErrorIn("const volScalarField& noFilm::sigma() const") + << "sigma field not available for " << type() << abort(FatalError); + + return volScalarField::null(); +} + + tmp<volScalarField> noFilm::primaryMassTrans() const { return tmp<volScalarField> diff --git a/src/regionModels/surfaceFilmModels/noFilm/noFilm.H b/src/regionModels/surfaceFilmModels/noFilm/noFilm.H index 76501a4fd82cd59c6211251fef1e9a52d3e31608..17915f778806849c0f636023f98aa853dbf39e61 100644 --- a/src/regionModels/surfaceFilmModels/noFilm/noFilm.H +++ b/src/regionModels/surfaceFilmModels/noFilm/noFilm.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -115,8 +115,8 @@ public: //- Return the film thickness [m] virtual const volScalarField& delta() const; - //- Return const access to the surface tension / [m/s2] - inline const volScalarField& sigma() const; + //- Return the film coverage, 1 = covered, 0 = uncovered / [] + virtual const volScalarField& alpha() const; //- Return the film velocity [m/s] virtual const volVectorField& U() const; @@ -145,6 +145,9 @@ public: //- Return the film thermal conductivity [W/m/K] virtual const volScalarField& kappa() const; + //- Return const access to the surface tension / [m/s2] + inline const volScalarField& sigma() const; + // Transfer fields - to the primary region diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C index 5f31601474a327835ab8b8fd2b73cf8fb7de2ede..2ceff1429f3f065fdb03962ba9291d6449f89c79 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,7 +52,6 @@ contactAngleForce::contactAngleForce ) : force(typeName, owner, dict), - deltaWet_(readScalar(coeffs_.lookup("deltaWet"))), Ccf_(readScalar(coeffs_.lookup("Ccf"))), rndGen_(label(0), -1), distribution_ @@ -82,7 +81,7 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U) ( IOobject ( - "contactForce", + typeName + ".contactForce", owner_.time().timeName(), owner_.regionMesh(), IOobject::NO_READ, @@ -100,17 +99,11 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U) const scalarField& magSf = owner_.magSf(); - const volScalarField& delta = owner_.delta(); + const volScalarField& alpha = owner_.alpha(); const volScalarField& sigma = owner_.sigma(); - volScalarField alpha - ( - "alpha", - pos(delta - dimensionedScalar("deltaWet", dimLength, deltaWet_)) - ); volVectorField gradAlpha(fvc::grad(alpha)); - scalarField nHits(owner_.regionMesh().nCells(), 0.0); forAll(nbr, faceI) @@ -119,19 +112,17 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U) const label cellN = nbr[faceI]; label cellI = -1; - if ((delta[cellO] > deltaWet_) && (delta[cellN] < deltaWet_)) + if ((alpha[cellO] > 0.5) && (alpha[cellN] < 0.5)) { cellI = cellO; } - else if ((delta[cellO] < deltaWet_) && (delta[cellN] > deltaWet_)) + else if ((alpha[cellO] < 0.5) && (alpha[cellN] > 0.5)) { cellI = cellN; } if (cellI != -1) { -// const scalar dx = Foam::sqrt(magSf[cellI]); - // bit of a cheat, but ok for regular meshes const scalar dx = owner_.regionMesh().deltaCoeffs()[faceI]; const vector n = gradAlpha[cellI]/(mag(gradAlpha[cellI]) + ROOTVSMALL); @@ -141,17 +132,17 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U) } } - forAll(delta.boundaryField(), patchI) + forAll(alpha.boundaryField(), patchI) { - const fvPatchField<scalar>& df = delta.boundaryField()[patchI]; - const scalarField& dx = df.patch().deltaCoeffs(); - const labelUList& faceCells = df.patch().faceCells(); + const fvPatchField<scalar>& alphaf = alpha.boundaryField()[patchI]; + const scalarField& dx = alphaf.patch().deltaCoeffs(); + const labelUList& faceCells = alphaf.patch().faceCells(); - forAll(df, faceI) + forAll(alphaf, faceI) { label cellO = faceCells[faceI]; - if ((delta[cellO] > deltaWet_) && (df[faceI] < deltaWet_)) + if ((alpha[cellO] > 0.5) && (alphaf[faceI] < 0.5)) { const vector n = gradAlpha[cellO]/(mag(gradAlpha[cellO]) + ROOTVSMALL); diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H index 2ed08e02eeaf16e0872768d3ab6ee1c66ffec6b8..8a6dc7a8b3be713ba44e89c9746669b5deea4b1d 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,9 +60,6 @@ private: // Private Data - //- Threshold film thickness beyon which the film is 'wet' - scalar deltaWet_; - //- Coefficient applied to the contact angle force scalar Ccf_; diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C index c5419d2909b880014daa0c6c5b48a5cf4560cfcf..a2c910c412397d0a85ca7b0447af260a3701d298 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -80,11 +80,11 @@ tmp<fvVectorMatrix> surfaceShearForce::correct(volVectorField& U) tmp<volScalarField> tCs; typedef compressible::turbulenceModel turbModel; - if (film.primaryMesh().foundObject<turbModel>("turbulenceProperties")) + if (film.primaryMesh().foundObject<turbModel>("turbulenceModel")) { // local reference to turbulence model const turbModel& turb = - film.primaryMesh().lookupObject<turbModel>("turbulenceProperties"); + film.primaryMesh().lookupObject<turbModel>("turbulenceModel"); // calculate and store the stress on the primary region const volSymmTensorField primaryReff(turb.devRhoReff()); @@ -117,13 +117,23 @@ tmp<fvVectorMatrix> surfaceShearForce::correct(volVectorField& U) Reff.correctBoundaryConditions(); dimensionedScalar U0("SMALL", U.dimensions(), SMALL); - tCs = Cf_*mag(-film.nHat() & Reff)/(mag(Up - U) + U0); + volVectorField UHat("UHat", (Up - U)/(mag(Up - U) + U0)); + + // shear stress tangential to the film + volVectorField tauTan + ( + "tauTan", + UHat & (Reff + film.nHat()*(-film.nHat() & Reff)) + ); + + // note: Cf_ 'should' be 1 in this case + tCs = Cf_*mag(tauTan)/(mag(Up - U) + U0); } else { // laminar case - employ simple coeff-based model - const volScalarField& rho = film.rho(); - tCs = Cf_*rho*mag(Up - U); + const volScalarField& rhop = film.rhoPrimary(); + tCs = Cf_*rhop*mag(Up - U); } dimensionedScalar d0("SMALL", delta.dimensions(), SMALL); @@ -131,7 +141,7 @@ tmp<fvVectorMatrix> surfaceShearForce::correct(volVectorField& U) // linear coeffs to apply to velocity const volScalarField& Cs = tCs(); volScalarField Cw("Cw", mu/(0.3333*(delta + d0))); - Cw.min(1.0e+06); + Cw.min(5000.0); return ( diff --git a/src/regionModels/surfaceFilmModels/submodels/subModelBase.C b/src/regionModels/surfaceFilmModels/submodels/subModelBase.C index 469b62e855599055e2ebd7daee86ed27a00bd7e7..b2283172b39c913783fdc84fea23aa0d2e7f211d 100644 --- a/src/regionModels/surfaceFilmModels/submodels/subModelBase.C +++ b/src/regionModels/surfaceFilmModels/submodels/subModelBase.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,7 +51,7 @@ subModelBase::subModelBase ) : owner_(owner), - coeffs_(dict.subDict(type + "Coeffs")) + coeffs_(dict.subOrEmptyDict(type + "Coeffs")) {} diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C new file mode 100644 index 0000000000000000000000000000000000000000..bb1b6c294f4bfe38bafe1c97004fea3c85d797e4 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C @@ -0,0 +1,145 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "constantRadiation.H" +#include "volFields.H" +#include "zeroGradientFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(constantRadiation, 0); + +addToRunTimeSelectionTable +( + filmRadiationModel, + constantRadiation, + dictionary +); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +constantRadiation::constantRadiation +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + filmRadiationModel(typeName, owner, dict), + QrConst_ + ( + IOobject + ( + typeName + "::QrConst", + owner.time().timeName(), + owner.regionMesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + owner.regionMesh() + ), + mask_ + ( + IOobject + ( + typeName + "::mask", + owner.time().timeName(), + owner.regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + owner.regionMesh(), + dimensionedScalar("one", dimless, 1.0) + ), + timeStart_(readScalar(coeffs_.lookup("timeStart"))), + duration_(readScalar(coeffs_.lookup("duration"))) +{ + mask_ = pos(mask_); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +constantRadiation::~constantRadiation() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void constantRadiation::correct() +{} + + +tmp<volScalarField> constantRadiation::Shs() +{ + tmp<volScalarField> tShs + ( + new volScalarField + ( + IOobject + ( + typeName + "::Shs", + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + const scalar time = owner().time().value(); + + if ((time >= timeStart_) && (time <= timeStart_ + duration_)) + { + scalarField& Shs = tShs(); + const scalarField& Qr = QrConst_.internalField(); + const scalarField& alpha = owner_.alpha().internalField(); + + Shs = mask_*Qr*alpha; + } + + return tShs; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.H b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.H new file mode 100644 index 0000000000000000000000000000000000000000..06e6fe676b2974381cd22d76bdc78423285514b8 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.H @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::constantRadiation + +Description + Film constant radiation model. The constant radiative flux is specified + by the user, and operated over a time interval defined by a start time and + duration. In addition, a mask can be applied to shield the film from the + radiation. + +SourceFiles + constantRadiation.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantRadiation_H +#define constantRadiation_H + +#include "filmRadiationModel.H" +#include "volFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class constantRadiation Declaration +\*---------------------------------------------------------------------------*/ + +class constantRadiation +: + public filmRadiationModel +{ +private: + + // Private data + + //- Constant radiative flux [kg/s3] + volScalarField QrConst_; + + //- Radiation mask + volScalarField mask_; + + //- Time start [s] + const scalar timeStart_; + + //- Duration [s] + const scalar duration_; + + + // Private member functions + + //- Disallow default bitwise copy construct + constantRadiation(const constantRadiation&); + + //- Disallow default bitwise assignment + void operator=(const constantRadiation&); + + +public: + + //- Runtime type information + TypeName("constantRadiation"); + + + // Constructors + + //- Construct from surface film model and dictionary + constantRadiation + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~constantRadiation(); + + + // Member Functions + + // Evolution + + //- Correct + virtual void correct(); + + //- Return the radiation sensible enthalpy source + // Also updates QrNet + virtual tmp<volScalarField> Shs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C new file mode 100644 index 0000000000000000000000000000000000000000..2fdccf63f76db32f078bd76d436202119f1d016d --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "primaryRadiation.H" +#include "volFields.H" +#include "zeroGradientFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(primaryRadiation, 0); + +addToRunTimeSelectionTable +( + filmRadiationModel, + primaryRadiation, + dictionary +); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +primaryRadiation::primaryRadiation +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + filmRadiationModel(typeName, owner, dict), + QinPrimary_ + ( + IOobject + ( + "Qin", // same name as Qin on primary region to enable mapping + owner.time().timeName(), + owner.regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner.regionMesh(), + dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0), + owner.mappedPushedFieldPatchTypes<scalar>() + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +primaryRadiation::~primaryRadiation() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void primaryRadiation::correct() +{ + // Transfer Qin from primary region + QinPrimary_.correctBoundaryConditions(); +} + + +tmp<volScalarField> primaryRadiation::Shs() +{ + tmp<volScalarField> tShs + ( + new volScalarField + ( + IOobject + ( + typeName + "::Shs", + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + scalarField& Shs = tShs(); + const scalarField& QinP = QinPrimary_.internalField(); + const scalarField& alpha = owner_.alpha().internalField(); + + Shs = QinP*alpha; + + return tShs; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.H b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.H new file mode 100644 index 0000000000000000000000000000000000000000..a8904cb1e2100ea4ebd8e4f8e9f0275ad4435e2f --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ 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 3 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, see <http://www.gnu.org/licenses/>. + +Class + Foam::primaryRadiation + +Description + Radiation model whereby the radiative heat flux is mapped from the primary + region + +SourceFiles + primaryRadiation.C + +\*---------------------------------------------------------------------------*/ + +#ifndef primaryRadiation_H +#define primaryRadiation_H + +#include "filmRadiationModel.H" +#include "volFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class primaryRadiation Declaration +\*---------------------------------------------------------------------------*/ + +class primaryRadiation +: + public filmRadiationModel +{ +private: + + // Private data + + //- Incident radiative flux mapped from the primary region / [kg/s3] + volScalarField QinPrimary_; + + + // Private member functions + + //- Disallow default bitwise copy construct + primaryRadiation(const primaryRadiation&); + + //- Disallow default bitwise assignment + void operator=(const primaryRadiation&); + + +public: + + //- Runtime type information + TypeName("primaryRadiation"); + + + // Constructors + + //- Construct from surface film model and dictionary + primaryRadiation + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~primaryRadiation(); + + + // Member Functions + + // Evolution + + //- Correct + virtual void correct(); + + //- Return the radiation sensible enthalpy source + // Also updates QrNet + virtual tmp<volScalarField> Shs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C index be5460757fe76f12808d2b5eb48f44456632af90..1ff32747161d746d71b3b9e8c82f9af7deec74c8 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C @@ -85,8 +85,6 @@ standardRadiation::standardRadiation dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0), zeroGradientFvPatchScalarField::typeName ), - delta_(owner.delta()), - deltaMin_(readScalar(coeffs_.lookup("deltaMin"))), beta_(readScalar(coeffs_.lookup("beta"))), kappaBar_(readScalar(coeffs_.lookup("kappaBar"))) {} @@ -129,9 +127,10 @@ tmp<volScalarField> standardRadiation::Shs() scalarField& Shs = tShs(); const scalarField& QinP = QinPrimary_.internalField(); - const scalarField& delta = delta_.internalField(); + const scalarField& delta = owner_.delta().internalField(); + const scalarField& alpha = owner_.alpha().internalField(); - Shs = beta_*(QinP*pos(delta - deltaMin_))*(1.0 - exp(-kappaBar_*delta)); + Shs = beta_*QinP*alpha*(1.0 - exp(-kappaBar_*delta)); // Update net Qr on local region QrNet_.internalField() = QinP - Shs; diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H index 9b96fb60fe189f33f3415f585f333af01cabadc3..799bb6c64934962f5f8c08e694a1b22486608abe 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H @@ -65,15 +65,9 @@ private: //- Remaining radiative flux after removing local contribution volScalarField QrNet_; - //- Reference to the film thickness field / [m] - const volScalarField& delta_; - // Model coefficients - //- Minimum thickness to apply radiation model - scalar deltaMin_; - //- Beta coefficient scalar beta_; diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C index 552bd0dda447264962d23889c21f85fff4daee1c..4a08755ee3e68a1950074fc80295882222d421c3 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -77,7 +77,6 @@ standardPhaseChange::standardPhaseChange ) : phaseChangeModel(typeName, owner, dict), - Tb_(readScalar(coeffs_.lookup("Tb"))), deltaMin_(readScalar(coeffs_.lookup("deltaMin"))), L_(readScalar(coeffs_.lookup("L"))), TbFactor_(coeffs_.lookupOrDefault<scalar>("TbFactor", 1.1)) @@ -113,14 +112,10 @@ void standardPhaseChange::correctModel const scalarField& YInf = film.YPrimary()[vapId]; const scalarField& pInf = film.pPrimary(); const scalarField& T = film.T(); - const scalarField& Tw = film.Tw(); const scalarField& rho = film.rho(); - const scalarField& TInf = film.TPrimary(); const scalarField& rhoInf = film.rhoPrimary(); const scalarField& muInf = film.muPrimary(); const scalarField& magSf = film.magSf(); - const scalarField hInf(film.htcs().h()); - const scalarField hFilm(film.htcw().h()); const vectorField dU(film.UPrimary() - film.Us()); const scalarField limMass ( @@ -134,8 +129,11 @@ void standardPhaseChange::correctModel // cell pressure [Pa] const scalar pc = pInf[cellI]; + // calculate the boiling temperature + const scalar Tb = liq.pvInvert(pc); + // local temperature - impose lower limit of 200 K for stability - const scalar Tloc = min(TbFactor_*Tb_, max(200.0, T[cellI])); + const scalar Tloc = min(TbFactor_*Tb, max(200.0, T[cellI])); // saturation pressure [Pa] const scalar pSat = liq.pv(pc, Tloc); @@ -147,15 +145,10 @@ void standardPhaseChange::correctModel if (pSat >= 0.95*pc) { // boiling - const scalar qDotInf = hInf[cellI]*(TInf[cellI] - T[cellI]); - const scalar qDotFilm = hFilm[cellI]*(T[cellI] - Tw[cellI]); - const scalar Cp = liq.Cp(pc, Tloc); - const scalar Tcorr = max(0.0, T[cellI] - Tb_); + const scalar Tcorr = max(0.0, T[cellI] - Tb); const scalar qCorr = limMass[cellI]*Cp*(Tcorr); - dMass[cellI] = - dt*magSf[cellI]/hVap*(qDotInf + qDotFilm) - + qCorr/hVap; + dMass[cellI] = qCorr/hVap; } else { diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H index 1fff3384ff87c90ad93f9b0f9ac08db0b26f753f..ee1b21d6d0adfd80ad1e6d42c1e2612c699bb074 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,9 +69,6 @@ protected: // Protected data - //- Boiling temperature / [K] - const scalar Tb_; - //- Minimum film height for model to be active const scalar deltaMin_; diff --git a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H index 32c71b3fed7205e411bbb24282e941253cc209ae..2aa442319670d96c026ecd5d296d704fee6aee36 100644 --- a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H +++ b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -186,6 +186,9 @@ public: //- Return the film thickness [m] virtual const volScalarField& delta() const = 0; + //- Return the film coverage, 1 = covered, 0 = uncovered / [] + virtual const volScalarField& alpha() const = 0; + //- Return the film velocity [m/s] virtual const volVectorField& U() const = 0; diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index 1cb392eb6aae39549fc56095e0c6908e382cf919..07a70d651b62103c25f1693f48e0541a267a6e80 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -227,6 +227,33 @@ void thermoSingleLayer::transferPrimaryRegionSourceFields() } +void thermoSingleLayer::correctAlpha() +{ + if (hydrophilic_) + { + const scalar hydrophilicDry = hydrophilicDryScale_*deltaWet_; + const scalar hydrophilicWet = hydrophilicWetScale_*deltaWet_; + + forAll(alpha_, i) + { + if ((alpha_[i] < 0.5) && (delta_[i] > hydrophilicDry)) + { + alpha_[i] = 1.0; + } + else if ((alpha_[i] > 0.5) && (delta_[i] < hydrophilicWet)) + { + alpha_[i] = 0.0; + } + } + } + else + { + alpha_ == + pos(delta_ - dimensionedScalar("deltaWet", dimLength, deltaWet_)); + } +} + + void thermoSingleLayer::updateSubmodels() { if (debug) @@ -290,7 +317,8 @@ void thermoSingleLayer::solveEnergy() - hsSp_ + q(hs_) + radiation_->Shs() - - fvm::SuSp(rhoSp_, hs_) +// - fvm::SuSp(rhoSp_, hs_) + - rhoSp_*hs_ ); correctThermoFields(); @@ -426,6 +454,11 @@ thermoSingleLayer::thermoSingleLayer zeroGradientFvPatchScalarField::typeName ), + deltaWet_(readScalar(coeffs_.lookup("deltaWet"))), + hydrophilic_(readBool(coeffs_.lookup("hydrophilic"))), + hydrophilicDryScale_(0.0), + hydrophilicWetScale_(0.0), + hsSp_ ( IOobject @@ -481,8 +514,20 @@ thermoSingleLayer::thermoSingleLayer heatTransferModel::New(*this, coeffs().subDict("lowerSurfaceModels")) ), phaseChange_(phaseChangeModel::New(*this, coeffs())), - radiation_(filmRadiationModel::New(*this, coeffs())) + radiation_(filmRadiationModel::New(*this, coeffs())), + Tmin_(-VGREAT), + Tmax_(VGREAT) { + if (coeffs().readIfPresent("Tmin", Tmin_)) + { + Info<< " limiting minimum temperature to " << Tmin_ << endl; + } + + if (coeffs().readIfPresent("Tmax", Tmax_)) + { + Info<< " limiting maximum temperature to " << Tmax_ << endl; + } + if (thermo_.hasMultiComponentCarrier()) { YPrimary_.setSize(thermo_.carrier().species().size()); @@ -510,6 +555,12 @@ thermoSingleLayer::thermoSingleLayer } } + if (hydrophilic_) + { + coeffs_.lookup("hydrophilicDryScale") >> hydrophilicDryScale_; + coeffs_.lookup("hydrophilicWetScale") >> hydrophilicWetScale_; + } + if (readFields) { transferPrimaryRegionThermoFields(); @@ -584,12 +635,14 @@ void thermoSingleLayer::evolveRegion() Info<< "thermoSingleLayer::evolveRegion()" << endl; } + correctAlpha(); + updateSubmodels(); // Solve continuity for deltaRho_ solveContinuity(); - for (int oCorr=0; oCorr<nOuterCorr_; oCorr++) + for (int oCorr=1; oCorr<=nOuterCorr_; oCorr++) { // Explicit pressure source contribution tmp<volScalarField> tpu(this->pu()); @@ -674,8 +727,10 @@ void thermoSingleLayer::info() const { kinematicSingleLayer::info(); - Info<< indent << "min/max(T) = " << min(T_).value() << ", " - << max(T_).value() << nl; + const scalarField& Tinternal = T_.internalField(); + + Info<< indent << "min/max(T) = " << gMin(Tinternal) << ", " + << gMax(Tinternal) << nl; phaseChange_->info(Info); } diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H index 6814e25a3e4c0e934378bd72b0e77d2a55110358..696728e7f97b846f20b6a0cb0660f804f9e1b848 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -123,6 +123,22 @@ protected: volScalarField primaryEnergyPCTrans_; + //- Threshold film thickness beyond which the film is considered 'wet' + scalar deltaWet_; + + + // Hyprophilic/phobic properties + + //- Activation flag + bool hydrophilic_; + + //- Length scale applied to deltaWet_ for dry faces, typically 0.5 + scalar hydrophilicDryScale_; + + //- Length scale applied to deltaWet_ for wet faces, typically 0.001 + scalar hydrophilicWetScale_; + + // Source term fields // Film region - registered to the film region mesh @@ -166,6 +182,14 @@ protected: autoPtr<filmRadiationModel> radiation_; + // Limits + + //- Minimum temperature limit (optional) + scalar Tmin_; + + //- Maximum temperature limit (optional) + scalar Tmax_; + // Protected member functions @@ -190,6 +214,9 @@ protected: //- Transfer source fields from the primary region to the film region virtual void transferPrimaryRegionSourceFields(); + //- Correct film coverage field + virtual void correctAlpha(); + //- Update the film sub-models virtual void updateSubmodels(); @@ -342,6 +369,15 @@ public: inline const filmRadiationModel& radiation() const; + // Derived fields (calculated on-the-fly) + + //- Return the convective heat energy from film to wall + inline tmp<scalarField> Qconvw(const label patchI) const; + + //- Return the convective heat energy from primary region to film + inline tmp<scalarField> Qconvp(const label patchI) const; + + // Evolution //- Pre-evolve film hook diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H index 73dc08496b64a1543be3ba563ae492f2efc814d4..659a315f4916487eedfe0a8ce0db10f32705c50d 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "thermoSingleLayer.H" +#include "heatTransferModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -88,7 +89,7 @@ inline tmp<volScalarField> thermoSingleLayer::T const volScalarField& hs ) const { - return tmp<volScalarField> + tmp<volScalarField> tT ( new volScalarField ( @@ -104,6 +105,11 @@ inline tmp<volScalarField> thermoSingleLayer::T zeroGradientFvPatchScalarField::typeName ) ); + + tT().min(Tmax_); + tT().max(Tmin_); + + return tT; } @@ -155,6 +161,26 @@ inline const filmRadiationModel& thermoSingleLayer::radiation() const } +inline tmp<scalarField> thermoSingleLayer::Qconvw(const label patchI) const +{ + const scalarField htc(htcw_->h()().boundaryField()[patchI]); + const scalarField& Tp = T_.boundaryField()[patchI]; + const scalarField& Twp = Tw_.boundaryField()[patchI]; + + return htc*(Tp - Twp); +} + + +inline tmp<scalarField> thermoSingleLayer::Qconvp(const label patchI) const +{ + const scalarField htc(htcs_->h()().boundaryField()[patchI]); + const scalarField& Tp = T_.boundaryField()[patchI]; + const scalarField& Tpp = TPrimary_.boundaryField()[patchI]; + + return htc*(Tp - Tpp); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace surfaceFilmModels diff --git a/src/regionModels/thermoBaffleModels/Make/options b/src/regionModels/thermoBaffleModels/Make/options index 2c0e2cf57ca23b57686ac288837710aa4ba0174d..21a54595be530da1a87d94e9e1aacdedb522cdea 100644 --- a/src/regionModels/thermoBaffleModels/Make/options +++ b/src/regionModels/thermoBaffleModels/Make/options @@ -3,7 +3,6 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/AMIInterpolation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ diff --git a/src/sampling/Make/files b/src/sampling/Make/files index 8c5227dbf206a2ec9cf3560c42e10d82435ae6ca..ef0415f0f24848e1ea802c699731ac6587d69a29 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -5,7 +5,6 @@ probes/probesFunctionObject/probesFunctionObject.C sampledSet/circle/circleSet.C sampledSet/cloud/cloudSet.C -sampledSet/coordSet/coordSet.C sampledSet/patchCloud/patchCloudSet.C sampledSet/polyLine/polyLineSet.C sampledSet/face/faceOnlySet.C @@ -20,17 +19,6 @@ sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C sampledSet/uniform/uniformSet.C sampledSet/array/arraySet.C -setWriters = sampledSet/writers - -$(setWriters)/writers.C -$(setWriters)/ensight/ensightSetWriterRunTime.C -$(setWriters)/gnuplot/gnuplotSetWriterRunTime.C -$(setWriters)/jplot/jplotSetWriterRunTime.C -$(setWriters)/raw/rawSetWriterRunTime.C -$(setWriters)/vtk/vtkSetWriterRunTime.C -$(setWriters)/xmgrace/xmgraceSetWriterRunTime.C -$(setWriters)/csv/csvSetWriterRunTime.C - cuttingPlane/cuttingPlane.C sampledSurface/sampledPatch/sampledPatch.C diff --git a/src/sampling/Make/options b/src/sampling/Make/options index 3fbc509d541cb70355abee9f03412bea6c2d2528..23e6bc81a7e708d69b5fd14d27073827646e14ef 100644 --- a/src/sampling/Make/options +++ b/src/sampling/Make/options @@ -2,6 +2,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/conversion/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude @@ -10,6 +11,7 @@ LIB_LIBS = \ -lfiniteVolume \ -lmeshTools \ -lsurfMesh \ + -lfileFormats \ -ltriSurface \ -llagrangian \ -lconversion diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C index e01429fc88cbea5018d7f5bcb128927df49341ea..e43dc5757fe2762dce15951679509b37e456ab48 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C @@ -25,6 +25,7 @@ License #include "OFstream.H" #include "IOmanip.H" +#include "OSspecific.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/writers/surfaceWriter.H b/src/sampling/sampledSurface/writers/surfaceWriter.H index dd54a756c69f1b927d20882f0259ce093200ebe6..84ca3cdf5d57ba6e38c2326eed2bef5aad6f1ec4 100644 --- a/src/sampling/sampledSurface/writers/surfaceWriter.H +++ b/src/sampling/sampledSurface/writers/surfaceWriter.H @@ -35,7 +35,6 @@ SourceFiles #ifndef surfaceWriter_H #define surfaceWriter_H -#include "volFields.H" #include "typeInfo.H" #include "autoPtr.H" #include "pointField.H" diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C index 9e5578b886582bde51751c97164965c8b8570eff..9851f44b6ff3d7b6528d9b2cb82b6bb5137573e0 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C @@ -68,6 +68,10 @@ Foam::energyJumpFvPatchScalarField::energyJumpFvPatchScalarField scalarField("value", dict, p.size()) ); } + else + { + evaluate(Pstream::blocking); + } } diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C index 7f6a09c181d0b2215d34fec6adb93a5bfb2f4204..cc8675dad9bc22114957ab568ce1b759461ef9b2 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C @@ -68,6 +68,10 @@ Foam::energyJumpAMIFvPatchScalarField::energyJumpAMIFvPatchScalarField scalarField("value", dict, p.size()) ); } + else + { + evaluate(Pstream::blocking); + } } diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C index bba8da15144c72cb0d14c8d1c4610f837b63f0ca..8efaf0f5d50ee60a97cb1bbda81fe132b39c3ce1 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -35,6 +35,39 @@ License // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // +template<class BasicThermo, class MixtureType> +Foam::wordList Foam::heThermo<BasicThermo, MixtureType>::heBoundaryBaseTypes() +{ + const volScalarField::GeometricBoundaryField& tbf = + this->T_.boundaryField(); + + wordList hbt(tbf.size(), word::null); + + forAll(tbf, patchi) + { + if (isA<fixedJumpFvPatchScalarField>(tbf[patchi])) + { + const fixedJumpFvPatchScalarField& pf = + dynamic_cast<const fixedJumpFvPatchScalarField&>(tbf[patchi]); + + hbt[patchi] = pf.interfaceFieldType(); + } + else if (isA<fixedJumpAMIFvPatchScalarField>(tbf[patchi])) + { + const fixedJumpAMIFvPatchScalarField& pf = + dynamic_cast<const fixedJumpAMIFvPatchScalarField&> + ( + tbf[patchi] + ); + + hbt[patchi] = pf.interfaceFieldType(); + } + } + + return hbt; +} + + template<class BasicThermo, class MixtureType> Foam::wordList Foam::heThermo<BasicThermo, MixtureType>::heBoundaryTypes() { @@ -149,7 +182,8 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo ), mesh, dimEnergy/dimMass, - this->heBoundaryTypes() + this->heBoundaryTypes(), + this->heBoundaryBaseTypes() ) { init(); @@ -179,7 +213,8 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo ), mesh, dimEnergy/dimMass, - this->heBoundaryTypes() + this->heBoundaryTypes(), + this->heBoundaryBaseTypes() ) { init(); diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.H b/src/thermophysicalModels/basic/heThermo/heThermo.H index 2c894eee43727db7c8d7b3f84380b0840805284b..ef9919a99cdb5b3a303780d45045ccfcfe5bd176 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.H +++ b/src/thermophysicalModels/basic/heThermo/heThermo.H @@ -68,6 +68,10 @@ protected: // by interrogating the temperature field boundary types wordList heBoundaryTypes(); + //- Return the enthalpy/internal energy field boundary base types + // by interrogating the temperature field boundary types + wordList heBoundaryBaseTypes(); + //- Correct the enthalpy/internal energy field boundaries void heBoundaryCorrection(volScalarField& he); diff --git a/src/turbulenceModels/compressible/LES/LESModel/LESModel.H b/src/turbulenceModels/compressible/LES/LESModel/LESModel.H index 1f514840ae2bf7a53c4e1e3dab86a95a20f769f8..5b4cc39fca2cbf0a7978c2c5da9045be3b0b57da 100644 --- a/src/turbulenceModels/compressible/LES/LESModel/LESModel.H +++ b/src/turbulenceModels/compressible/LES/LESModel/LESModel.H @@ -169,7 +169,7 @@ public: //- Const access to the coefficients dictionary, // which provides info. about choice of models, // and all related data (particularly model coefficients). - inline const dictionary& coeffDict() const + virtual const dictionary& coeffDict() const { return coeffDict_; } diff --git a/src/turbulenceModels/compressible/RAS/LRR/LRR.C b/src/turbulenceModels/compressible/RAS/LRR/LRR.C index 1528ba2affc56f092dd970317fc5052b1b9af983..0a36879bc463eccf04655830a091d8b5610783a3 100644 --- a/src/turbulenceModels/compressible/RAS/LRR/LRR.C +++ b/src/turbulenceModels/compressible/RAS/LRR/LRR.C @@ -342,7 +342,7 @@ void LRR::correct() RASModel::correct(); volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_))); - volScalarField G("RASModel.G", 0.5*mag(tr(P))); + volScalarField G(type() + ".G", 0.5*mag(tr(P))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C index 7273efc82cd452df81b8f80088d15557bd9b4091..dafa58ebb3a01f0ece2dc059639d47bcec3e9c13 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C +++ b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C @@ -379,7 +379,7 @@ void LaunderGibsonRSTM::correct() } volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_))); - volScalarField G("RASModel.G", 0.5*mag(tr(P))); + volScalarField G(type() + ".G", 0.5*mag(tr(P))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C index 048f15eec624e577f68e8c047d5d1dbeeef7f187..8a1073e354a84152a11c04cf95781ec6801bd86e 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C +++ b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C @@ -304,7 +304,7 @@ void LaunderSharmaKE::correct() } tmp<volTensorField> tgradU = fvc::grad(U_); - volScalarField G("RASModel.G", mut_*(tgradU() && dev(twoSymm(tgradU())))); + volScalarField G(type() + ".G", mut_*(tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); diff --git a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H index 1efe2cd08dfdd64be7c8a4e1080120d76976479d..8bfa031882b1cdb9c1834f7ed15ac56483b69780 100644 --- a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H +++ b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H @@ -209,7 +209,7 @@ public: } //- Const access to the coefficients dictionary - const dictionary& coeffDict() const + virtual const dictionary& coeffDict() const { return coeffDict_; } diff --git a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C index 70094c353b6987808b6c19d3ad54bf90350f0b07..56192780098ec1ee47e4eeed497bb4712c116235 100644 --- a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C +++ b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C @@ -303,7 +303,7 @@ void RNGkEpsilon::correct() volScalarField S2((tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); - volScalarField G("RASModel.G", mut_*S2); + volScalarField G(type() + ".G", mut_*S2); volScalarField eta(sqrt(mag(S2))*k_/epsilon_); volScalarField eta3(eta*sqr(eta)); diff --git a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C b/src/turbulenceModels/compressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C index 52c5a2ed4f6adbceb9e1c1ace0dda6a2cceeb28e..55434df625a5b4588e9034d58805c53ec89d5b71 100644 --- a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C +++ b/src/turbulenceModels/compressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,7 +76,7 @@ tmp<volScalarField> autoCreateAlphat if (isA<wallFvPatch>(bm[patchI])) { alphatBoundaryTypes[patchI] = - RASModels::alphatWallFunctionFvPatchScalarField::typeName; + alphatWallFunctionFvPatchScalarField::typeName; } else { @@ -146,7 +146,7 @@ tmp<volScalarField> autoCreateMut if (isA<wallFvPatch>(bm[patchI])) { mutBoundaryTypes[patchI] = - RASModels::mutkWallFunctionFvPatchScalarField::typeName; + mutkWallFunctionFvPatchScalarField::typeName; } else { @@ -216,7 +216,7 @@ tmp<volScalarField> autoCreateLowReMut if (isA<wallFvPatch>(bm[patchI])) { mutBoundaryTypes[patchI] = - RASModels::mutLowReWallFunctionFvPatchScalarField::typeName; + mutLowReWallFunctionFvPatchScalarField::typeName; } else { @@ -262,7 +262,7 @@ tmp<volScalarField> autoCreateEpsilon autoCreateWallFunctionField < scalar, - RASModels::epsilonWallFunctionFvPatchScalarField + epsilonWallFunctionFvPatchScalarField > ( fieldName, @@ -281,7 +281,7 @@ tmp<volScalarField> autoCreateOmega autoCreateWallFunctionField < scalar, - RASModels::omegaWallFunctionFvPatchScalarField + omegaWallFunctionFvPatchScalarField > ( fieldName, @@ -300,7 +300,7 @@ tmp<volScalarField> autoCreateK autoCreateWallFunctionField < scalar, - RASModels::kqRWallFunctionFvPatchField<scalar> + kqRWallFunctionFvPatchField<scalar> > ( fieldName, @@ -319,7 +319,7 @@ tmp<volScalarField> autoCreateQ autoCreateWallFunctionField < scalar, - RASModels::kqRWallFunctionFvPatchField<scalar> + kqRWallFunctionFvPatchField<scalar> > ( fieldName, @@ -338,7 +338,7 @@ tmp<volSymmTensorField> autoCreateR autoCreateWallFunctionField < symmTensor, - RASModels::kqRWallFunctionFvPatchField<symmTensor> + kqRWallFunctionFvPatchField<symmTensor> > ( fieldName, diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C index 116bfc9c2534b5b906b2491b5eda97f170767665..65405445628d270328547a7cebc3182cae43f90f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "convectiveHeatTransferFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "addToRunTimeSelectionTable.H" @@ -34,8 +34,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -167,7 +165,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.H index 2bc06bb0e47751bf72d8887ca9ba011fb647ed34..cbbd7869befd12b7b5ba42fb4ca4b6e8758dd45b 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::convectiveHeatTransferFvPatchScalarField + Foam::compressible::convectiveHeatTransferFvPatchScalarField Group grpCmpRASBoundaryConditions @@ -85,8 +85,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class convectiveHeatTransferFvPatchScalarField Declaration @@ -190,7 +188,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C index 2811ea25795e9734a7faca4ebdfc0e6708aad2a5..e7003426bec723cd4007e985fbc19278627fc562 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C @@ -28,7 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "surfaceFields.H" #include "volFields.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -131,10 +131,11 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs() } // Lookup Cmu corresponding to the turbulence model selected - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); const scalar Cmu = - rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); + turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); const scalar Cmu75 = pow(Cmu, 0.75); diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C index eda8faf3244b0cdf47c01234b069db195c94d00a..de7c947a9f5e4b02a1e1f073edba7dc69e1878fd 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C @@ -131,10 +131,11 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs() } // Lookup Cmu corresponding to the turbulence model selected - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); const scalar Cmu = - rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); + turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); const scalar Cmu25 = pow(Cmu, 0.25); diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C index 5db232e85eae14d90291788034448a1a523f3b06..16b69874f0eb13caf7404530ea06f50ec95e2ae3 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "alphatJayatillekeWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -36,8 +36,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -312,7 +310,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.H index 60271aae48a4a17fc420737a61f4696468d2efd3..455041334e43aaee81f7df2e0a180ea9712c9723 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - alphatJayatillekeWallFunctionFvPatchScalarField + Foam::compressible::alphatJayatillekeWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -72,8 +72,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class alphatJayatillekeWallFunctionFvPatchScalarField Declaration @@ -211,7 +209,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C index c8051bb4511368e303df468eb62b165d3a3fcdfc..dcf694ad1ab6eaa115a7c17308e51594e177d675 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,13 +34,10 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -alphatWallFunctionFvPatchScalarField:: -alphatWallFunctionFvPatchScalarField +alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF @@ -52,8 +49,7 @@ alphatWallFunctionFvPatchScalarField {} -alphatWallFunctionFvPatchScalarField:: -alphatWallFunctionFvPatchScalarField +alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField ( const alphatWallFunctionFvPatchScalarField& ptf, const fvPatch& p, @@ -67,8 +63,7 @@ alphatWallFunctionFvPatchScalarField {} -alphatWallFunctionFvPatchScalarField:: -alphatWallFunctionFvPatchScalarField +alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, @@ -81,8 +76,7 @@ alphatWallFunctionFvPatchScalarField {} -alphatWallFunctionFvPatchScalarField:: -alphatWallFunctionFvPatchScalarField +alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField ( const alphatWallFunctionFvPatchScalarField& awfpsf ) @@ -93,8 +87,7 @@ alphatWallFunctionFvPatchScalarField {} -alphatWallFunctionFvPatchScalarField:: -alphatWallFunctionFvPatchScalarField +alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField ( const alphatWallFunctionFvPatchScalarField& awfpsf, const DimensionedField<scalar, volMesh>& iF @@ -143,7 +136,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.H index c9031e53ed58e8ba158584d6067948adcd9e41ea..011d17f958453d0485fddfa44a048cb1429b8a8f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::alphatWallFunctionFvPatchScalarField + Foam::compressible::alphatWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -84,8 +84,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class alphatWallFunctionFvPatchScalarField Declaration @@ -190,7 +188,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C index c9d824287dbaa98bbb900893b2302a2d4038a71b..279897e833d0376e4abb090cc4a40ce317626b43 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "epsilonLowReWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -132,11 +130,18 @@ void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; volScalarField& G = - const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_)); + const_cast<volScalarField&> + ( + db().lookupObject<volScalarField> + ( + turbulence.type() + ".G" + ) + ); DimensionedField<scalar, volMesh>& epsilon = const_cast<DimensionedField<scalar, volMesh>&> @@ -144,19 +149,19 @@ void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField() ); - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tmu = rasModel.mu(); + const tmp<volScalarField> tmu = turbulence.mu(); const scalarField& muw = tmu().boundaryField()[patchI]; - const tmp<volScalarField> tmut = rasModel.mut(); + const tmp<volScalarField> tmut = turbulence.mut(); const volScalarField& mut = tmut(); const scalarField& mutw = mut.boundaryField()[patchI]; - const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; + const scalarField& rhow = turbulence.rho().boundaryField()[patchI]; - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; const scalarField magGradUw(mag(Uw.snGrad())); const scalar Cmu25 = pow025(Cmu_); @@ -175,7 +180,8 @@ void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs() } else { - epsilon[faceCellI] = 2.0*Cmu25*pow(k[faceCellI], 1.5)/y[faceI]; + epsilon[faceCellI] = + 2.0*k[faceCellI]*muw[faceI]/rhow[faceI]/sqr(y[faceI]); } G[faceCellI] = @@ -201,7 +207,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H index 825adbf2c5a89bd3832eb85fa10a94ec3431a44b..61434c29b5020f24de8cca75004ce0ff4cb8c7c3 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::iompressible::RASModels::epsilonLowReWallFunctionFvPatchScalarField + Foam::iompressible::epsilonLowReWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -74,8 +74,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class epsilonLowReWallFunctionFvPatchScalarField Declaration @@ -180,7 +178,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index c2cce3febdb7c9233922b2f5c906092c318f6c22..88b91c0513923c12d5cbf0d96fcc62fb62fa021d 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "epsilonWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -37,8 +37,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -58,7 +56,6 @@ void epsilonWallFunctionFvPatchScalarField::checkType() void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const { - writeEntryIfDifferent<word>(os, "G", "RASModel.G", GName_); os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; @@ -74,7 +71,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF), - GName_("RASModel.G"), Cmu_(0.09), kappa_(0.41), E_(9.8) @@ -92,7 +88,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper), - GName_(ptf.GName_), Cmu_(ptf.Cmu_), kappa_(ptf.kappa_), E_(ptf.E_) @@ -109,7 +104,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF, dict), - GName_(dict.lookupOrDefault<word>("G", "RASModel.G")), Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), E_(dict.lookupOrDefault<scalar>("E", 9.8)) @@ -124,7 +118,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ewfpsf), - GName_(ewfpsf.GName_), Cmu_(ewfpsf.Cmu_), kappa_(ewfpsf.kappa_), E_(ewfpsf.E_) @@ -140,7 +133,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ewfpsf, iF), - GName_(ewfpsf.GName_), Cmu_(ewfpsf.Cmu_), kappa_(ewfpsf.kappa_), E_(ewfpsf.E_) @@ -160,15 +152,22 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); const scalar Cmu25 = pow025(Cmu_); const scalar Cmu75 = pow(Cmu_, 0.75); - const scalarField& y = rasModel.y()[patchI]; + const scalarField& y = turbulence.y()[patchI]; volScalarField& G = - const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_)); + const_cast<volScalarField&> + ( + db().lookupObject<volScalarField> + ( + turbulence.type() + ".G" + ) + ); DimensionedField<scalar, volMesh>& epsilon = const_cast<DimensionedField<scalar, volMesh>&> @@ -176,16 +175,16 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField() ); - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const scalarField& muw = rasModel.mu().boundaryField()[patchI]; + const scalarField& muw = turbulence.mu().boundaryField()[patchI]; - const tmp<volScalarField> tmut = rasModel.mut(); + const tmp<volScalarField> tmut = turbulence.mut(); const volScalarField& mut = tmut(); const scalarField& mutw = mut.boundaryField()[patchI]; - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; const scalarField magGradUw(mag(Uw.snGrad())); @@ -236,7 +235,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H index 486b7fb707deb2fdad9f18f307c67196f4760218..9975348d0be53acb86dc2765eb872df90f4634f8 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::epsilonWallFunctionFvPatchScalarField + Foam::compressible::epsilonWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -47,7 +47,6 @@ Description \table Property | Description | Required | Default value - G | turbulence generation field name | no | G Cmu | model coefficient | no | 0.09 kappa | Von Karman constant | no | 0.41 E | model coefficient | no | 9.8 @@ -80,8 +79,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class epsilonWallFunctionFvPatchScalarField Declaration @@ -95,9 +92,6 @@ protected: // Protected data - //- Name of turbulence generation field - word GName_; - //- Cmu coefficient scalar Cmu_; @@ -206,7 +200,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C index 07ea00c1b00f4a557fecb9f0a1770726550317a0..abb969914b1562eac83799a57f34b4a8cdb3e7b4 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "fWallFunctionFvPatchScalarField.H" -#include "RASModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "wallFvPatch.H" @@ -168,8 +167,9 @@ void fWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const v2f& v2fModel = refCast<const v2f>(rasModel); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const v2f& v2fModel = refCast<const v2f>(turbulence); const scalarField& y = v2fModel.y()[patchI]; diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C index 5f10ea4f2247ca2140381f747287ce30cc8c61b4..5e403ab932b1baa4c74022cdde82ab74eefe6b1e 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "kLowReWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -36,8 +36,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -174,16 +172,17 @@ void kLowReWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tmu = rasModel.mu(); + const tmp<volScalarField> tmu = turbulence.mu(); const scalarField& muw = tmu().boundaryField()[patchI]; - const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; + const scalarField& rhow = turbulence.rho().boundaryField()[patchI]; const scalar Cmu25 = pow025(Cmu_); @@ -250,7 +249,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H index d70f288653270346dc4ac557a829092cccfa373f..511bc19b6c6304a6260b80005a960482d2d46dcb 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::kLowReWallFunctionFvPatchScalarField + Foam::compressible::kLowReWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -71,8 +71,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class kLowReWallFunctionFvPatchScalarField Declaration @@ -199,7 +197,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C index 6cabd2171ab9f9781326524838f28dac41f12ebb..0d0fc613812df257164a92d88d7807a5c5360bb5 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,8 +34,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -146,7 +144,6 @@ void kqRWallFunctionFvPatchField<Type>::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H index d525d80b56c8f16ab1560d5a41ef7d752a6fe1ff..e96076fbc76a038958b20c81d4d07f7d9893a400 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::kqRWallFunctionFvPatchField + Foam::compressible::kqRWallFunctionFvPatchField Group grpCmpWallFunctions @@ -60,8 +60,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class kqRWallFunctionFvPatchField Declaration @@ -168,7 +166,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C index cd4eb03ec6f3b0c27246696fe74b04b4557c6c21..249b99ba3d0581fffab745a0d7851f53fc488a99 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,8 +34,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -43,7 +41,6 @@ makePatchFields(kqRWallFunction); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H index 95e36995dd38e99283c8cd3638737571d2990312..a62cd0806edd69365a1137a76c7b4c9f293e6e04 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,7 +42,6 @@ makePatchTypeFieldTypedefs(kqRWallFunction); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C index 5eee5c270289d210b489b5497a9d8a7c100be7d1..269f9698a9515b66d71ab8aa4a5c1f78889798fe 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "mutLowReWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -129,7 +127,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.H index 2cbbef359cb13de77d4c80e703471f9d12940bbc..75f751288b97c80d911e2b3e2199af905a7d5449 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutLowReWallFunctionFvPatchScalarField + Foam::compressible::mutLowReWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -43,7 +43,7 @@ Description \endverbatim SeeAlso - Foam::mutWallFunctionFvPatchScalarField + Foam::compressible::mutWallFunctionFvPatchScalarField SourceFiles mutLowReWallFunctionFvPatchScalarField.C @@ -61,8 +61,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutLowReWallFunctionFvPatchScalarField Declaration @@ -160,7 +158,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C index f5571451a1fb4d9f20dd4350a8e5d355825c9eff..5591904c9e0e93f49917e3d979539977ac8805bb 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C @@ -26,7 +26,7 @@ License #include "mutURoughWallFunctionFvPatchScalarField.H" #include "fvPatchFieldMapper.H" #include "volFields.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -311,7 +309,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.H index 479cb18b4009dc3b940cd965a6ddcae6417726cd..12beef633820fcb4ec2e39e8044e6806dc3cba26 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutURoughWallFunctionFvPatchScalarField + Foam::compressible:::mutURoughWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -52,7 +52,7 @@ Description \endverbatim SeeAlso - Foam::mutWallFunctionFvPatchScalarField + Foam::compressible::mutWallFunctionFvPatchScalarField SourceFiles mutURoughWallFunctionFvPatchScalarField.C @@ -70,8 +70,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutURoughWallFunctionFvPatchScalarField Declaration @@ -232,7 +230,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C index 4a4691c12c98254e27b567d19f985a349da1cffd..64bb1238ec7869113a6844989f3aceee24fc5893 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C @@ -26,7 +26,7 @@ License #include "mutUSpaldingWallFunctionFvPatchScalarField.H" #include "fvPatchFieldMapper.H" #include "volFields.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -219,7 +217,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.H index 2501fa5b719427f210694eb2b417ab8b18ae851f..a0322dbeb26b8b2688830588dcdd3af37843074f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutUSpaldingWallFunctionFvPatchScalarField + Foam::compressible::mutUSpaldingWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -56,7 +56,7 @@ Description \endverbatim SeeAlso - Foam::mutWallFunctionFvPatchScalarField + Foam::compressible::mutWallFunctionFvPatchScalarField SourceFiles mutUSpaldingWallFunctionFvPatchScalarField.C @@ -74,8 +74,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutUSpaldingWallFunctionFvPatchScalarField Declaration @@ -182,7 +180,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C index 85efec0327fd244601701cabdb2980bc21909d1b..3148119dcfb100f226e955946a998f0d0ec61385 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "mutUWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -197,7 +195,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.H index 08a938b52c5716cd6a30b19de151096809350910..1c6ed4f7d64cf47fd91894404bf7ffead1f0eebb 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutUWallFunctionFvPatchScalarField + Foam::compressible::mutUWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -42,7 +42,7 @@ Description \endverbatim SeeAlso - Foam::mutWallFunctionFvPatchScalarField + Foam::compressible::mutWallFunctionFvPatchScalarField SourceFiles mutUWallFunctionFvPatchScalarField.C @@ -60,8 +60,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutUWallFunctionFvPatchScalarField Declaration @@ -168,7 +166,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.C index 6f0dbb1a9fea14a6301e90b90419d237a68f7177..f4a6476be6b7fad21ace76c82e6204876eec9d33 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "mutWallFunctionFvPatchScalarField.H" -#include "RASModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "wallFvPatch.H" @@ -36,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -184,7 +181,6 @@ void mutWallFunctionFvPatchScalarField::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.H index 9228b609242f5a08f1e76e18e52885d753781520..29bc406aa1e3f9ee85b88acb35f8bc4e72c8d2de 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutWallFunctionFvPatchScalarField + Foam::compressible::mutWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -61,8 +61,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutWallFunctionFvPatchScalarField Declaration @@ -173,7 +171,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C index cc04471f4fc4ca692f9ccb8d98d0012ab42cb8c7..e634b89acc1baca2277abe37645aaa311e3c105f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "mutkRoughWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -237,7 +235,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.H index fdf5a0a7d6364919c2cea2b7604c9951953f2473..6ff72c42d3b22341b64a0f13c7e84298dd692f18 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutkRoughWallFunctionFvPatchScalarField + Foam::compressible::mutkRoughWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -56,7 +56,7 @@ Description \endverbatim SeeAlso - Foam::mutkRoughWallFunctionFvPatchScalarField + Foam::compressible::mutkRoughWallFunctionFvPatchScalarField SourceFiles mutkRoughWallFunctionFvPatchScalarField.C @@ -74,8 +74,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutkRoughWallFunctionFvPatchScalarField Declaration @@ -198,7 +196,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C index 9aeb96b297e2720547fad2a1f13f246d8d13a34f..72b010d55d0d11b3774ef07b41a1d0b3c84559b4 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "mutkWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "wallFvPatch.H" @@ -36,8 +36,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -159,7 +157,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H index 8d952a64285e0811afca6082f9c2d778030e04f1..f81625627cf26d86d2ac36abc5f492078f59ab5e 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutkWallFunctionFvPatchScalarField + Foam::compressible::mutkWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -43,7 +43,7 @@ Description \endverbatim SeeAlso - Foam::mutWallFunctionFvPatchScalarField + Foam::compressible::mutWallFunctionFvPatchScalarField SourceFiles mutkWallFunctionFvPatchScalarField.C @@ -61,8 +61,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutkWallFunctionFvPatchScalarField Declaration @@ -160,7 +158,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index d7f2f4fa5ed14cbe229dd4d1fa7dd7e9837d0b17..e95a4d9bf7b92e61eda664157df89c901d9bcd6c 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "omegaWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -37,8 +37,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -58,7 +56,6 @@ void omegaWallFunctionFvPatchScalarField::checkType() void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const { - writeEntryIfDifferent<word>(os, "G", "RASModel.G", GName_); os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; @@ -75,7 +72,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF), - GName_("RASModel.G"), Cmu_(0.09), kappa_(0.41), E_(9.8), @@ -96,7 +92,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper), - GName_(ptf.GName_), Cmu_(ptf.Cmu_), kappa_(ptf.kappa_), E_(ptf.E_), @@ -115,7 +110,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF, dict), - GName_(dict.lookupOrDefault<word>("G", "RASModel.G")), Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), E_(dict.lookupOrDefault<scalar>("E", 9.8)), @@ -132,7 +126,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(owfpsf), - GName_(owfpsf.GName_), Cmu_(owfpsf.Cmu_), kappa_(owfpsf.kappa_), E_(owfpsf.E_), @@ -150,7 +143,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(owfpsf, iF), - GName_(owfpsf.GName_), Cmu_(owfpsf.Cmu_), kappa_(owfpsf.kappa_), E_(owfpsf.E_), @@ -173,13 +165,19 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patch().index()]; + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patch().index()]; const scalar Cmu25 = pow025(Cmu_); volScalarField& G = const_cast<volScalarField&> - (db().lookupObject<volScalarField>(GName_)); + ( + db().lookupObject<volScalarField> + ( + turbulence.type() + ".G" + ) + ); DimensionedField<scalar, volMesh>& omega = const_cast<DimensionedField<scalar, volMesh>&> @@ -187,18 +185,18 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField() ); - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; + const scalarField& rhow = turbulence.rho().boundaryField()[patchI]; - const scalarField& muw = rasModel.mu().boundaryField()[patchI]; + const scalarField& muw = turbulence.mu().boundaryField()[patchI]; - const tmp<volScalarField> tmut = rasModel.mut(); + const tmp<volScalarField> tmut = turbulence.mut(); const volScalarField& mut = tmut(); const scalarField& mutw = mut.boundaryField()[patchI]; - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; const scalarField magGradUw(mag(Uw.snGrad())); @@ -242,7 +240,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H index d6516c5449ab748a213960619e6301e290e1a602..69fa8ee9cd06ea6ab759ef193a94c9c89a8e3f9f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::omegaWallFunctionFvPatchScalarField + Foam::compressible::omegaWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -54,7 +54,6 @@ Description \table Property | Description | Required | Default value - G | turbulence generation field name | no | G Cmu | model coefficient | no | 0.09 kappa | Von Karman constant | no | 0.41 E | model coefficient | no | 9.8 @@ -85,8 +84,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class omegaWallFunctionFvPatchScalarField Declaration @@ -100,9 +97,6 @@ protected: // Protected data - //- Name of turbulence generation field - word GName_; - //- Cmu coefficient scalar Cmu_; @@ -214,7 +208,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C index f7c8643baedd3014173768850dce842b44bcadd7..8c30e82d006ec0f5024cbac918a2d4ed36afce96 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C @@ -167,16 +167,17 @@ void v2WallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tmu = rasModel.mu(); + const tmp<volScalarField> tmu = turbulence.mu(); const scalarField& muw = tmu().boundaryField()[patchI]; - const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; + const scalarField& rhow = turbulence.rho().boundaryField()[patchI]; const scalar Cmu25 = pow025(Cmu_); diff --git a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C index 7475a39f5bdfc699c275421ad91f1dcd1e6882f5..93e902cfe406c029932c460dc201d45f42783bc4 100644 --- a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C +++ b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C @@ -281,7 +281,7 @@ void kEpsilon::correct() } tmp<volTensorField> tgradU = fvc::grad(U_); - volScalarField G("RASModel.G", mut_*(tgradU() && dev(twoSymm(tgradU())))); + volScalarField G(type() + ".G", mut_*(tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); // Update epsilon and G at the wall diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C index 066e427741e4e576b210e036b21ea282495924df..ddde795545d66396d6675a73f2acf9fc45f4330b 100644 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C +++ b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C @@ -85,6 +85,18 @@ tmp<volScalarField> kOmegaSST::F2() const } +tmp<volScalarField> kOmegaSST::F3() const +{ + tmp<volScalarField> arg3 = min + ( + 150*(mu()/rho_)/(omega_*sqr(y_)), + scalar(10) + ); + + return 1 - tanh(pow4(arg3)); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // kOmegaSST::kOmegaSST @@ -198,6 +210,15 @@ kOmegaSST::kOmegaSST 0.31 ) ), + b1_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "b1", + coeffDict_, + 1.0 + ) + ), c1_ ( dimensioned<scalar>::lookupOrAddToDict @@ -268,7 +289,7 @@ kOmegaSST::kOmegaSST / max ( a1_*omega_, - F2()*sqrt(2.0)*mag(symm(fvc::grad(U_))) + b1_*F2()*F3()*sqrt(2.0)*mag(symm(fvc::grad(U_))) ) ); mut_.correctBoundaryConditions(); @@ -347,6 +368,7 @@ bool kOmegaSST::read() beta2_.readIfPresent(coeffDict()); betaStar_.readIfPresent(coeffDict()); a1_.readIfPresent(coeffDict()); + b1_.readIfPresent(coeffDict()); c1_.readIfPresent(coeffDict()); return true; @@ -392,7 +414,7 @@ void kOmegaSST::correct() tmp<volTensorField> tgradU = fvc::grad(U_); volScalarField S2(2*magSqr(symm(tgradU()))); volScalarField GbyMu((tgradU() && dev(twoSymm(tgradU())))); - volScalarField G("RASModel.G", mut_*GbyMu); + volScalarField G(type() + ".G", mut_*GbyMu); tgradU.clear(); // Update omega and G at the wall @@ -448,7 +470,7 @@ void kOmegaSST::correct() // Re-calculate viscosity - mut_ = a1_*rho_*k_/max(a1_*omega_, F2()*sqrt(S2)); + mut_ = a1_*rho_*k_/max(a1_*omega_, b1_*F2()*F3()*sqrt(S2)); mut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H index d498a9a1f1031afdbeeb768dc1c9f3453720b170..6cc40f6b683e81e8955566e3803b5462597c9298 100644 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H +++ b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H @@ -38,6 +38,15 @@ Description Nov. 2001 \endverbatim + with the addition of the F3 term for rough walls from + \verbatim + Hellsten, A. + "Some Improvements in Menter’s k-omega-SST turbulence model" + 29th AIAA Fluid Dynamics Conference, + AIAA-98-2554, + June 1998. + \endverbatim + Note that this implementation is written in terms of alpha diffusion coefficients rather than the more traditional sigma (alpha = 1/sigma) so that the blending can be applied to all coefficuients in a consistent @@ -69,6 +78,7 @@ Description gamma1 0.5532; gamma2 0.4403; a1 0.31; + b1 1.0; c1 10.0; } \endverbatim @@ -125,6 +135,7 @@ protected: dimensionedScalar betaStar_; dimensionedScalar a1_; + dimensionedScalar b1_; dimensionedScalar c1_; @@ -144,6 +155,7 @@ protected: tmp<volScalarField> F1(const volScalarField& CDkOmega) const; tmp<volScalarField> F2() const; + tmp<volScalarField> F3() const; tmp<volScalarField> blend ( diff --git a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C index 537a2c8e44cad7853ae22e6478aac93bdba400d2..4d3e8cf94b9afdee89c537b25528cf473d37176b 100644 --- a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C +++ b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C @@ -321,7 +321,7 @@ void realizableKE::correct() volScalarField eta(magS*k_/epsilon_); volScalarField C1(max(eta/(scalar(5) + eta), scalar(0.43))); - volScalarField G("RASModel.G", mut_*(gradU && dev(twoSymm(gradU)))); + volScalarField G(type() + ".G", mut_*(gradU && dev(twoSymm(gradU)))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/compressible/RAS/v2f/v2f.C b/src/turbulenceModels/compressible/RAS/v2f/v2f.C index fa5c19503eb176ad5e04ec99077b095e0067d20f..0fb834ac49fdc76766ad961ea09d246c975eca99 100644 --- a/src/turbulenceModels/compressible/RAS/v2f/v2f.C +++ b/src/turbulenceModels/compressible/RAS/v2f/v2f.C @@ -398,7 +398,7 @@ void v2f::correct() const volTensorField gradU(fvc::grad(U_)); const volScalarField S2(2*magSqr(dev(symm(gradU)))); - const volScalarField G("RASModel.G", mut_*S2); + const volScalarField G(type() + ".G", mut_*S2); const volScalarField T(Ts()); const volScalarField L2("v2f.L2", sqr(Ls())); const volScalarField alpha diff --git a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C index aa56d7cfddb3203db512b59f152a677b893c6592..a7188c5eebdd9a61873dc0d964178888164f3805 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C +++ b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C @@ -79,6 +79,12 @@ autoPtr<laminar> laminar::New // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +const dictionary& laminar::coeffDict() const +{ + return dictionary::null; +} + + tmp<volScalarField> laminar::mut() const { return tmp<volScalarField> diff --git a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H index bead5d06de48c9295978b3848732d39b442f255c..b1de35154ecb5612d72cf11480821425518ccb9d 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H +++ b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H @@ -91,6 +91,9 @@ public: // Member Functions + //- Const access to the coefficients dictionary + virtual const dictionary& coeffDict() const; + //- Return the turbulence viscosity, i.e. 0 for laminar flow virtual tmp<volScalarField> mut() const; diff --git a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H index e6d8bf290fdfbef40eccb24596df3f01596761ef..87d283b29ab8d318cb625269052367e219f5a3a2 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H +++ b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H @@ -158,6 +158,9 @@ public: // Member Functions + //- Const access to the coefficients dictionary + virtual const dictionary& coeffDict() const = 0; + //- Access function to density field const volScalarField& rho() const { diff --git a/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C b/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C index 0f1d19bb2e04a4cfaf55054b1cc327767efcb01d..7afc74c400d527e2072fc6abdd008ea2dc326b40 100644 --- a/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C +++ b/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C @@ -28,8 +28,9 @@ License #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" #include "volFields.H" -#include "incompressible/RAS/RASModel/RASModel.H" -#include "compressible/RAS/RASModel/RASModel.H" +#include "surfaceFields.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H b/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H index c790bb587196e0a22660779e001f39207f21f6ed..d08086234b856a55ebc4c941b3cf587b3ae18dd1 100644 --- a/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H +++ b/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H @@ -166,7 +166,7 @@ public: //- Const access to the coefficients dictionary, // which provides info. about choice of models, // and all related data (particularly model coefficients). - inline const dictionary& coeffDict() const + virtual const dictionary& coeffDict() const { return coeffDict_; } diff --git a/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C b/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C index bbbf51332b98cd60f5ca3f12a07001d7d3cac223..4bbf67702af1f770995b91a71684cda821678f58 100644 --- a/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C +++ b/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C @@ -53,7 +53,7 @@ void SpalartAllmaras::updateSubGridScaleFields() tmp<volScalarField> SpalartAllmaras::fv1() const { - const volScalarField chi3(pow3(nuTilda_/nu())); + const volScalarField chi3("chi3", pow3(nuTilda_/nu())); return chi3/(chi3 + pow3(Cv1_)); } @@ -66,8 +66,8 @@ tmp<volScalarField> SpalartAllmaras::fv2() const tmp<volScalarField> SpalartAllmaras::fv3() const { - const volScalarField chi(nuTilda_/nu()); - const volScalarField chiByCv2((1/Cv2_)*chi); + const volScalarField chi("chi", nuTilda_/nu()); + const volScalarField chiByCv2(chi/Cv2_); return (scalar(1) + chi*fv1()) diff --git a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C index 2b54d0ef09223a0942b96f6345f4211e18ce13e8..acb34537c7fca816f3d6324a8d2ba4236b817e1e 100644 --- a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C +++ b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C @@ -353,7 +353,7 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU) volScalarField L(sqrt(k_)/(pow025(Cmu_)*omega_)); volScalarField CDkOmega((2.0*alphaOmega2_)*(gradK & gradOmega)/omega_); volScalarField F1(this->F1(CDkOmega)); - volScalarField G(nuSgs_*S2); + volScalarField G(type() + ".G", nuSgs_*S2); // Turbulent kinetic energy equation { diff --git a/src/turbulenceModels/incompressible/RAS/LRR/LRR.C b/src/turbulenceModels/incompressible/RAS/LRR/LRR.C index 68f0d2b2b0916f736169bbc7062bfccab7982113..49b0bd0a17b6192d4a8745b384b2c83d4b30c11f 100644 --- a/src/turbulenceModels/incompressible/RAS/LRR/LRR.C +++ b/src/turbulenceModels/incompressible/RAS/LRR/LRR.C @@ -339,7 +339,7 @@ void LRR::correct() } volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_))); - volScalarField G("RASModel.G", 0.5*mag(tr(P))); + volScalarField G(type() + ".G", 0.5*mag(tr(P))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C b/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C index 17d9157c905492c8806e93ef4cf7c7b71d4c7955..576d830421908a8e32e83065d09e5bc0787418c1 100644 --- a/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C +++ b/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C @@ -252,7 +252,7 @@ void LamBremhorstKE::correct() y_.correct(); } - volScalarField G("RASModel.G", nut_*2*magSqr(symm(fvc::grad(U_)))); + volScalarField G(type() + ".G", nut_*2*magSqr(symm(fvc::grad(U_)))); // Calculate parameters and coefficients for low-Reynolds number model diff --git a/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C b/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C index c6ee7a7d448528bb363b420a923e85d9d1a37e97..2f8ff3b7ea0af39c5c2c35be8e160726be142dce 100644 --- a/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C +++ b/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C @@ -386,7 +386,7 @@ void LaunderGibsonRSTM::correct() } volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_))); - volScalarField G("RASModel.G", 0.5*mag(tr(P))); + volScalarField G(type() + ".G", 0.5*mag(tr(P))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C b/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C index 53cc490f297f68a27758c1fdf311d8ba9172c616..c6854e7cba2f0c8a199ed0b7fea4a98b93390ed3 100644 --- a/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C +++ b/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C @@ -255,7 +255,7 @@ void LaunderSharmaKE::correct() tmp<volScalarField> S2 = 2*magSqr(symm(fvc::grad(U_))); - volScalarField G("RASModel.G", nut_*S2); + volScalarField G(type() + ".G", nut_*S2); const volScalarField E(2.0*nu()*nut_*fvc::magSqrGradGrad(U_)); const volScalarField D(2.0*nu()*magSqr(fvc::grad(sqrt(k_)))); diff --git a/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C b/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C index 8eb972dcfbdc7083e243486748a25d2b3162e287..dbecdb2dc83602b917d5588005c6dc327b985844 100644 --- a/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C +++ b/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C @@ -356,7 +356,7 @@ void LienCubicKE::correct() volScalarField G ( - "RASModel.G", + type() + ".G", Cmu_*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU) ); diff --git a/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C b/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C index 5162fa78bdafe469329f5ce28037b19ec34b7282..9c5d561998dc45c2256f5f92e0aeebcb694cc13c 100644 --- a/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C +++ b/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C @@ -446,7 +446,7 @@ void LienCubicKELowRe::correct() volScalarField G ( - "RASModel.G", + type() + ".G", Cmu_*fMu*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU) ); diff --git a/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C b/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C index 6daecaae6badc12bb3b88b7f5c46e348ae478f78..faf5c125e4f4a84e44e65124fc6753aa1c7b6580 100644 --- a/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C +++ b/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C @@ -319,7 +319,7 @@ void LienLeschzinerLowRe::correct() const volScalarField f2(scalar(1) - 0.3*exp(-sqr(Rt))); - volScalarField G("RASModel.G", Cmu_*fMu*sqr(k_)/epsilon_*S2); + volScalarField G(type() + ".G", Cmu_*fMu*sqr(k_)/epsilon_*S2); // Dissipation equation diff --git a/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C b/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C index 750a4dc15b58d6a937ac4ffc633a8cd40b1b28cc..b33c0cd3a863b39f70876d86664e17b077ff94af 100644 --- a/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C +++ b/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C @@ -348,9 +348,8 @@ void NonlinearKEShih::correct() volScalarField G ( - "RASModel.G", - Cmu_*sqr(k_)/epsilon_*S2 - - (nonlinearStress_ && gradU) + type() + ".G", + Cmu_*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU) ); #include "nonLinearWallFunctionsI.H" diff --git a/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.H b/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.H index b1a97681c28c41f042f0235e7e5abe4e9ac0f498..4e890bb20514b6517bec7e280ca41a3902470f27 100644 --- a/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.H +++ b/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.H @@ -208,7 +208,7 @@ public: } //- Const access to the coefficients dictionary - const dictionary& coeffDict() const + virtual const dictionary& coeffDict() const { return coeffDict_; } diff --git a/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C b/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C index 20ed988ca7eb507ecd9cc79fc111d6dcdd84056b..b82719f22189c2add52274d42141aea85ee45cf0 100644 --- a/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C +++ b/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C @@ -267,7 +267,7 @@ void RNGkEpsilon::correct() } const volScalarField S2(2*magSqr(symm(fvc::grad(U_)))); - volScalarField G("RASModel.G", nut_*S2); + volScalarField G(type() + ".G", nut_*S2); const volScalarField eta(sqrt(S2)*k_/epsilon_); volScalarField R diff --git a/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C b/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C index 3940b067a45ce75724acd68de67b48778b15c891..98514bb5bec842d5a97ded1ec85a49111afd9a0a 100644 --- a/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C +++ b/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,7 +75,7 @@ tmp<volScalarField> autoCreateNut if (isA<wallFvPatch>(bm[patchI])) { nutBoundaryTypes[patchI] = - RASModels::nutkWallFunctionFvPatchScalarField::typeName; + nutkWallFunctionFvPatchScalarField::typeName; } else { @@ -145,7 +145,7 @@ tmp<volScalarField> autoCreateLowReNut if (isA<wallFvPatch>(bm[patchI])) { nutBoundaryTypes[patchI] = - RASModels::nutLowReWallFunctionFvPatchScalarField::typeName; + nutLowReWallFunctionFvPatchScalarField::typeName; } else { @@ -191,7 +191,7 @@ tmp<volScalarField> autoCreateEpsilon autoCreateWallFunctionField < scalar, - RASModels::epsilonWallFunctionFvPatchScalarField + epsilonWallFunctionFvPatchScalarField > ( fieldName, @@ -210,7 +210,7 @@ tmp<volScalarField> autoCreateOmega autoCreateWallFunctionField < scalar, - RASModels::omegaWallFunctionFvPatchScalarField + omegaWallFunctionFvPatchScalarField > ( fieldName, @@ -229,7 +229,7 @@ tmp<volScalarField> autoCreateK autoCreateWallFunctionField < scalar, - RASModels::kqRWallFunctionFvPatchField<scalar> + kqRWallFunctionFvPatchField<scalar> > ( fieldName, @@ -248,7 +248,7 @@ tmp<volScalarField> autoCreateQ autoCreateWallFunctionField < scalar, - RASModels::kqRWallFunctionFvPatchField<scalar> + kqRWallFunctionFvPatchField<scalar> > ( fieldName, @@ -267,7 +267,7 @@ tmp<volSymmTensorField> autoCreateR autoCreateWallFunctionField < symmTensor, - RASModels::kqRWallFunctionFvPatchField<symmTensor> + kqRWallFunctionFvPatchField<symmTensor> > ( fieldName, diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C index b65b1cde9e8f3a60de74648d1bbc7764625d0993..52d39a366f0e6089e7458ed1278ce47f26632447 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,7 @@ License #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" #include "volFields.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -184,8 +184,9 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs() patch().lookupPatchField<volScalarField, scalar>(alphaEffName_); // retrieve (constant) specific heat capacity from transport dictionary - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalar Cp0(readScalar(rasModel.transport().lookup("Cp0"))); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalar Cp0(readScalar(turbulence.transport().lookup("Cp0"))); switch (heatSource_) { diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C index f0e9d5bdfeaffb5fddcd4984ef270325b0aae6f7..a7563417448bc0c6041b18e63dab4ed6608ed675 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C @@ -28,7 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "surfaceFields.H" #include "volFields.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -131,10 +131,11 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs() } // Lookup Cmu corresponding to the turbulence model selected - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); const scalar Cmu = - rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); + turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); const scalar Cmu75 = pow(Cmu, 0.75); diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C index 1a9c4ae29a0b9e1b7a0aba257236b957e7768478..bf9f904f7a8a6d8abcdc11c82a7083311bc0c17f 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,7 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "surfaceFields.H" #include "volFields.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -127,10 +127,11 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs() } // Lookup Cmu corresponding to the turbulence model selected - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); const scalar Cmu = - rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); + turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); const scalar Cmu25 = pow(Cmu, 0.25); diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C index 1a67d2329f66feb5713b8a9432bbca6ec11fab52..df52c7373e8ffac02c03ecbc016d179e97fe75cc 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "epsilonLowReWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -132,11 +130,18 @@ void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; volScalarField& G = - const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_)); + const_cast<volScalarField&> + ( + db().lookupObject<volScalarField> + ( + turbulence.type() + ".G" + ) + ); DimensionedField<scalar, volMesh>& epsilon = const_cast<DimensionedField<scalar, volMesh>&> @@ -144,17 +149,17 @@ void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField() ); - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tnu = rasModel.nu(); + const tmp<volScalarField> tnu = turbulence.nu(); const scalarField& nuw = tnu().boundaryField()[patchI]; - const tmp<volScalarField> tnut = rasModel.nut(); + const tmp<volScalarField> tnut = turbulence.nut(); const volScalarField& nut = tnut(); const scalarField& nutw = nut.boundaryField()[patchI]; - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; const scalarField magGradUw(mag(Uw.snGrad())); const scalar Cmu25 = pow025(Cmu_); @@ -173,7 +178,7 @@ void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs() } else { - epsilon[faceCellI] = 2.0*Cmu25*pow(k[faceCellI], 1.5)/y[faceI]; + epsilon[faceCellI] = 2.0*k[faceCellI]*nuw[faceI]/sqr(y[faceI]); } G[faceCellI] = @@ -199,7 +204,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H index 9191a584b457062bfaba5dfa591f5e822d5aee8b..b8cf09f0b7930d3da619f0fbd350089ff4b725f0 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::epsilonLowReWallFunctionFvPatchScalarField + Foam::incompressible::epsilonLowReWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -74,8 +74,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class epsilonLowReWallFunctionFvPatchScalarField Declaration @@ -180,7 +178,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index 3fcb175fb36310fafa789db3288c7346c06ec191..518bb38f471a8f97818deab85d043275d3d25757 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "epsilonWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -38,8 +38,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -59,7 +57,6 @@ void epsilonWallFunctionFvPatchScalarField::checkType() void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const { - writeEntryIfDifferent<word>(os, "G", "RASModel.G", GName_); os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; @@ -75,7 +72,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF), - GName_("RASModel.G"), Cmu_(0.09), kappa_(0.41), E_(9.8) @@ -93,7 +89,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper), - GName_(ptf.GName_), Cmu_(ptf.Cmu_), kappa_(ptf.kappa_), E_(ptf.E_) @@ -110,7 +105,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF, dict), - GName_(dict.lookupOrDefault<word>("G", "RASModel.G")), Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), E_(dict.lookupOrDefault<scalar>("E", 9.8)) @@ -125,7 +119,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ewfpsf), - GName_(ewfpsf.GName_), Cmu_(ewfpsf.Cmu_), kappa_(ewfpsf.kappa_), E_(ewfpsf.E_) @@ -141,7 +134,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ewfpsf, iF), - GName_(ewfpsf.GName_), Cmu_(ewfpsf.Cmu_), kappa_(ewfpsf.kappa_), E_(ewfpsf.E_) @@ -161,14 +153,21 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; const scalar Cmu25 = pow025(Cmu_); const scalar Cmu75 = pow(Cmu_, 0.75); volScalarField& G = - const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_)); + const_cast<volScalarField&> + ( + db().lookupObject<volScalarField> + ( + turbulence.type() + ".G" + ) + ); DimensionedField<scalar, volMesh>& epsilon = const_cast<DimensionedField<scalar, volMesh>&> @@ -176,17 +175,17 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField() ); - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tnu = rasModel.nu(); + const tmp<volScalarField> tnu = turbulence.nu(); const scalarField& nuw = tnu().boundaryField()[patchI]; - const tmp<volScalarField> tnut = rasModel.nut(); + const tmp<volScalarField> tnut = turbulence.nut(); const volScalarField& nut = tnut(); const scalarField& nutw = nut.boundaryField()[patchI]; - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; const scalarField magGradUw(mag(Uw.snGrad())); @@ -237,7 +236,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H index e988f05aff5bc85cc6de9737f4fd7926a7fb1e56..9ff7b7acb544341bc1a46a8d1ef9d9ce20cb7f31 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::epsilonWallFunctionFvPatchScalarField + Foam::incompressible::epsilonWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -47,7 +47,6 @@ Description \table Property | Description | Required | Default value - G | turbulence generation field name | no | G Cmu | model coefficient | no | 0.09 kappa | Von Karman constant | no | 0.41 E | model coefficient | no | 9.8 @@ -80,8 +79,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class epsilonWallFunctionFvPatchScalarField Declaration @@ -95,9 +92,6 @@ protected: // Protected data - //- Name of turbulence generation field - word GName_; - //- Cmu coefficient scalar Cmu_; @@ -206,7 +200,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C index 2fae43e16119d3c6290332a44eba789b9441b2fd..cb905c80e28a839c4266fc79814581d666465b35 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C @@ -168,8 +168,9 @@ void fWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const v2f& v2fModel = refCast<const v2f>(rasModel); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const v2f& v2fModel = refCast<const v2f>(turbulence); const scalarField& y = v2fModel.y()[patchI]; diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C index a87f31144164c263e2e0eb6865514080a69b0322..ac3855632aa1208405d6a53925297a0e4d5494b5 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "kappatJayatillekeWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "wallFvPatch.H" @@ -36,8 +36,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -272,7 +270,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H index c26d9a41ecbfadfe77b83ca340892a814034f7e0..d4e0af5dd8728469b06aa08b5059e12028bc4e72 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H @@ -22,8 +22,7 @@ License OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels:: - kappatJayatillekeWallFunctionFvPatchScalarField + Foam::incompressible::kappatJayatillekeWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -72,8 +71,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class kappatJayatillekeWallFunctionFvPatchScalarField Declaration @@ -208,7 +205,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C index a7da31f471a4c591305febcc2db017d51d25ad7e..a53c5e0697cfd2280d9de3d32039afb650231cfd 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "kLowReWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -36,8 +36,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -174,13 +172,14 @@ void kLowReWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tnu = rasModel.nu(); + const tmp<volScalarField> tnu = turbulence.nu(); const scalarField& nuw = tnu().boundaryField()[patchI]; const scalar Cmu25 = pow025(Cmu_); @@ -248,7 +247,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H index 72c077d33e99a94c08302cdfcacb64093bc3fe89..db99287eaaf6b348d74bd72599bf69ea158dfd23 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::kLowReWallFunctionFvPatchScalarField + Foam::incompressible::kLowReWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -71,8 +71,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class kLowReWallFunctionFvPatchScalarField Declaration @@ -199,7 +197,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C index 8861be642ec43c68029593b76649cd2889daf393..9ff2371a62c5528fbd0b0c1f6cabdb0aeedce4f5 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,8 +34,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -146,7 +144,6 @@ void kqRWallFunctionFvPatchField<Type>::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H index c63821fe9a9da5502a534060c93801f5088df372..e9b3731deb16fc93be0c1724d012328fe6734ac3 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::kqRWallFunctionFvPatchField + Foam::incompressible::kqRWallFunctionFvPatchField Group grpIcoWallFunctions @@ -63,8 +63,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class kqRWallFunctionFvPatchField Declaration @@ -171,7 +169,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C index 0ecaa87a5dc69baa7c101e50df3f1c75015970f4..9465bdf18c5bf24fce9b0e6afd9362c9882bba35 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,8 +34,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -43,7 +41,6 @@ makePatchFields(kqRWallFunction); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H index fe76853910a2203c020dff6c10202fbfe5791aef..b9a2727f34da2c52c2556b79d4d86a854b50e1df 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,7 +42,6 @@ makePatchTypeFieldTypedefs(kqRWallFunction); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C index c23e832c5ce11880465dca3ffde97123a4eac754..a0e340bf4dee21b29bb69d8d5cb274e272c2942e 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutLowReWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -127,7 +125,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.H index 008fe9c96c6559b978b189787080ccbeb9c346b7..f79533c20420fb94bbd3d4bae786e8a5d7883ee5 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutLowReWallFunctionFvPatchScalarField + Foam::incompressible::nutLowReWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -61,8 +61,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutLowReWallFunctionFvPatchScalarField Declaration @@ -158,7 +156,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C index 4be408474d68b4bfda648db04d94894c11f0a736..9ec799e35323b8cfa37269d66b34287c85918d7a 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutURoughWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -302,7 +300,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.H index 881752d9f54e21fb0565311a0756957634d5cb68..17adf6f909fa2d0f334c8e52b3f675cba0b0f9c9 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutURoughWallFunctionFvPatchScalarField + Foam::incompressible::nutURoughWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -70,8 +70,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutURoughWallFunctionFvPatchScalarField Declaration @@ -233,7 +231,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C index 2d55b5ed7925240ab455d119eee6fe317e73642f..7dca54b3e5964ce3e3d07abbedc1434622dfb295 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutUSpaldingWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,22 +35,20 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcNut() const { - const label patchi = patch().index(); + const label patchI = patch().index(); const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>("turbulenceModel"); - const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI]; const scalarField magGradU(mag(Uw.snGrad())); const tmp<volScalarField> tnu = turbModel.nu(); const volScalarField& nu = tnu(); - const scalarField& nuw = nu.boundaryField()[patchi]; + const scalarField& nuw = nu.boundaryField()[patchI]; return max ( @@ -65,23 +63,27 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau const scalarField& magGradU ) const { + const label patchI = patch().index(); + const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>("turbulenceModel"); - const scalarField& y = turbModel.y()[patch().index()]; + const scalarField& y = turbModel.y()[patchI]; - const fvPatchVectorField& Uw = - turbModel.U().boundaryField()[patch().index()]; + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI]; const scalarField magUp(mag(Uw.patchInternalField() - Uw)); - const scalarField& nuw = turbModel.nu()().boundaryField()[patch().index()]; + const tmp<volScalarField> tnu = turbModel.nu(); + const volScalarField& nu = tnu(); + const scalarField& nuw = nu.boundaryField()[patchI]; + const scalarField& nutw = *this; tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0)); scalarField& uTau = tuTau(); - forAll(uTau, facei) + forAll(uTau, faceI) { - scalar ut = sqrt((nutw[facei] + nuw[facei])*magGradU[facei]); + scalar ut = sqrt((nutw[faceI] + nuw[faceI])*magGradU[faceI]); if (ut > ROOTVSMALL) { @@ -90,17 +92,17 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau do { - scalar kUu = min(kappa_*magUp[facei]/ut, 50); + scalar kUu = min(kappa_*magUp[faceI]/ut, 50); scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu); scalar f = - - ut*y[facei]/nuw[facei] - + magUp[facei]/ut + - ut*y[faceI]/nuw[faceI] + + magUp[faceI]/ut + 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu)); scalar df = - y[facei]/nuw[facei] - + magUp[facei]/sqr(ut) + y[faceI]/nuw[faceI] + + magUp[faceI]/sqr(ut) + 1/E_*kUu*fkUu/ut; scalar uTauNew = ut + f/df; @@ -109,7 +111,7 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau } while (ut > ROOTVSMALL && err > 0.01 && ++iter < 10); - uTau[facei] = max(0.0, ut); + uTau[faceI] = max(0.0, ut); } } @@ -212,7 +214,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.H index b9f75ed1b17395581b2b981b9532bf4ba7bd7257..210de458373175f451c07339024440bbfa499d3c 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutUSpaldingWallFunctionFvPatchScalarField + Foam::incompressible::nutUSpaldingWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -74,8 +74,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutUSpaldingWallFunctionFvPatchScalarField Declaration @@ -182,7 +180,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C index 1cbc8971f745cf851a4960f8a50c5a66562bc472..63bab814711cfb16d81a159f16cb629fe6b19cc6 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutUTabulatedWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -214,7 +212,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.H index 95bde3ba032d724ebb8c5628af4a7155ff6632bc..dbc1a75ab738d91220b812dfeaccf514b116efbc 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutUTabulatedWallFunctionFvPatchScalarField + Foam::incompressible::nutUTabulatedWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -73,8 +73,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutUTabulatedWallFunctionFvPatchScalarField Declaration @@ -190,7 +188,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C index 5ba0a0ef34626ba631ace1f20df3815f6e41515b..3b34b46df128ec8a0736e236c791a4adca532a58 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutUWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -198,7 +196,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.H index 6f32734149b36460f2f1e8069db4366c41ae6410..0a34ad6facabbf086557f2613ad576559f9199a8 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutUWallFunctionFvPatchScalarField + Foam::incompressible::nutUWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -60,8 +60,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutUWallFunctionFvPatchScalarField Declaration @@ -168,7 +166,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C index c23aea5551d9c13e99025834358d851a1ba084de..3b8749974d706e54d98b177e838ce84f350d6b7c 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "nutWallFunctionFvPatchScalarField.H" -#include "RASModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "wallFvPatch.H" @@ -36,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -194,7 +191,6 @@ void nutWallFunctionFvPatchScalarField::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H index 01355ec454d7260ba0000f81d887e3c7e73e97df..de68000bd9f6e672442787c9262a29ff0090b316 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutWallFunctionFvPatchScalarField + Foam::incompressible::nutWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -61,8 +61,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutWallFunctionFvPatchScalarField Declaration @@ -173,7 +171,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C index b00e9f0bf984e881f8237a3f75197531ae9e4cfa..2406f30d0ad656f8534d8f1f807e2fa6ec1ba62b 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutkAtmRoughWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -44,11 +42,12 @@ tmp<scalarField> nutkAtmRoughWallFunctionFvPatchScalarField::calcNut() const { const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; - const tmp<volScalarField> tk = rasModel.k(); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tnu = rasModel.nu(); + const tmp<volScalarField> tnu = turbulence.nu(); const volScalarField& nu = tnu(); const scalarField& nuw = nu.boundaryField()[patchI]; @@ -192,7 +191,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H index 3e0f67a4fcbfe3803eb4b0f6f4189a39006742a3..3767de1fc0dc1ad73f634fe2c4e49fe0f9afc80f 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H @@ -22,8 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels:: - nutkAtmRoughWallFunctionFvPatchScalarField + Foam::incompressible::nutkAtmRoughWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -82,8 +81,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutkAtmRoughWallFunctionFvPatchScalarField Declaration @@ -210,7 +207,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C index df8480da007b798e1ff9d7b431e4259a84e439fa..61d806882685d2b1c4831ae6bff8e8dedea7cdcc 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutkRoughWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -237,7 +235,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.H index 50d24a3ebd804f849b7ad7b550d127693c18ef4d..4a8d812ad5aedf8d2791392aa1dc67b41dc7dca1 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutkRoughWallFunctionFvPatchScalarField + Foam::incompressible::nutkRoughWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -74,8 +74,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutkRoughWallFunctionFvPatchScalarField Declaration @@ -213,7 +211,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C index afbd1548d15fb7e38b4c494a56b92feb12dff40c..bfc542434fa882b2a288e036cd9d2ccebced29d3 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutkWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "wallFvPatch.H" @@ -36,8 +36,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -160,7 +158,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.H index 49a2257e093eb2df45e83be774232dbe9f23ded3..ef0a3066db762efa32589694d81909d77fa324e0 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutkWallFunctionFvPatchScalarField + Foam::incompressible::nutkWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -61,8 +61,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutkWallFunctionFvPatchScalarField Declaration @@ -158,7 +156,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index 0ad2595c7c6217d7738f14e8855c72f139a2ca6e..83444c5d407156cee0655377d13e75d9a5cd80cf 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "omegaWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -38,8 +38,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -59,7 +57,6 @@ void omegaWallFunctionFvPatchScalarField::checkType() void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const { - writeEntryIfDifferent<word>(os, "G", "RASModel.G", GName_); os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; @@ -76,7 +73,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF), - GName_("RASModel.G"), Cmu_(0.09), kappa_(0.41), E_(9.8), @@ -96,7 +92,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper), - GName_(ptf.GName_), Cmu_(ptf.Cmu_), kappa_(ptf.kappa_), E_(ptf.E_), @@ -115,7 +110,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF, dict), - GName_(dict.lookupOrDefault<word>("G", "RASModel.G")), Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), E_(dict.lookupOrDefault<scalar>("E", 9.8)), @@ -132,7 +126,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(owfpsf), - GName_(owfpsf.GName_), Cmu_(owfpsf.Cmu_), kappa_(owfpsf.kappa_), E_(owfpsf.E_), @@ -150,7 +143,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(owfpsf, iF), - GName_(owfpsf.GName_), Cmu_(owfpsf.Cmu_), kappa_(owfpsf.kappa_), E_(owfpsf.E_), @@ -172,13 +164,20 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; const scalar Cmu25 = pow025(Cmu_); volScalarField& G = - const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_)); + const_cast<volScalarField&> + ( + db().lookupObject<volScalarField> + ( + turbulence.type() + ".G" + ) + ); DimensionedField<scalar, volMesh>& omega = const_cast<DimensionedField<scalar, volMesh>&> @@ -186,17 +185,17 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField() ); - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tnu = rasModel.nu(); + const tmp<volScalarField> tnu = turbulence.nu(); const scalarField& nuw = tnu().boundaryField()[patchI]; - const tmp<volScalarField> tnut = rasModel.nut(); + const tmp<volScalarField> tnut = turbulence.nut(); const volScalarField& nut = tnut(); const scalarField& nutw = nut.boundaryField()[patchI]; - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; const scalarField magGradUw(mag(Uw.snGrad())); @@ -242,7 +241,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H index 9c03a85f259a0ddfded87dcba8313f5cf29798ab..9ee99bd6c6927e76a57325b96fbeb8b1be76d1a1 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::omegaWallFunctionFvPatchScalarField + Foam::incompressible::omegaWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -54,7 +54,6 @@ Description \table Property | Description | Required | Default value - G | turbulence generation field name | no | G Cmu | model coefficient | no | 0.09 kappa | Von Karman constant | no | 0.41 E | model coefficient | no | 9.8 @@ -85,8 +84,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class omegaWallFunctionFvPatchScalarField Declaration @@ -100,9 +97,6 @@ protected: // Protected data - //- Name of turbulence generation field - word GName_; - //- Cmu coefficient scalar Cmu_; @@ -214,7 +208,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C index d896d4d08b1c48a3ebd34b9d65d7212979854110..b2a3e38dedfa7049f2d0b0e5daf4afa37ea5e4ef 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C @@ -167,13 +167,14 @@ void v2WallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tnu = rasModel.nu(); + const tmp<volScalarField> tnu = turbulence.nu(); const scalarField& nuw = tnu().boundaryField()[patchI]; const scalar Cmu25 = pow025(Cmu_); diff --git a/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C b/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C index c12783bcdbb2c69e329bf73c3f9443885430b7cd..48ccd699c74bd230a63f70af181411996ad1ec50 100644 --- a/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C +++ b/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C @@ -235,7 +235,7 @@ void kEpsilon::correct() return; } - volScalarField G("RASModel.G", nut_*2*magSqr(symm(fvc::grad(U_)))); + volScalarField G(type() + ".G", nut_*2*magSqr(symm(fvc::grad(U_)))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C b/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C index f2faf19966b4e11f493d28849078bedecd3e7615..497fbed7c6914eb53572a52af6c02ed8b09483b3 100644 --- a/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C +++ b/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C @@ -244,7 +244,7 @@ void kOmega::correct() return; } - volScalarField G("RASModel.G", nut_*2*magSqr(symm(fvc::grad(U_)))); + volScalarField G(type() + ".G", nut_*2*magSqr(symm(fvc::grad(U_)))); // Update omega and G at the wall omega_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C b/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C index e48bc0ae45f7ece18aa8a20b11dbbf96e9af70b8..cff0d48146077e69f3a7af4a18a303b671d33588 100644 --- a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C +++ b/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C @@ -69,6 +69,7 @@ tmp<volScalarField> kOmegaSST::F1(const volScalarField& CDkOmega) const return tanh(pow4(arg1)); } + tmp<volScalarField> kOmegaSST::F2() const { tmp<volScalarField> arg2 = min @@ -359,6 +360,7 @@ bool kOmegaSST::read() beta2_.readIfPresent(coeffDict()); betaStar_.readIfPresent(coeffDict()); a1_.readIfPresent(coeffDict()); + b1_.readIfPresent(coeffDict()); c1_.readIfPresent(coeffDict()); return true; @@ -385,7 +387,7 @@ void kOmegaSST::correct() } const volScalarField S2(2*magSqr(symm(fvc::grad(U_)))); - volScalarField G("RASModel.G", nut_*S2); + volScalarField G(type() + ".G", nut_*S2); // Update omega and G at the wall omega_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C.new b/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C.new deleted file mode 100644 index b28e14bce9e3d070a6d68928a1051170c8bbe3e6..0000000000000000000000000000000000000000 --- a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C.new +++ /dev/null @@ -1,419 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ 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 3 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, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "kOmegaSST.H" -#include "addToRunTimeSelectionTable.H" - -#include "backwardsCompatibilityWallFunctions.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(kOmegaSST, 0); -addToRunTimeSelectionTable(RASModel, kOmegaSST, dictionary); - -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // - -tmp<volScalarField> kOmegaSST::F1(const volScalarField& CDkOmega) const -{ - volScalarField CDkOmegaPlus = max - ( - CDkOmega, - dimensionedScalar("1.0e-10", dimless/sqr(dimTime), 1.0e-10) - ); - - volScalarField arg1 = min - ( - min - ( - max - ( - (scalar(1)/betaStar_)*sqrt(k_)/(omega_*y_), - scalar(500)*nu()/(sqr(y_)*omega_) - ), - (4*alphaOmega2_)*k_/(CDkOmegaPlus*sqr(y_)) - ), - scalar(10) - ); - - return tanh(pow4(arg1)); -} - -tmp<volScalarField> kOmegaSST::F2() const -{ - volScalarField arg2 = min - ( - max - ( - (scalar(2)/betaStar_)*sqrt(k_)/(omega_*y_), - scalar(500)*nu()/(sqr(y_)*omega_) - ), - scalar(100) - ); - - return tanh(sqr(arg2)); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -kOmegaSST::kOmegaSST -( - const volVectorField& U, - const surfaceScalarField& phi, - transportModel& lamTransportModel -) -: - RASModel(typeName, U, phi, lamTransportModel), - - alphaK1_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "alphaK1", - coeffDict_, - 0.85034 - ) - ), - alphaK2_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "alphaK2", - coeffDict_, - 1.0 - ) - ), - alphaOmega1_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "alphaOmega1", - coeffDict_, - 0.5 - ) - ), - alphaOmega2_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "alphaOmega2", - coeffDict_, - 0.85616 - ) - ), - gamma1_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "gamma1", - coeffDict_, - 0.5532 - ) - ), - gamma2_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "gamma2", - coeffDict_, - 0.4403 - ) - ), - beta1_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "beta1", - coeffDict_, - 0.075 - ) - ), - beta2_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "beta2", - coeffDict_, - 0.0828 - ) - ), - betaStar_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "betaStar", - coeffDict_, - 0.09 - ) - ), - a1_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "a1", - coeffDict_, - 0.31 - ) - ), - c1_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "c1", - coeffDict_, - 10.0 - ) - ), - - y_(mesh_), - - k_ - ( - IOobject - ( - "k", - runTime_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - autoCreateK("k", mesh_) - ), - omega_ - ( - IOobject - ( - "omega", - runTime_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - autoCreateOmega("omega", mesh_) - ), - nut_ - ( - IOobject - ( - "nut", - runTime_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - autoCreateNut("nut", mesh_) - ) -{ - nut_ = - a1_*k_ - /max - ( - a1_*(omega_ + omegaSmall_), - F2()*mag(symm(fvc::grad(U_))) - ); - nut_.correctBoundaryConditions(); - - printCoeffs(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -tmp<volSymmTensorField> kOmegaSST::R() const -{ - return tmp<volSymmTensorField> - ( - new volSymmTensorField - ( - IOobject - ( - "R", - runTime_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)), - k_.boundaryField().types() - ) - ); -} - - -tmp<volSymmTensorField> kOmegaSST::devReff() const -{ - return tmp<volSymmTensorField> - ( - new volSymmTensorField - ( - IOobject - ( - "devRhoReff", - runTime_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - -nuEff()*dev(twoSymm(fvc::grad(U_))) - ) - ); -} - - -tmp<fvVectorMatrix> kOmegaSST::divDevReff(volVectorField& U) const -{ - return - ( - - fvm::laplacian(nuEff(), U) - - fvc::div(nuEff()*dev(fvc::grad(U)().T())) - ); -} - - -bool kOmegaSST::read() -{ - if (RASModel::read()) - { - alphaK1_.readIfPresent(coeffDict()); - alphaK2_.readIfPresent(coeffDict()); - alphaOmega1_.readIfPresent(coeffDict()); - alphaOmega2_.readIfPresent(coeffDict()); - gamma1_.readIfPresent(coeffDict()); - gamma2_.readIfPresent(coeffDict()); - beta1_.readIfPresent(coeffDict()); - beta2_.readIfPresent(coeffDict()); - betaStar_.readIfPresent(coeffDict()); - a1_.readIfPresent(coeffDict()); - c1_.readIfPresent(coeffDict()); - - return true; - } - else - { - return false; - } -} - - -void kOmegaSST::correct() -{ - RASModel::correct(); - - if (!turbulence_) - { - return; - } - - if (mesh_.changing()) - { - y_.correct(); - } - - volScalarField S2 = magSqr(symm(fvc::grad(U_))); - volScalarField G("RASModel.G", nut_*2*S2); - - // Update omega and G at the wall - omega_.boundaryField().updateCoeffs(); - - volScalarField F1 = this->F1 - ( - (2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_ - ); - - // Epsilon diffusion correction - surfaceScalarField CDkPhiOmega - ( - "CDkPhiOmega", - (2*alphaOmega2_) - *fvc::interpolate(F1 - scalar(1)) - /fvc::interpolate(omega_) - *fvc::snGrad(k_)*mesh_.magSf() - ); - - forAll (CDkPhiOmega.boundaryField(), patchi) - { - if (!CDkPhiOmega.boundaryField()[patchi].coupled()) - { - CDkPhiOmega.boundaryField()[patchi] = 0.0; - } - } - - // Turbulent frequency equation - tmp<fvScalarMatrix> omegaEqn - ( - fvm::ddt(omega_) - + fvm::div(phi_, omega_) - - fvm::laplacian(DomegaEff(F1), omega_) - + fvm::div(CDkPhiOmega, omega_) - == - gamma(F1)*2*S2 - - fvm::Sp(beta(F1)*omega_, omega_) - ); - - omegaEqn().relax(); - - omegaEqn().boundaryManipulate(omega_.boundaryField()); - - solve(omegaEqn); - bound(omega_, omega0_); - - // Turbulent kinetic energy equation - tmp<fvScalarMatrix> kEqn - ( - fvm::ddt(k_) - + fvm::div(phi_, k_) - - fvm::laplacian(DkEff(F1), k_) - == - min(G, c1_*betaStar_*k_*omega_) - - fvm::Sp(betaStar_*omega_, k_) - ); - - kEqn().relax(); - solve(kEqn); - bound(k_, k0_); - - - // Re-calculate viscosity - nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(S2)); - nut_.correctBoundaryConditions(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C b/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C index 03a3b8a5a6eaa9981d91986000fc33e9985bc716..8803807bbee7c4d89f5c5ace959c0b0aaa7cf882 100644 --- a/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C +++ b/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C @@ -311,7 +311,7 @@ void qZeta::correct() tmp<volScalarField> S2 = 2*magSqr(symm(fvc::grad(U_))); - volScalarField G("RASModel.G", nut_/(2.0*q_)*S2); + volScalarField G(type() + ".G", nut_/(2.0*q_)*S2); const volScalarField E(nu()*nut_/q_*fvc::magSqrGradGrad(U_)); diff --git a/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C b/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C index 3161d16371a95bf46db40c7dc4808acca7284a7d..d106180142072934341fe6040083f7e33a4fb444 100644 --- a/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C +++ b/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C @@ -297,7 +297,7 @@ void realizableKE::correct() const volScalarField eta(magS*k_/epsilon_); tmp<volScalarField> C1 = max(eta/(scalar(5) + eta), scalar(0.43)); - volScalarField G("RASModel.G", nut_*S2); + volScalarField G(type() + ".G", nut_*S2); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/incompressible/RAS/v2f/v2f.C b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C index d7304617ac2b35239454a6eda24371379fd6ceb3..b8d20d262433c0c213e9d84e0e03fa2162f688c8 100644 --- a/src/turbulenceModels/incompressible/RAS/v2f/v2f.C +++ b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C @@ -364,9 +364,9 @@ void v2f::correct() const volTensorField gradU(fvc::grad(U_)); const volScalarField S2(2*magSqr(dev(symm(gradU)))); - const volScalarField G("RASModel.G", nut_*S2); + const volScalarField G(type() + ".G", nut_*S2); const volScalarField T(Ts()); - const volScalarField L2("v2f.L2", sqr(Ls())); + const volScalarField L2(type() + ".L2", sqr(Ls())); const volScalarField alpha ( "v2f::alpha", diff --git a/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.C b/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.C index a633c7a70e30df29bdc8c7feb1b33e4fa86d3ffc..65a6e2e6850bb00222cdd8103482490e41d27b78 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.C +++ b/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.C @@ -77,6 +77,12 @@ autoPtr<laminar> laminar::New // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +const dictionary& laminar::coeffDict() const +{ + return dictionary::null; +} + + tmp<volScalarField> laminar::nut() const { return tmp<volScalarField> diff --git a/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.H b/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.H index 5b79ecd48538d6226854350183a0746e7ab9b5ca..9c8588015f02025d604238d121367902b2a0e95a 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.H +++ b/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.H @@ -89,6 +89,9 @@ public: // Member Functions + //- Const access to the coefficients dictionary + virtual const dictionary& coeffDict() const; + //- Return the turbulence viscosity, i.e. 0 for laminar flow virtual tmp<volScalarField> nut() const; diff --git a/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H b/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H index c2eacdaf39201458b69422646d363383a7fde7f3..91eef14ad78ce3f5cb62e9c556b28586e3325ee1 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H +++ b/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H @@ -153,6 +153,9 @@ public: // Member Functions + //- Const access to the coefficients dictionary + virtual const dictionary& coeffDict() const = 0; + //- Access function to velocity field inline const volVectorField& U() const { diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/pyrolysisZones b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/pyrolysisZones index 1895f851df5b662b8e39e0b663c4b2d2e358cba1..cef16b64a545cd096a1387206ea715df3c9f582f 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/pyrolysisZones +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/pyrolysisZones @@ -27,8 +27,6 @@ FoamFile reactingOneDimCoeffs { - filmCoupled false; - radFluxName Qr; minimumDelta 1e-12; diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/pyrolysisZones b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/pyrolysisZones index 65436e1e8d7b36fb10c386e0eec7efff240ba130..d5ebc6e44efc3b6467acbd8b0cd6f33780f01a25 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/pyrolysisZones +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/pyrolysisZones @@ -28,8 +28,6 @@ FoamFile reactingOneDimCoeffs { - filmCoupled false; - radFluxName Qr; minimumDelta 1e-8; diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/pyrolysisZones b/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/pyrolysisZones index 65436e1e8d7b36fb10c386e0eec7efff240ba130..d5ebc6e44efc3b6467acbd8b0cd6f33780f01a25 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/pyrolysisZones +++ b/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/pyrolysisZones @@ -28,8 +28,6 @@ FoamFile reactingOneDimCoeffs { - filmCoupled false; - radFluxName Qr; minimumDelta 1e-8; diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFProperties b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFProperties index 3782a377cd79bf07dfc62e29c4078b5dfaa935b9..c4c20f18d00832f8078eca66c760dfd069ef9282 100644 --- a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFProperties +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFProperties @@ -19,6 +19,8 @@ zone1 { cellZone rotor; + active on; + // Fixed patches (by default they 'move' with the MRF zone) nonRotatingPatches (); diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/sourcesProperties b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/sourcesProperties index 4386bc52506b016f5aa089d5535b7d7c81ed7694..ddd2bf9c9faaa53e07e1835ad4a289e8a38e8495 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/sourcesProperties +++ b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/sourcesProperties @@ -26,6 +26,7 @@ source1 fixedTemperatureSourceCoeffs { + mode uniform; temperature 350; } } diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/sourcesProperties b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/sourcesProperties index 4386bc52506b016f5aa089d5535b7d7c81ed7694..ddd2bf9c9faaa53e07e1835ad4a289e8a38e8495 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/sourcesProperties +++ b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/sourcesProperties @@ -26,6 +26,7 @@ source1 fixedTemperatureSourceCoeffs { + mode uniform; temperature 350; } } diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict index 788a47939064e48f15c8ecd6e0d0b46fcc930850..bc90ed1c2b5ff900402f1dc5e704347fddf8f3f7 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict @@ -256,35 +256,34 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.5; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. - // See relativeSizes parameter. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. + // See relativeSizes parameter. minThickness 0.25; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 60; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict index 0f936407a4f3ece79bb85279d2ee5a23c11046a8..c92d4511d033e9e22c54e7ab6ba9977eccc5a66d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict @@ -58,37 +58,6 @@ dictionaryReplacement } } } - - pmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - char - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } - } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict index 4deb0d8e1b0b0377fae898d61778e644e31f1044..8c75b7e4bddf6063c0b7ee7aecf77fbbeeb1d536 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict @@ -49,36 +49,6 @@ dictionaryReplacement } } } - - pmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - char - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict index c97bbad50fa6ecd12205ac09503c3b61d16dc70e..9c9b20e5ed859499ab26e59d59fe085b7c1a9f3d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict @@ -49,36 +49,6 @@ dictionaryReplacement } } } - - pmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - char - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict index 1222482e8fa96ac25ee1b8118f5e3e71e59752f3..c92d4511d033e9e22c54e7ab6ba9977eccc5a66d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict @@ -58,37 +58,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } - } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict index c70f5391f632c2889eb1f33d255d6548d96abd14..8c75b7e4bddf6063c0b7ee7aecf77fbbeeb1d536 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict @@ -49,36 +49,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict index 913adcf7844b5fd8984ea628382de5953af89ad4..9c9b20e5ed859499ab26e59d59fe085b7c1a9f3d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict @@ -49,36 +49,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/snappyHexMeshDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/snappyHexMeshDict index 82b6381b1b4c594362bec8c764549d9acf5ce4eb..072870efc37c3182654f6675c8623e8e0c70fa7e 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/snappyHexMeshDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/snappyHexMeshDict @@ -285,31 +285,30 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.3; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. finalLayerThickness 1; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.1; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 30; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/heater/changeDictionaryDict index 1222482e8fa96ac25ee1b8118f5e3e71e59752f3..c92d4511d033e9e22c54e7ab6ba9977eccc5a66d 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/heater/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/heater/changeDictionaryDict @@ -58,37 +58,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } - } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict index c70f5391f632c2889eb1f33d255d6548d96abd14..8c75b7e4bddf6063c0b7ee7aecf77fbbeeb1d536 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict @@ -49,36 +49,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict index 913adcf7844b5fd8984ea628382de5953af89ad4..9c9b20e5ed859499ab26e59d59fe085b7c1a9f3d 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict @@ -49,36 +49,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/heater/changeDictionaryDict index 1a680f09a2404fe8a9aaf975352ae5ea1ab439ad..024770648cad728b831dbff97512347dbb7693a1 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/heater/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/heater/changeDictionaryDict @@ -81,36 +81,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } - } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/leftSolid/changeDictionaryDict index 59116a041a13ea466a74dd387aa9e77e27a7b62a..b3ef4c896eb0db12d78f9d716f6e4b33b0ce4e16 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/leftSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/leftSolid/changeDictionaryDict @@ -72,36 +72,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/rightSolid/changeDictionaryDict index 4f018226087024a4f0527d1d122ccc260a1b2179..741624e3d1980d9f1f49cea5b39813661c48dbb5 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/rightSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/rightSolid/changeDictionaryDict @@ -72,36 +72,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/system/snappyHexMeshDict b/tutorials/incompressible/pimpleDyMFoam/propeller/system/snappyHexMeshDict index 326bafe1d49c61d867727ca6e9caa85f1221ee8e..d060b73f934050abc1739c7cb772d3973390ac80 100644 --- a/tutorials/incompressible/pimpleDyMFoam/propeller/system/snappyHexMeshDict +++ b/tutorials/incompressible/pimpleDyMFoam/propeller/system/snappyHexMeshDict @@ -335,33 +335,33 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the + // thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.1; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 30; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/snappyHexMeshDict b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/snappyHexMeshDict index b4c3ed8f64c234a2fa7ea9e71484da7d363427f9..fcf64ed65dcf03ea4b3b82920264dd6d6772d2ac 100644 --- a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/snappyHexMeshDict +++ b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/snappyHexMeshDict @@ -189,34 +189,33 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.3; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.7; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. - // See relativeSizes parameter. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. + // See relativeSizes parameter. minThickness 0.25; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 60; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals diff --git a/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/system/snappyHexMeshDict b/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/system/snappyHexMeshDict index 3e9353f452e73fc4215f3134676befae39dea890..452adf13dee51d21ca557ff438a774bf0eddade4 100644 --- a/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/system/snappyHexMeshDict +++ b/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/system/snappyHexMeshDict @@ -204,30 +204,30 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.1; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 60; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/incompressible/pisoFoam/ras/cavity/constant/polyMesh/boundary b/tutorials/incompressible/pisoFoam/ras/cavity/constant/polyMesh/boundary index 61feadd97403fbf58a57c925fc262f3de46ec95a..9294a312662a782327ee00bce133050c7518aa9d 100644 --- a/tutorials/incompressible/pisoFoam/ras/cavity/constant/polyMesh/boundary +++ b/tutorials/incompressible/pisoFoam/ras/cavity/constant/polyMesh/boundary @@ -32,6 +32,7 @@ FoamFile frontAndBack { type empty; + inGroups 1(empty); nFaces 800; startFace 840; } diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/U b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/U new file mode 100644 index 0000000000000000000000000000000000000000..711702f9871ed36f0695ef53bedb90b80c345a78 --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/U @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + movingWall + { + type fixedValue; + value uniform (1 0 0); + } + + fixedWalls + { + type fixedValue; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/epsilon b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..6b009c939ad092fdef7f54b8ecb9b755fb70ac3c --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/epsilon @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform 0.000765; + +boundaryField +{ + movingWall + { + type epsilonWallFunction; + value uniform 0.000765; + } + fixedWalls + { + type epsilonWallFunction; + value uniform 0.000765; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/k b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/k new file mode 100644 index 0000000000000000000000000000000000000000..72d1287df1f9d694a11cdb8b08012070367d6f06 --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/k @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0.00325; + +boundaryField +{ + movingWall + { + type kqRWallFunction; + value uniform 0.00325; + } + fixedWalls + { + type kqRWallFunction; + value uniform 0.00325; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/nuTilda b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/nuTilda new file mode 100644 index 0000000000000000000000000000000000000000..36021c60af557192f19b9aed3e448742c21843c5 --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/nuTilda @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nuTilda; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + movingWall + { + type zeroGradient; + } + + fixedWalls + { + type zeroGradient; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/nut b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/nut new file mode 100644 index 0000000000000000000000000000000000000000..2a9a9727fc9069af13d53199405fdc00e5d5d913 --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/nut @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + movingWall + { + type nutkWallFunction; + value uniform 0; + } + fixedWalls + { + type nutkWallFunction; + value uniform 0; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/p b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/p new file mode 100644 index 0000000000000000000000000000000000000000..3e00d9eb3198e7c3d1d96d37378ad5ab6466637b --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/p @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + movingWall + { + type zeroGradient; + } + + fixedWalls + { + type zeroGradient; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/RASProperties b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..a4937b503a46850b2626f0d301e4a07b9f691507 --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/RASProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kEpsilon; + +turbulence on; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/polyMesh/blockMeshDict b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..165a600c7b4a929aaa62ad1750bfbb9d279c2e65 --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/polyMesh/blockMeshDict @@ -0,0 +1,75 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.1; + +vertices +( + (0 0 0) + (1 0 0) + (1 1 0) + (0 1 0) + (0 0 0.1) + (1 0 0.1) + (1 1 0.1) + (0 1 0.1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (20 20 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + movingWall + { + type wall; + faces + ( + (3 7 6 2) + ); + } + fixedWalls + { + type wall; + faces + ( + (0 4 7 3) + (2 6 5 1) + (1 5 4 0) + ); + } + frontAndBack + { + type empty; + faces + ( + (0 3 2 1) + (4 5 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/polyMesh/boundary b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/polyMesh/boundary new file mode 100644 index 0000000000000000000000000000000000000000..9294a312662a782327ee00bce133050c7518aa9d --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/polyMesh/boundary @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +3 +( + movingWall + { + type wall; + nFaces 20; + startFace 760; + } + fixedWalls + { + type wall; + nFaces 60; + startFace 780; + } + frontAndBack + { + type empty; + inGroups 1(empty); + nFaces 800; + startFace 840; + } +) + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/transportProperties b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..b40b7d66cd884b7a54d4c7a61b50b1e39a466150 --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/transportProperties @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu nu [ 0 2 -1 0 0 0 0 ] 1e-05; + +CrossPowerLawCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 1; +} + +BirdCarreauCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 0; + n n [ 0 0 0 0 0 0 0 ] 1; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/turbulenceProperties b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..3721a46a2ead37eb2bf10434bcde59afa9fe9bf6 --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/controlDict b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..15396ddf40c7eaf68016dadeb5bda58bc62ccd31 --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/controlDict @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application pisoFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 10; + +deltaT 0.005; + +writeControl timeStep; + +writeInterval 100; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/fvSchemes b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..6a9eea83ddac00d64496b8bc5a959e22bb44e0ca --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/fvSchemes @@ -0,0 +1,71 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; + grad(p) Gauss linear; + grad(U) Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss limitedLinearV 1; + div(phi,k) Gauss limitedLinear 1; + div(phi,epsilon) Gauss limitedLinear 1; + div(phi,R) Gauss limitedLinear 1; + div(R) Gauss linear; + div(phi,nuTilda) Gauss limitedLinear 1; + div((nuEff*dev(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default none; + laplacian(nuEff,U) Gauss linear corrected; + laplacian((1|A(U)),p) Gauss linear corrected; + laplacian(DkEff,k) Gauss linear corrected; + laplacian(DepsilonEff,epsilon) Gauss linear corrected; + laplacian(DREff,R) Gauss linear corrected; + laplacian(DnuTildaEff,nuTilda) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; + interpolate(U) linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p ; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/fvSolution b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..dc8a5f5eb6d47c612c08729bf693e108e546a2f9 --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/fvSolution @@ -0,0 +1,87 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0.1; + } + + pFinal + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0; + } + + U + { + type coupled; + solver PBiCCG; + preconditioner DILU; + tolerance (1e-05 1e-05 1e-05); + relTol (0 0 0); + } + + k + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-05; + relTol 0; + } + + epsilon + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-05; + relTol 0; + } + + R + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-05; + relTol 0; + } + + nuTilda + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-05; + relTol 0; + } +} + +PISO +{ + nCorrectors 2; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 0; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/potentialFreeSurfaceFoam/oscillatingBox/Allrun b/tutorials/incompressible/potentialFreeSurfaceFoam/oscillatingBox/Allrun index 12efff4e492c0ea2b2d7c191bff1d7a6538c4292..76db27411528594a27ec1e3f77a85d3dd6b6485b 100755 --- a/tutorials/incompressible/potentialFreeSurfaceFoam/oscillatingBox/Allrun +++ b/tutorials/incompressible/potentialFreeSurfaceFoam/oscillatingBox/Allrun @@ -9,7 +9,7 @@ application=`getApplication` runApplication blockMesh runApplication topoSet -runApplication subsetMesh -overwrite c0 -patch floatingObject +runApplication subsetMesh -overwrite -cellSet c0 -patch floatingObject cp -r 0.org 0 > /dev/null 2>&1 runApplication $application diff --git a/tutorials/incompressible/shallowWaterFoam/squareBump/constant/polyMesh/boundary b/tutorials/incompressible/shallowWaterFoam/squareBump/constant/polyMesh/boundary index b96b8676fd4a649081dc3b177ade0f112412a450..4778c6be3c64e1be531f0ad92a4216c6e8261cd2 100644 --- a/tutorials/incompressible/shallowWaterFoam/squareBump/constant/polyMesh/boundary +++ b/tutorials/incompressible/shallowWaterFoam/squareBump/constant/polyMesh/boundary @@ -38,6 +38,7 @@ FoamFile frontAndBack { type empty; + inGroups 1(empty); nFaces 800; startFace 840; } diff --git a/tutorials/incompressible/shallowWaterFoam/squareBump/system/fvSchemes b/tutorials/incompressible/shallowWaterFoam/squareBump/system/fvSchemes index 7a0b99df5dcbf331a31429d24bf363e01020ce81..036a75cf3c9a39cc390a99659f9a47b3ca2299ab 100644 --- a/tutorials/incompressible/shallowWaterFoam/squareBump/system/fvSchemes +++ b/tutorials/incompressible/shallowWaterFoam/squareBump/system/fvSchemes @@ -16,7 +16,7 @@ FoamFile ddtSchemes { - default CrankNicholson 0.9; + default CrankNicolson 0.9; } gradSchemes diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict index e7c16adc8d3dd3fb8ebba77e0e7646a2f0f81893..f075505d6870afcaed85cdfe23a65e4b7e1aca33 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict +++ b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict @@ -39,6 +39,13 @@ writeInterval 100; purgeWrite 0; + +//- Have regular restart files +secondaryWriteControl cpuTime; +secondaryWriteInterval 120; +secondaryPurgeWrite 1; + + writeFormat ascii; writePrecision 6; diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/snappyHexMeshDict b/tutorials/incompressible/simpleFoam/motorBike/system/snappyHexMeshDict index 517ef75b9c006d25f7612feb10c804be8c06136c..6b36b1ef39b20813b04a9a56b575bfff7a765f1c 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/snappyHexMeshDict +++ b/tutorials/incompressible/simpleFoam/motorBike/system/snappyHexMeshDict @@ -227,37 +227,37 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the + // thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.1; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 60; - //- At non-patched sides allow mesh to slip if extrusion direction makes - // angle larger than slipFeatureAngle. + // At non-patched sides allow mesh to slip if extrusion direction makes + // angle larger than slipFeatureAngle. slipFeatureAngle 30; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/U b/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/U index c261ab16ba13cd1d55b5c54484a2df0ae19842de..bb861bfc6d1728ef2dc6aa6797e028a7fbb77371 100644 --- a/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/U +++ b/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/U @@ -23,6 +23,7 @@ boundaryField inlet { type timeVaryingMappedFixedValue; + offset (0 0 0); setAverage off; } diff --git a/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/epsilon b/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/epsilon index 28ff270cc2051c697e7760a851b726ac66155de8..b70f15f11994bfb3c213f3ff4dcc453c323b1b64 100644 --- a/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/epsilon +++ b/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/epsilon @@ -25,6 +25,7 @@ boundaryField { type timeVaryingMappedFixedValue; setAverage 0; + offset 0; value nonuniform List<scalar> 30 ( diff --git a/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/k b/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/k index 3d54d8e0972efdf77d41884462f1c7d2082699d8..f5f11a1aed3de9e8d9b76526cbf6fefc45853167 100644 --- a/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/k +++ b/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/k @@ -25,6 +25,7 @@ boundaryField { type timeVaryingMappedFixedValue; setAverage 0; + offset 0; value nonuniform List<scalar> 30 ( diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/system/snappyHexMeshDict b/tutorials/incompressible/simpleFoam/turbineSiting/system/snappyHexMeshDict index 8054858f2a7cbcaffe1b8512939d6372af22b7c9..f294a40e53e28b67533e5908c3d2c555c2e69183 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/system/snappyHexMeshDict +++ b/tutorials/incompressible/simpleFoam/turbineSiting/system/snappyHexMeshDict @@ -277,31 +277,31 @@ addLayersControls expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // See relativeSizes parameter. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // See relativeSizes parameter. minThickness 0.25; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 60; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/sourcesProperties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/sourcesProperties index 715f0ebdd9fc926737bb0f26ff740a4bada1bd4c..d351c7f360e1ae40a730f3f60600fbd5760fbc1a 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/sourcesProperties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/sourcesProperties @@ -26,6 +26,7 @@ source1 fixedTemperatureSourceCoeffs { + mode uniform; temperature 2000; } } diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties index 98c728fdecd864d5e28f394f3537f7bd06bf75c3..e327a829599ca9d90206d28ee6bcfd5a96bfeea9 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties @@ -26,6 +26,9 @@ thermoSingleLayerCoeffs thermoModel singleComponent; liquid H2O; + deltaWet 1e-4; + hydrophilic no; + forces ( surfaceShear diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/system/wallFilmRegion/fvSolution b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/system/wallFilmRegion/fvSolution index 381a5c4f27841eb58906d9902ce7a15261dc7eb2..eedbd097d3d322b785bb49d61583fa5af0cd6f47 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/system/wallFilmRegion/fvSolution +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/system/wallFilmRegion/fvSolution @@ -37,8 +37,7 @@ solvers PISO { momentumPredictor true; - nOuterCorr 1; - nCorr 2; + nCorr 1; nNonOrthCorr 0; } diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre index e2e3a1f1bfc160c87375794ff93643d23cb27730..627999b5cd9e4124cf2bf4f00b5fdf7f61fdaafe 100755 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre @@ -13,7 +13,7 @@ runApplication blockMesh runApplication topoSet # create the obstacles - add obstacle patches to wallFilm patch -runApplication subsetMesh c0 -patch wallFilm -overwrite +runApplication subsetMesh -cellSet c0 -patch wallFilm -overwrite # split the obstacle patches into cube[1-6]_patch[1-6] echo "running patchifyObstacles" diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties index 6984dcbb1e876386d5eaba75c0fc4786b0d7c7e4..96e33c1d68a2f91c9a59fe4bb9e2b083c4e78838 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties @@ -28,6 +28,9 @@ thermoSingleLayerCoeffs liquid H2O; + deltaWet 1e-4; + hydrophilic no; + radiationModel none; upperSurfaceModels @@ -65,7 +68,6 @@ thermoSingleLayerCoeffs contactAngleCoeffs { - deltaWet 1e-4; Ccf 0.085; contactAngleDistribution { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/fvSolution b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/fvSolution index cfae8b06ceb271cf05a9ee11ec39344afa079585..9385e6ec40d512c789920599ee18efa3b828ca02 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/fvSolution +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/fvSolution @@ -39,8 +39,7 @@ solvers PISO { momentumPredictor true; - nOuterCorr 1; - nCorr 2; + nCorr 1; nNonOrthCorr 0; } diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/constant/surfaceFilmProperties index d9a68e059d339cc8cc23b54067fb0c7798b1fdce..8440f3f47953d46dd66cbf6ae0207948f049df64 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/constant/surfaceFilmProperties @@ -43,7 +43,6 @@ kinematicSingleLayerCoeffs contactAngleCoeffs { - deltaWet 1e-4; Ccf 1; contactAngleDistribution { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/system/wallFilmRegion/fvSolution b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/system/wallFilmRegion/fvSolution index 645d42a4563911f1bd0f6adc3531cea607b3bfda..86cdc388bf53280a96c3d9322b7579a3c4f04f58 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/system/wallFilmRegion/fvSolution +++ b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/system/wallFilmRegion/fvSolution @@ -37,8 +37,7 @@ solvers PISO { momentumPredictor true; - nOuterCorr 1; - nCorr 2; + nCorr 1; nNonOrthCorr 0; } diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties index 30a2dd79f3721bd35423dc2c48f5217be5eec1a2..8335fadfc218d46a36d4c93c882f0e40738d7b69 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties @@ -27,6 +27,9 @@ thermoSingleLayerCoeffs liquid H2O; + deltaWet 1e-4; + hydrophilic no; + forces ( surfaceShear diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/system/wallFilmRegion/fvSolution b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/system/wallFilmRegion/fvSolution index 381a5c4f27841eb58906d9902ce7a15261dc7eb2..eedbd097d3d322b785bb49d61583fa5af0cd6f47 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/system/wallFilmRegion/fvSolution +++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/system/wallFilmRegion/fvSolution @@ -37,8 +37,7 @@ solvers PISO { momentumPredictor true; - nOuterCorr 1; - nCorr 2; + nCorr 1; nNonOrthCorr 0; } diff --git a/tutorials/mesh/cvMesh/blob/system/snappyHexMeshDict b/tutorials/mesh/cvMesh/blob/system/snappyHexMeshDict index da3f1895b4b58c861f8902a8a109d83c5fa61fbf..c5723d829f22cd893114a969605b413cdcb75b84 100644 --- a/tutorials/mesh/cvMesh/blob/system/snappyHexMeshDict +++ b/tutorials/mesh/cvMesh/blob/system/snappyHexMeshDict @@ -216,33 +216,32 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.5; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.02; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.005; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 90; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/mesh/cvMesh/flange/Allrun b/tutorials/mesh/cvMesh/flange/Allrun index dcbbfb47d41692c7e12c8aa3cb009f6e482def5d..d79a0bb18573235a6a56b230a84c5d3d9d87f158 100755 --- a/tutorials/mesh/cvMesh/flange/Allrun +++ b/tutorials/mesh/cvMesh/flange/Allrun @@ -14,7 +14,7 @@ runApplication surfaceFeatureExtract runApplication blockMesh runApplication topoSet -dict system/topoSetDict-background mv log.topoSet log.topoSet.background -runApplication subsetMesh background -patch walls -overwrite +runApplication subsetMesh -cellSet background -patch walls -overwrite runApplication decomposePar diff --git a/tutorials/mesh/cvMesh/flange/system/snappyHexMeshDict b/tutorials/mesh/cvMesh/flange/system/snappyHexMeshDict index 9da7fabcafea5f7ef0e7951a190148200f5a701c..12c88b16c4dba21ff638a3d6c8738fb70fa44c40 100644 --- a/tutorials/mesh/cvMesh/flange/system/snappyHexMeshDict +++ b/tutorials/mesh/cvMesh/flange/system/snappyHexMeshDict @@ -216,33 +216,32 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.5; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.0003; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.0001; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 90; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/mesh/moveDynamicMesh/simpleHarmonicMotion/Allrun b/tutorials/mesh/moveDynamicMesh/simpleHarmonicMotion/Allrun index a0ea6affe8410d37c0d234263686a20a58e7fad9..bca050f753663c824f7634f195b86ac66064e50b 100755 --- a/tutorials/mesh/moveDynamicMesh/simpleHarmonicMotion/Allrun +++ b/tutorials/mesh/moveDynamicMesh/simpleHarmonicMotion/Allrun @@ -10,7 +10,7 @@ application=`getApplication` runApplication blockMesh runApplication topoSet -runApplication subsetMesh -overwrite c0 -patch movingBlock +runApplication subsetMesh -overwrite -cellSet c0 -patch movingBlock cp -r 0.org 0 > /dev/null 2>&1 runApplication $application ./extractData log.$application diff --git a/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict b/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict index a1c0e1162f43801b6007ec103c38b837ec14209c..0e686729062863241611a64d61872df14ae436dc 100644 --- a/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict +++ b/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict @@ -214,30 +214,30 @@ addLayersControls expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // See relativeSizes parameter. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // See relativeSizes parameter. minThickness 0.25; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 30; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/snappyHexMeshDict b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/snappyHexMeshDict index 01badbd1ec0ac2a2512d5fdd4e4214feaa9467e3..dbb112f07439ca131953010a34df5c5cb802fdb1 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/snappyHexMeshDict +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/snappyHexMeshDict @@ -228,31 +228,31 @@ addLayersControls expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // See relativeSizes parameter. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // See relativeSizes parameter. minThickness 0.25; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 60; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals diff --git a/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/Allrun b/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/Allrun index 3c68954487c006d7bd5dd874a26d4169d78e1230..5b0f4b59e10d52f4b63103a32de9392cb637644a 100755 --- a/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/Allrun +++ b/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/Allrun @@ -8,7 +8,7 @@ cp -r 0.org 0 > /dev/null 2>&1 runApplication blockMesh #runApplication setSet -batch createObstacle.setSet runApplication topoSet -runApplication subsetMesh -overwrite c0 -patch walls +runApplication subsetMesh -overwrite -cellSet c0 -patch walls runApplication setFields runApplication `getApplication` diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun index 8ca61574f237151679a9f4041dcc7540282c72b3..896dd6e6f2b4238bb601eb289d5d4135fc3248b9 100755 --- a/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun @@ -9,7 +9,7 @@ application=`getApplication` runApplication blockMesh runApplication topoSet -runApplication subsetMesh -overwrite c0 -patch floatingObject +runApplication subsetMesh -overwrite -cellSet c0 -patch floatingObject cp -r 0.org 0 > /dev/null 2>&1 runApplication setFields runApplication $application diff --git a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/snappyHexMeshDict b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/snappyHexMeshDict index 5150850030ac242e598558d58da560e03415393c..48e88d648bd38daff282bbb43c88a35e286ae381 100644 --- a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/snappyHexMeshDict +++ b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/snappyHexMeshDict @@ -210,32 +210,32 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. + // Wanted thickness of final added cell layer. If multiple layers + // is the + // thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.1; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 30; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals