diff --git a/applications/solvers/DNS/dnsFoam/createFields.H b/applications/solvers/DNS/dnsFoam/createFields.H index 6c1bb42929..7584773636 100644 --- a/applications/solvers/DNS/dnsFoam/createFields.H +++ b/applications/solvers/DNS/dnsFoam/createFields.H @@ -1,29 +1,31 @@ - Info<< "Reading field p\n" << endl; - volScalarField p +Info<< "Reading field p\n" << endl; +volScalarField p +( + IOobject ( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "p", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - Info<< "Reading field U\n" << endl; - volVectorField U +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - #include "createPhi.H" +#include "createPhi.H" + +mesh.setFluxRequired(p.name()); diff --git a/applications/solvers/combustion/PDRFoam/createFields.H b/applications/solvers/combustion/PDRFoam/createFields.H index 2af6ecd53f..fb958b3b52 100644 --- a/applications/solvers/combustion/PDRFoam/createFields.H +++ b/applications/solvers/combustion/PDRFoam/createFields.H @@ -1,227 +1,229 @@ - Info<< "Reading thermophysical properties\n" << endl; +Info<< "Reading thermophysical properties\n" << endl; - autoPtr pThermo +autoPtr pThermo +( + psiuReactionThermo::New(mesh) +); +psiuReactionThermo& thermo = pThermo(); +thermo.validate(args.executable(), "ha", "ea"); + +basicMultiComponentMixture& composition = thermo.composition(); + +volScalarField rho +( + IOobject ( - psiuReactionThermo::New(mesh) - ); - psiuReactionThermo& thermo = pThermo(); - thermo.validate(args.executable(), "ha", "ea"); - - basicMultiComponentMixture& composition = thermo.composition(); - - volScalarField rho - ( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - thermo.rho() - ); - - volScalarField& p = thermo.p(); - const volScalarField& psi = thermo.psi(); - - volScalarField& b = composition.Y("b"); - Info<< "min(b) = " << min(b).value() << endl; - - Info<< "\nReading field U\n" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - #include "compressibleCreatePhi.H" - - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence - ( - compressible::RASModel::New - ( - rho, - U, - phi, - thermo - ) - ); - - - 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::AUTO_WRITE + ), + thermo.rho() +); - Info<< "Creating field kinetic energy K\n" << endl; - volScalarField K("K", 0.5*magSqr(U)); +volScalarField& p = thermo.p(); +const volScalarField& psi = thermo.psi(); +volScalarField& b = composition.Y("b"); +Info<< "min(b) = " << min(b).value() << endl; - Info<< "Creating the unstrained laminar flame speed\n" << endl; - autoPtr unstrainedLaminarFlameSpeed +Info<< "\nReading field U\n" << endl; +volVectorField U +( + IOobject ( - laminarFlameSpeed::New(thermo) - ); + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); +#include "compressibleCreatePhi.H" - Info<< "Reading strained laminar flame speed field Su\n" << endl; - volScalarField Su +mesh.setFluxRequired(p.name()); + +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + compressible::RASModel::New ( - IOobject - ( - "Su", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< "Reading field betav\n" << endl; - volScalarField betav - ( - IOobject - ( - "betav", - mesh.facesInstance(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ), - mesh - ); - - Info<< "Reading field Lobs\n" << endl; - volScalarField Lobs - ( - IOobject - ( - "Lobs", - mesh.facesInstance(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ), - mesh - ); - - Info<< "Reading field CT\n" << endl; - volSymmTensorField CT - ( - IOobject - ( - "CT", - mesh.facesInstance(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ), - mesh - ); - - Info<< "Reading field Nv\n" << endl; - volScalarField Nv - ( - IOobject - ( - "Nv", - mesh.facesInstance(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ), - mesh - ); - - Info<< "Reading field nsv\n" << endl; - volSymmTensorField nsv - ( - IOobject - ( - "nsv", - mesh.facesInstance(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ), - mesh - ); - - IOdictionary PDRProperties - ( - IOobject - ( - "PDRProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); - - //- Create the drag model - autoPtr drag = PDRDragModel::New - ( - PDRProperties, - turbulence, rho, U, - phi - ); + phi, + thermo + ) +); - //- Create the flame-wrinkling model - autoPtr flameWrinkling = XiModel::New + +Info<< "Creating field dpdt\n" << endl; +volScalarField dpdt +( + IOobject ( - PDRProperties, - thermo, - turbulence, - Su, - rho, - b, - phi - ); + "dpdt", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) +); - Info<< "Calculating turbulent flame speed field St\n" << endl; - volScalarField St +Info<< "Creating field kinetic energy K\n" << endl; +volScalarField K("K", 0.5*magSqr(U)); + + +Info<< "Creating the unstrained laminar flame speed\n" << endl; +autoPtr unstrainedLaminarFlameSpeed +( + laminarFlameSpeed::New(thermo) +); + + +Info<< "Reading strained laminar flame speed field Su\n" << endl; +volScalarField Su +( + IOobject ( - IOobject - ( - "St", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - flameWrinkling->Xi()*Su - ); + "Su", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +Info<< "Reading field betav\n" << endl; +volScalarField betav +( + IOobject + ( + "betav", + mesh.facesInstance(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh +); + +Info<< "Reading field Lobs\n" << endl; +volScalarField Lobs +( + IOobject + ( + "Lobs", + mesh.facesInstance(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh +); + +Info<< "Reading field CT\n" << endl; +volSymmTensorField CT +( + IOobject + ( + "CT", + mesh.facesInstance(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh +); + +Info<< "Reading field Nv\n" << endl; +volScalarField Nv +( + IOobject + ( + "Nv", + mesh.facesInstance(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh +); + +Info<< "Reading field nsv\n" << endl; +volSymmTensorField nsv +( + IOobject + ( + "nsv", + mesh.facesInstance(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh +); + +IOdictionary PDRProperties +( + IOobject + ( + "PDRProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) +); + +//- Create the drag model +autoPtr drag = PDRDragModel::New +( + PDRProperties, + turbulence, + rho, + U, + phi +); + +//- Create the flame-wrinkling model +autoPtr flameWrinkling = XiModel::New +( + PDRProperties, + thermo, + turbulence, + Su, + rho, + b, + phi +); + +Info<< "Calculating turbulent flame speed field St\n" << endl; +volScalarField St +( + IOobject + ( + "St", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + flameWrinkling->Xi()*Su +); - multivariateSurfaceInterpolationScheme::fieldTable fields; +multivariateSurfaceInterpolationScheme::fieldTable fields; - if (composition.contains("ft")) - { - fields.add(composition.Y("ft")); - } +if (composition.contains("ft")) +{ + fields.add(composition.Y("ft")); +} - fields.add(b); - fields.add(thermo.he()); - fields.add(thermo.heu()); - flameWrinkling->addXi(fields); +fields.add(b); +fields.add(thermo.he()); +fields.add(thermo.heu()); +flameWrinkling->addXi(fields); diff --git a/applications/solvers/combustion/XiFoam/createFields.H b/applications/solvers/combustion/XiFoam/createFields.H index 17103885e5..fa573b9b77 100644 --- a/applications/solvers/combustion/XiFoam/createFields.H +++ b/applications/solvers/combustion/XiFoam/createFields.H @@ -1,140 +1,141 @@ - Info<< "Reading thermophysical properties\n" << endl; +Info<< "Reading thermophysical properties\n" << endl; - autoPtr pThermo +autoPtr pThermo +( + psiuReactionThermo::New(mesh) +); +psiuReactionThermo& thermo = pThermo(); +thermo.validate(args.executable(), "ha", "ea"); + +basicMultiComponentMixture& composition = thermo.composition(); + +volScalarField rho +( + IOobject ( - psiuReactionThermo::New(mesh) - ); - psiuReactionThermo& thermo = pThermo(); - thermo.validate(args.executable(), "ha", "ea"); - - basicMultiComponentMixture& composition = thermo.composition(); - - volScalarField rho - ( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - thermo.rho() - ); - - volScalarField& p = thermo.p(); - const volScalarField& psi = thermo.psi(); - - volScalarField& b = composition.Y("b"); - Info<< "min(b) = " << min(b).value() << endl; - - - Info<< "\nReading field U\n" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - #include "compressibleCreatePhi.H" - - - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence - ( - compressible::turbulenceModel::New - ( - rho, - U, - phi, - thermo - ) - ); - - 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::AUTO_WRITE + ), + thermo.rho() +); - Info<< "Creating field kinetic energy K\n" << endl; - volScalarField K("K", 0.5*magSqr(U)); +volScalarField& p = thermo.p(); +const volScalarField& psi = thermo.psi(); - Info<< "Creating field Xi\n" << endl; - volScalarField Xi +volScalarField& b = composition.Y("b"); +Info<< "min(b) = " << min(b).value() << endl; + + +Info<< "\nReading field U\n" << endl; +volVectorField U +( + IOobject ( - IOobject - ( - "Xi", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "compressibleCreatePhi.H" + +mesh.setFluxRequired(p.name()); + +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) +); + +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)); - Info<< "Creating the unstrained laminar flame speed\n" << endl; - autoPtr unstrainedLaminarFlameSpeed +Info<< "Creating field Xi\n" << endl; +volScalarField Xi +( + IOobject ( - laminarFlameSpeed::New(thermo) - ); + "Xi", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - Info<< "Reading strained laminar flame speed field Su\n" << endl; - volScalarField Su +Info<< "Creating the unstrained laminar flame speed\n" << endl; +autoPtr unstrainedLaminarFlameSpeed +( + laminarFlameSpeed::New(thermo) +); + + +Info<< "Reading strained laminar flame speed field Su\n" << endl; +volScalarField Su +( + IOobject ( - IOobject - ( - "Su", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "Su", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - dimensionedScalar SuMin = 0.01*Su.average(); - dimensionedScalar SuMax = 4*Su.average(); +dimensionedScalar SuMin = 0.01*Su.average(); +dimensionedScalar SuMax = 4*Su.average(); - Info<< "Calculating turbulent flame speed field St\n" << endl; - volScalarField St +Info<< "Calculating turbulent flame speed field St\n" << endl; +volScalarField St +( + IOobject ( - IOobject - ( - "St", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - Xi*Su - ); + "St", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + Xi*Su +); - multivariateSurfaceInterpolationScheme::fieldTable fields; +multivariateSurfaceInterpolationScheme::fieldTable fields; - if (composition.contains("ft")) - { - fields.add(composition.Y("ft")); - } +if (composition.contains("ft")) +{ + fields.add(composition.Y("ft")); +} - fields.add(b); - fields.add(thermo.he()); - fields.add(thermo.heu()); +fields.add(b); +fields.add(thermo.he()); +fields.add(thermo.heu()); diff --git a/applications/solvers/combustion/fireFoam/createFields.H b/applications/solvers/combustion/fireFoam/createFields.H index 72b5e0869b..c5fcc21c90 100644 --- a/applications/solvers/combustion/fireFoam/createFields.H +++ b/applications/solvers/combustion/fireFoam/createFields.H @@ -1,148 +1,150 @@ - Info<< "Creating combustion model\n" << endl; +Info<< "Creating combustion model\n" << endl; - autoPtr combustion +autoPtr combustion +( + combustionModels::psiCombustionModel::New ( - combustionModels::psiCombustionModel::New - ( - mesh - ) - ); - - Info<< "Reading thermophysical properties\n" << endl; - - psiReactionThermo& thermo = combustion->thermo(); - thermo.validate(args.executable(), "h", "e"); - - SLGThermo slgThermo(mesh, thermo); - - basicMultiComponentMixture& composition = thermo.composition(); - PtrList& Y = composition.Y(); - - const word inertSpecie(thermo.lookup("inertSpecie")); - - Info<< "Creating field rho\n" << endl; - volScalarField rho - ( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - thermo.rho() - ); - - volScalarField& p = thermo.p(); - const volScalarField& T = thermo.T(); - const volScalarField& psi = thermo.psi(); - - Info<< "\nReading field U\n" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), mesh - ); + ) +); - #include "compressibleCreatePhi.H" +Info<< "Reading thermophysical properties\n" << endl; - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence +psiReactionThermo& thermo = combustion->thermo(); +thermo.validate(args.executable(), "h", "e"); + +SLGThermo slgThermo(mesh, thermo); + +basicMultiComponentMixture& composition = thermo.composition(); +PtrList& Y = composition.Y(); + +const word inertSpecie(thermo.lookup("inertSpecie")); + +Info<< "Creating field rho\n" << endl; +volScalarField rho +( + IOobject ( - compressible::turbulenceModel::New - ( - rho, - U, - phi, - thermo - ) - ); - - // Set the turbulence into the combustion model - combustion->setTurbulence(turbulence()); - - volScalarField dQ - ( - IOobject - ( - "dQ", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), + "rho", + runTime.timeName(), mesh, - dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) - ); + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + thermo.rho() +); +volScalarField& p = thermo.p(); +const volScalarField& T = thermo.T(); +const volScalarField& psi = thermo.psi(); - Info<< "Creating field dpdt\n" << endl; - volScalarField dpdt +Info<< "\nReading field U\n" << endl; +volVectorField U +( + IOobject ( - IOobject - ( - "dpdt", - runTime.timeName(), - mesh - ), + "U", + runTime.timeName(), mesh, - dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) - ); + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - Info<< "Creating field kinetic energy K\n" << endl; - volScalarField K("K", 0.5*magSqr(U)); +#include "compressibleCreatePhi.H" - - #include "readGravitationalAcceleration.H" - #include "readhRef.H" - #include "gh.H" - - - volScalarField p_rgh +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + compressible::turbulenceModel::New ( - IOobject - ( - "p_rgh", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), + rho, + U, + phi, + thermo + ) +); + +// Set the turbulence into the combustion model +combustion->setTurbulence(turbulence()); + +volScalarField dQ +( + IOobject + ( + "dQ", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) +); + + +Info<< "Creating field dpdt\n" << endl; +volScalarField dpdt +( + IOobject + ( + "dpdt", + runTime.timeName(), mesh - ); + ), + mesh, + dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) +); - // Force p_rgh to be consistent with p - p_rgh = p - rho*gh; +Info<< "Creating field kinetic energy K\n" << endl; +volScalarField K("K", 0.5*magSqr(U)); - multivariateSurfaceInterpolationScheme::fieldTable fields; - forAll(Y, i) - { - fields.add(Y[i]); - } - fields.add(thermo.he()); +#include "readGravitationalAcceleration.H" +#include "readhRef.H" +#include "gh.H" - IOdictionary additionalControlsDict + +volScalarField p_rgh +( + IOobject ( - IOobject - ( - "additionalControls", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); + "p_rgh", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - Switch solvePrimaryRegion +// Force p_rgh to be consistent with p +p_rgh = p - rho*gh; + +mesh.setFluxRequired(p_rgh.name()); + +multivariateSurfaceInterpolationScheme::fieldTable fields; + +forAll(Y, i) +{ + fields.add(Y[i]); +} +fields.add(thermo.he()); + +IOdictionary additionalControlsDict +( + IOobject ( - additionalControlsDict.lookup("solvePrimaryRegion") - ); + "additionalControls", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) +); + +Switch solvePrimaryRegion +( + additionalControlsDict.lookup("solvePrimaryRegion") +); diff --git a/applications/solvers/combustion/reactingFoam/createFields.H b/applications/solvers/combustion/reactingFoam/createFields.H index 32bdd372ee..19c115a8f2 100644 --- a/applications/solvers/combustion/reactingFoam/createFields.H +++ b/applications/solvers/combustion/reactingFoam/createFields.H @@ -45,6 +45,8 @@ const volScalarField& T = thermo.T(); #include "compressibleCreatePhi.H" +mesh.setFluxRequired(p.name()); + Info << "Creating turbulence model.\n" << nl; autoPtr turbulence ( diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H index 5298950425..9caa9effab 100644 --- a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H +++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H @@ -46,6 +46,7 @@ const volScalarField& T = thermo.T(); #include "compressibleCreatePhi.H" +mesh.setFluxRequired(p.name()); Info << "Creating turbulence model.\n" << nl; autoPtr turbulence diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H index e99639e189..32dc5f0483 100644 --- a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H +++ b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H @@ -43,9 +43,10 @@ volScalarField& p = thermo.p(); const volScalarField& psi = thermo.psi(); const volScalarField& T = thermo.T(); - #include "compressibleCreatePhi.H" +mesh.setFluxRequired(p.name()); + Info << "Creating turbulence model.\n" << nl; autoPtr turbulence diff --git a/applications/solvers/compressible/rhoPimpleFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/createFields.H index fc82f631d0..0e214011de 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoPimpleFoam/createFields.H @@ -1,90 +1,92 @@ - Info<< "Reading thermophysical properties\n" << endl; +Info<< "Reading thermophysical properties\n" << endl; - autoPtr pThermo +autoPtr pThermo +( + psiThermo::New(mesh) +); +psiThermo& thermo = pThermo(); +thermo.validate(args.executable(), "h", "e"); + +volScalarField& p = thermo.p(); +const volScalarField& psi = thermo.psi(); + +volScalarField rho +( + IOobject ( - psiThermo::New(mesh) - ); - psiThermo& thermo = pThermo(); - thermo.validate(args.executable(), "h", "e"); - - volScalarField& p = thermo.p(); - const volScalarField& psi = thermo.psi(); - - volScalarField rho - ( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - thermo.rho() - ); - - Info<< "Reading field U\n" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - #include "compressibleCreatePhi.H" - - dimensionedScalar rhoMax - ( - dimensionedScalar::lookupOrDefault - ( - "rhoMax", - pimple.dict(), - GREAT, - dimDensity - ) - ); - - dimensionedScalar rhoMin - ( - dimensionedScalar::lookupOrDefault - ( - "rhoMin", - pimple.dict(), - 0, - dimDensity - ) - ); - - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence - ( - compressible::turbulenceModel::New - ( - rho, - U, - phi, - thermo - ) - ); - - Info<< "Creating field dpdt\n" << endl; - volScalarField dpdt - ( - IOobject - ( - "dpdt", - runTime.timeName(), - mesh - ), + "rho", + runTime.timeName(), mesh, - dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) - ); + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + thermo.rho() +); - Info<< "Creating field kinetic energy K\n" << endl; - volScalarField K("K", 0.5*magSqr(U)); +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "compressibleCreatePhi.H" + +dimensionedScalar rhoMax +( + dimensionedScalar::lookupOrDefault + ( + "rhoMax", + pimple.dict(), + GREAT, + dimDensity + ) +); + +dimensionedScalar rhoMin +( + dimensionedScalar::lookupOrDefault + ( + "rhoMin", + pimple.dict(), + 0, + dimDensity + ) +); + +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) +); + +mesh.setFluxRequired(p.name()); + +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)); diff --git a/applications/solvers/compressible/rhoSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/createFields.H index fd303612c6..2d89e2b566 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoSimpleFoam/createFields.H @@ -1,81 +1,83 @@ - Info<< "Reading thermophysical properties\n" << endl; +Info<< "Reading thermophysical properties\n" << endl; - autoPtr pThermo +autoPtr pThermo +( + psiThermo::New(mesh) +); +psiThermo& thermo = pThermo(); +thermo.validate(args.executable(), "h", "e"); + +volScalarField rho +( + IOobject ( - psiThermo::New(mesh) - ); - psiThermo& thermo = pThermo(); - thermo.validate(args.executable(), "h", "e"); + "rho", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + thermo.rho() +); - volScalarField rho +volScalarField& p = thermo.p(); +const volScalarField& psi = thermo.psi(); + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject ( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - thermo.rho() - ); + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - volScalarField& p = thermo.p(); - const volScalarField& psi = thermo.psi(); +#include "compressibleCreatePhi.H" - Info<< "Reading field U\n" << endl; - volVectorField U + +label pRefCell = 0; +scalar pRefValue = 0.0; +setRefCell(p, simple.dict(), pRefCell, pRefValue); + +mesh.setFluxRequired(p.name()); + +dimensionedScalar rhoMax +( + dimensionedScalar::lookupOrDefault ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "rhoMax", + simple.dict(), + GREAT, + dimDensity + ) +); - #include "compressibleCreatePhi.H" - - - label pRefCell = 0; - scalar pRefValue = 0.0; - setRefCell(p, simple.dict(), pRefCell, pRefValue); - - dimensionedScalar rhoMax +dimensionedScalar rhoMin +( + dimensionedScalar::lookupOrDefault ( - dimensionedScalar::lookupOrDefault - ( - "rhoMax", - simple.dict(), - GREAT, - dimDensity - ) - ); + "rhoMin", + simple.dict(), + 0, + dimDensity + ) +); - dimensionedScalar rhoMin +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + compressible::RASModel::New ( - dimensionedScalar::lookupOrDefault - ( - "rhoMin", - simple.dict(), - 0, - dimDensity - ) - ); + rho, + U, + phi, + thermo + ) +); - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence - ( - compressible::RASModel::New - ( - rho, - U, - phi, - thermo - ) - ); - - dimensionedScalar initialMass = fvc::domainIntegrate(rho); +dimensionedScalar initialMass = fvc::domainIntegrate(rho); diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createFields.H index ced5e478bf..3ce8270b5e 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createFields.H @@ -1,80 +1,82 @@ - Info<< "Reading thermophysical properties\n" << endl; +Info<< "Reading thermophysical properties\n" << endl; - autoPtr pThermo +autoPtr pThermo +( + rhoThermo::New(mesh) +); +rhoThermo& thermo = pThermo(); +thermo.validate(args.executable(), "h", "e"); + +volScalarField rho +( + IOobject ( - rhoThermo::New(mesh) - ); - rhoThermo& thermo = pThermo(); - thermo.validate(args.executable(), "h", "e"); + "rho", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + thermo.rho() +); - volScalarField rho +volScalarField& p = thermo.p(); + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject ( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - thermo.rho() - ); + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - volScalarField& p = thermo.p(); +#include "compressibleCreatePhi.H" - Info<< "Reading field U\n" << endl; - volVectorField U + +label pRefCell = 0; +scalar pRefValue = 0.0; +setRefCell(p, simple.dict(), pRefCell, pRefValue); + +mesh.setFluxRequired(p.name()); + +dimensionedScalar rhoMax +( + dimensionedScalar::lookupOrDefault ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "rhoMax", + simple.dict(), + GREAT, + dimDensity + ) +); - #include "compressibleCreatePhi.H" - - - label pRefCell = 0; - scalar pRefValue = 0.0; - setRefCell(p, simple.dict(), pRefCell, pRefValue); - - dimensionedScalar rhoMax +dimensionedScalar rhoMin +( + dimensionedScalar::lookupOrDefault ( - dimensionedScalar::lookupOrDefault - ( - "rhoMax", - simple.dict(), - GREAT, - dimDensity - ) - ); + "rhoMin", + simple.dict(), + 0, + dimDensity + ) +); - dimensionedScalar rhoMin +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + compressible::RASModel::New ( - dimensionedScalar::lookupOrDefault - ( - "rhoMin", - simple.dict(), - 0, - dimDensity - ) - ); + rho, + U, + phi, + thermo + ) +); - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence - ( - compressible::RASModel::New - ( - rho, - U, - phi, - thermo - ) - ); - - dimensionedScalar initialMass = fvc::domainIntegrate(rho); +dimensionedScalar initialMass = fvc::domainIntegrate(rho); diff --git a/applications/solvers/compressible/sonicFoam/createFields.H b/applications/solvers/compressible/sonicFoam/createFields.H index c3421369e7..ad4b4a3019 100644 --- a/applications/solvers/compressible/sonicFoam/createFields.H +++ b/applications/solvers/compressible/sonicFoam/createFields.H @@ -1,55 +1,56 @@ - Info<< "Reading thermophysical properties\n" << endl; +Info<< "Reading thermophysical properties\n" << endl; - autoPtr pThermo +autoPtr pThermo +( + psiThermo::New(mesh) +); +psiThermo& thermo = pThermo(); +thermo.validate(args.executable(), "e"); + +volScalarField& p = thermo.p(); +volScalarField& e = thermo.he(); +const volScalarField& psi = thermo.psi(); + +volScalarField rho +( + IOobject ( - psiThermo::New(mesh) - ); - psiThermo& thermo = pThermo(); - thermo.validate(args.executable(), "e"); - - volScalarField& p = thermo.p(); - volScalarField& e = thermo.he(); - const volScalarField& psi = thermo.psi(); - - volScalarField rho - ( - IOobject - ( - "rho", - runTime.timeName(), - mesh - ), - thermo.rho() - ); - - Info<< "Reading field U\n" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), + "rho", + runTime.timeName(), mesh - ); + ), + thermo.rho() +); - #include "compressibleCreatePhi.H" - - - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject ( - compressible::turbulenceModel::New - ( - rho, - U, - phi, - thermo - ) - ); + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - Info<< "Creating field kinetic energy K\n" << endl; - volScalarField K("K", 0.5*magSqr(U)); +#include "compressibleCreatePhi.H" + +mesh.setFluxRequired(p.name()); + +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) +); + +Info<< "Creating field kinetic energy K\n" << endl; +volScalarField K("K", 0.5*magSqr(U)); diff --git a/applications/solvers/compressible/sonicFoam/sonicLiquidFoam/createFields.H b/applications/solvers/compressible/sonicFoam/sonicLiquidFoam/createFields.H index 1268cbb7b0..54f26a90c0 100644 --- a/applications/solvers/compressible/sonicFoam/sonicLiquidFoam/createFields.H +++ b/applications/solvers/compressible/sonicFoam/sonicLiquidFoam/createFields.H @@ -1,44 +1,46 @@ - Info<< "Reading field p\n" << endl; - volScalarField p +Info<< "Reading field p\n" << endl; +volScalarField p +( + IOobject ( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "p", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - Info<< "Reading field U\n" << endl; - volVectorField U +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - volScalarField rho +volScalarField rho +( + IOobject ( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - rhoO + psi*p - ); + "rho", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + rhoO + psi*p +); - #include "compressibleCreatePhi.H" +#include "compressibleCreatePhi.H" + +mesh.setFluxRequired(p.name()); diff --git a/applications/solvers/electromagnetics/mhdFoam/createFields.H b/applications/solvers/electromagnetics/mhdFoam/createFields.H index a514f11416..528bcd1b54 100644 --- a/applications/solvers/electromagnetics/mhdFoam/createFields.H +++ b/applications/solvers/electromagnetics/mhdFoam/createFields.H @@ -1,107 +1,110 @@ - Info<< "Reading transportProperties\n" << endl; +Info<< "Reading transportProperties\n" << endl; - IOdictionary transportProperties +IOdictionary transportProperties +( + IOobject ( - IOobject - ( - "transportProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); + "transportProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) +); - dimensionedScalar rho +dimensionedScalar rho +( + transportProperties.lookup("rho") +); + +dimensionedScalar nu +( + transportProperties.lookup("nu") +); + +dimensionedScalar mu +( + transportProperties.lookup("mu") +); + +dimensionedScalar sigma +( + transportProperties.lookup("sigma") +); + +Info<< "Reading field p\n" << endl; +volScalarField p +( + IOobject ( - transportProperties.lookup("rho") - ); + "p", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - dimensionedScalar nu + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject ( - transportProperties.lookup("nu") - ); + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - dimensionedScalar mu +#include "createPhi.H" + +Info<< "Reading field pB\n" << endl; +volScalarField pB +( + IOobject ( - transportProperties.lookup("mu") - ); + "pB", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - dimensionedScalar sigma + +Info<< "Reading field B\n" << endl; +volVectorField B +( + IOobject ( - transportProperties.lookup("sigma") - ); - - Info<< "Reading field p\n" << endl; - volScalarField p - ( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "B", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - Info<< "Reading field U\n" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); +#include "createPhiB.H" - #include "createPhi.H" +dimensionedScalar DB = 1.0/(mu*sigma); +DB.name() = "DB"; - Info<< "Reading field pB\n" << endl; - volScalarField pB - ( - IOobject - ( - "pB", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); +dimensionedScalar DBU = 1.0/(2.0*mu*rho); +DBU.name() = "DBU"; - Info<< "Reading field B\n" << endl; - volVectorField B - ( - IOobject - ( - "B", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); +label pRefCell = 0; +scalar pRefValue = 0.0; +setRefCell(p, piso.dict(), pRefCell, pRefValue); - - #include "createPhiB.H" - - dimensionedScalar DB = 1.0/(mu*sigma); - DB.name() = "DB"; - - dimensionedScalar DBU = 1.0/(2.0*mu*rho); - DBU.name() = "DBU"; - - - label pRefCell = 0; - scalar pRefValue = 0.0; - setRefCell(p, piso.dict(), pRefCell, pRefValue); +mesh.setFluxRequired(p.name()); +mesh.setFluxRequired(pB.name()); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H index 0f554ef78d..f98c472e11 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H @@ -1,120 +1,122 @@ - Info<< "Reading thermophysical properties\n" << endl; +Info<< "Reading thermophysical properties\n" << endl; - Info<< "Reading field T\n" << endl; - volScalarField T +Info<< "Reading field T\n" << endl; +volScalarField T +( + IOobject ( - IOobject - ( - "T", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), + "T", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +Info<< "Reading field p_rgh\n" << endl; +volScalarField p_rgh +( + IOobject + ( + "p_rgh", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "createPhi.H" + +#include "readTransportProperties.H" + +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + incompressible::RASModel::New(U, phi, laminarTransport) +); + +// Kinematic density for buoyancy force +volScalarField rhok +( + IOobject + ( + "rhok", + runTime.timeName(), mesh - ); + ), + 1.0 - beta*(T - TRef) +); - Info<< "Reading field p_rgh\n" << endl; - volScalarField p_rgh +// kinematic turbulent thermal thermal conductivity m2/s +Info<< "Reading field alphat\n" << endl; +volScalarField alphat +( + IOobject ( - IOobject - ( - "p_rgh", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "alphat", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - Info<< "Reading field U\n" << endl; - volVectorField U + +#include "readGravitationalAcceleration.H" +#include "readhRef.H" +#include "gh.H" + + +volScalarField p +( + IOobject ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "p", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + p_rgh + rhok*gh +); - #include "createPhi.H" +label pRefCell = 0; +scalar pRefValue = 0.0; +setRefCell +( + p, + p_rgh, + pimple.dict(), + pRefCell, + pRefValue +); - #include "readTransportProperties.H" - - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence +if (p_rgh.needReference()) +{ + p += dimensionedScalar ( - incompressible::RASModel::New(U, phi, laminarTransport) + "p", + p.dimensions(), + pRefValue - getRefCellValue(p, pRefCell) ); +} - // Kinematic density for buoyancy force - volScalarField rhok - ( - IOobject - ( - "rhok", - runTime.timeName(), - mesh - ), - 1.0 - beta*(T - TRef) - ); - - // kinematic turbulent thermal thermal conductivity m2/s - Info<< "Reading field alphat\n" << endl; - volScalarField alphat - ( - IOobject - ( - "alphat", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - - #include "readGravitationalAcceleration.H" - #include "readhRef.H" - #include "gh.H" - - - volScalarField p - ( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - p_rgh + rhok*gh - ); - - label pRefCell = 0; - scalar pRefValue = 0.0; - setRefCell - ( - p, - p_rgh, - pimple.dict(), - pRefCell, - pRefValue - ); - - if (p_rgh.needReference()) - { - p += dimensionedScalar - ( - "p", - p.dimensions(), - pRefValue - getRefCellValue(p, pRefCell) - ); - } +mesh.setFluxRequired(p_rgh.name()); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H index c54cebc9f4..17306f7d46 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H @@ -1,120 +1,122 @@ - Info<< "Reading thermophysical properties\n" << endl; +Info<< "Reading thermophysical properties\n" << endl; - Info<< "Reading field T\n" << endl; - volScalarField T +Info<< "Reading field T\n" << endl; +volScalarField T +( + IOobject ( - IOobject - ( - "T", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), + "T", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +Info<< "Reading field p_rgh\n" << endl; +volScalarField p_rgh +( + IOobject + ( + "p_rgh", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "createPhi.H" + +#include "readTransportProperties.H" + +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + incompressible::RASModel::New(U, phi, laminarTransport) +); + +// Kinematic density for buoyancy force +volScalarField rhok +( + IOobject + ( + "rhok", + runTime.timeName(), mesh - ); + ), + 1.0 - beta*(T - TRef) +); - Info<< "Reading field p_rgh\n" << endl; - volScalarField p_rgh +// kinematic turbulent thermal thermal conductivity m2/s +Info<< "Reading field alphat\n" << endl; +volScalarField alphat +( + IOobject ( - IOobject - ( - "p_rgh", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "alphat", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - Info<< "Reading field U\n" << endl; - volVectorField U + +#include "readGravitationalAcceleration.H" +#include "readhRef.H" +#include "gh.H" + + +volScalarField p +( + IOobject ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "p", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + p_rgh + rhok*gh +); - #include "createPhi.H" +label pRefCell = 0; +scalar pRefValue = 0.0; +setRefCell +( + p, + p_rgh, + simple.dict(), + pRefCell, + pRefValue +); - #include "readTransportProperties.H" - - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence +if (p_rgh.needReference()) +{ + p += dimensionedScalar ( - incompressible::RASModel::New(U, phi, laminarTransport) + "p", + p.dimensions(), + pRefValue - getRefCellValue(p, pRefCell) ); +} - // Kinematic density for buoyancy force - volScalarField rhok - ( - IOobject - ( - "rhok", - runTime.timeName(), - mesh - ), - 1.0 - beta*(T - TRef) - ); - - // kinematic turbulent thermal thermal conductivity m2/s - Info<< "Reading field alphat\n" << endl; - volScalarField alphat - ( - IOobject - ( - "alphat", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - - #include "readGravitationalAcceleration.H" - #include "readhRef.H" - #include "gh.H" - - - volScalarField p - ( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - p_rgh + rhok*gh - ); - - label pRefCell = 0; - scalar pRefValue = 0.0; - setRefCell - ( - p, - p_rgh, - simple.dict(), - pRefCell, - pRefValue - ); - - if (p_rgh.needReference()) - { - p += dimensionedScalar - ( - "p", - p.dimensions(), - pRefValue - getRefCellValue(p, pRefCell) - ); - } +mesh.setFluxRequired(p_rgh.name()); diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H index eaa078c6ad..977fb1542a 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H @@ -1,88 +1,90 @@ - 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(); - const volScalarField& psi = thermo.psi(); - - - Info<< "Reading field U\n" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - #include "compressibleCreatePhi.H" - - - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence - ( - compressible::turbulenceModel::New - ( - rho, - U, - phi, - thermo - ) - ); - - Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("ghf", g & mesh.Cf()); - - Info<< "Reading field p_rgh\n" << endl; - volScalarField p_rgh - ( - IOobject - ( - "p_rgh", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - // Force p_rgh to be consistent with p - p_rgh = p - rho*gh; - - 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(); +const volScalarField& psi = thermo.psi(); + + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "compressibleCreatePhi.H" + + +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) +); + +Info<< "Calculating field g.h\n" << endl; +volScalarField gh("gh", g & mesh.C()); +surfaceScalarField ghf("ghf", g & mesh.Cf()); + +Info<< "Reading field p_rgh\n" << endl; +volScalarField p_rgh +( + IOobject + ( + "p_rgh", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +// Force p_rgh to be consistent with p +p_rgh = p - rho*gh; + +mesh.setFluxRequired(p_rgh.name()); + +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)); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H index f60eb1481c..5b07f643b1 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H @@ -1,86 +1,87 @@ - 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() - ); + "rho", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + thermo.rho() +); - volScalarField& p = thermo.p(); - const volScalarField& psi = thermo.psi(); +volScalarField& p = thermo.p(); +const volScalarField& psi = thermo.psi(); - Info<< "Reading field U\n" << endl; - volVectorField U +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - #include "compressibleCreatePhi.H" +#include "compressibleCreatePhi.H" - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + compressible::RASModel::New ( - compressible::RASModel::New - ( - rho, - U, - phi, - thermo - ) - ); + rho, + U, + phi, + thermo + ) +); - Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("ghf", g & mesh.Cf()); +Info<< "Calculating field g.h\n" << endl; +volScalarField gh("gh", g & mesh.C()); +surfaceScalarField ghf("ghf", g & mesh.Cf()); - Info<< "Reading field p_rgh\n" << endl; - volScalarField p_rgh +Info<< "Reading field p_rgh\n" << endl; +volScalarField p_rgh +( + IOobject ( - IOobject - ( - "p_rgh", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + "p_rgh", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); - // Force p_rgh to be consistent with p - p_rgh = p - rho*gh; +// Force p_rgh to be consistent with p +p_rgh = p - rho*gh; +label pRefCell = 0; +scalar pRefValue = 0.0; +setRefCell +( + p, + p_rgh, + simple.dict(), + pRefCell, + pRefValue +); - label pRefCell = 0; - scalar pRefValue = 0.0; - setRefCell - ( - p, - p_rgh, - simple.dict(), - pRefCell, - pRefValue - ); +mesh.setFluxRequired(p_rgh.name()); - dimensionedScalar initialMass = fvc::domainIntegrate(rho); - dimensionedScalar totalVolume = sum(mesh.V()); +dimensionedScalar initialMass = fvc::domainIntegrate(rho); +dimensionedScalar totalVolume = sum(mesh.V()); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H index f41f8f97e3..bd7452ae9e 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H @@ -1,222 +1,224 @@ - // Initialise fluid field pointer lists - PtrList thermoFluid(fluidRegions.size()); - PtrList rhoFluid(fluidRegions.size()); - PtrList UFluid(fluidRegions.size()); - PtrList phiFluid(fluidRegions.size()); - PtrList gFluid(fluidRegions.size()); - PtrList turbulence(fluidRegions.size()); - PtrList p_rghFluid(fluidRegions.size()); - PtrList ghFluid(fluidRegions.size()); - PtrList ghfFluid(fluidRegions.size()); - PtrList radiation(fluidRegions.size()); +// Initialise fluid field pointer lists +PtrList thermoFluid(fluidRegions.size()); +PtrList rhoFluid(fluidRegions.size()); +PtrList UFluid(fluidRegions.size()); +PtrList phiFluid(fluidRegions.size()); +PtrList gFluid(fluidRegions.size()); +PtrList turbulence(fluidRegions.size()); +PtrList p_rghFluid(fluidRegions.size()); +PtrList ghFluid(fluidRegions.size()); +PtrList ghfFluid(fluidRegions.size()); +PtrList radiation(fluidRegions.size()); - List initialMassFluid(fluidRegions.size()); - List