From e588d618799acabdff0499ed4bca4603d67b9097 Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Tue, 17 Mar 2015 17:15:11 +0000 Subject: [PATCH] Solvers based on p_rgh: Added support for optional hRef Allows the specification of a reference height, for example the height of the free-surface in a VoF simulation, which reduces the range of p_rgh. hRef is a uniformDimensionedScalarField specified via the constant/hRef file, equivalent to the way in which g is specified, so that it can be looked-up from the database. For example see the constant/hRef file in the DTCHull LTSInterFoam and interDyMFoam cases. --- .../combustion/fireFoam/createFields.H | 8 +++++-- .../solvers/combustion/fireFoam/fireFoam.C | 1 - .../rhoReactingBuoyantFoam/createFields.H | 9 ++++++-- .../rhoReactingBuoyantFoam.C | 1 - .../buoyantBoussinesqPimpleFoam.C | 1 - .../createFields.H | 10 +++++++-- .../buoyantBoussinesqSimpleFoam.C | 1 - .../createFields.H | 10 +++++++-- .../reactingParcelFilmFoam/createFields.H | 9 ++++++-- .../reactingParcelFilmFoam.C | 1 - .../compressibleInterDyMFoam.C | 5 ++--- .../compressibleInterFoam.C | 1 - .../compressibleInterFoam/createFields.H | 17 ++++++++++++--- .../compressibleMultiphaseInterFoam.C | 1 - .../createFields.H | 9 ++++++-- .../multiphase/driftFluxFoam/createFields.H | 12 ++++++++--- .../multiphase/driftFluxFoam/driftFluxFoam.C | 1 - .../multiphase/interFoam/createFields.H | 6 ++++-- .../interFoam/interDyMFoam/interDyMFoam.C | 4 ++-- .../interFoam/interMixingFoam/createFields.H | 7 +++++-- .../interMixingFoam/interMixingFoam.C | 1 - .../interPhaseChangeFoam/createFields.H | 9 ++++++-- .../interPhaseChangeDyMFoam.C | 5 ++--- .../interPhaseChangeFoam.C | 1 - .../multiphaseInterFoam/createFields.H | 8 +++++-- .../multiphaseInterDyMFoam.C | 4 ++-- .../twoLiquidMixingFoam/createFields.H | 10 +++++++-- .../twoLiquidMixingFoam/twoLiquidMixingFoam.C | 1 - .../cfdTools/general/include/readhRef.H | 13 ++++++++++++ .../LTSInterFoam/DTCHull/constant/hRef | 21 +++++++++++++++++++ .../interDyMFoam/ras/DTCHull/constant/hRef | 21 +++++++++++++++++++ 31 files changed, 159 insertions(+), 49 deletions(-) create mode 100644 src/finiteVolume/cfdTools/general/include/readhRef.H create mode 100644 tutorials/multiphase/LTSInterFoam/DTCHull/constant/hRef create mode 100644 tutorials/multiphase/interDyMFoam/ras/DTCHull/constant/hRef diff --git a/applications/solvers/combustion/fireFoam/createFields.H b/applications/solvers/combustion/fireFoam/createFields.H index 8159ee73aa6..5de143de2c2 100644 --- a/applications/solvers/combustion/fireFoam/createFields.H +++ b/applications/solvers/combustion/fireFoam/createFields.H @@ -101,10 +101,14 @@ volScalarField K("K", 0.5*magSqr(U)); + #include "readGravitationalAcceleration.H" + #include "readhRef.H" + Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); + dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); + volScalarField gh("gh", (g & mesh.C()) - ghRef); + surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); - surfaceScalarField ghf("ghf", g & mesh.Cf()); volScalarField p_rgh ( diff --git a/applications/solvers/combustion/fireFoam/fireFoam.C b/applications/solvers/combustion/fireFoam/fireFoam.C index d055be0de5d..d7ec701ad88 100644 --- a/applications/solvers/combustion/fireFoam/fireFoam.C +++ b/applications/solvers/combustion/fireFoam/fireFoam.C @@ -54,7 +54,6 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); - #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createFvOptions.H" #include "createClouds.H" diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H index 4b901672bd0..fa06a820d89 100644 --- a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H +++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H @@ -63,9 +63,14 @@ autoPtr<compressible::turbulenceModel> turbulence reaction->setTurbulence(turbulence()); +#include "readGravitationalAcceleration.H" +#include "readhRef.H" + Info<< "Calculating field g.h\n" << endl; -volScalarField gh("gh", g & mesh.C()); -surfaceScalarField ghf("ghf", g & mesh.Cf()); +dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); +volScalarField gh("gh", (g & mesh.C()) - ghRef); +surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); + Info<< "Reading field p_rgh\n" << endl; volScalarField p_rgh diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/rhoReactingBuoyantFoam.C b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/rhoReactingBuoyantFoam.C index 4d6ca92e56c..d8e68441c9d 100644 --- a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/rhoReactingBuoyantFoam.C +++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/rhoReactingBuoyantFoam.C @@ -48,7 +48,6 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); - #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createFvOptions.H" #include "initContinuityErrs.H" diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C index c5be6738678..f1074675108 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C @@ -63,7 +63,6 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); - #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createIncompressibleRadiationModel.H" #include "createFvOptions.H" diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H index a7243f28179..8fd4fda768a 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H @@ -79,9 +79,15 @@ mesh ); + + #include "readGravitationalAcceleration.H" + #include "readhRef.H" + Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("ghf", g & mesh.Cf()); + dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); + volScalarField gh("gh", (g & mesh.C()) - ghRef); + surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); + volScalarField p ( diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C index 42a843365d1..fbf754f6de5 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C @@ -62,7 +62,6 @@ int main(int argc, char *argv[]) simpleControl simple(mesh); - #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createFvOptions.H" #include "initContinuityErrs.H" diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H index 242350fe64b..91d584eb85c 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H @@ -79,9 +79,15 @@ mesh ); + + #include "readGravitationalAcceleration.H" + #include "readhRef.H" + Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("ghf", g & mesh.Cf()); + dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); + volScalarField gh("gh", (g & mesh.C()) - ghRef); + surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); + volScalarField p ( diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H index d3fffd02440..b22934c60f4 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H @@ -80,10 +80,15 @@ Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); + + #include "readGravitationalAcceleration.H" + #include "readhRef.H" + Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); + dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); + volScalarField gh("gh", (g & mesh.C()) - ghRef); + surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); - surfaceScalarField ghf("ghf", g & mesh.Cf()); volScalarField p_rgh ( diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C b/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C index 9c2260696bc..757ede7fee4 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C @@ -52,7 +52,6 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); - #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createFvOptions.H" #include "createClouds.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C index 7f225f4607a..9d56a2334f9 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -56,7 +56,6 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createDynamicFvMesh.H" - #include "readGravitationalAcceleration.H" #include "initContinuityErrs.H" pimpleControl pimple(mesh); @@ -98,8 +97,8 @@ int main(int argc, char *argv[]) << runTime.elapsedCpuTime() - timeBeforeMeshUpdate << " s" << endl; - gh = g & mesh.C(); - ghf = g & mesh.Cf(); + gh = (g & mesh.C()) - ghRef; + ghf = (g & mesh.Cf()) - ghRef; } if (mesh.changing() && correctPhi) diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 0559985b546..de2c07e1488 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -53,7 +53,6 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - #include "readGravitationalAcceleration.H" pimpleControl pimple(mesh); diff --git a/applications/solvers/multiphase/compressibleInterFoam/createFields.H b/applications/solvers/multiphase/compressibleInterFoam/createFields.H index 5f7b4dddadf..f1be9b3a371 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleInterFoam/createFields.H @@ -57,11 +57,22 @@ ); - dimensionedScalar pMin(mixture.lookup("pMin")); + dimensionedScalar pMin + ( + "pMin", + dimPressure, + mixture.lookup("pMin") + ); + + + #include "readGravitationalAcceleration.H" + #include "readhRef.H" Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("ghf", g & mesh.Cf()); + dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); + volScalarField gh("gh", (g & mesh.C()) - ghRef); + surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); + // Mass flux // Initialisation does not matter because rhoPhi is reset after the diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseInterFoam.C b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseInterFoam.C index 24ba56e3e5e..21ef8128899 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseInterFoam.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseInterFoam.C @@ -48,7 +48,6 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - #include "readGravitationalAcceleration.H" pimpleControl pimple(mesh); diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/createFields.H b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/createFields.H index 7c864cc569a..3ef9f32477d 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/createFields.H @@ -49,9 +49,14 @@ dimensionedScalar pMin(mixture.lookup("pMin")); + #include "readGravitationalAcceleration.H" + #include "readhRef.H" + Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("ghf", g & mesh.Cf()); + dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); + volScalarField gh("gh", (g & mesh.C()) - ghRef); + surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); + // Construct compressible turbulence model autoPtr<compressible::turbulenceModel> turbulence diff --git a/applications/solvers/multiphase/driftFluxFoam/createFields.H b/applications/solvers/multiphase/driftFluxFoam/createFields.H index bfd899dd986..fc66a17f8b3 100644 --- a/applications/solvers/multiphase/driftFluxFoam/createFields.H +++ b/applications/solvers/multiphase/driftFluxFoam/createFields.H @@ -90,9 +90,15 @@ ::New(rho, U, rhoPhi, mixture) ); - Info<< "Calculating field (g.h)f\n" << endl; - volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("ghf", g & mesh.Cf()); + + #include "readGravitationalAcceleration.H" + #include "readhRef.H" + + Info<< "Calculating field g.h\n" << endl; + dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); + volScalarField gh("gh", (g & mesh.C()) - ghRef); + surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); + volScalarField p ( diff --git a/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C b/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C index fc366873fa3..35d4b441d0e 100644 --- a/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C +++ b/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C @@ -57,7 +57,6 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); - #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createFvOptions.H" #include "initContinuityErrs.H" diff --git a/applications/solvers/multiphase/interFoam/createFields.H b/applications/solvers/multiphase/interFoam/createFields.H index 93465ed299e..5413bd193e9 100644 --- a/applications/solvers/multiphase/interFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/createFields.H @@ -77,10 +77,12 @@ ); #include "readGravitationalAcceleration.H" + #include "readhRef.H" Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("ghf", g & mesh.Cf()); + dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); + volScalarField gh("gh", (g & mesh.C()) - ghRef); + surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); volScalarField p ( diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C index 4df1c23dfc3..84d1283d04a 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C @@ -110,8 +110,8 @@ int main(int argc, char *argv[]) << runTime.elapsedCpuTime() - timeBeforeMeshUpdate << " s" << endl; - gh = g & mesh.C(); - ghf = g & mesh.Cf(); + gh = (g & mesh.C()) - ghRef; + ghf = (g & mesh.Cf()) - ghRef; } if (mesh.changing() && correctPhi) diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H b/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H index 284d9ed035e..8b1be416de7 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H @@ -79,10 +79,13 @@ incompressible::turbulenceModel::New(U, phi, mixture) ); + #include "readGravitationalAcceleration.H" + #include "readhRef.H" Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("ghf", g & mesh.Cf()); + dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); + volScalarField gh("gh", (g & mesh.C()) - ghRef); + surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); volScalarField p ( diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C index d51f5a83ab2..abb18c4ba30 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C @@ -50,7 +50,6 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); - #include "readGravitationalAcceleration.H" #include "initContinuityErrs.H" #include "createFields.H" #include "createFvOptions.H" diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/createFields.H b/applications/solvers/multiphase/interPhaseChangeFoam/createFields.H index d8b06da38d1..05bb201cb87 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/createFields.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/createFields.H @@ -67,9 +67,14 @@ ); + #include "readGravitationalAcceleration.H" + #include "readhRef.H" + Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("ghf", g & mesh.Cf()); + dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); + volScalarField gh("gh", (g & mesh.C()) - ghRef); + surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); + volScalarField p ( diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C index 5c05875e358..a1a416f0863 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C @@ -63,7 +63,6 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); - #include "readGravitationalAcceleration.H" #include "initContinuityErrs.H" #include "createFields.H" #include "createFvOptions.H" @@ -122,8 +121,8 @@ int main(int argc, char *argv[]) << runTime.elapsedCpuTime() - timeBeforeMeshUpdate << " s" << endl; - gh = g & mesh.C(); - ghf = g & mesh.Cf(); + gh = (g & mesh.C()) - ghRef; + ghf = (g & mesh.Cf()) - ghRef; } if (mesh.changing() && correctPhi) diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C index 2364208b5a7..8f5c97522fb 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C @@ -60,7 +60,6 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); - #include "readGravitationalAcceleration.H" #include "initContinuityErrs.H" #include "createFields.H" #include "createFvOptions.H" diff --git a/applications/solvers/multiphase/multiphaseInterFoam/createFields.H b/applications/solvers/multiphase/multiphaseInterFoam/createFields.H index 26d7a17dc01..bc4f6b362b8 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/createFields.H +++ b/applications/solvers/multiphase/multiphaseInterFoam/createFields.H @@ -52,11 +52,15 @@ incompressible::turbulenceModel::New(U, phi, mixture) ); + #include "readGravitationalAcceleration.H" + #include "readhRef.H" Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("ghf", g & mesh.Cf()); + dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); + volScalarField gh("gh", (g & mesh.C()) - ghRef); + surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); + volScalarField p ( diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterDyMFoam/multiphaseInterDyMFoam.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterDyMFoam/multiphaseInterDyMFoam.C index f75e6d9c4bd..fff99c0b77c 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterDyMFoam/multiphaseInterDyMFoam.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterDyMFoam/multiphaseInterDyMFoam.C @@ -106,8 +106,8 @@ int main(int argc, char *argv[]) << runTime.elapsedCpuTime() - timeBeforeMeshUpdate << " s" << endl; - gh = g & mesh.C(); - ghf = g & mesh.Cf(); + gh = (g & mesh.C()) - ghRef; + ghf = (g & mesh.Cf()) - ghRef; } if (mesh.changing() && correctPhi) diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/createFields.H b/applications/solvers/multiphase/twoLiquidMixingFoam/createFields.H index 442bb9083b6..ad8b08a45c6 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/createFields.H +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/createFields.H @@ -69,9 +69,15 @@ incompressible::turbulenceModel::New(U, phi, mixture) ); + + #include "readGravitationalAcceleration.H" + #include "readhRef.H" + Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); - surfaceScalarField ghf("ghf", g & mesh.Cf()); + dimensionedScalar ghRef(g & (cmptMag(g.value())/mag(g.value()))*hRef); + volScalarField gh("gh", (g & mesh.C()) - ghRef); + surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef); + volScalarField p ( diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C index 283724286b7..dab88b930af 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C @@ -49,7 +49,6 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); - #include "readGravitationalAcceleration.H" #include "initContinuityErrs.H" #include "createFields.H" #include "readTimeControls.H" diff --git a/src/finiteVolume/cfdTools/general/include/readhRef.H b/src/finiteVolume/cfdTools/general/include/readhRef.H new file mode 100644 index 00000000000..d34c3e7dd9d --- /dev/null +++ b/src/finiteVolume/cfdTools/general/include/readhRef.H @@ -0,0 +1,13 @@ + Info<< "\nReading hRef" << endl; + uniformDimensionedScalarField hRef + ( + IOobject + ( + "hRef", + runTime.constant(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + dimensionedScalar("hRef", dimLength, 0) + ); diff --git a/tutorials/multiphase/LTSInterFoam/DTCHull/constant/hRef b/tutorials/multiphase/LTSInterFoam/DTCHull/constant/hRef new file mode 100644 index 00000000000..bda49ba8836 --- /dev/null +++ b/tutorials/multiphase/LTSInterFoam/DTCHull/constant/hRef @@ -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 uniformDimensionedScalarField; + location "constant"; + object hRef; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; +value 0.244; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/DTCHull/constant/hRef b/tutorials/multiphase/interDyMFoam/ras/DTCHull/constant/hRef new file mode 100644 index 00000000000..bda49ba8836 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/DTCHull/constant/hRef @@ -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 uniformDimensionedScalarField; + location "constant"; + object hRef; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; +value 0.244; + +// ************************************************************************* // -- GitLab