From 98f69d417f3bb418c2c8dbb568279b20eaf6dea7 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 9 May 2016 16:28:48 +0100 Subject: [PATCH] applications/solvers/heatTransfer: Added -postProcess option See also commit cc455173ffc914470a830c46ae51fabbba8dfdb0 --- .../buoyantBoussinesqPimpleFoam/Make/options | 1 + .../buoyantBoussinesqPimpleFoam.C | 9 +- .../createFields.H | 1 + .../buoyantBoussinesqSimpleFoam.C | 7 +- .../createFields.H | 1 + .../buoyantPimpleFoam/buoyantPimpleFoam.C | 8 +- .../buoyantPimpleFoam/createFieldRefs.H | 1 + .../buoyantPimpleFoam/createFields.H | 3 +- .../buoyantSimpleFoam/buoyantSimpleFoam.C | 8 +- .../buoyantSimpleFoam/createFieldRefs.H | 1 + .../buoyantSimpleFoam/createFields.H | 2 +- .../chtMultiRegionFoam/Make/options | 1 + .../chtMultiRegionFoam/chtMultiRegionFoam.C | 17 ++- .../chtMultiRegionSimpleFoam/Make/options | 2 + .../chtMultiRegionSimpleFoam.C | 15 ++- .../chtMultiRegionFoam/createFields.H | 2 + .../chtMultiRegionFoam/createMeshes.H | 4 + .../createMeshesPostProcess.H | 2 + .../heatTransfer/thermoFoam/createFields.H | 100 +++++++++--------- .../heatTransfer/thermoFoam/setAlphaEff.H | 82 +++++++------- .../heatTransfer/thermoFoam/thermoFoam.C | 9 +- 21 files changed, 142 insertions(+), 134 deletions(-) create mode 100644 applications/solvers/heatTransfer/buoyantPimpleFoam/createFieldRefs.H create mode 100644 applications/solvers/heatTransfer/buoyantSimpleFoam/createFieldRefs.H create mode 100644 applications/solvers/heatTransfer/chtMultiRegionFoam/createFields.H create mode 100644 applications/solvers/heatTransfer/chtMultiRegionFoam/createMeshes.H create mode 100644 applications/solvers/heatTransfer/chtMultiRegionFoam/createMeshesPostProcess.H diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options index c14a8799f6..043be5d13c 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I. \ -I../buoyantBoussinesqSimpleFoam \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C index d522323fd3..e082648b75 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C @@ -56,19 +56,18 @@ Description int main(int argc, char *argv[]) { + #include "postProcess.H" + #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - - pimpleControl pimple(mesh); - + #include "createControl.H" #include "createFields.H" - #include "createIncompressibleRadiationModel.H" #include "createFvOptions.H" - #include "initContinuityErrs.H" #include "createTimeControls.H" #include "CourantNo.H" #include "setInitialDeltaT.H" + #include "initContinuityErrs.H" turbulence->validate(); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H index cc2c5f0b4c..def60953c4 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H @@ -122,3 +122,4 @@ if (p_rgh.needReference()) mesh.setFluxRequired(p_rgh.name()); #include "createMRF.H" +#include "createIncompressibleRadiationModel.H" diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C index 6c4955dfbf..de844ad96e 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C @@ -56,14 +56,13 @@ Description int main(int argc, char *argv[]) { + #include "postProcess.H" + #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - - simpleControl simple(mesh); - + #include "createControl.H" #include "createFields.H" - #include "createIncompressibleRadiationModel.H" #include "createFvOptions.H" #include "initContinuityErrs.H" diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H index 583cbaf2d5..043440763f 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H @@ -122,3 +122,4 @@ if (p_rgh.needReference()) mesh.setFluxRequired(p_rgh.name()); #include "createMRF.H" +#include "createIncompressibleRadiationModel.H" diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C index 56ebdc5c8b..d960e053d8 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C @@ -44,15 +44,15 @@ Description int main(int argc, char *argv[]) { + #include "postProcess.H" + #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - - pimpleControl pimple(mesh); - + #include "createControl.H" #include "createFields.H" + #include "createFieldRefs.H" #include "createFvOptions.H" - #include "createRadiationModel.H" #include "initContinuityErrs.H" #include "createTimeControls.H" #include "compressibleCourantNo.H" diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFieldRefs.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFieldRefs.H new file mode 100644 index 0000000000..502b3b4230 --- /dev/null +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFieldRefs.H @@ -0,0 +1 @@ +const volScalarField& psi = thermo.psi(); diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H index b3c45fcaaf..ff835c8a79 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H @@ -18,8 +18,6 @@ volScalarField rho ); volScalarField& p = thermo.p(); -const volScalarField& psi = thermo.psi(); - Info<< "Reading field U\n" << endl; volVectorField U @@ -92,3 +90,4 @@ Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); #include "createMRF.H" +#include "createRadiationModel.H" diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C index cb4d67a0c2..e9add9cd02 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C @@ -41,15 +41,15 @@ Description int main(int argc, char *argv[]) { + #include "postProcess.H" + #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - - simpleControl simple(mesh); - + #include "createControl.H" #include "createFields.H" + #include "createFieldRefs.H" #include "createFvOptions.H" - #include "createRadiationModel.H" #include "initContinuityErrs.H" turbulence->validate(); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFieldRefs.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFieldRefs.H new file mode 100644 index 0000000000..502b3b4230 --- /dev/null +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFieldRefs.H @@ -0,0 +1 @@ +const volScalarField& psi = thermo.psi(); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H index ca107c0928..b9f275407f 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H @@ -18,7 +18,6 @@ volScalarField rho ); volScalarField& p = thermo.p(); -const volScalarField& psi = thermo.psi(); Info<< "Reading field U\n" << endl; volVectorField U @@ -88,3 +87,4 @@ dimensionedScalar initialMass = fvc::domainIntegrate(rho); dimensionedScalar totalVolume = sum(mesh.V()); #include "createMRF.H" +#include "createRadiationModel.H" diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options index 2b6f5e7e70..fd53d162e6 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ + -I. \ -I./fluid \ -I./solid \ -I./porousFluid \ diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C index 1ad39c9d08..7a396ee389 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C @@ -50,22 +50,17 @@ Description int main(int argc, char *argv[]) { + #define NO_CONTROL + #define CREATE_MESH createMeshesPostProcess.H + #include "postProcess.H" + #include "setRootCase.H" #include "createTime.H" - - regionProperties rp(runTime); - - #include "createFluidMeshes.H" - #include "createSolidMeshes.H" - - #include "createFluidFields.H" - #include "createSolidFields.H" - + #include "createMeshes.H" + #include "createFields.H" #include "initContinuityErrs.H" #include "createTimeControls.H" #include "readSolidTimeControls.H" - - #include "compressibleMultiRegionCourantNo.H" #include "solidRegionDiffusionNo.H" #include "setInitialMultiRegionDeltaT.H" diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options index 252ecae022..78fc5be02c 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options @@ -1,4 +1,6 @@ EXE_INC = \ + -I. \ + -I.. \ -Ifluid \ -Isolid \ -I../solid \ diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C index 6b4811a026..9992f8f705 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C @@ -43,17 +43,14 @@ Description int main(int argc, char *argv[]) { + #define NO_CONTROL + #define CREATE_MESH createMeshesPostProcess.H + #include "postProcess.H" + #include "setRootCase.H" #include "createTime.H" - - regionProperties rp(runTime); - - #include "createFluidMeshes.H" - #include "createSolidMeshes.H" - - #include "createFluidFields.H" - #include "createSolidFields.H" - + #include "createMeshes.H" + #include "createFields.H" #include "initContinuityErrs.H" diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/createFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/createFields.H new file mode 100644 index 0000000000..30f4452304 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/createFields.H @@ -0,0 +1,2 @@ +#include "createFluidFields.H" +#include "createSolidFields.H" diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/createMeshes.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/createMeshes.H new file mode 100644 index 0000000000..97aed21778 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/createMeshes.H @@ -0,0 +1,4 @@ +regionProperties rp(runTime); + +#include "createFluidMeshes.H" +#include "createSolidMeshes.H" diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/createMeshesPostProcess.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/createMeshesPostProcess.H new file mode 100644 index 0000000000..61d94eb5c8 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/createMeshesPostProcess.H @@ -0,0 +1,2 @@ +#include "createMeshes.H" +fvMesh& mesh = fluidRegions[0]; diff --git a/applications/solvers/heatTransfer/thermoFoam/createFields.H b/applications/solvers/heatTransfer/thermoFoam/createFields.H index ffa6c3f3b5..3a217895f6 100644 --- a/applications/solvers/heatTransfer/thermoFoam/createFields.H +++ b/applications/solvers/heatTransfer/thermoFoam/createFields.H @@ -1,54 +1,56 @@ - Info<< "Reading thermophysical properties\n" << endl; +Info<< "Reading thermophysical properties\n" << endl; - autoPtr pThermo(rhoThermo::New(mesh)); - rhoThermo& thermo = pThermo(); - thermo.validate(args.executable(), "h", "e"); +autoPtr pThermo(rhoThermo::New(mesh)); +rhoThermo& thermo = pThermo(); +thermo.validate(args.executable(), "h", "e"); - volScalarField rho +volScalarField rho +( + IOobject ( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - thermo.rho() - ); - - volScalarField& p = thermo.p(); - - Info<< "Reading field U\n" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - #include "compressibleCreatePhi.H" - - #include "setAlphaEff.H" - - Info<< "Creating field dpdt\n" << endl; - volScalarField dpdt - ( - IOobject - ( - "dpdt", - runTime.timeName(), - mesh - ), + "rho", + runTime.timeName(), mesh, - dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) - ); + IOobject::NO_READ, + IOobject::NO_WRITE + ), + thermo.rho() +); - Info<< "Creating field kinetic energy K\n" << endl; - volScalarField K("K", 0.5*magSqr(U)); +volScalarField& p = thermo.p(); + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "compressibleCreatePhi.H" + +#include "setAlphaEff.H" + +Info<< "Creating field dpdt\n" << endl; +volScalarField dpdt +( + IOobject + ( + "dpdt", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) +); + +Info<< "Creating field kinetic energy K\n" << endl; +volScalarField K("K", 0.5*magSqr(U)); + +#include "createRadiationModel.H" diff --git a/applications/solvers/heatTransfer/thermoFoam/setAlphaEff.H b/applications/solvers/heatTransfer/thermoFoam/setAlphaEff.H index fff960526f..73a157fc12 100644 --- a/applications/solvers/heatTransfer/thermoFoam/setAlphaEff.H +++ b/applications/solvers/heatTransfer/thermoFoam/setAlphaEff.H @@ -1,49 +1,47 @@ - Info<< "Creating turbulence model\n" << endl; - tmp talphaEff; +Info<< "Creating turbulence model\n" << endl; +tmp talphaEff; - IOobject turbulencePropertiesHeader +IOobject turbulencePropertiesHeader +( + "turbulenceProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false +); + +if (turbulencePropertiesHeader.headerOk()) +{ + autoPtr turbulence ( - "turbulenceProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) ); - if (turbulencePropertiesHeader.headerOk()) - { - autoPtr turbulence + talphaEff = turbulence->alphaEff(); +} +else +{ + talphaEff = tmp + ( + new volScalarField ( - compressible::turbulenceModel::New + IOobject ( - rho, - U, - phi, - thermo - ) - ); - - talphaEff = turbulence->alphaEff(); - } - else - { - talphaEff = tmp - ( - new volScalarField - ( - IOobject - ( - "alphaEff", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "alphaEff", + runTime.timeName(), mesh, - dimensionedScalar("0", dimMass/dimLength/dimTime, 0.0) - ) - ); - } - - const volScalarField& alphaEff = talphaEff(); + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimMass/dimLength/dimTime, 0.0) + ) + ); +} diff --git a/applications/solvers/heatTransfer/thermoFoam/thermoFoam.C b/applications/solvers/heatTransfer/thermoFoam/thermoFoam.C index a3687213df..5770912322 100644 --- a/applications/solvers/heatTransfer/thermoFoam/thermoFoam.C +++ b/applications/solvers/heatTransfer/thermoFoam/thermoFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,13 +43,16 @@ Description int main(int argc, char *argv[]) { - #include "setRootCase.H" + #define NO_CONTROL + #include "postProcess.H" + #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createFields.H" #include "createFvOptions.H" - #include "createRadiationModel.H" + + const volScalarField& alphaEff = talphaEff(); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //