heatTransfer solvers: Added optional pressure reference

Added optional pressure reference pRef to p_rgh in buoyantPimpleFoam,
buoyantSimpleFoam and chtMultiRegionFoam which handles cases in which the
pressure variation is small compared to the pressure level more accurately.

The pRef value is provided in the optional constant/pRef file.

All tutorials and templates have been updated to use pRef as appropriate.
This commit is contained in:
Henry Weller
2020-07-03 15:41:58 +01:00
parent 1611e0dbfb
commit 2f30c1364b
34 changed files with 328 additions and 68 deletions

View File

@ -62,6 +62,7 @@ autoPtr<fluidThermophysicalTransportModel> thermophysicalTransport
#include "readGravitationalAcceleration.H" #include "readGravitationalAcceleration.H"
#include "readhRef.H" #include "readhRef.H"
#include "gh.H" #include "gh.H"
#include "readpRef.H"
Info<< "Reading field p_rgh\n" << endl; Info<< "Reading field p_rgh\n" << endl;
@ -79,7 +80,7 @@ volScalarField p_rgh
); );
// Force p_rgh to be consistent with p // Force p_rgh to be consistent with p
p_rgh = p - rho*gh; p_rgh = p - rho*gh - pRef;
pressureControl pressureControl pressureControl pressureControl
( (

View File

@ -103,7 +103,7 @@ else
phi = phiHbyA + p_rghEqn.flux(); phi = phiHbyA + p_rghEqn.flux();
p = p_rgh + rho*gh; p = p_rgh + rho*gh + pRef;
if (mesh.steady()) if (mesh.steady())
{ {
@ -146,7 +146,7 @@ if (adjustMass && !thermo.incompressible())
{ {
p += (initialMass - fvc::domainIntegrate(thermo.rho())) p += (initialMass - fvc::domainIntegrate(thermo.rho()))
/fvc::domainIntegrate(psi); /fvc::domainIntegrate(psi);
p_rgh = p - rho*gh; p_rgh = p - rho*gh - pRef;
p.correctBoundaryConditions(); p.correctBoundaryConditions();
} }

View File

@ -57,6 +57,7 @@ autoPtr<fluidThermophysicalTransportModel> thermophysicalTransport
#include "readGravitationalAcceleration.H" #include "readGravitationalAcceleration.H"
#include "readhRef.H" #include "readhRef.H"
#include "gh.H" #include "gh.H"
#include "readpRef.H"
Info<< "Reading field p_rgh\n" << endl; Info<< "Reading field p_rgh\n" << endl;
@ -74,7 +75,7 @@ volScalarField p_rgh
); );
// Force p_rgh to be consistent with p // Force p_rgh to be consistent with p
p_rgh = p - rho*gh; p_rgh = p - rho*gh - pRef;
pressureControl pressureControl pressureControl pressureControl
( (

View File

@ -77,7 +77,7 @@ else
phi = phiHbyA + p_rghEqn.flux(); phi = phiHbyA + p_rghEqn.flux();
p = p_rgh + rho*gh; p = p_rgh + rho*gh + pRef;
#include "incompressible/continuityErrs.H" #include "incompressible/continuityErrs.H"
@ -98,7 +98,7 @@ if (closedVolume && !thermo.incompressible())
{ {
p += (initialMass - fvc::domainIntegrate(thermo.rho())) p += (initialMass - fvc::domainIntegrate(thermo.rho()))
/fvc::domainIntegrate(psi); /fvc::domainIntegrate(psi);
p_rgh = p - rho*gh; p_rgh = p - rho*gh - pRef;
p.correctBoundaryConditions(); p.correctBoundaryConditions();
} }

View File

@ -5,6 +5,7 @@ PtrList<volVectorField> UFluid(fluidRegions.size());
PtrList<surfaceScalarField> phiFluid(fluidRegions.size()); PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size()); PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
PtrList<uniformDimensionedScalarField> hRefFluid(fluidRegions.size()); PtrList<uniformDimensionedScalarField> hRefFluid(fluidRegions.size());
PtrList<uniformDimensionedScalarField> pRefFluid(fluidRegions.size());
PtrList<volScalarField> ghFluid(fluidRegions.size()); PtrList<volScalarField> ghFluid(fluidRegions.size());
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size()); PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
PtrList<compressible::momentumTransportModel> PtrList<compressible::momentumTransportModel>
@ -123,6 +124,24 @@ forAll(fluidRegions, i)
) )
); );
Info<< " Adding to pRefFluid\n" << endl;
pRefFluid.set
(
i,
new uniformDimensionedScalarField
(
IOobject
(
"pRef",
runTime.constant(),
fluidRegions[i],
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
dimensionedScalar(dimPressure, 0)
)
);
dimensionedScalar ghRef(- mag(gFluid[i])*hRefFluid[i]); dimensionedScalar ghRef(- mag(gFluid[i])*hRefFluid[i]);
Info<< " Adding to ghFluid\n" << endl; Info<< " Adding to ghFluid\n" << endl;
@ -200,7 +219,7 @@ forAll(fluidRegions, i)
); );
// Force p_rgh to be consistent with p // Force p_rgh to be consistent with p
p_rghFluid[i] = thermoFluid[i].p() - rhoFluid[i]*ghFluid[i]; p_rghFluid[i] = thermoFluid[i].p() - rhoFluid[i]*ghFluid[i] - pRefFluid[i];
fluidRegions[i].setFluxRequired(p_rghFluid[i].name()); fluidRegions[i].setFluxRequired(p_rghFluid[i].name());

View File

@ -40,6 +40,7 @@
volScalarField& p_rgh = p_rghFluid[i]; volScalarField& p_rgh = p_rghFluid[i];
const dimensionedVector& g = gFluid[i]; const dimensionedVector& g = gFluid[i];
const dimensionedScalar& pRef = pRefFluid[i];
const volScalarField& gh = ghFluid[i]; const volScalarField& gh = ghFluid[i];
const surfaceScalarField& ghf = ghfFluid[i]; const surfaceScalarField& ghf = ghfFluid[i];

View File

@ -25,13 +25,13 @@ boundaryField
outlet outlet
{ {
type calculated; type calculated;
value uniform $pInitial; value $internalField;
} }
inlet inlet
{ {
type calculated; type calculated;
value uniform $pInitial; value $internalField;
} }
wall wall

View File

@ -16,22 +16,22 @@ FoamFile
#include "$FOAM_CASE/constant/initialConditions" #include "$FOAM_CASE/constant/initialConditions"
dimensions [ 1 -1 -2 0 0 0 0 ]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform $pInitial; internalField uniform 0;
boundaryField boundaryField
{ {
outlet outlet
{ {
type fixedValue; type fixedValue;
value uniform $pInitial; value $internalField;
} }
inlet inlet
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform $pInitial; value $internalField;
} }
wall wall

View File

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedScalarField;
location "constant";
object pRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "$FOAM_CASE/constant/initialConditions"
dimensions [1 -1 -2 0 0 0 0];
value $pInitial;
// ************************************************************************* //

View File

@ -16,26 +16,26 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 1e5; internalField uniform 0;
boundaryField boundaryField
{ {
floor floor
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 1e5; value $internalField;
} }
ceiling ceiling
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 1e5; value $internalField;
} }
fixedWalls fixedWalls
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 1e5; value $internalField;
} }
} }

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedScalarField;
location "constant";
object pRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
value 1e5;
// ************************************************************************* //

View File

@ -17,32 +17,32 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 1e5; internalField uniform 0;
boundaryField boundaryField
{ {
frontAndBack frontAndBack
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 1e5; value $internalField;
} }
topAndBottom topAndBottom
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 1e5; value $internalField;
} }
hot hot
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 1e5; value $internalField;
} }
cold cold
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 1e5; value $internalField;
} }
} }

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedScalarField;
location "constant";
object pRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
value 1e5;
// ************************************************************************* //

View File

@ -17,7 +17,7 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 101325; internalField uniform 1e5;
boundaryField boundaryField
{ {
@ -27,28 +27,31 @@ boundaryField
floor floor
{ {
type calculated; type calculated;
value uniform 101325; value $internalField;
} }
ceiling ceiling
{ {
type calculated; type calculated;
value uniform 101325; value $internalField;
} }
inlet inlet
{ {
type calculated; type calculated;
value uniform 101325; value $internalField;
} }
outlet outlet
{ {
type calculated; type calculated;
value uniform 101325; value $internalField;
} }
fixedWalls fixedWalls
{ {
type empty; type empty;
} }
} }

View File

@ -17,7 +17,7 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 101325; internalField uniform 0;
boundaryField boundaryField
{ {
@ -27,31 +27,31 @@ boundaryField
floor floor
{ {
type fixedFluxPressure; type fixedFluxPressure;
gradient uniform 0; value $internalField;
value uniform 101325;
} }
ceiling ceiling
{ {
type fixedFluxPressure; type fixedFluxPressure;
gradient uniform 0; value $internalField;
value uniform 101325;
} }
inlet inlet
{ {
type fixedFluxPressure; type fixedFluxPressure;
gradient uniform 0; value $internalField;
value uniform 101325;
} }
outlet outlet
{ {
type fixedValue; type fixedValue;
value uniform 101325; value $internalField;
} }
fixedWalls fixedWalls
{ {
type empty; type empty;
} }
} }

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedScalarField;
location "constant";
object pRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
value 1e5;
// ************************************************************************* //

View File

@ -16,7 +16,7 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 1e5; internalField uniform 0;
boundaryField boundaryField
{ {

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedScalarField;
location "constant";
object pRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
value 1e5;
// ************************************************************************* //

View File

@ -17,32 +17,32 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 1e5; internalField uniform 0;
boundaryField boundaryField
{ {
frontAndBack frontAndBack
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 1e5; value $internalField;
} }
topAndBottom topAndBottom
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 1e5; value $internalField;
} }
hot hot
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 1e5; value $internalField;
} }
cold cold
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 1e5; value $internalField;
} }
} }

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedScalarField;
location "constant";
object pRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
value 1e5;
// ************************************************************************* //

View File

@ -16,7 +16,7 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 100000; internalField uniform 1e5;
boundaryField boundaryField
{ {

View File

@ -16,32 +16,32 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 100000; internalField uniform 0;
boundaryField boundaryField
{ {
floor floor
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 100000; value $internalField;
} }
ceiling ceiling
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 100000; value $internalField;
} }
fixedWalls fixedWalls
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 100000; value $internalField;
} }
box box
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 100000; value $internalField;
} }
} }

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedScalarField;
location "constant";
object pRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
value 1e5;
// ************************************************************************* //

View File

@ -16,32 +16,32 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 100000; internalField uniform 1e5;
boundaryField boundaryField
{ {
floor floor
{ {
type calculated; type calculated;
value uniform 100000; value $internalField;
} }
ceiling ceiling
{ {
type calculated; type calculated;
value uniform 100000; value $internalField;
} }
fixedWalls fixedWalls
{ {
type calculated; type calculated;
value uniform 100000; value $internalField;
} }
box box
{ {
type calculated; type calculated;
value uniform 100000; value $internalField;
} }
} }

View File

@ -16,32 +16,32 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 100000; internalField uniform 0;
boundaryField boundaryField
{ {
floor floor
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 100000; value $internalField;
} }
ceiling ceiling
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 100000; value $internalField;
} }
fixedWalls fixedWalls
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 100000; value $internalField;
} }
box box
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 100000; value $internalField;
} }
} }

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedScalarField;
location "constant";
object pRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
value 1e5;
// ************************************************************************* //

View File

@ -23,19 +23,19 @@ boundaryField
floor floor
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 0; value $internalField;
} }
ceiling ceiling
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 0; value $internalField;
} }
fixedWalls fixedWalls
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 0; value $internalField;
} }
} }

View File

@ -26,7 +26,7 @@ boundaryField
wall wall
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform 0; value $internalField;
} }
} }

View File

@ -18,20 +18,20 @@ FoamFile
dimensions [ 1 -1 -2 0 0 0 0 ]; dimensions [ 1 -1 -2 0 0 0 0 ];
internalField uniform $pInitial; internalField uniform 0;
boundaryField boundaryField
{ {
outlet outlet
{ {
type fixedValue; type fixedValue;
value uniform $pInitial; value uniform 0;
} }
inlet inlet
{ {
type fixedFluxPressure; type fixedFluxPressure;
value uniform $pInitial; value uniform 0;
} }
wall wall

View File

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedScalarField;
location "constant";
object pRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "$FOAM_CASE/constant/initialConditions"
dimensions [1 -1 -2 0 0 0 0];
value $pInitial;
// ************************************************************************* //

View File

@ -17,7 +17,7 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 100000; internalField uniform 0;
boundaryField boundaryField
{ {

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedScalarField;
location "constant";
object pRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
value 1e5;
// ************************************************************************* //

View File

@ -17,7 +17,7 @@ FoamFile
dimensions [ 1 -1 -2 0 0 0 0 ]; dimensions [ 1 -1 -2 0 0 0 0 ];
internalField uniform 1e6; internalField uniform 0;
boundaryField boundaryField
{ {

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedScalarField;
location "constant";
object pRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
value 1e6;
// ************************************************************************* //