diff --git a/applications/solvers/combustion/XiFoam/correctPhi.H b/applications/solvers/combustion/XiFoam/correctPhi.H index f907eed8bd..d9c9d641fb 100644 --- a/applications/solvers/combustion/XiFoam/correctPhi.H +++ b/applications/solvers/combustion/XiFoam/correctPhi.H @@ -1 +1,19 @@ -#include "../../compressible/rhoPimpleFoam/correctPhi.H" +// Calculate absolute flux +// from the mapped surface velocity +phi = mesh.Sf() & rhoUf(); + +correctUphiBCs(rho, U, phi, true); + +CorrectPhi +( + phi, + p, + rho, + psi, + dimensionedScalar("rAUf", dimTime, 1), + divrhoU(), + pimple +); + +// Make the fluxes relative to the mesh-motion +fvc::makeRelative(phi, rho, U); diff --git a/applications/solvers/combustion/reactingFoam/EEqn.H b/applications/solvers/combustion/reactingFoam/EEqn.H deleted file mode 100644 index cb93bd570d..0000000000 --- a/applications/solvers/combustion/reactingFoam/EEqn.H +++ /dev/null @@ -1,31 +0,0 @@ -{ - volScalarField& he = thermo.he(); - - fvScalarMatrix EEqn - ( - fvm::ddt(rho, he) + mvConvection->fvmDiv(phi, he) - + fvc::ddt(rho, K) + fvc::div(phi, K) - + ( - he.name() == "e" - ? mvConvection->fvcDiv(fvc::absolute(phi, rho, U), p/rho) - : -dpdt - ) - + thermophysicalTransport->divq(he) - == - reaction->Qdot() - + fvModels.source(rho, he) - ); - - EEqn.relax(); - - fvConstraints.constrain(EEqn); - - EEqn.solve(); - - fvConstraints.constrain(he); - - thermo.correct(); - - Info<< "min/max(T) = " - << min(T).value() << ", " << max(T).value() << endl; -} diff --git a/applications/solvers/combustion/reactingFoam/Make/files b/applications/solvers/combustion/reactingFoam/Make/files deleted file mode 100644 index a0472c2aa9..0000000000 --- a/applications/solvers/combustion/reactingFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -reactingFoam.C - -EXE = $(FOAM_APPBIN)/reactingFoam diff --git a/applications/solvers/combustion/reactingFoam/Make/options b/applications/solvers/combustion/reactingFoam/Make/options deleted file mode 100644 index 6d9c65469a..0000000000 --- a/applications/solvers/combustion/reactingFoam/Make/options +++ /dev/null @@ -1,33 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ - -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ - -I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \ - -I$(LIB_SRC)/ThermophysicalTransportModels/fluidMulticomponentThermo/lnInclude \ - -I$(LIB_SRC)/physicalProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/multicomponentThermo/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ - -I$(LIB_SRC)/ODE/lnInclude \ - -I$(LIB_SRC)/combustionModels/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/finiteVolume/cfdTools \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude - -EXE_LIBS = \ - -lfluidThermophysicalModels \ - -lspecie \ - -lchemistryModel \ - -lODE \ - -lcombustionModels \ - -lmulticomponentThermophysicalModels \ - -lmomentumTransportModels \ - -lcompressibleMomentumTransportModels \ - -lthermophysicalTransportModels \ - -lfluidMulticomponentThermophysicalTransportModels \ - -lfiniteVolume \ - -lfvModels \ - -lfvConstraints \ - -lmeshTools \ - -lsampling diff --git a/applications/solvers/combustion/reactingFoam/UEqn.H b/applications/solvers/combustion/reactingFoam/UEqn.H deleted file mode 100644 index 9083f9485f..0000000000 --- a/applications/solvers/combustion/reactingFoam/UEqn.H +++ /dev/null @@ -1,25 +0,0 @@ -// Solve the Momentum equation - -MRF.correctBoundaryVelocity(U); - -tmp tUEqn -( - fvm::ddt(rho, U) + fvm::div(phi, U) - + MRF.DDt(rho, U) - + turbulence->divDevTau(U) - == - fvModels.source(rho, U) -); -fvVectorMatrix& UEqn = tUEqn.ref(); - -UEqn.relax(); - -fvConstraints.constrain(UEqn); - -if (pimple.momentumPredictor()) -{ - solve(UEqn == -fvc::grad(p)); - - fvConstraints.constrain(U); - K = 0.5*magSqr(U); -} diff --git a/applications/solvers/combustion/reactingFoam/YEqn.H b/applications/solvers/combustion/reactingFoam/YEqn.H deleted file mode 100644 index e9eb43a66e..0000000000 --- a/applications/solvers/combustion/reactingFoam/YEqn.H +++ /dev/null @@ -1,40 +0,0 @@ -tmp> mvConvection -( - fv::convectionScheme::New - ( - mesh, - fields, - phi, - mesh.schemes().div("div(phi,Yi_h)") - ) -); - -reaction->correct(); - -forAll(Y, i) -{ - if (composition.solve(i)) - { - volScalarField& Yi = Y[i]; - - fvScalarMatrix YiEqn - ( - fvm::ddt(rho, Yi) - + mvConvection->fvmDiv(phi, Yi) - + thermophysicalTransport->divj(Yi) - == - reaction->R(Yi) - + fvModels.source(rho, Yi) - ); - - YiEqn.relax(); - - fvConstraints.constrain(YiEqn); - - YiEqn.solve("Yi"); - - fvConstraints.constrain(Yi); - } -} - -composition.normalise(); diff --git a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/Make/files b/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/Make/files deleted file mode 100644 index e3f19fecaa..0000000000 --- a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -buoyantReactingFoam.C - -EXE = $(FOAM_APPBIN)/buoyantReactingFoam diff --git a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/UEqn.H b/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/UEqn.H deleted file mode 100644 index 3795849fc1..0000000000 --- a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/UEqn.H +++ /dev/null @@ -1,36 +0,0 @@ -// Solve the Momentum equation - -MRF.correctBoundaryVelocity(U); - -tmp tUEqn -( - fvm::ddt(rho, U) + fvm::div(phi, U) - + MRF.DDt(rho, U) - + turbulence->divDevTau(U) - == - fvModels.source(rho, U) -); -fvVectorMatrix& UEqn = tUEqn.ref(); - -UEqn.relax(); - -fvConstraints.constrain(UEqn); - -if (pimple.momentumPredictor()) -{ - solve - ( - UEqn - == - fvc::reconstruct - ( - ( - - ghf*fvc::snGrad(rho) - - fvc::snGrad(p_rgh) - )*mesh.magSf() - ) - ); - - fvConstraints.constrain(U); - K = 0.5*magSqr(U); -} diff --git a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/buoyantReactingFoam.C b/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/buoyantReactingFoam.C deleted file mode 100644 index 9ee4fcbee0..0000000000 --- a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/buoyantReactingFoam.C +++ /dev/null @@ -1,211 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Application - buoyantReactingFoam - -Description - Transient solver for turbulent flow of compressible reacting fluids with - enhanced buoyancy treatment and optional mesh motion and mesh topology - changes. - - Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and - pseudo-transient simulations. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "fluidMulticomponentThermo.H" -#include "combustionModel.H" -#include "compressibleMomentumTransportModels.H" -#include "fluidMulticomponentThermophysicalTransportModel.H" -#include "multivariateScheme.H" -#include "pimpleControl.H" -#include "pressureReference.H" -#include "hydrostaticInitialisation.H" -#include "CorrectPhi.H" -#include "fvModels.H" -#include "fvConstraints.H" -#include "localEulerDdtScheme.H" -#include "fvcSmooth.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "postProcess.H" - - #include "setRootCaseLists.H" - #include "createTime.H" - #include "createMesh.H" - #include "createDyMControls.H" - #include "initContinuityErrs.H" - #include "createFields.H" - #include "createFieldRefs.H" - #include "createRhoUfIfPresent.H" - - turbulence->validate(); - - if (!LTS) - { - #include "compressibleCourantNo.H" - #include "setInitialDeltaT.H" - } - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - Info<< "\nStarting time loop\n" << endl; - - while (pimple.run(runTime)) - { - #include "readDyMControls.H" - - // Store divrhoU from the previous mesh so that it can be mapped - // and used in correctPhi to ensure the corrected phi has the - // same divergence - autoPtr divrhoU; - if (correctPhi) - { - divrhoU = new volScalarField - ( - "divrhoU", - fvc::div(fvc::absolute(phi, rho, U)) - ); - } - - if (LTS) - { - #include "setRDeltaT.H" - } - else - { - #include "compressibleCourantNo.H" - #include "setDeltaT.H" - } - - fvModels.preUpdateMesh(); - - // Store momentum to set rhoUf for introduced faces. - autoPtr rhoU; - if (rhoUf.valid()) - { - rhoU = new volVectorField("rhoU", rho*U); - } - - // Update the mesh for topology change, mesh to mesh mapping - mesh.update(); - - runTime++; - - Info<< "Time = " << runTime.userTimeName() << nl << endl; - - // --- Pressure-velocity PIMPLE corrector loop - while (pimple.loop()) - { - if (!pimple.flow()) - { - if (pimple.models()) - { - fvModels.correct(); - } - - if (pimple.thermophysics()) - { - #include "YEqn.H" - #include "EEqn.H" - } - } - else - { - if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) - { - // Move the mesh - mesh.move(); - - if (mesh.changing()) - { - gh = (g & mesh.C()) - ghRef; - ghf = (g & mesh.Cf()) - ghRef; - - MRF.update(); - - if (correctPhi) - { - #include "correctPhi.H" - } - - if (checkMeshCourantNo) - { - #include "meshCourantNo.H" - } - } - } - - if (pimple.firstPimpleIter() && !pimple.simpleRho()) - { - #include "rhoEqn.H" - } - - if (pimple.models()) - { - fvModels.correct(); - } - - #include "UEqn.H" - - if (pimple.thermophysics()) - { - #include "YEqn.H" - #include "EEqn.H" - } - - // --- Pressure corrector loop - while (pimple.correct()) - { - #include "../../../heatTransfer/buoyantFoam/pEqn.H" - } - - if (pimple.turbCorr()) - { - turbulence->correct(); - thermophysicalTransport->correct(); - } - } - } - - rho = thermo.rho(); - - runTime.write(); - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/createFieldRefs.H b/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/createFieldRefs.H deleted file mode 100644 index 6e1184a1fa..0000000000 --- a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/createFieldRefs.H +++ /dev/null @@ -1,2 +0,0 @@ -const volScalarField& psi = thermo.psi(); -const volScalarField& T = thermo.T(); diff --git a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/createFields.H b/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/createFields.H deleted file mode 100644 index 30557a8307..0000000000 --- a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/createFields.H +++ /dev/null @@ -1,143 +0,0 @@ -#include "createRDeltaT.H" - -Info<< "Reading thermophysical properties\n" << endl; -autoPtr pThermo -( - fluidMulticomponentThermo::New(mesh) -); -fluidMulticomponentThermo& thermo = pThermo(); -thermo.validate(args.executable(), "h", "e"); - -basicSpecieMixture& composition = thermo.composition(); -PtrList& Y = composition.Y(); - -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 - ), - mesh -); - - -volScalarField& p = thermo.p(); - - -#include "compressibleCreatePhi.H" - -mesh.schemes().setFluxRequired(p.name()); - -Info << "Creating turbulence model.\n" << nl; -autoPtr turbulence -( - compressible::momentumTransportModel::New - ( - rho, - U, - phi, - thermo - ) -); - -Info<< "Creating thermophysical transport model\n" << endl; -autoPtr -thermophysicalTransport -( - fluidMulticomponentThermophysicalTransportModel::New - ( - turbulence(), - thermo - ) -); - -Info<< "Creating reaction model\n" << endl; -autoPtr reaction(combustionModel::New(thermo, turbulence())); - -#include "readGravitationalAcceleration.H" -#include "readhRef.H" -#include "gh.H" -#include "readpRef.H" - -Info<< "Reading field p_rgh\n" << endl; -volScalarField p_rgh -( - IOobject - ( - "p_rgh", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh -); - -pressureReference pressureReference -( - p, - p_rgh, - pimple.dict(), - thermo.incompressible() -); - -mesh.schemes().setFluxRequired(p_rgh.name()); - -hydrostaticInitialisation -( - p_rgh, - p, - rho, - U, - gh, - ghf, - pRef, - thermo, - pimple.dict() -); - -Info<< "Creating field dpdt\n" << endl; -volScalarField dpdt -( - IOobject - ( - "dpdt", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar(p.dimensions()/dimTime, 0) -); - -Info<< "Creating field kinetic energy K\n" << endl; -volScalarField K("K", 0.5*magSqr(U)); - -dimensionedScalar initialMass = fvc::domainIntegrate(rho); - - -multivariateSurfaceInterpolationScheme::fieldTable fields; -forAll(Y, i) -{ - fields.add(Y[i]); -} -fields.add(thermo.he()); - -#include "createMRF.H" -#include "createFvModels.H" -#include "createFvConstraints.H" diff --git a/applications/solvers/combustion/reactingFoam/correctPhi.H b/applications/solvers/combustion/reactingFoam/correctPhi.H deleted file mode 100644 index f907eed8bd..0000000000 --- a/applications/solvers/combustion/reactingFoam/correctPhi.H +++ /dev/null @@ -1 +0,0 @@ -#include "../../compressible/rhoPimpleFoam/correctPhi.H" diff --git a/applications/solvers/combustion/reactingFoam/createFieldRefs.H b/applications/solvers/combustion/reactingFoam/createFieldRefs.H deleted file mode 100644 index 6e1184a1fa..0000000000 --- a/applications/solvers/combustion/reactingFoam/createFieldRefs.H +++ /dev/null @@ -1,2 +0,0 @@ -const volScalarField& psi = thermo.psi(); -const volScalarField& T = thermo.T(); diff --git a/applications/solvers/combustion/reactingFoam/createFields.H b/applications/solvers/combustion/reactingFoam/createFields.H deleted file mode 100644 index a9650eb2e7..0000000000 --- a/applications/solvers/combustion/reactingFoam/createFields.H +++ /dev/null @@ -1,105 +0,0 @@ -#include "createRDeltaT.H" - -Info<< "Reading thermophysical properties\n" << endl; -autoPtr pThermo -( - fluidMulticomponentThermo::New(mesh) -); -fluidMulticomponentThermo& thermo = pThermo(); -thermo.validate(args.executable(), "h", "e"); - -basicSpecieMixture& composition = thermo.composition(); -PtrList& Y = composition.Y(); - -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 - ), - mesh -); - - -volScalarField& p = thermo.p(); - -#include "compressibleCreatePhi.H" - -pressureReference pressureReference(p, pimple.dict(), false); - -mesh.schemes().setFluxRequired(p.name()); - - -Info << "Creating turbulence model.\n" << nl; -autoPtr turbulence -( - compressible::momentumTransportModel::New - ( - rho, - U, - phi, - thermo - ) -); - -Info<< "Creating thermophysical transport model\n" << endl; -autoPtr -thermophysicalTransport -( - fluidMulticomponentThermophysicalTransportModel::New - ( - turbulence(), - thermo - ) -); - -Info<< "Creating reaction model\n" << endl; -autoPtr reaction(combustionModel::New(thermo, turbulence())); - - -Info<< "Creating field dpdt\n" << endl; -volScalarField dpdt -( - IOobject - ( - "dpdt", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar(p.dimensions()/dimTime, 0) -); - -Info<< "Creating field kinetic energy K\n" << endl; -volScalarField K("K", 0.5*magSqr(U)); - -dimensionedScalar initialMass = fvc::domainIntegrate(rho); - - -multivariateSurfaceInterpolationScheme::fieldTable fields; - -forAll(Y, i) -{ - fields.add(Y[i]); -} -fields.add(thermo.he()); - -#include "createMRF.H" -#include "createFvModels.H" -#include "createFvConstraints.H" diff --git a/applications/solvers/combustion/reactingFoam/reactingFoam.C b/applications/solvers/combustion/reactingFoam/reactingFoam.C deleted file mode 100644 index 55e5560a77..0000000000 --- a/applications/solvers/combustion/reactingFoam/reactingFoam.C +++ /dev/null @@ -1,206 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Application - reactingFoam - -Description - Transient solver for turbulent flow of compressible reacting fluids with - optional mesh motion and mesh topology changes. - - Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and - pseudo-transient simulations. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "fluidMulticomponentThermo.H" -#include "combustionModel.H" -#include "compressibleMomentumTransportModels.H" -#include "fluidMulticomponentThermophysicalTransportModel.H" -#include "multivariateScheme.H" -#include "pimpleControl.H" -#include "pressureReference.H" -#include "CorrectPhi.H" -#include "fvModels.H" -#include "fvConstraints.H" -#include "localEulerDdtScheme.H" -#include "fvcSmooth.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "postProcess.H" - - #include "setRootCaseLists.H" - #include "createTime.H" - #include "createMesh.H" - #include "createDyMControls.H" - #include "initContinuityErrs.H" - #include "createFields.H" - #include "createFieldRefs.H" - #include "createRhoUfIfPresent.H" - - turbulence->validate(); - - if (!LTS) - { - #include "compressibleCourantNo.H" - #include "setInitialDeltaT.H" - } - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - Info<< "\nStarting time loop\n" << endl; - - while (pimple.run(runTime)) - { - #include "readDyMControls.H" - - // Store divrhoU from the previous mesh so that it can be mapped - // and used in correctPhi to ensure the corrected phi has the - // same divergence - autoPtr divrhoU; - if (correctPhi) - { - divrhoU = new volScalarField - ( - "divrhoU", - fvc::div(fvc::absolute(phi, rho, U)) - ); - } - - if (LTS) - { - #include "setRDeltaT.H" - } - else - { - #include "compressibleCourantNo.H" - #include "setDeltaT.H" - } - - fvModels.preUpdateMesh(); - - // Store momentum to set rhoUf for introduced faces. - autoPtr rhoU; - if (rhoUf.valid()) - { - rhoU = new volVectorField("rhoU", rho*U); - } - - // Update the mesh for topology change, mesh to mesh mapping - mesh.update(); - - runTime++; - - Info<< "Time = " << runTime.userTimeName() << nl << endl; - - // --- Pressure-velocity PIMPLE corrector loop - while (pimple.loop()) - { - if (!pimple.flow()) - { - if (pimple.models()) - { - fvModels.correct(); - } - - if (pimple.thermophysics()) - { - #include "YEqn.H" - #include "EEqn.H" - } - } - else - { - if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) - { - // Move the mesh - mesh.move(); - - if (mesh.changing()) - { - MRF.update(); - - if (correctPhi) - { - #include "correctPhi.H" - } - - if (checkMeshCourantNo) - { - #include "meshCourantNo.H" - } - } - } - - if (pimple.firstPimpleIter() && !pimple.simpleRho()) - { - #include "rhoEqn.H" - } - - if (pimple.models()) - { - fvModels.correct(); - } - - #include "UEqn.H" - - if (pimple.thermophysics()) - { - #include "YEqn.H" - #include "EEqn.H" - } - - // --- Pressure corrector loop - while (pimple.correct()) - { - #include "../../compressible/rhoPimpleFoam/pEqn.H" - } - - if (pimple.turbCorr()) - { - turbulence->correct(); - thermophysicalTransport->correct(); - } - } - } - - rho = thermo.rho(); - - runTime.write(); - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/solvers/compressible/rhoPimpleFoam/EEqn.H b/applications/solvers/compressible/rhoPimpleFoam/EEqn.H deleted file mode 100644 index c2c0a51d54..0000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/EEqn.H +++ /dev/null @@ -1,27 +0,0 @@ -{ - volScalarField& he = thermo.he(); - - fvScalarMatrix EEqn - ( - fvm::ddt(rho, he) + fvm::div(phi, he) - + fvc::ddt(rho, K) + fvc::div(phi, K) - + ( - he.name() == "e" - ? fvc::div(fvc::absolute(phi, rho, U), p/rho) - : -dpdt - ) - + thermophysicalTransport->divq(he) - == - fvModels.source(rho, he) - ); - - EEqn.relax(); - - fvConstraints.constrain(EEqn); - - EEqn.solve(); - - fvConstraints.constrain(he); - - thermo.correct(); -} diff --git a/applications/solvers/compressible/rhoPimpleFoam/Make/files b/applications/solvers/compressible/rhoPimpleFoam/Make/files deleted file mode 100644 index 59ed124eea..0000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -rhoPimpleFoam.C - -EXE = $(FOAM_APPBIN)/rhoPimpleFoam diff --git a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H deleted file mode 100644 index 9083f9485f..0000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H +++ /dev/null @@ -1,25 +0,0 @@ -// Solve the Momentum equation - -MRF.correctBoundaryVelocity(U); - -tmp tUEqn -( - fvm::ddt(rho, U) + fvm::div(phi, U) - + MRF.DDt(rho, U) - + turbulence->divDevTau(U) - == - fvModels.source(rho, U) -); -fvVectorMatrix& UEqn = tUEqn.ref(); - -UEqn.relax(); - -fvConstraints.constrain(UEqn); - -if (pimple.momentumPredictor()) -{ - solve(UEqn == -fvc::grad(p)); - - fvConstraints.constrain(U); - K = 0.5*magSqr(U); -} diff --git a/applications/solvers/compressible/rhoPimpleFoam/correctPhi.H b/applications/solvers/compressible/rhoPimpleFoam/correctPhi.H deleted file mode 100644 index d9c9d641fb..0000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/correctPhi.H +++ /dev/null @@ -1,19 +0,0 @@ -// Calculate absolute flux -// from the mapped surface velocity -phi = mesh.Sf() & rhoUf(); - -correctUphiBCs(rho, U, phi, true); - -CorrectPhi -( - phi, - p, - rho, - psi, - dimensionedScalar("rAUf", dimTime, 1), - divrhoU(), - pimple -); - -// Make the fluxes relative to the mesh-motion -fvc::makeRelative(phi, rho, U); diff --git a/applications/solvers/compressible/rhoPimpleFoam/createFieldRefs.H b/applications/solvers/compressible/rhoPimpleFoam/createFieldRefs.H deleted file mode 100644 index 502b3b4230..0000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/createFieldRefs.H +++ /dev/null @@ -1 +0,0 @@ -const volScalarField& psi = thermo.psi(); diff --git a/applications/solvers/compressible/rhoPimpleFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/createFields.H deleted file mode 100644 index 7d41857c7c..0000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/createFields.H +++ /dev/null @@ -1,90 +0,0 @@ -#include "createRDeltaT.H" - -Info<< "Reading thermophysical properties\n" << endl; - -autoPtr pThermo -( - fluidThermo::New(mesh) -); -fluidThermo& thermo = pThermo(); -thermo.validate(args.executable(), "h", "e"); - -volScalarField& p = thermo.p(); - -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" - -pressureReference pressureReference -( - p, - pimple.dict(), - thermo.incompressible() -); - -mesh.schemes().setFluxRequired(p.name()); - -Info<< "Creating turbulence model\n" << endl; -autoPtr turbulence -( - compressible::momentumTransportModel::New - ( - rho, - U, - phi, - thermo - ) -); - -Info<< "Creating thermophysical transport model\n" << endl; -autoPtr thermophysicalTransport -( - fluidThermophysicalTransportModel::New(turbulence(), thermo) -); - -Info<< "Creating field dpdt\n" << endl; -volScalarField dpdt -( - IOobject - ( - "dpdt", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar(p.dimensions()/dimTime, 0) -); - -Info<< "Creating field kinetic energy K\n" << endl; -volScalarField K("K", 0.5*magSqr(U)); - -dimensionedScalar initialMass = fvc::domainIntegrate(rho); - -#include "createMRF.H" -#include "createFvModels.H" -#include "createFvConstraints.H" diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H deleted file mode 100644 index 94f76a960c..0000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H +++ /dev/null @@ -1,200 +0,0 @@ -rho = thermo.rho(); -rho.relax(); - -// Thermodynamic density needs to be updated by psi*d(p) after the -// pressure solution -const volScalarField psip0(psi*p); - -const volScalarField rAU("rAU", 1.0/UEqn.A()); -const surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -tmp rAtU -( - pimple.consistent() - ? volScalarField::New("rAtU", 1.0/(1.0/rAU - UEqn.H1())) - : tmp(nullptr) -); -tmp rhorAtUf -( - pimple.consistent() - ? surfaceScalarField::New("rhoRAtUf", fvc::interpolate(rho*rAtU())) - : tmp(nullptr) -); - -const volScalarField& rAAtU = pimple.consistent() ? rAtU() : rAU; -const surfaceScalarField& rhorAAtUf = - pimple.consistent() ? rhorAtUf() : rhorAUf; - -volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); - -if (pimple.nCorrPiso() <= 1) -{ - tUEqn.clear(); -} - -surfaceScalarField phiHbyA -( - "phiHbyA", - fvc::interpolate(rho)*fvc::flux(HbyA) - + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf)) -); - -MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - -// Update the pressure BCs to ensure flux consistency -constrainPressure(p, rho, U, phiHbyA, rhorAAtUf, MRF); - -fvc::makeRelative(phiHbyA, rho, U); - -bool adjustMass = false; - -if (pimple.transonic()) -{ - const surfaceScalarField phid - ( - "phid", - (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA - ); - - const fvScalarMatrix divPhidp(fvm::div(phid, p)); - phiHbyA -= divPhidp.flux(); - - if (pimple.consistent()) - { - phiHbyA += (rhorAAtUf - rhorAUf)*fvc::snGrad(p)*mesh.magSf(); - HbyA += (rAAtU - rAU)*fvc::grad(p); - } - - fvScalarMatrix pDDtEqn - ( - fvc::ddt(rho) + psi*correction(fvm::ddt(p)) - + fvc::div(phiHbyA) + divPhidp - == - fvModels.source(psi, p, rho.name()) - ); - - while (pimple.correctNonOrthogonal()) - { - fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAAtUf, p)); - - // Relax the pressure equation to ensure diagonal-dominance - pEqn.relax(); - - pEqn.setReference - ( - pressureReference.refCell(), - pressureReference.refValue() - ); - - pEqn.solve(); - - if (pimple.finalNonOrthogonalIter()) - { - phi = phiHbyA + pEqn.flux(); - } - } -} -else -{ - if (mesh.schemes().steady()) - { - adjustMass = adjustPhi(phiHbyA, U, p); - } - - if (pimple.consistent()) - { - phiHbyA += (rhorAAtUf - rhorAUf)*fvc::snGrad(p)*mesh.magSf(); - HbyA += (rAAtU - rAU)*fvc::grad(p); - } - - fvScalarMatrix pDDtEqn - ( - fvc::ddt(rho) + psi*correction(fvm::ddt(p)) - + fvc::div(phiHbyA) - == - fvModels.source(psi, p, rho.name()) - ); - - while (pimple.correctNonOrthogonal()) - { - fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAAtUf, p)); - - pEqn.setReference - ( - pressureReference.refCell(), - pressureReference.refValue() - ); - - pEqn.solve(); - - if (pimple.finalNonOrthogonalIter()) - { - phi = phiHbyA + pEqn.flux(); - } - } -} - -if (mesh.schemes().steady()) -{ - #include "incompressible/continuityErrs.H" -} -else -{ - const bool constrained = fvConstraints.constrain(p); - - // Thermodynamic density update - thermo.correctRho(psi*p - psip0); - - if (constrained) - { - rho = thermo.rho(); - } - - #include "rhoEqn.H" - #include "compressibleContinuityErrs.H" -} - -// Explicitly relax pressure for momentum corrector -p.relax(); - -U = HbyA - rAAtU*fvc::grad(p); -U.correctBoundaryConditions(); -fvConstraints.constrain(U); -K = 0.5*magSqr(U); - -if (mesh.schemes().steady()) -{ - fvConstraints.constrain(p); -} - -// For steady compressible closed-volume cases adjust the pressure level -// to obey overall mass continuity -if (adjustMass && !thermo.incompressible()) -{ - p += (initialMass - fvc::domainIntegrate(thermo.rho())) - /fvc::domainIntegrate(psi); - p.correctBoundaryConditions(); -} - -if (mesh.schemes().steady() || pimple.simpleRho() || adjustMass) -{ - rho = thermo.rho(); -} - -// Correct rhoUf if the mesh is moving -fvc::correctRhoUf(rhoUf, rho, U, phi, MRF); - -if (mesh.schemes().steady() || pimple.simpleRho()) -{ - rho.relax(); -} - -if (thermo.dpdt()) -{ - dpdt = fvc::ddt(p); - - if (mesh.moving()) - { - dpdt -= fvc::div(fvc::meshPhi(rho, U), p); - } -} diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C deleted file mode 100644 index 1834cbfe6c..0000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ /dev/null @@ -1,188 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Application - rhoPimpleFoam - -Description - Transient solver for turbulent flow of compressible fluids for HVAC and - similar applications, with optional mesh motion and mesh topology changes. - - Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and - pseudo-transient simulations. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "fluidThermo.H" -#include "compressibleMomentumTransportModels.H" -#include "fluidThermophysicalTransportModel.H" -#include "pimpleControl.H" -#include "pressureReference.H" -#include "CorrectPhi.H" -#include "fvModels.H" -#include "fvConstraints.H" -#include "localEulerDdtScheme.H" -#include "fvcSmooth.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "postProcess.H" - - #include "setRootCaseLists.H" - #include "createTime.H" - #include "createMesh.H" - #include "createDyMControls.H" - #include "initContinuityErrs.H" - #include "createFields.H" - #include "createFieldRefs.H" - #include "createRhoUfIfPresent.H" - - turbulence->validate(); - - if (!LTS) - { - #include "compressibleCourantNo.H" - #include "setInitialDeltaT.H" - } - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - Info<< "\nStarting time loop\n" << endl; - - while (pimple.run(runTime)) - { - #include "readDyMControls.H" - - // Store divrhoU from the previous mesh so that it can be mapped - // and used in correctPhi to ensure the corrected phi has the - // same divergence - autoPtr divrhoU; - if (correctPhi) - { - divrhoU = new volScalarField - ( - "divrhoU", - fvc::div(fvc::absolute(phi, rho, U)) - ); - } - - if (LTS) - { - #include "setRDeltaT.H" - } - else - { - #include "compressibleCourantNo.H" - #include "setDeltaT.H" - } - - fvModels.preUpdateMesh(); - - // Store momentum to set rhoUf for introduced faces. - autoPtr rhoU; - if (rhoUf.valid()) - { - rhoU = new volVectorField("rhoU", rho*U); - } - - // Update the mesh for topology change, mesh to mesh mapping - mesh.update(); - - runTime++; - - Info<< "Time = " << runTime.userTimeName() << nl << endl; - - // --- Pressure-velocity PIMPLE corrector loop - while (pimple.loop()) - { - if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) - { - // Move the mesh - mesh.move(); - - if (mesh.changing()) - { - MRF.update(); - - if (correctPhi) - { - #include "correctPhi.H" - } - - if (checkMeshCourantNo) - { - #include "meshCourantNo.H" - } - } - } - - if - ( - !mesh.schemes().steady() - && !pimple.simpleRho() - && pimple.firstPimpleIter() - ) - { - #include "rhoEqn.H" - } - - fvModels.correct(); - - #include "UEqn.H" - #include "EEqn.H" - - // --- Pressure corrector loop - while (pimple.correct()) - { - #include "pEqn.H" - } - - if (pimple.turbCorr()) - { - turbulence->correct(); - thermophysicalTransport->correct(); - } - } - - if (!mesh.schemes().steady()) - { - rho = thermo.rho(); - } - - runTime.write(); - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/solvers/compressible/rhoSimpleFoam/EEqn.H b/applications/solvers/compressible/rhoPorousSimpleFoam/EEqn.H similarity index 100% rename from applications/solvers/compressible/rhoSimpleFoam/EEqn.H rename to applications/solvers/compressible/rhoPorousSimpleFoam/EEqn.H diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/Make/files b/applications/solvers/compressible/rhoPorousSimpleFoam/Make/files similarity index 100% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/Make/files rename to applications/solvers/compressible/rhoPorousSimpleFoam/Make/files diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/Make/options b/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options similarity index 100% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/Make/options rename to applications/solvers/compressible/rhoPorousSimpleFoam/Make/options diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPorousSimpleFoam/UEqn.H similarity index 100% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/UEqn.H rename to applications/solvers/compressible/rhoPorousSimpleFoam/UEqn.H diff --git a/applications/solvers/compressible/rhoSimpleFoam/createFields.H b/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H similarity index 100% rename from applications/solvers/compressible/rhoSimpleFoam/createFields.H rename to applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H b/applications/solvers/compressible/rhoPorousSimpleFoam/createZones.H similarity index 100% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H rename to applications/solvers/compressible/rhoPorousSimpleFoam/createZones.H diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPorousSimpleFoam/pEqn.H similarity index 100% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H rename to applications/solvers/compressible/rhoPorousSimpleFoam/pEqn.H diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C b/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C similarity index 97% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C rename to applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C index b4b7564f61..de6cb7d7cd 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/compressible/rhoSimpleFoam/Make/files b/applications/solvers/compressible/rhoSimpleFoam/Make/files deleted file mode 100644 index cb152a3f21..0000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -rhoSimpleFoam.C - -EXE = $(FOAM_APPBIN)/rhoSimpleFoam diff --git a/applications/solvers/compressible/rhoSimpleFoam/UEqn.H b/applications/solvers/compressible/rhoSimpleFoam/UEqn.H deleted file mode 100644 index 33c6f2da99..0000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/UEqn.H +++ /dev/null @@ -1,21 +0,0 @@ - // Solve the Momentum equation - - MRF.correctBoundaryVelocity(U); - - tmp tUEqn - ( - fvm::div(phi, U) - + MRF.DDt(rho, U) - + turbulence->divDevTau(U) - == - fvModels.source(rho, U) - ); - fvVectorMatrix& UEqn = tUEqn.ref(); - - UEqn.relax(); - - fvConstraints.constrain(UEqn); - - solve(UEqn == -fvc::grad(p)); - - fvConstraints.constrain(U); diff --git a/applications/solvers/compressible/rhoSimpleFoam/createFieldRefs.H b/applications/solvers/compressible/rhoSimpleFoam/createFieldRefs.H deleted file mode 100644 index 502b3b4230..0000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/createFieldRefs.H +++ /dev/null @@ -1 +0,0 @@ -const volScalarField& psi = thermo.psi(); diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H deleted file mode 100644 index 8812504130..0000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ /dev/null @@ -1,141 +0,0 @@ -rho = thermo.rho(); -rho.relax(); - -const volScalarField rAU("rAU", 1.0/UEqn.A()); -const surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -tmp rAtU -( - simple.consistent() - ? volScalarField::New("rAtU", 1.0/(1.0/rAU - UEqn.H1())) - : tmp(nullptr) -); -tmp rhorAtUf -( - simple.consistent() - ? surfaceScalarField::New("rhoRAtUf", fvc::interpolate(rho*rAtU())) - : tmp(nullptr) -); - -const volScalarField& rAAtU = simple.consistent() ? rAtU() : rAU; -const surfaceScalarField& rhorAAtUf = - simple.consistent() ? rhorAtUf() : rhorAUf; - -volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); - -tUEqn.clear(); - -surfaceScalarField phiHbyA -( - "phiHbyA", - fvc::interpolate(rho)*fvc::flux(HbyA) -); - -MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - -bool closedVolume = false; - -// Update the pressure BCs to ensure flux consistency -constrainPressure(p, rho, U, phiHbyA, rhorAAtUf, MRF); - -if (simple.transonic()) -{ - const surfaceScalarField phid - ( - "phid", - fvc::interpolate(psi)*phiHbyA/fvc::interpolate(rho) - ); - - const fvScalarMatrix divPhidp(fvm::div(phid, p)); - phiHbyA -= divPhidp.flux(); - - if (simple.consistent()) - { - phiHbyA += (rhorAAtUf - rhorAUf)*fvc::snGrad(p)*mesh.magSf(); - HbyA += (rAAtU - rAU)*fvc::grad(p); - } - - while (simple.correctNonOrthogonal()) - { - fvScalarMatrix pEqn - ( - fvc::div(phiHbyA) + divPhidp - - fvm::laplacian(rhorAAtUf, p) - == - fvModels.source(psi, p, rho.name()) - ); - - // Relax the pressure equation to ensure diagonal-dominance - pEqn.relax(); - - pEqn.setReference - ( - pressureReference.refCell(), - pressureReference.refValue() - ); - - pEqn.solve(); - - if (simple.finalNonOrthogonalIter()) - { - phi = phiHbyA + pEqn.flux(); - } - } -} -else -{ - closedVolume = adjustPhi(phiHbyA, U, p); - - if (simple.consistent()) - { - phiHbyA += (rhorAAtUf - rhorAUf)*fvc::snGrad(p)*mesh.magSf(); - HbyA += (rAAtU - rAU)*fvc::grad(p); - } - - while (simple.correctNonOrthogonal()) - { - fvScalarMatrix pEqn - ( - fvc::div(phiHbyA) - - fvm::laplacian(rhorAAtUf, p) - == - fvModels.source(psi, p, rho.name()) - ); - - pEqn.setReference - ( - pressureReference.refCell(), - pressureReference.refValue() - ); - - pEqn.solve(); - - if (simple.finalNonOrthogonalIter()) - { - phi = phiHbyA + pEqn.flux(); - } - } -} - -#include "incompressible/continuityErrs.H" - -// Explicitly relax pressure for momentum corrector -p.relax(); - -U = HbyA - rAAtU*fvc::grad(p); -U.correctBoundaryConditions(); -fvConstraints.constrain(U); - -fvConstraints.constrain(p); - -// For closed-volume cases adjust the pressure and density levels -// to obey overall mass continuity -if (closedVolume && !thermo.incompressible()) -{ - p += (initialMass - fvc::domainIntegrate(psi*p)) - /fvc::domainIntegrate(psi); - p.correctBoundaryConditions(); -} - -rho = thermo.rho(); -rho.relax(); diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C deleted file mode 100644 index 40ca6a8f41..0000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C +++ /dev/null @@ -1,88 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Application - rhoSimpleFoam - -Description - Steady-state solver for turbulent flow of compressible fluids. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "fluidThermo.H" -#include "compressibleMomentumTransportModels.H" -#include "fluidThermophysicalTransportModel.H" -#include "simpleControl.H" -#include "pressureReference.H" -#include "fvModels.H" -#include "fvConstraints.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "postProcess.H" - - #include "setRootCaseLists.H" - #include "createTime.H" - #include "createMesh.H" - #include "createControl.H" - #include "createFields.H" - #include "createFieldRefs.H" - #include "initContinuityErrs.H" - - turbulence->validate(); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - Info<< "\nStarting time loop\n" << endl; - - while (simple.loop(runTime)) - { - Info<< "Time = " << runTime.userTimeName() << nl << endl; - - fvModels.correct(); - - // Pressure-velocity SIMPLE corrector - #include "UEqn.H" - #include "EEqn.H" - #include "pEqn.H" - - turbulence->correct(); - thermophysicalTransport->correct(); - - runTime.write(); - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/buoyantFoam/EEqn.H b/applications/solvers/heatTransfer/buoyantFoam/EEqn.H deleted file mode 100644 index 4fe0523821..0000000000 --- a/applications/solvers/heatTransfer/buoyantFoam/EEqn.H +++ /dev/null @@ -1,28 +0,0 @@ -{ - volScalarField& he = thermo.he(); - - fvScalarMatrix EEqn - ( - fvm::ddt(rho, he) + fvm::div(phi, he) - + fvc::ddt(rho, K) + fvc::div(phi, K) - + ( - he.name() == "e" - ? fvc::div(fvc::absolute(phi, rho, U), p/rho) - : -dpdt - ) - + thermophysicalTransport->divq(he) - == - rho*(U&g) - + fvModels.source(rho, he) - ); - - EEqn.relax(); - - fvConstraints.constrain(EEqn); - - EEqn.solve(); - - fvConstraints.constrain(he); - - thermo.correct(); -} diff --git a/applications/solvers/heatTransfer/buoyantFoam/Make/files b/applications/solvers/heatTransfer/buoyantFoam/Make/files deleted file mode 100644 index fccde862b2..0000000000 --- a/applications/solvers/heatTransfer/buoyantFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -buoyantFoam.C - -EXE = $(FOAM_APPBIN)/buoyantFoam diff --git a/applications/solvers/heatTransfer/buoyantFoam/Make/options b/applications/solvers/heatTransfer/buoyantFoam/Make/options deleted file mode 100644 index b62c3724d2..0000000000 --- a/applications/solvers/heatTransfer/buoyantFoam/Make/options +++ /dev/null @@ -1,24 +0,0 @@ -EXE_INC = \ - -I. \ - -I../../compressible/rhoPimpleFoam \ - -I$(LIB_SRC)/physicalProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ - -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ - -I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \ - -I$(LIB_SRC)/finiteVolume/cfdTools \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude - -EXE_LIBS = \ - -lfluidThermophysicalModels \ - -lspecie \ - -lmomentumTransportModels \ - -lcompressibleMomentumTransportModels \ - -lthermophysicalTransportModels \ - -lfiniteVolume \ - -lmeshTools \ - -lsampling \ - -lfvModels \ - -lfvConstraints diff --git a/applications/solvers/heatTransfer/buoyantFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantFoam/UEqn.H deleted file mode 100644 index bbec8ff24f..0000000000 --- a/applications/solvers/heatTransfer/buoyantFoam/UEqn.H +++ /dev/null @@ -1,36 +0,0 @@ - // Solve the Momentum equation - - MRF.correctBoundaryVelocity(U); - - tmp tUEqn - ( - fvm::ddt(rho, U) + fvm::div(phi, U) - + MRF.DDt(rho, U) - + turbulence->divDevTau(U) - == - fvModels.source(rho, U) - ); - fvVectorMatrix& UEqn = tUEqn.ref(); - - UEqn.relax(); - - fvConstraints.constrain(UEqn); - - if (pimple.momentumPredictor()) - { - solve - ( - UEqn - == - fvc::reconstruct - ( - ( - - ghf*fvc::snGrad(rho) - - fvc::snGrad(p_rgh) - )*mesh.magSf() - ) - ); - - fvConstraints.constrain(U); - K = 0.5*magSqr(U); - } diff --git a/applications/solvers/heatTransfer/buoyantFoam/buoyantFoam.C b/applications/solvers/heatTransfer/buoyantFoam/buoyantFoam.C deleted file mode 100644 index 56c12c0956..0000000000 --- a/applications/solvers/heatTransfer/buoyantFoam/buoyantFoam.C +++ /dev/null @@ -1,207 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Application - buoyantFoam - -Description - Solver for steady or transient buoyant, turbulent flow of compressible - fluids for ventilation and heat-transfer, with optional mesh motion and mesh - topology changes. - - Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and - pseudo-transient simulations. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "fluidThermo.H" -#include "compressibleMomentumTransportModels.H" -#include "fluidThermophysicalTransportModel.H" -#include "pimpleControl.H" -#include "pressureReference.H" -#include "hydrostaticInitialisation.H" -#include "CorrectPhi.H" -#include "fvModels.H" -#include "fvConstraints.H" -#include "localEulerDdtScheme.H" -#include "fvcSmooth.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "postProcess.H" - - #include "setRootCaseLists.H" - #include "createTime.H" - #include "createMesh.H" - #include "createDyMControls.H" - #include "initContinuityErrs.H" - #include "createFields.H" - #include "createFieldRefs.H" - #include "createRhoUfIfPresent.H" - - turbulence->validate(); - - if (!LTS) - { - #include "compressibleCourantNo.H" - #include "setInitialDeltaT.H" - } - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - Info<< "\nStarting time loop\n" << endl; - - while (pimple.run(runTime)) - { - #include "readDyMControls.H" - - // Store divrhoU from the previous mesh so that it can be mapped - // and used in correctPhi to ensure the corrected phi has the - // same divergence - autoPtr divrhoU; - if (correctPhi) - { - divrhoU = new volScalarField - ( - "divrhoU", - fvc::div(fvc::absolute(phi, rho, U)) - ); - } - - if (LTS) - { - #include "setRDeltaT.H" - } - else - { - #include "compressibleCourantNo.H" - #include "setDeltaT.H" - } - - fvModels.preUpdateMesh(); - - // Store momentum to set rhoUf for introduced faces. - autoPtr rhoU; - if (rhoUf.valid()) - { - rhoU = new volVectorField("rhoU", rho*U); - } - - // Update the mesh for topology change, mesh to mesh mapping - mesh.update(); - - runTime++; - - Info<< "Time = " << runTime.userTimeName() << nl << endl; - - // --- Pressure-velocity PIMPLE corrector loop - while (pimple.loop()) - { - if (!pimple.flow()) - { - if (pimple.models()) - { - fvModels.correct(); - } - - if (pimple.thermophysics()) - { - #include "EEqn.H" - } - } - else - { - if (pimple.firstPimpleIter() || moveMeshOuterCorrectors) - { - // Move the mesh - mesh.move(); - - if (mesh.changing()) - { - gh = (g & mesh.C()) - ghRef; - ghf = (g & mesh.Cf()) - ghRef; - - MRF.update(); - - if (correctPhi) - { - #include "correctPhi.H" - } - - if (checkMeshCourantNo) - { - #include "meshCourantNo.H" - } - } - } - - if (pimple.firstPimpleIter() && !pimple.simpleRho()) - { - #include "rhoEqn.H" - } - - if (pimple.models()) - { - fvModels.correct(); - } - - #include "UEqn.H" - - if (pimple.thermophysics()) - { - #include "EEqn.H" - } - - // --- Pressure corrector loop - while (pimple.correct()) - { - #include "pEqn.H" - } - - if (pimple.turbCorr()) - { - turbulence->correct(); - thermophysicalTransport->correct(); - } - } - } - - rho = thermo.rho(); - - runTime.write(); - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/buoyantFoam/correctPhi.H b/applications/solvers/heatTransfer/buoyantFoam/correctPhi.H deleted file mode 100644 index 6d61a1b1f5..0000000000 --- a/applications/solvers/heatTransfer/buoyantFoam/correctPhi.H +++ /dev/null @@ -1,19 +0,0 @@ -// Calculate absolute flux -// from the mapped surface velocity -phi = mesh.Sf() & rhoUf(); - -correctUphiBCs(rho, U, phi, true); - -CorrectPhi -( - phi, - p_rgh, - rho, - psi, - dimensionedScalar("rAUf", dimTime, 1), - divrhoU(), - pimple -); - -// Make the fluxes relative to the mesh-motion -fvc::makeRelative(phi, rho, U); diff --git a/applications/solvers/heatTransfer/buoyantFoam/createFieldRefs.H b/applications/solvers/heatTransfer/buoyantFoam/createFieldRefs.H deleted file mode 100644 index 502b3b4230..0000000000 --- a/applications/solvers/heatTransfer/buoyantFoam/createFieldRefs.H +++ /dev/null @@ -1 +0,0 @@ -const volScalarField& psi = thermo.psi(); diff --git a/applications/solvers/heatTransfer/buoyantFoam/createFields.H b/applications/solvers/heatTransfer/buoyantFoam/createFields.H deleted file mode 100644 index 3962547731..0000000000 --- a/applications/solvers/heatTransfer/buoyantFoam/createFields.H +++ /dev/null @@ -1,123 +0,0 @@ -#include "createRDeltaT.H" - -Info<< "Reading thermophysical properties\n" << endl; - -autoPtr pThermo(fluidThermo::New(mesh)); -fluidThermo& thermo = pThermo(); -thermo.validate(args.executable(), "h", "e"); - -volScalarField& p = thermo.p(); - -volScalarField rho -( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_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" - -Info<< "Creating turbulence model\n" << endl; -autoPtr turbulence -( - compressible::momentumTransportModel::New - ( - rho, - U, - phi, - thermo - ) -); - -Info<< "Creating thermophysical transport model\n" << endl; -autoPtr thermophysicalTransport -( - fluidThermophysicalTransportModel::New(turbulence(), thermo) -); - - -#include "readGravitationalAcceleration.H" -#include "readhRef.H" -#include "gh.H" -#include "readpRef.H" - - -Info<< "Reading field p_rgh\n" << endl; -volScalarField p_rgh -( - IOobject - ( - "p_rgh", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh -); - -pressureReference pressureReference -( - p, - p_rgh, - pimple.dict(), - thermo.incompressible() -); - -mesh.schemes().setFluxRequired(p_rgh.name()); - -hydrostaticInitialisation -( - p_rgh, - p, - rho, - U, - gh, - ghf, - pRef, - thermo, - pimple.dict() -); - -Info<< "Creating field dpdt\n" << endl; -volScalarField dpdt -( - IOobject - ( - "dpdt", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar(p.dimensions()/dimTime, 0) -); - -Info<< "Creating field kinetic energy K\n" << endl; -volScalarField K("K", 0.5*magSqr(U)); - -dimensionedScalar initialMass = fvc::domainIntegrate(rho); - -#include "createMRF.H" -#include "createFvModels.H" -#include "createFvConstraints.H" -#include "checkRadiationModel.H" diff --git a/applications/solvers/heatTransfer/buoyantFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantFoam/pEqn.H deleted file mode 100644 index 5a8487c9f7..0000000000 --- a/applications/solvers/heatTransfer/buoyantFoam/pEqn.H +++ /dev/null @@ -1,174 +0,0 @@ -rho = thermo.rho(); -rho.relax(); - -// Thermodynamic density needs to be updated by psi*d(p) after the -// pressure solution -const volScalarField psip0(psi*p); - -const volScalarField rAU("rAU", 1.0/UEqn.A()); -const surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); -volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); - -if (pimple.nCorrPiso() <= 1) -{ - tUEqn.clear(); -} - -surfaceScalarField phiHbyA -( - "phiHbyA", - fvc::interpolate(rho)*fvc::flux(HbyA) - + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf)) -); - -MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - -bool adjustMass = mesh.schemes().steady() && adjustPhi(phiHbyA, U, p_rgh); - -const surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); - -phiHbyA += phig; - -// Update the pressure BCs to ensure flux consistency -constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF); - -fvc::makeRelative(phiHbyA, rho, U); - -fvScalarMatrix p_rghEqn(p_rgh, dimMass/dimTime); - -if (pimple.transonic()) -{ - const surfaceScalarField phid - ( - "phid", - (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA - ); - - const fvScalarMatrix divPhidp(fvm::div(phid, p)); - phiHbyA -= divPhidp.flux(); - - fvScalarMatrix p_rghDDtEqn - ( - fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) - + fvc::div(phiHbyA) + divPhidp - == - fvModels.source(psi, p_rgh, rho.name()) - ); - - while (pimple.correctNonOrthogonal()) - { - p_rghEqn = p_rghDDtEqn - fvm::laplacian(rhorAUf, p_rgh); - - // Relax the pressure equation to ensure diagonal-dominance - p_rghEqn.relax(); - - p_rghEqn.setReference - ( - pressureReference.refCell(), - pressureReference.refValue() - ); - - p_rghEqn.solve(); - } -} -else -{ - fvScalarMatrix p_rghDDtEqn - ( - fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) - + fvc::div(phiHbyA) - == - fvModels.source(psi, p_rgh, rho.name()) - ); - - while (pimple.correctNonOrthogonal()) - { - p_rghEqn = p_rghDDtEqn - fvm::laplacian(rhorAUf, p_rgh); - - p_rghEqn.setReference - ( - pressureReference.refCell(), - pressureReference.refValue() - ); - - p_rghEqn.solve(); - } -} - -phi = phiHbyA + p_rghEqn.flux(); - -if (mesh.schemes().steady()) -{ - #include "incompressible/continuityErrs.H" -} -else -{ - p = p_rgh + rho*gh + pRef; - - const bool constrained = fvConstraints.constrain(p); - - // Thermodynamic density update - thermo.correctRho(psi*p - psip0); - - if (constrained) - { - rho = thermo.rho(); - } - - #include "rhoEqn.H" - #include "compressibleContinuityErrs.H" -} - -// Explicitly relax pressure for momentum corrector -p_rgh.relax(); - -p = p_rgh + rho*gh + pRef; - -// Correct the momentum source with the pressure gradient flux -// calculated from the relaxed pressure -U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf); -U.correctBoundaryConditions(); -fvConstraints.constrain(U); -K = 0.5*magSqr(U); - -if (mesh.schemes().steady()) -{ - if (fvConstraints.constrain(p)) - { - p_rgh = p - rho*gh - pRef; - p_rgh.correctBoundaryConditions(); - } -} - -// For steady closed-volume compressible cases adjust the pressure level -// to obey overall mass continuity -if (adjustMass && !thermo.incompressible()) -{ - p += (initialMass - fvc::domainIntegrate(thermo.rho())) - /fvc::domainIntegrate(psi); - p_rgh = p - rho*gh - pRef; - p_rgh.correctBoundaryConditions(); -} - -if (mesh.schemes().steady() || pimple.simpleRho() || adjustMass) -{ - rho = thermo.rho(); -} - -if (mesh.schemes().steady() || pimple.simpleRho()) -{ - rho.relax(); -} - -// Correct rhoUf if the mesh is moving -fvc::correctRhoUf(rhoUf, rho, U, phi, MRF); - -if (thermo.dpdt()) -{ - dpdt = fvc::ddt(p); - - if (mesh.moving()) - { - dpdt -= fvc::div(fvc::meshPhi(rho, U), p); - } -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/files b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/files deleted file mode 100644 index 522f90e3ef..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/files +++ /dev/null @@ -1,5 +0,0 @@ -fluid/compressibleCourantNo.C -solid/solidRegionDiffNo.C -chtMultiRegionFoam.C - -EXE = $(FOAM_APPBIN)/chtMultiRegionFoam diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options deleted file mode 100644 index 00c9e2a879..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options +++ /dev/null @@ -1,44 +0,0 @@ -EXE_INC = \ - -I. \ - -I./fluid \ - -I./solid \ - -I./porousFluid \ - -I./porousSolid \ - -I./include \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/finiteVolume/cfdTools \ - -I$(LIB_SRC)/physicalProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/multicomponentThermo/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ - -I$(LIB_SRC)/ODE/lnInclude \ - -I$(LIB_SRC)/combustionModels/lnInclude \ - -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ - -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ - -I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \ - -I$(LIB_SRC)/ThermophysicalTransportModels/fluidMulticomponentThermo/lnInclude \ - -I$(LIB_SRC)/regionModels/regionModel/lnInclude - - -EXE_LIBS = \ - -lfluidThermophysicalModels \ - -lspecie \ - -lmulticomponentThermophysicalModels \ - -lsolidThermo \ - -lchemistryModel \ - -lODE \ - -lcombustionModels \ - -lmomentumTransportModels \ - -lcompressibleMomentumTransportModels \ - -lthermophysicalTransportModels \ - -lfluidMulticomponentThermophysicalTransportModels \ - -lmeshTools \ - -lfiniteVolume \ - -lfvModels \ - -lfvConstraints \ - -lregionModels \ - -lsampling diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C deleted file mode 100644 index 0bc2102d4c..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C +++ /dev/null @@ -1,129 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Application - chtMultiRegionFoam - -Description - Solver for steady or transient fluid flow and solid heat conduction, with - conjugate heat transfer between regions, buoyancy effects, turbulence, - reactions and radiation modelling. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "compressibleMomentumTransportModels.H" -#include "fluidMulticomponentThermophysicalTransportModel.H" -#include "fluidMulticomponentThermo.H" -#include "combustionModel.H" -#include "fixedGradientFvPatchFields.H" -#include "regionProperties.H" -#include "compressibleCourantNo.H" -#include "solidRegionDiffNo.H" -#include "solidThermo.H" -#include "fvModels.H" -#include "fvConstraints.H" -#include "coordinateSystem.H" -#include "pimpleMultiRegionControl.H" -#include "pressureReference.H" -#include "hydrostaticInitialisation.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #define NO_CONTROL - #define CREATE_MESH createMeshesPostProcess.H - #include "postProcess.H" - - #include "setRootCaseLists.H" - #include "createTime.H" - #include "createMeshes.H" - pimpleMultiRegionControl pimples(fluidRegions, solidRegions); - #include "createFields.H" - #include "initContinuityErrs.H" - #include "createFluidPressureControls.H" - #include "createTimeControls.H" - #include "readSolidTimeControls.H" - #include "compressibleMultiRegionCourantNo.H" - #include "solidRegionDiffusionNo.H" - #include "setInitialMultiRegionDeltaT.H" - - while (pimples.run(runTime)) - { - #include "readTimeControls.H" - #include "readSolidTimeControls.H" - - #include "compressibleMultiRegionCourantNo.H" - #include "solidRegionDiffusionNo.H" - #include "setMultiRegionDeltaT.H" - - runTime++; - - Info<< "Time = " << runTime.userTimeName() << nl << endl; - - // Optional number of energy correctors - const int nEcorr = pimples.dict().lookupOrDefault - ( - "nEcorrectors", - 1 - ); - - // --- PIMPLE loop - while (pimples.loop()) - { - List> UEqns(fluidRegions.size()); - - for(int Ecorr=0; EcorrfvmDiv(phi, he) - : fvm::div(phi, he) - ) - + fvc::ddt(rho, K) + fvc::div(phi, K) - + ( - he.name() == "e" - ? mvConvection.valid() - ? mvConvection->fvcDiv(fvc::absolute(phi, rho, U), p/rho) - : fvc::div(fvc::absolute(phi, rho, U), p/rho) - : -dpdt - ) - + thermophysicalTransport.divq(he) - == - rho*(U&g) - + reaction.Qdot() - + fvModels.source(rho, he) - ); - - EEqn.relax(); - - fvConstraints.constrain(EEqn); - - EEqn.solve(); - - fvConstraints.constrain(he); - - thermo.correct(); - - Info<< "Min/max T:" << min(thermo.T()).value() << ' ' - << max(thermo.T()).value() << endl; -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H deleted file mode 100644 index f5cf1011d1..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H +++ /dev/null @@ -1,38 +0,0 @@ - // Solve the Momentum equation - - MRF.correctBoundaryVelocity(U); - - UEqns[i] = - ( - fvm::ddt(rho, U) + fvm::div(phi, U) - + MRF.DDt(rho, U) - + turbulence.divDevTau(U) - == - fvModels.source(rho, U) - ); - fvVectorMatrix& UEqn = UEqns[i].ref(); - - UEqn.relax(); - - fvConstraints.constrain(UEqn); - - if (pimple.momentumPredictor()) - { - solve - ( - UEqn - == - fvc::reconstruct - ( - ( - - ghf*fvc::snGrad(rho) - - fvc::snGrad(p_rgh) - )*mesh.magSf() - ) - ); - - fvConstraints.constrain(U); - K = 0.5*magSqr(U); - } - - fvConstraints.constrain(U); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/YEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/YEqn.H deleted file mode 100644 index 2c0e98c2a7..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/YEqn.H +++ /dev/null @@ -1,42 +0,0 @@ -if (Y.size()) -{ - mvConvection = tmp> - ( - fv::convectionScheme::New - ( - mesh, - fields, - phi, - mesh.schemes().div("div(phi,Yi_h)") - ) - ); -} - -reaction.correct(); - -forAll(Y, i) -{ - if (composition.solve(i)) - { - volScalarField& Yi = Y[i]; - - fvScalarMatrix YiEqn - ( - fvm::ddt(rho, Yi) + mvConvection->fvmDiv(phi, Yi) - + thermophysicalTransport.divj(Yi) - == - reaction.R(Yi) - + fvModels.source(rho, Yi) - ); - - YiEqn.relax(); - - fvConstraints.constrain(YiEqn); - - YiEqn.solve("Yi"); - - fvConstraints.constrain(Yi); - } -} - -composition.normalise(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.C deleted file mode 100644 index fc150ee7b8..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.C +++ /dev/null @@ -1,55 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "compressibleCourantNo.H" -#include "fvc.H" - -Foam::scalar Foam::compressibleCourantNo -( - const fvMesh& mesh, - const Time& runTime, - const volScalarField& rho, - const surfaceScalarField& phi -) -{ - scalarField sumPhi - ( - fvc::surfaceSum(mag(phi))().primitiveField() - / rho.primitiveField() - ); - - scalar CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); - - scalar meanCoNum = - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); - - Info<< "Region: " << mesh.name() << " Courant Number mean: " << meanCoNum - << " max: " << CoNum << endl; - - return CoNum; -} - - -// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H deleted file mode 100644 index 7af4be54df..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H +++ /dev/null @@ -1,16 +0,0 @@ - scalar CoNum = -great; - - forAll(fluidRegions, regionI) - { - CoNum = max - ( - compressibleCourantNo - ( - fluidRegions[regionI], - runTime, - rhoFluid[regionI], - phiFluid[regionI] - ), - CoNum - ); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H deleted file mode 100644 index f4377038e9..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H +++ /dev/null @@ -1,287 +0,0 @@ -// 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 hRefFluid(fluidRegions.size()); -PtrList pRefFluid(fluidRegions.size()); -PtrList ghFluid(fluidRegions.size()); -PtrList ghfFluid(fluidRegions.size()); -PtrList - turbulenceFluid(fluidRegions.size()); -PtrList - thermophysicalTransportFluid(fluidRegions.size()); -PtrList reactionFluid(fluidRegions.size()); -PtrList p_rghFluid(fluidRegions.size()); -PtrList KFluid(fluidRegions.size()); -PtrList dpdtFluid(fluidRegions.size()); -PtrList::fieldTable> - fieldsFluid(fluidRegions.size()); - -List initialMassFluid(fluidRegions.size()); - -PtrList MRFfluid(fluidRegions.size()); -PtrList fvModelsFluid(fluidRegions.size()); -PtrList fvConstraintsFluid(fluidRegions.size()); - -// Populate fluid field pointer lists -forAll(fluidRegions, i) -{ - Info<< "*** Reading fluid mesh thermophysical properties for region " - << fluidRegions[i].name() << nl << endl; - - Info<< " Adding to thermoFluid\n" << endl; - thermoFluid.set(i, fluidMulticomponentThermo::New(fluidRegions[i]).ptr()); - - Info<< " Adding to rhoFluid\n" << endl; - rhoFluid.set - ( - i, - new volScalarField - ( - IOobject - ( - "rho", - runTime.timeName(), - fluidRegions[i], - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - thermoFluid[i].rho() - ) - ); - - Info<< " Adding to UFluid\n" << endl; - UFluid.set - ( - i, - new volVectorField - ( - IOobject - ( - "U", - runTime.timeName(), - fluidRegions[i], - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - fluidRegions[i] - ) - ); - - Info<< " Adding to phiFluid\n" << endl; - phiFluid.set - ( - i, - new surfaceScalarField - ( - IOobject - ( - "phi", - runTime.timeName(), - fluidRegions[i], - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - linearInterpolate(rhoFluid[i]*UFluid[i]) - & fluidRegions[i].Sf() - ) - ); - - Info<< " Adding to gFluid\n" << endl; - gFluid.set - ( - i, - new uniformDimensionedVectorField - ( - IOobject - ( - "g", - runTime.constant(), - fluidRegions[i], - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ) - ); - - Info<< " Adding to hRefFluid\n" << endl; - hRefFluid.set - ( - i, - new uniformDimensionedScalarField - ( - IOobject - ( - "hRef", - runTime.constant(), - fluidRegions[i], - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE - ), - dimensionedScalar(dimLength, 0) - ) - ); - - 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]); - - Info<< " Adding to ghFluid\n" << endl; - ghFluid.set - ( - i, - new volScalarField - ( - "gh", - (gFluid[i] & fluidRegions[i].C()) - ghRef - ) - ); - - Info<< " Adding to ghfFluid\n" << endl; - ghfFluid.set - ( - i, - new surfaceScalarField - ( - "ghf", - (gFluid[i] & fluidRegions[i].Cf()) - ghRef - ) - ); - - Info<< " Adding to turbulenceFluid\n" << endl; - turbulenceFluid.set - ( - i, - compressible::momentumTransportModel::New - ( - rhoFluid[i], - UFluid[i], - phiFluid[i], - thermoFluid[i] - ).ptr() - ); - - Info<< " Adding to thermophysicalTransport\n" << endl; - thermophysicalTransportFluid.set - ( - i, - fluidMulticomponentThermophysicalTransportModel::New - ( - turbulenceFluid[i], - thermoFluid[i] - ).ptr() - ); - - Info<< " Adding to reactionFluid\n" << endl; - reactionFluid.set - ( - i, - combustionModel::New(thermoFluid[i], turbulenceFluid[i]) - ); - - p_rghFluid.set - ( - i, - new volScalarField - ( - IOobject - ( - "p_rgh", - runTime.timeName(), - fluidRegions[i], - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - fluidRegions[i] - ) - ); - - fluidRegions[i].schemes().setFluxRequired(p_rghFluid[i].name()); - - initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value(); - - Info<< " Adding to KFluid\n" << endl; - KFluid.set - ( - i, - new volScalarField - ( - "K", - 0.5*magSqr(UFluid[i]) - ) - ); - - Info<< " Adding to dpdtFluid\n" << endl; - dpdtFluid.set - ( - i, - new volScalarField - ( - IOobject - ( - "dpdt", - runTime.timeName(), - fluidRegions[i] - ), - fluidRegions[i], - dimensionedScalar - ( - thermoFluid[i].p().dimensions()/dimTime, - 0 - ) - ) - ); - - Info<< " Adding to fieldsFluid\n" << endl; - fieldsFluid.set - ( - i, - new multivariateSurfaceInterpolationScheme::fieldTable - ); - forAll(thermoFluid[i].composition().Y(), j) - { - fieldsFluid[i].add(thermoFluid[i].composition().Y()[j]); - } - fieldsFluid[i].add(thermoFluid[i].he()); - - Info<< " Adding MRF\n" << endl; - MRFfluid.set - ( - i, - new IOMRFZoneList(fluidRegions[i]) - ); - - Info<< " Adding fvModelsFluid\n" << endl; - fvModelsFluid.set - ( - i, - new Foam::fvModels(fluidRegions[i]) - ); - - Info<< " Adding fvConstraintsFluid\n" << endl; - fvConstraintsFluid.set - ( - i, - new fvConstraints(fluidRegions[i]) - ); - - turbulenceFluid[i].validate(); -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidMeshes.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidMeshes.H deleted file mode 100644 index 0e76c92caf..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidMeshes.H +++ /dev/null @@ -1,27 +0,0 @@ - const wordList fluidNames - ( - rp.found("fluid") ? rp["fluid"] : wordList(0) - ); - - PtrList fluidRegions(fluidNames.size()); - - forAll(fluidNames, i) - { - Info<< "Create fluid mesh for region " << fluidNames[i] - << " for time = " << runTime.timeName() << nl << endl; - - fluidRegions.set - ( - i, - new fvMesh - ( - IOobject - ( - fluidNames[i], - runTime.timeName(), - runTime, - IOobject::MUST_READ - ) - ) - ); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidPressureControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidPressureControls.H deleted file mode 100644 index 5c58bf8aef..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidPressureControls.H +++ /dev/null @@ -1,28 +0,0 @@ -PtrList pressureReferenceFluid(fluidRegions.size()); - -forAll(fluidRegions, i) -{ - pressureReferenceFluid.set - ( - i, - new pressureReference - ( - p_rghFluid[i], - pimples.pimple(i).dict(), - false - ) - ); - - hydrostaticInitialisation - ( - p_rghFluid[i], - thermoFluid[i].p(), - rhoFluid[i], - UFluid[i], - ghFluid[i], - ghfFluid[i], - pRefFluid[i], - thermoFluid[i], - pimples.pimple(i).dict() - ); -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/initContinuityErrs.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/initContinuityErrs.H deleted file mode 100644 index 354a85a03d..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/initContinuityErrs.H +++ /dev/null @@ -1 +0,0 @@ -List cumulativeContErrs(fluidRegions.size(), 0.0); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H deleted file mode 100644 index 61ea776a91..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H +++ /dev/null @@ -1,56 +0,0 @@ - const fvMesh& mesh = fluidRegions[i]; - - combustionModel& reaction = reactionFluid[i]; - - fluidMulticomponentThermo& thermo = thermoFluid[i]; - thermo.validate(args.executable(), "h", "e"); - - basicSpecieMixture& composition = thermo.composition(); - PtrList& Y = composition.Y(); - - volScalarField& rho = rhoFluid[i]; - volVectorField& U = UFluid[i]; - surfaceScalarField& phi = phiFluid[i]; - - compressible::momentumTransportModel& turbulence = turbulenceFluid[i]; - fluidMulticomponentThermophysicalTransportModel& thermophysicalTransport = - thermophysicalTransportFluid[i]; - - volScalarField& K = KFluid[i]; - volScalarField& dpdt = dpdtFluid[i]; - - volScalarField& p = thermo.p(); - const volScalarField& psi = thermo.psi(); - - volScalarField& p_rgh = p_rghFluid[i]; - - const dimensionedVector& g = gFluid[i]; - const dimensionedScalar& pRef = pRefFluid[i]; - const volScalarField& gh = ghFluid[i]; - const surfaceScalarField& ghf = ghfFluid[i]; - - multivariateSurfaceInterpolationScheme::fieldTable& fields = - fieldsFluid[i]; - - IOMRFZoneList& MRF = MRFfluid[i]; - Foam::fvModels& fvModels = fvModelsFluid[i]; - Foam::fvConstraints& fvConstraints = fvConstraintsFluid[i]; - - #include "checkRadiationModel.H" - - const dimensionedScalar initialMass - ( - "initialMass", - dimMass, - initialMassFluid[i] - ); - - pimpleNoLoopControl& pimple = pimples.pimple(i); - - pressureReference& pressureReference = pressureReferenceFluid[i]; - - scalar cumulativeContErr = cumulativeContErrs[i]; - - // This solver does not support moving mesh but it uses the pressure - // equation of one which does, so we need a dummy face-momentum field - autoPtr rhoUf(nullptr); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/solveFluid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/solveFluid.H deleted file mode 100644 index cdcd5641b9..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/solveFluid.H +++ /dev/null @@ -1,69 +0,0 @@ -if (!pimple.flow()) -{ - if (pimple.models()) - { - fvModels.correct(); - } - - if (pimple.thermophysics()) - { - tmp> mvConvection(nullptr); - - if (Ecorr == 0) - { - #include "YEqn.H" - } - #include "EEqn.H" - } -} -else -{ - if (Ecorr == 0) - { - if (!mesh.schemes().steady() && pimples.firstPimpleIter()) - { - #include "rhoEqn.H" - } - - if (pimple.models()) - { - fvModels.correct(); - } - - #include "UEqn.H" - } - - if (pimple.thermophysics()) - { - tmp> mvConvection(nullptr); - - if (Ecorr == 0) - { - #include "YEqn.H" - } - #include "EEqn.H" - } - - if (Ecorr == nEcorr - 1) - { - tmp& tUEqn = UEqns[i]; - fvVectorMatrix& UEqn = tUEqn.ref(); - - // --- PISO loop - while (pimple.correct()) - { - #include "../../buoyantFoam/pEqn.H" - } - - if (pimples.pimpleTurbCorr(i)) - { - turbulence.correct(); - thermophysicalTransport.correct(); - } - - if (!mesh.schemes().steady() && pimples.finalPimpleIter()) - { - rho = thermo.rho(); - } - } -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H deleted file mode 100644 index 27cd9cd51a..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H +++ /dev/null @@ -1,28 +0,0 @@ -// Initialise solid field pointer lists -PtrList thermoSolid(solidRegions.size()); -PtrList fvModelsSolid(solidRegions.size()); -PtrList fvConstraintsSolid(solidRegions.size()); - -// Populate solid field pointer lists -forAll(solidRegions, i) -{ - Info<< "*** Reading solid mesh thermophysical properties for region " - << solidRegions[i].name() << nl << endl; - - Info<< " Adding to thermoSolid\n" << endl; - thermoSolid.set(i, solidThermo::New(solidRegions[i])); - - Info<< " Adding to fvModelsSolid\n" << endl; - fvModelsSolid.set - ( - i, - new Foam::fvModels(solidRegions[i]) - ); - - Info<< " Adding fvConstraintsSolid\n" << endl; - fvConstraintsSolid.set - ( - i, - new fvConstraints(solidRegions[i]) - ); -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidMeshes.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidMeshes.H deleted file mode 100644 index bc08644911..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidMeshes.H +++ /dev/null @@ -1,32 +0,0 @@ - const wordList solidNames - ( - rp.found("solid") ? rp["solid"] : wordList(0) - ); - - PtrList solidRegions(solidNames.size()); - - forAll(solidNames, i) - { - Info<< "Create solid mesh for region " << solidNames[i] - << " for time = " << runTime.timeName() << nl << endl; - - solidRegions.set - ( - i, - new fvMesh - ( - IOobject - ( - solidNames[i], - runTime.timeName(), - runTime, - IOobject::MUST_READ - ) - ) - ); - - // Force calculation of geometric properties to prevent it being done - // later in e.g. some boundary evaluation - //(void)solidRegions[i].weights(); - //(void)solidRegions[i].deltaCoeffs(); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H deleted file mode 100644 index ca83f8058d..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H +++ /dev/null @@ -1,15 +0,0 @@ -const fvMesh& mesh = solidRegions[i]; - -solidThermo& thermo = thermoSolid[i]; - -tmp trho = thermo.rho(); -const volScalarField& rho = trho(); - -volScalarField& e = thermo.he(); - -const Foam::fvModels& fvModels = fvModelsSolid[i]; -Foam::fvConstraints& fvConstraints = fvConstraintsSolid[i]; - -#include "checkRadiationModel.H" - -solidNoLoopControl& pimple = pimples.solid(i); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffusionNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffusionNo.H deleted file mode 100644 index 7f818bc0ef..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffusionNo.H +++ /dev/null @@ -1,37 +0,0 @@ -scalar DiNum = -great; - -forAll(solidRegions, i) -{ - // Note: do not use setRegionSolidFields.H to avoid double registering Cp - //#include "setRegionSolidFields.H" - const solidThermo& thermo = thermoSolid[i]; - - tmp magKappa; - if (thermo.isotropic()) - { - magKappa = thermo.kappa(); - } - else - { - magKappa = mag(thermo.Kappa()); - } - - tmp tcp = thermo.Cp(); - const volScalarField& cp = tcp(); - - tmp trho = thermo.rho(); - const volScalarField& rho = trho(); - - DiNum = max - ( - solidRegionDiffNo - ( - solidRegions[i], - runTime, - rho*cp, - magKappa() - ), - DiNum - ); - -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H deleted file mode 100644 index 986d33a362..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H +++ /dev/null @@ -1,25 +0,0 @@ -{ - while (pimple.correctNonOrthogonal()) - { - fvScalarMatrix eEqn - ( - fvm::ddt(rho, e) - + thermo.divq(e) - == - fvModels.source(rho, e) - ); - - eEqn.relax(); - - fvConstraints.constrain(eEqn); - - eEqn.solve(); - - fvConstraints.constrain(e); - } -} - -thermo.correct(); - -Info<< "Min/max T:" << min(thermo.T()).value() << ' ' - << max(thermo.T()).value() << endl; diff --git a/applications/solvers/modules/fluid/Allwmake b/applications/solvers/modules/fluid/Allwmake new file mode 100755 index 0000000000..862d7ad45e --- /dev/null +++ b/applications/solvers/modules/fluid/Allwmake @@ -0,0 +1,11 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Parse arguments for library compilation +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments + +wmake $targetType isothermalFluid +wmake $targetType fluid +wmake $targetType multicomponentFluid + +#------------------------------------------------------------------------------ diff --git a/applications/solvers/modules/fluid/fluid/Make/files b/applications/solvers/modules/fluid/fluid/Make/files new file mode 100644 index 0000000000..4f4db2f07e --- /dev/null +++ b/applications/solvers/modules/fluid/fluid/Make/files @@ -0,0 +1,4 @@ +fluid.C +thermophysicalPredictor.C + +LIB = $(FOAM_LIBBIN)/libfluid diff --git a/applications/solvers/compressible/rhoPimpleFoam/Make/options b/applications/solvers/modules/fluid/fluid/Make/options similarity index 90% rename from applications/solvers/compressible/rhoPimpleFoam/Make/options rename to applications/solvers/modules/fluid/fluid/Make/options index b22cafd9a2..18ffe9c1e8 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/Make/options +++ b/applications/solvers/modules/fluid/fluid/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I../isothermalFluid/lnInclude \ -I$(LIB_SRC)/physicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ @@ -9,9 +10,9 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude -EXE_LIBS = \ +LIB_LIBS = \ + -lisothermalFluid \ -lfluidThermophysicalModels \ - -lspecie \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ -lthermophysicalTransportModels \ diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solidControl/solidNoLoopControl/solidNoLoopControl.C b/applications/solvers/modules/fluid/fluid/fluid.C similarity index 62% rename from src/finiteVolume/cfdTools/general/solutionControl/solidControl/solidNoLoopControl/solidNoLoopControl.C rename to applications/solvers/modules/fluid/fluid/fluid.C index c5eaf9fde2..ad6030be8f 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solidControl/solidNoLoopControl/solidNoLoopControl.C +++ b/applications/solvers/modules/fluid/fluid/fluid.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,61 +23,48 @@ License \*---------------------------------------------------------------------------*/ -#include "solidNoLoopControl.H" +#include "fluid.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(solidNoLoopControl, 0); +namespace solvers +{ + defineTypeNameAndDebug(fluid, 0); + addToRunTimeSelectionTable(solver, fluid, fvMesh); +} } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::solidNoLoopControl::solidNoLoopControl -( - fvMesh& mesh, - const word& algorithmName, - const pimpleLoop& loop -) +Foam::solvers::fluid::fluid(fvMesh& mesh) : - nonOrthogonalSolutionControl(mesh, algorithmName), - singleRegionConvergenceControl + isothermalFluid(mesh), + + thermophysicalTransport ( - static_cast(*this) - ), - singleRegionCorrectorConvergenceControl - ( - static_cast(*this), - "outerCorrector" - ), - loop_(loop) -{ - read(); -} + fluidThermophysicalTransportModel::New(turbulence(), thermo) + ) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::solidNoLoopControl::~solidNoLoopControl() +Foam::solvers::fluid::~fluid() {} // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -bool Foam::solidNoLoopControl::read() +void Foam::solvers::fluid::thermophysicalTransportCorrector() { - return - nonOrthogonalSolutionControl::read() - && readResidualControls() - && readCorrResidualControls(); -} - - -bool Foam::solidNoLoopControl::isFinal() const -{ - return loop_.finalPimpleIter() && finalNonOrthogonalIter(); + if (pimple.transportCorr()) + { + thermophysicalTransport->correct(); + } } diff --git a/applications/solvers/modules/fluid/fluid/fluid.H b/applications/solvers/modules/fluid/fluid/fluid.H new file mode 100644 index 0000000000..9a901ed937 --- /dev/null +++ b/applications/solvers/modules/fluid/fluid/fluid.H @@ -0,0 +1,122 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::solvers::fluid + +Description + Solver module for steady or transient turbulent flow of compressible fluids + with heat-transfer for HVAC and similar applications, with optional + mesh motion and mesh topology changes. + + Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and + pseudo-transient and steady simulations. + + Reference: + \verbatim + Greenshields, C. J., & Weller, H. G. (2022). + Notes on Computational Fluid Dynamics: General Principles. + CFD Direct Ltd.: Reading, UK. + \endverbatim + +SourceFiles + fluid.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fluid_H +#define fluid_H + +#include "isothermalFluid.H" +#include "fluidThermophysicalTransportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + +/*---------------------------------------------------------------------------*\ + Class fluid Declaration +\*---------------------------------------------------------------------------*/ + +class fluid +: + public isothermalFluid +{ + +protected: + + // Thermophysical transport + + autoPtr thermophysicalTransport; + + +public: + + //- Runtime type information + TypeName("fluid"); + + + // Constructors + + //- Construct from region mesh + fluid(fvMesh& mesh); + + //- Disallow default bitwise copy construction + fluid(const fluid&) = delete; + + + //- Destructor + virtual ~fluid(); + + + // Member Functions + + //- Construct and solve the energy equation, + // convert to temperature + // and update thermophysical and transport properties + virtual void thermophysicalPredictor(); + + //- Correct the thermophysical transport modelling + virtual void thermophysicalTransportCorrector(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const fluid&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solvers +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C b/applications/solvers/modules/fluid/fluid/thermophysicalPredictor.C similarity index 59% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C rename to applications/solvers/modules/fluid/fluid/thermophysicalPredictor.C index e57d982644..c558660a0b 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C +++ b/applications/solvers/modules/fluid/fluid/thermophysicalPredictor.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,34 +23,42 @@ License \*---------------------------------------------------------------------------*/ -#include "solidRegionDiffNo.H" -#include "surfaceInterpolate.H" +#include "fluid.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -Foam::scalar Foam::solidRegionDiffNo -( - const fvMesh& mesh, - const Time& runTime, - const volScalarField& Cprho, - const volScalarField& kappa -) +void Foam::solvers::fluid::thermophysicalPredictor() { - surfaceScalarField kapparhoCpbyDelta + volScalarField& he = thermo.he(); + + fvScalarMatrix EEqn ( - sqr(mesh.surfaceInterpolation::deltaCoeffs()) - *fvc::interpolate(kappa) - /fvc::interpolate(Cprho) + fvm::ddt(rho, he) + fvm::div(phi, he) + + fvc::ddt(rho, K) + fvc::div(phi, K) + + ( + he.name() == "e" + ? fvc::div(fvc::absolute(phi, rho, U), p/rho) + : -dpdt + ) + + thermophysicalTransport->divq(he) + == + ( + buoyancy.valid() + ? fvModels().source(rho, he) + rho*(U & buoyancy->g) + : fvModels().source(rho, he) + ) ); - const scalar DiNum = max(kapparhoCpbyDelta).value()*runTime.deltaTValue(); - const scalar meanDiNum = - average(kapparhoCpbyDelta).value()*runTime.deltaTValue(); + EEqn.relax(); - Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum - << " max: " << DiNum << endl; + fvConstraints().constrain(EEqn); - return DiNum; + EEqn.solve(); + + fvConstraints().constrain(he); + + thermo.correct(); } + // ************************************************************************* // diff --git a/applications/solvers/modules/fluid/isothermalFluid/Make/files b/applications/solvers/modules/fluid/isothermalFluid/Make/files new file mode 100644 index 0000000000..a210935ab0 --- /dev/null +++ b/applications/solvers/modules/fluid/isothermalFluid/Make/files @@ -0,0 +1,11 @@ +buoyancy/buoyancy.C +setRDeltaT.C +moveMesh.C +prePredictor.C +correctDensity.C +momentumPredictor.C +correctPressure.C +correctBuoyantPressure.C +isothermalFluid.C + +LIB = $(FOAM_LIBBIN)/libisothermalFluid diff --git a/applications/solvers/compressible/rhoSimpleFoam/Make/options b/applications/solvers/modules/fluid/isothermalFluid/Make/options similarity index 78% rename from applications/solvers/compressible/rhoSimpleFoam/Make/options rename to applications/solvers/modules/fluid/isothermalFluid/Make/options index 5703b6fa05..92c30a330b 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/Make/options +++ b/applications/solvers/modules/fluid/isothermalFluid/Make/options @@ -3,20 +3,16 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ - -I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \ -I$(LIB_SRC)/finiteVolume/cfdTools \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude -EXE_LIBS = \ +LIB_LIBS = \ -lfluidThermophysicalModels \ - -lspecie \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ - -lthermophysicalTransportModels \ -lfiniteVolume \ - -lsampling \ -lmeshTools \ + -lsampling \ -lfvModels \ -lfvConstraints diff --git a/applications/solvers/modules/fluid/isothermalFluid/buoyancy/buoyancy.C b/applications/solvers/modules/fluid/isothermalFluid/buoyancy/buoyancy.C new file mode 100644 index 0000000000..b4529198a2 --- /dev/null +++ b/applications/solvers/modules/fluid/isothermalFluid/buoyancy/buoyancy.C @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "buoyancy.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solvers::buoyancy::buoyancy(const fvMesh& mesh_) +: + mesh(mesh_), + + runTime(mesh.time()), + + g + ( + IOobject + ( + "g", + runTime.constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ), + + hRef + ( + IOobject + ( + "hRef", + runTime.constant(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + dimensionedScalar(dimLength, 0) + ), + + pRef + ( + IOobject + ( + "pRef", + runTime.constant(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + dimensionedScalar(dimPressure, 0) + ), + + ghRef(-mag(g)*hRef), + + gh("gh", (g & mesh.C()) - ghRef), + + ghf("ghf", (g & mesh.Cf()) - ghRef), + + p_rgh + ( + IOobject + ( + "p_rgh", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ) +{ + mesh.schemes().setFluxRequired(p_rgh.name()); +} + + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::solvers::buoyancy::New +( + const fvMesh& mesh +) +{ + return typeIOobject + ( + "p_rgh", + mesh.time().timeName(), + mesh, + IOobject::MUST_READ + ).headerOk() + ? autoPtr(new solvers::buoyancy(mesh)) + : autoPtr(nullptr); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::solvers::buoyancy::~buoyancy() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::buoyancy::moveMesh() +{ + gh = (g & mesh.C()) - ghRef; + ghf = (g & mesh.Cf()) - ghRef; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/isothermalFluid/buoyancy/buoyancy.H b/applications/solvers/modules/fluid/isothermalFluid/buoyancy/buoyancy.H new file mode 100644 index 0000000000..88d292abc7 --- /dev/null +++ b/applications/solvers/modules/fluid/isothermalFluid/buoyancy/buoyancy.H @@ -0,0 +1,146 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::solvers::buoyancy + +Description + Buoyancy related data for the Foam::solvers::isothermalFluid solver module + when solving buoyant cases with \c p_rgh and is selected based on the + presence of the \c p_rgh field file. + + Provides: + g : gravitational acceleration + hRef : optional reference height + pRef : optional reference pressure + ghRef : -mag(g)*hRef + gh : (g & h) - ghRef + ghf : (g & hf) - ghRef + p_rgh : p - rho*gh - pRef + + The \c Foam::solvers::buoyancy::New function returns an \c autoPtr + pointer containing either a \c buoyancy class pointer if the \c p_rgh field + file is available othewise a \c nullptr which can be checked using + the \c autoPtr::valid() member function. + +SourceFiles + buoyancy.C + +\*---------------------------------------------------------------------------*/ + +#ifndef buoyancy_H +#define buoyancy_H + +#include "fvMesh.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "uniformDimensionedFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + +/*---------------------------------------------------------------------------*\ + Class buoyancy Declaration +\*---------------------------------------------------------------------------*/ + +class buoyancy +{ + // Private member data + + const fvMesh& mesh; + + const Time& runTime; + + +public: + + // Thermophysical properties + + //- Gravitational acceleration + uniformDimensionedVectorField g; + + //- Reference height + uniformDimensionedScalarField hRef; + + //- Reference pressure + uniformDimensionedScalarField pRef; + + //- -mag(g)*hRef + dimensionedScalar ghRef; + + //- (g & h) - ghRef + volScalarField gh; + + //- (g & hf) - ghRef + surfaceScalarField ghf; + + //- Buoyant pressure p - rho*gh - pRef + volScalarField p_rgh; + + + // Constructors + + //- Construct from the region mesh + buoyancy(const fvMesh& mesh); + + //- Disallow default bitwise copy construction + buoyancy(const buoyancy&) = delete; + + + // Selectors + + //- Select, construct and return the buoyancy + static autoPtr New(const fvMesh& mesh); + + + //- Destructor + virtual ~buoyancy(); + + + // Member Functions + + //- Update gh and ghf following mesh-motion + void moveMesh(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const buoyancy&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solvers +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/isothermalFluid/correctBuoyantPressure.C b/applications/solvers/modules/fluid/isothermalFluid/correctBuoyantPressure.C new file mode 100644 index 0000000000..291831329e --- /dev/null +++ b/applications/solvers/modules/fluid/isothermalFluid/correctBuoyantPressure.C @@ -0,0 +1,262 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "isothermalFluid.H" +#include "constrainHbyA.H" +#include "constrainPressure.H" +#include "adjustPhi.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::isothermalFluid::correctBuoyantPressure() +{ + // Local references to the buoyancy paramaters + const volScalarField& gh = buoyancy->gh; + const surfaceScalarField& ghf = buoyancy->ghf; + const uniformDimensionedScalarField pRef = buoyancy->pRef; + + const volScalarField& psi = thermo.psi(); + rho = thermo.rho(); + rho.relax(); + + fvVectorMatrix& UEqn = tUEqn.ref(); + + // Thermodynamic density needs to be updated by psi*d(p) after the + // pressure solution + const volScalarField psip0(psi*p); + + const volScalarField rAU("rAU", 1.0/UEqn.A()); + const surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); + + tmp rAtU + ( + pimple.consistent() + ? volScalarField::New("rAtU", 1.0/(1.0/rAU - UEqn.H1())) + : tmp(nullptr) + ); + + tmp rhorAtUf + ( + pimple.consistent() + ? surfaceScalarField::New("rhoRAtUf", fvc::interpolate(rho*rAtU())) + : tmp(nullptr) + ); + + const volScalarField& rAAtU = pimple.consistent() ? rAtU() : rAU; + const surfaceScalarField& rhorAAtUf = + pimple.consistent() ? rhorAtUf() : rhorAUf; + + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); + + if (pimple.nCorrPiso() <= 1) + { + tUEqn.clear(); + } + + surfaceScalarField phiHbyA + ( + "phiHbyA", + fvc::interpolate(rho)*fvc::flux(HbyA) + + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf)) + ); + + MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + + const bool adjustMass = + mesh.schemes().steady() && adjustPhi(phiHbyA, U, p_rgh); + + const surfaceScalarField ghGradRhof(-ghf*fvc::snGrad(rho)*mesh.magSf()); + + phiHbyA += rhorAUf*ghGradRhof; + + tmp tp_rghEqn; + + if (pimple.transonic()) + { + const surfaceScalarField phid + ( + "phid", + (fvc::interpolate(psi)/fvc::interpolate(rho)) + *fvc::relative(phiHbyA, rho, U) + ); + + const fvScalarMatrix divPhidp(fvm::div(phid, p)); + phiHbyA -= divPhidp.flux(); + + if (pimple.consistent()) + { + const surfaceScalarField gradpf(fvc::snGrad(p_rgh)*mesh.magSf()); + phiHbyA += (rhorAAtUf - rhorAUf)*gradpf; + HbyA += (rAAtU - rAU)*fvc::reconstruct(gradpf - ghGradRhof); + } + + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, rho, U, phiHbyA, rhorAAtUf, MRF); + + fvc::makeRelative(phiHbyA, rho, U); + + fvScalarMatrix p_rghDDtEqn + ( + fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) + + fvc::div(phiHbyA) + divPhidp + == + fvModels().source(psi, p_rgh, rho.name()) + ); + + while (pimple.correctNonOrthogonal()) + { + tp_rghEqn = p_rghDDtEqn - fvm::laplacian(rhorAAtUf, p); + fvScalarMatrix& p_rghEqn = tp_rghEqn.ref(); + + // Relax the pressure equation to ensure diagonal-dominance + p_rghEqn.relax(); + + p_rghEqn.setReference + ( + pressureReference.refCell(), + pressureReference.refValue() + ); + + p_rghEqn.solve(); + } + } + else + { + if (pimple.consistent()) + { + const surfaceScalarField gradpf(fvc::snGrad(p_rgh)*mesh.magSf()); + phiHbyA += (rhorAAtUf - rhorAUf)*gradpf; + HbyA += (rAAtU - rAU)*fvc::reconstruct(gradpf - ghGradRhof); + } + + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, rho, U, phiHbyA, rhorAAtUf, MRF); + + fvc::makeRelative(phiHbyA, rho, U); + + fvScalarMatrix p_rghDDtEqn + ( + fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) + + fvc::div(phiHbyA) + == + fvModels().source(psi, p_rgh, rho.name()) + ); + + while (pimple.correctNonOrthogonal()) + { + tp_rghEqn = p_rghDDtEqn - fvm::laplacian(rhorAAtUf, p_rgh); + fvScalarMatrix& p_rghEqn = tp_rghEqn.ref(); + + p_rghEqn.setReference + ( + pressureReference.refCell(), + pressureReference.refValue() + ); + + p_rghEqn.solve(); + } + } + + const fvScalarMatrix& p_rghEqn = tp_rghEqn(); + + phi = phiHbyA + p_rghEqn.flux(); + + if (!mesh.schemes().steady()) + { + p = p_rgh + rho*gh + pRef; + + const bool constrained = fvConstraints().constrain(p); + + // Thermodynamic density update + thermo.correctRho(psi*p - psip0); + + if (constrained) + { + rho = thermo.rho(); + } + + correctDensity(); + } + + continuityErrors(); + + // Explicitly relax pressure for momentum corrector + p_rgh.relax(); + + p = p_rgh + rho*gh + pRef; + + // Correct the momentum source with the pressure gradient flux + // calculated from the relaxed pressure + U = HbyA + rAAtU*fvc::reconstruct((ghGradRhof + p_rghEqn.flux()/rhorAAtUf)); + U.correctBoundaryConditions(); + fvConstraints().constrain(U); + + K = 0.5*magSqr(U); + + if (mesh.schemes().steady()) + { + if (fvConstraints().constrain(p)) + { + p_rgh = p - rho*gh - pRef; + p_rgh.correctBoundaryConditions(); + } + } + + // For steady compressible closed-volume cases adjust the pressure level + // to obey overall mass continuity + if (adjustMass && !thermo.incompressible()) + { + p += (initialMass - fvc::domainIntegrate(thermo.rho())) + /fvc::domainIntegrate(psi); + p_rgh = p - rho*gh - pRef; + p_rgh.correctBoundaryConditions(); + } + + if (mesh.schemes().steady() || pimple.simpleRho() || adjustMass) + { + rho = thermo.rho(); + } + + // Correct rhoUf if the mesh is moving + fvc::correctRhoUf(rhoUf, rho, U, phi, MRF); + + if (mesh.schemes().steady() || pimple.simpleRho()) + { + rho.relax(); + } + + if (thermo.dpdt()) + { + dpdt = fvc::ddt(p); + + if (mesh.moving()) + { + dpdt -= fvc::div(fvc::meshPhi(rho, U), p); + } + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H b/applications/solvers/modules/fluid/isothermalFluid/correctDensity.C similarity index 73% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H rename to applications/solvers/modules/fluid/isothermalFluid/correctDensity.C index 3d5808db4d..f230651311 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H +++ b/applications/solvers/modules/fluid/isothermalFluid/correctDensity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,28 +21,27 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Description - Calculates and outputs the mean and maximum Diffusion Numbers for the solid - regions - \*---------------------------------------------------------------------------*/ -#ifndef solidRegionDiffNo_H -#define solidRegionDiffNo_H +#include "isothermalFluid.H" -#include "fvMesh.H" +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -namespace Foam +void Foam::solvers::isothermalFluid::correctDensity() { - scalar solidRegionDiffNo + fvScalarMatrix rhoEqn ( - const fvMesh& mesh, - const Time& runTime, - const volScalarField& Cprho, - const volScalarField& kappa + fvm::ddt(rho) + fvc::div(phi) + == + fvModels().source(rho) ); + + fvConstraints().constrain(rhoEqn); + + rhoEqn.solve(); + + fvConstraints().constrain(rho); } -#endif // ************************************************************************* // diff --git a/applications/solvers/modules/fluid/isothermalFluid/correctPressure.C b/applications/solvers/modules/fluid/isothermalFluid/correctPressure.C new file mode 100644 index 0000000000..8d39cd2e84 --- /dev/null +++ b/applications/solvers/modules/fluid/isothermalFluid/correctPressure.C @@ -0,0 +1,245 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "isothermalFluid.H" +#include "constrainHbyA.H" +#include "constrainPressure.H" +#include "adjustPhi.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::isothermalFluid::correctPressure() +{ + const volScalarField& psi = thermo.psi(); + rho = thermo.rho(); + rho.relax(); + + fvVectorMatrix& UEqn = tUEqn.ref(); + + // Thermodynamic density needs to be updated by psi*d(p) after the + // pressure solution + const volScalarField psip0(psi*p); + + const volScalarField rAU("rAU", 1.0/UEqn.A()); + const surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); + + tmp rAtU + ( + pimple.consistent() + ? volScalarField::New("rAtU", 1.0/(1.0/rAU - UEqn.H1())) + : tmp(nullptr) + ); + + tmp rhorAtUf + ( + pimple.consistent() + ? surfaceScalarField::New("rhoRAtUf", fvc::interpolate(rho*rAtU())) + : tmp(nullptr) + ); + + const volScalarField& rAAtU = pimple.consistent() ? rAtU() : rAU; + const surfaceScalarField& rhorAAtUf = + pimple.consistent() ? rhorAtUf() : rhorAUf; + + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); + + if (pimple.nCorrPiso() <= 1) + { + tUEqn.clear(); + } + + surfaceScalarField phiHbyA + ( + "phiHbyA", + fvc::interpolate(rho)*fvc::flux(HbyA) + + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf)) + ); + + MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + + bool adjustMass = false; + + if (pimple.transonic()) + { + const surfaceScalarField phid + ( + "phid", + (fvc::interpolate(psi)/fvc::interpolate(rho)) + *fvc::relative(phiHbyA, rho, U) + ); + + const fvScalarMatrix divPhidp(fvm::div(phid, p)); + phiHbyA -= divPhidp.flux(); + + if (pimple.consistent()) + { + phiHbyA += (rhorAAtUf - rhorAUf)*fvc::snGrad(p)*mesh.magSf(); + HbyA += (rAAtU - rAU)*fvc::grad(p); + } + + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, rho, U, phiHbyA, rhorAAtUf, MRF); + + fvc::makeRelative(phiHbyA, rho, U); + + fvScalarMatrix pDDtEqn + ( + fvc::ddt(rho) + psi*correction(fvm::ddt(p)) + + fvc::div(phiHbyA) + divPhidp + == + fvModels().source(psi, p, rho.name()) + ); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAAtUf, p)); + + // Relax the pressure equation to ensure diagonal-dominance + pEqn.relax(); + + pEqn.setReference + ( + pressureReference.refCell(), + pressureReference.refValue() + ); + + pEqn.solve(); + + if (pimple.finalNonOrthogonalIter()) + { + phi = phiHbyA + pEqn.flux(); + } + } + } + else + { + if (pimple.consistent()) + { + phiHbyA += (rhorAAtUf - rhorAUf)*fvc::snGrad(p)*mesh.magSf(); + HbyA += (rAAtU - rAU)*fvc::grad(p); + } + + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, rho, U, phiHbyA, rhorAAtUf, MRF); + + fvc::makeRelative(phiHbyA, rho, U); + + if (mesh.schemes().steady()) + { + adjustMass = adjustPhi(phiHbyA, U, p); + } + + fvScalarMatrix pDDtEqn + ( + fvc::ddt(rho) + psi*correction(fvm::ddt(p)) + + fvc::div(phiHbyA) + == + fvModels().source(psi, p, rho.name()) + ); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAAtUf, p)); + + pEqn.setReference + ( + pressureReference.refCell(), + pressureReference.refValue() + ); + + pEqn.solve(); + + if (pimple.finalNonOrthogonalIter()) + { + phi = phiHbyA + pEqn.flux(); + } + } + } + + if (!mesh.schemes().steady()) + { + const bool constrained = fvConstraints().constrain(p); + + // Thermodynamic density update + thermo.correctRho(psi*p - psip0); + + if (constrained) + { + rho = thermo.rho(); + } + + correctDensity(); + } + + continuityErrors(); + + // Explicitly relax pressure for momentum corrector + p.relax(); + + U = HbyA - rAAtU*fvc::grad(p); + U.correctBoundaryConditions(); + fvConstraints().constrain(U); + K = 0.5*magSqr(U); + + if (mesh.schemes().steady()) + { + fvConstraints().constrain(p); + } + + // For steady compressible closed-volume cases adjust the pressure level + // to obey overall mass continuity + if (adjustMass && !thermo.incompressible()) + { + p += (initialMass - fvc::domainIntegrate(thermo.rho())) + /fvc::domainIntegrate(psi); + p.correctBoundaryConditions(); + } + + if (mesh.schemes().steady() || pimple.simpleRho() || adjustMass) + { + rho = thermo.rho(); + } + + // Correct rhoUf if the mesh is moving + fvc::correctRhoUf(rhoUf, rho, U, phi, MRF); + + if (mesh.schemes().steady() || pimple.simpleRho()) + { + rho.relax(); + } + + if (thermo.dpdt()) + { + dpdt = fvc::ddt(p); + + if (mesh.moving()) + { + dpdt -= fvc::div(fvc::meshPhi(rho, U), p); + } + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/isothermalFluid/isothermalFluid.C b/applications/solvers/modules/fluid/isothermalFluid/isothermalFluid.C new file mode 100644 index 0000000000..d38daf98a0 --- /dev/null +++ b/applications/solvers/modules/fluid/isothermalFluid/isothermalFluid.C @@ -0,0 +1,412 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "isothermalFluid.H" +#include "localEulerDdtScheme.H" +#include "hydrostaticInitialisation.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + defineTypeNameAndDebug(isothermalFluid, 0); + addToRunTimeSelectionTable(solver, isothermalFluid, fvMesh); +} +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::solvers::isothermalFluid::read() +{ + maxCo = + runTime.controlDict().lookupOrDefault("maxCo", 1.0); + + maxDeltaT_ = + runTime.controlDict().lookupOrDefault("maxDeltaT", great); + + correctPhi = pimple.dict().lookupOrDefault + ( + "correctPhi", + correctPhi + ); + + checkMeshCourantNo = pimple.dict().lookupOrDefault + ( + "checkMeshCourantNo", + checkMeshCourantNo + ); + + moveMeshOuterCorrectors = pimple.dict().lookupOrDefault + ( + "moveMeshOuterCorrectors", + moveMeshOuterCorrectors + ); +} + + +void Foam::solvers::isothermalFluid::correctCoNum() +{ + const scalarField sumPhi + ( + fvc::surfaceSum(mag(phi))().primitiveField()/rho.primitiveField() + ); + + CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + + const scalar meanCoNum = + 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + + Info<< "Courant Number mean: " << meanCoNum + << " max: " << CoNum << endl; +} + + +void Foam::solvers::isothermalFluid::continuityErrors() +{ + scalar sumLocalContErr = 0; + scalar globalContErr = 0; + + if (mesh.schemes().steady()) + { + const volScalarField contErr(fvc::div(phi)); + + sumLocalContErr = + runTime.deltaTValue() + *mag(contErr)().weightedAverage(mesh.V()).value(); + + globalContErr = + runTime.deltaTValue() + *contErr.weightedAverage(mesh.V()).value(); + } + else + { + const dimensionedScalar totalMass = fvc::domainIntegrate(rho); + + sumLocalContErr = + (fvc::domainIntegrate(mag(rho - thermo.rho()))/totalMass).value(); + + globalContErr = + (fvc::domainIntegrate(rho - thermo.rho())/totalMass).value(); + } + + cumulativeContErr += globalContErr; + + Info<< "time step continuity errors : sum local = " << sumLocalContErr + << ", global = " << globalContErr + << ", cumulative = " << cumulativeContErr + << endl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solvers::isothermalFluid::isothermalFluid +( + fvMesh& mesh, + autoPtr thermoPtr +) +: + solver(mesh), + + thermo_(thermoPtr), + thermo(thermo_()), + + p(thermo.p()), + + rho + ( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + thermo.rho() + ), + + dpdt + ( + IOobject + ( + "dpdt", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar(p.dimensions()/dimTime, 0) + ), + + buoyancy(buoyancy::New(mesh)), + + p_rgh(buoyancy.valid() ? buoyancy->p_rgh : p), + + pressureReference + ( + p, + p_rgh, + pimple.dict(), + thermo.incompressible() + ), + + U + ( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ), + + phi + ( + IOobject + ( + "phi", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + linearInterpolate(rho*U) & mesh.Sf() + ), + + K("K", 0.5*magSqr(U)), + + turbulence + ( + compressible::momentumTransportModel::New + ( + rho, + U, + phi, + thermo + ) + ), + + initialMass(fvc::domainIntegrate(rho)), + + cumulativeContErr(0), + + MRF(mesh), + + CoNum(0) +{ + // Read the controls + read(); + + thermo.validate("isothermalFluid", "h", "e"); + mesh.schemes().setFluxRequired(p.name()); + turbulence->validate(); + + if (buoyancy.valid()) + { + hydrostaticInitialisation + ( + p_rgh, + p, + rho, + U, + buoyancy->gh, + buoyancy->ghf, + buoyancy->pRef, + thermo, + pimple.dict() + ); + } + + if (mesh.dynamic()) + { + Info<< "Constructing face momentum rhoUf" << endl; + + rhoUf = new surfaceVectorField + ( + IOobject + ( + "rhoUf", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + fvc::interpolate(rho*U) + ); + } + + if (transient()) + { + correctCoNum(); + } + else if (LTS) + { + Info<< "Using LTS" << endl; + + trDeltaT = tmp + ( + new volScalarField + ( + IOobject + ( + fv::localEulerDdt::rDeltaTName, + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar(dimless/dimTime, 1), + extrapolatedCalculatedFvPatchScalarField::typeName + ) + ); + } +} + + +Foam::solvers::isothermalFluid::isothermalFluid(fvMesh& mesh) +: + isothermalFluid(mesh, fluidThermo::New(mesh)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::solvers::isothermalFluid::~isothermalFluid() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::scalar Foam::solvers::isothermalFluid::maxDeltaT() const +{ + if (CoNum > small) + { + const scalar deltaT = maxCo*runTime.deltaTValue()/CoNum; + return min(min(deltaT, fvModels().maxDeltaT()), maxDeltaT_); + } + else + { + return runTime.deltaTValue(); + } +} + + +void Foam::solvers::isothermalFluid::preSolve() +{ + // Read the controls + read(); + + // Store divrhoU from the previous mesh so that it can be mapped + // and used in correctPhi to ensure the corrected phi has the + // same divergence + if (correctPhi) + { + divrhoU = new volScalarField + ( + "divrhoU", + fvc::div(fvc::absolute(phi, rho, U)) + ); + } + + fvModels().preUpdateMesh(); + + // Store momentum to set rhoUf for introduced faces + if (rhoUf.valid()) + { + rhoU = new volVectorField("rhoU", rho*U); + } + + // Update the mesh for topology change, mesh to mesh mapping + mesh.update(); + + if (transient()) + { + correctCoNum(); + } + else if (LTS) + { + setRDeltaT(); + } +} + + +void Foam::solvers::isothermalFluid::thermophysicalPredictor() +{ + thermo.correct(); +} + + +void Foam::solvers::isothermalFluid::pressureCorrector() +{ + while (pimple.correct()) + { + if (buoyancy.valid()) + { + correctBuoyantPressure(); + } + else + { + correctPressure(); + } + } + + tUEqn.clear(); +} + + +void Foam::solvers::isothermalFluid::momentumTransportCorrector() +{ + if (pimple.transportCorr()) + { + turbulence->correct(); + } +} + + +void Foam::solvers::isothermalFluid::thermophysicalTransportCorrector() +{} + + +void Foam::solvers::isothermalFluid::postSolve() +{ + rhoU.clear(); + divrhoU.clear(); + + if (!mesh.schemes().steady()) + { + rho = thermo.rho(); + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/isothermalFluid/isothermalFluid.H b/applications/solvers/modules/fluid/isothermalFluid/isothermalFluid.H new file mode 100644 index 0000000000..e7c8db2946 --- /dev/null +++ b/applications/solvers/modules/fluid/isothermalFluid/isothermalFluid.H @@ -0,0 +1,308 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::solvers::isothermalFluid + +Description + Solver module for steady or transient turbulent flow of compressible + isothermal fluids with optional mesh motion and mesh topology changes. + + Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and + pseudo-transient and steady simulations. + + Reference: + \verbatim + Greenshields, C. J., & Weller, H. G. (2022). + Notes on Computational Fluid Dynamics: General Principles. + CFD Direct Ltd.: Reading, UK. + \endverbatim + +SourceFiles + isothermalFluid.C + +\*---------------------------------------------------------------------------*/ + +#ifndef isothermalFluid_H +#define isothermalFluid_H + +#include "solver.H" +#include "fluidThermo.H" +#include "compressibleMomentumTransportModels.H" +#include "buoyancy.H" +#include "pressureReference.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + +/*---------------------------------------------------------------------------*\ + Class isothermalFluid Declaration +\*---------------------------------------------------------------------------*/ + +class isothermalFluid +: + public solver +{ + +protected: + + // Control parameters + + //- Maximum allowed Courant number + scalar maxCo; + + //- Maximum time-step + scalar maxDeltaT_; + + //- Switch to correct the flux after mesh change + bool correctPhi; + + //- Switch to check the mesh Courant number after mesh change + bool checkMeshCourantNo; + + //- Switch to move the mesh at the start of every PIMPLE outer corrected + // rather than the first corrector only which is the default + bool moveMeshOuterCorrectors; + + + // Thermophysical properties + + //- Pointer to the fluid thermophysical properties + autoPtr thermo_; + + //- Reference to the fluid thermophysical properties + fluidThermo& thermo; + + //- Reference to the pressure field + volScalarField& p; + + //- The continuity density field + volScalarField rho; + + //- Rate of change of the pressure + // Used in the enthalpy equation + volScalarField dpdt; + + + // Optional buoyancy + + //- Pointer to the optional buoyancy force + // Case is considered buoyant if the p_rgh field exists + autoPtr buoyancy; + + //- Reference to the buoyant pressure for buoyant cases + // otherwise to the pressure + volScalarField& p_rgh; + + + // Pressure reference + + //- Pressure reference + Foam::pressureReference pressureReference; + + + // Kinematic properties + + //- Velocity field + volVectorField U; + + //- Mass-flux field + surfaceScalarField phi; + + //- Kinetic energy field + // Used in the energy equation + volScalarField K; + + + // Momentum transport + + //- Pointer to the momentum transport model + autoPtr turbulence; + + + // Continuity properties + + //- Initial mass in the region + dimensionedScalar initialMass; + + //- Current cumulative continuity error + scalar cumulativeContErr; + + + // Optional models + + //- MRF zone list + IOMRFZoneList MRF; + + + // Time-step controls + + //- Current maximum Courant number + scalar CoNum; + + //- Current mean Courant number + scalar meanCoNum; + + + // Cached temporary fields + + //- Pointer to the surface momentum field + // used to recreate the flux after mesh-change + autoPtr rhoUf; + + //- Pointer to the vol momentum field + // used for mesh-change to set rhoUf for introduced faces + autoPtr rhoU; + + //- Pointer to the vol momentum divergence field + // used in correctPhi to ensure the corrected phi has the + // same divergence + autoPtr divrhoU; + + //- Optional LTS reciprocal time-step field + tmp trDeltaT; + + //- Cached momentum matrix + // shared between the momentum predictor and pressure corrector + tmp tUEqn; + + +private: + + // Private Member Data + + //- Pointer to the demand driven fvModels MeshObject + mutable Foam::fvModels* fvModelsPtr; + + //- Pointer to the demand driven fvConstraints MeshObject + mutable Foam::fvConstraints* fvConstraintsPtr; + + + // Private Member Functions + + //- Read controls + void read(); + + //- Set rDeltaT for LTS + virtual void setRDeltaT(); + + //- Correct the cached Courant numbers + void correctCoNum(); + + //- Check mesh Courant numbers for moving mesh cases + void meshCourantNo() const; + + //- Calculate and print the continuity errors + void continuityErrors(); + + //- Construct the continuity equation and correct the density + void correctDensity(); + + //- Construct the pressure equation + // and correct the pressure and velocity + void correctPressure(); + + //- Construct the buoyant pressure equation + // and correct the pressure and velocity + void correctBuoyantPressure(); + + +public: + + //- Runtime type information + TypeName("isothermalFluid"); + + + // Constructors + + //- Construct from region mesh and thermophysical properties + isothermalFluid(fvMesh& mesh, autoPtr); + + //- Construct from region mesh + isothermalFluid(fvMesh& mesh); + + //- Disallow default bitwise copy construction + isothermalFluid(const isothermalFluid&) = delete; + + + //- Destructor + virtual ~isothermalFluid(); + + + // Member Functions + + //- Return the current maximum time-step for stable solution + virtual scalar maxDeltaT() const; + + //- Called at the start of the time-step, before the PIMPLE loop + virtual void preSolve(); + + //- Called at the start of the PIMPLE loop to move the mesh + virtual bool moveMesh(); + + //- Called at the start of the PIMPLE loop + virtual void prePredictor(); + + //- Construct and optionally solve the momentum equation + virtual void momentumPredictor(); + + //- Construct and solve the energy equation, + // convert to temperature + // and update thermophysical and transport properties + virtual void thermophysicalPredictor(); + + //- Construct and solve the pressure equation in the PISO loop + virtual void pressureCorrector(); + + //- Correct the momentum transport modelling + // Newtonian, non-Newtonian or turbulent + virtual void momentumTransportCorrector(); + + //- Correct the thermophysical transport modelling + virtual void thermophysicalTransportCorrector(); + + //- Called after the PIMPLE loop at the end of the time-step + virtual void postSolve(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const isothermalFluid&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solvers +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H b/applications/solvers/modules/fluid/isothermalFluid/momentumPredictor.C similarity index 55% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H rename to applications/solvers/modules/fluid/isothermalFluid/momentumPredictor.C index 3e9df5aa01..967b761fe5 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H +++ b/applications/solvers/modules/fluid/isothermalFluid/momentumPredictor.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,38 +21,56 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Global - setInitialMultiRegionDeltaT - -Description - Set the initial timestep for the CHT MultiRegion solver. - \*---------------------------------------------------------------------------*/ -if (adjustTimeStep) +#include "isothermalFluid.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::isothermalFluid::momentumPredictor() { - if ((runTime.timeIndex() == 0) && ((CoNum > small) || (DiNum > small))) + MRF.correctBoundaryVelocity(U); + + tUEqn = + ( + fvm::ddt(rho, U) + fvm::div(phi, U) + + MRF.DDt(rho, U) + + turbulence->divDevTau(U) + == + fvModels().source(rho, U) + ); + fvVectorMatrix& UEqn = tUEqn.ref(); + + UEqn.relax(); + + fvConstraints().constrain(UEqn); + + if (pimple.momentumPredictor()) { - if (CoNum < small) + if (buoyancy.valid()) { - CoNum = small; - } - - if (DiNum < small) - { - DiNum = small; - } - - runTime.setDeltaT - ( - min + solve ( - min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaT().value(), - min(runTime.deltaTValue(), maxDeltaT) - ) - ); - Info<< "deltaT = " << runTime.deltaT().value() << endl; + UEqn + == + fvc::reconstruct + ( + ( + - buoyancy->ghf*fvc::snGrad(rho) + - fvc::snGrad(p_rgh) + )*mesh.magSf() + ) + ); + } + else + { + solve(UEqn == -fvc::grad(p)); + } + + fvConstraints().constrain(U); + K = 0.5*magSqr(U); } } + // ************************************************************************* // diff --git a/applications/solvers/modules/fluid/isothermalFluid/moveMesh.C b/applications/solvers/modules/fluid/isothermalFluid/moveMesh.C new file mode 100644 index 0000000000..3296e56804 --- /dev/null +++ b/applications/solvers/modules/fluid/isothermalFluid/moveMesh.C @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "isothermalFluid.H" +#include "CorrectPhi.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::isothermalFluid::meshCourantNo() const +{ + if (checkMeshCourantNo) + { + const scalarField sumPhi + ( + fvc::surfaceSum(mag(mesh.phi()))().primitiveField() + ); + + const scalar meshCoNum + ( + 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue() + ); + + const scalar meanMeshCoNum + ( + 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue() + ); + + Info<< "Mesh Courant Number mean: " << meanMeshCoNum + << " max: " << meshCoNum << endl; + } +} + + +bool Foam::solvers::isothermalFluid::moveMesh() +{ + if (pimple.firstIter() || moveMeshOuterCorrectors) + { + // Move the mesh + mesh.move(); + + if (mesh.changing()) + { + if (buoyancy.valid()) + { + buoyancy->moveMesh(); + } + + MRF.update(); + + if (correctPhi) + { + // Calculate absolute flux + // from the mapped surface velocity + phi = mesh.Sf() & rhoUf(); + + correctUphiBCs(rho, U, phi, true); + + CorrectPhi + ( + phi, + p, + rho, + thermo.psi(), + dimensionedScalar("rAUf", dimTime, 1), + divrhoU(), + pimple + ); + + // Make the fluxes relative to the mesh-motion + fvc::makeRelative(phi, rho, U); + } + + meshCourantNo(); + + return true; + } + } + + return false; +} + + +// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/readSolidTimeControls.H b/applications/solvers/modules/fluid/isothermalFluid/prePredictor.C similarity index 73% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/solid/readSolidTimeControls.H rename to applications/solvers/modules/fluid/isothermalFluid/prePredictor.C index 069fe95c72..73448d4bf4 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/readSolidTimeControls.H +++ b/applications/solvers/modules/fluid/isothermalFluid/prePredictor.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,14 +21,27 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Global - readSolidTimeControls - -Description - Read the control parameters used in the solid - \*---------------------------------------------------------------------------*/ -scalar maxDi = runTime.controlDict().lookupOrDefault("maxDi", 10.0); +#include "isothermalFluid.H" +#include "CorrectPhi.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::isothermalFluid::prePredictor() +{ + if + ( + !mesh.schemes().steady() + && !pimple.simpleRho() + && pimple.firstIter() + ) + { + correctDensity(); + } + + fvModels().correct(); +} + // ************************************************************************* // diff --git a/applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H b/applications/solvers/modules/fluid/isothermalFluid/setRDeltaT.C similarity index 62% rename from applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H rename to applications/solvers/modules/fluid/isothermalFluid/setRDeltaT.C index 44ef88e34b..d73082b835 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H +++ b/applications/solvers/modules/fluid/isothermalFluid/setRDeltaT.C @@ -1,4 +1,37 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "isothermalFluid.H" +#include "fvcSmooth.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::solvers::isothermalFluid::setRDeltaT() { + const volScalarField& psi = thermo.psi(); + volScalarField& rDeltaT = trDeltaT.ref(); const dictionary& pimpleDict = pimple.dict(); @@ -94,3 +127,6 @@ << ", " << gMax(1/rDeltaT.primitiveField()) << endl; } } + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multicomponentFluid/Make/files b/applications/solvers/modules/fluid/multicomponentFluid/Make/files new file mode 100644 index 0000000000..9d2d2dbb1c --- /dev/null +++ b/applications/solvers/modules/fluid/multicomponentFluid/Make/files @@ -0,0 +1,5 @@ +multicomponentFluid.C +setRDeltaT.C +thermophysicalPredictor.C + +LIB = $(FOAM_LIBBIN)/libmulticomponentFluid diff --git a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/Make/options b/applications/solvers/modules/fluid/multicomponentFluid/Make/options similarity index 94% rename from applications/solvers/combustion/reactingFoam/buoyantReactingFoam/Make/options rename to applications/solvers/modules/fluid/multicomponentFluid/Make/options index 8cda90cc2b..fe4e0fabc3 100644 --- a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/Make/options +++ b/applications/solvers/modules/fluid/multicomponentFluid/Make/options @@ -1,6 +1,5 @@ EXE_INC = \ - -I. \ - -I$(FOAM_SOLVERS)/combustion/reactingFoam \ + -I../isothermalFluid/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ -I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \ @@ -12,22 +11,23 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/combustionModels/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/cfdTools \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude -EXE_LIBS = \ +LIB_LIBS = \ + -lisothermalFluid \ + -lfluidThermophysicalModels \ + -lspecie \ + -lchemistryModel \ + -lODE \ + -lcombustionModels \ + -lmulticomponentThermophysicalModels \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ -lthermophysicalTransportModels \ -lfluidMulticomponentThermophysicalTransportModels \ - -lmulticomponentThermophysicalModels \ - -lspecie \ - -lfluidThermophysicalModels \ - -lchemistryModel \ - -lODE \ - -lcombustionModels \ -lfiniteVolume \ -lfvModels \ -lfvConstraints \ diff --git a/applications/solvers/modules/fluid/multicomponentFluid/multicomponentFluid.C b/applications/solvers/modules/fluid/multicomponentFluid/multicomponentFluid.C new file mode 100644 index 0000000000..5af25e7721 --- /dev/null +++ b/applications/solvers/modules/fluid/multicomponentFluid/multicomponentFluid.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "multicomponentFluid.H" +#include "localEulerDdtScheme.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + defineTypeNameAndDebug(multicomponentFluid, 0); + addToRunTimeSelectionTable(solver, multicomponentFluid, fvMesh); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solvers::multicomponentFluid::multicomponentFluid(fvMesh& mesh) +: + isothermalFluid + ( + mesh, + autoPtr(fluidMulticomponentThermo::New(mesh).ptr()) + ), + + thermo(refCast(isothermalFluid::thermo)), + + composition(thermo.composition()), + + Y(composition.Y()), + + reaction(combustionModel::New(thermo, turbulence())), + + thermophysicalTransport + ( + fluidMulticomponentThermophysicalTransportModel::New + ( + turbulence(), + thermo + ) + ) +{ + forAll(Y, i) + { + fields.add(Y[i]); + } + fields.add(thermo.he()); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::solvers::multicomponentFluid::~multicomponentFluid() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::multicomponentFluid::thermophysicalTransportCorrector() +{ + if (pimple.transportCorr()) + { + thermophysicalTransport->correct(); + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multicomponentFluid/multicomponentFluid.H b/applications/solvers/modules/fluid/multicomponentFluid/multicomponentFluid.H new file mode 100644 index 0000000000..09d0f9c8d4 --- /dev/null +++ b/applications/solvers/modules/fluid/multicomponentFluid/multicomponentFluid.H @@ -0,0 +1,143 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::solvers::multicomponentFluid + +Description + Solver module for steady or transient turbulent flow of compressible + reacting fluids with optional mesh motion and mesh topology changes. + + Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and + pseudo-transient and steady simulations. + + Reference: + \verbatim + Greenshields, C. J., & Weller, H. G. (2022). + Notes on Computational Fluid Dynamics: General Principles. + CFD Direct Ltd.: Reading, UK. + \endverbatim + +SourceFiles + multicomponentFluid.C + +\*---------------------------------------------------------------------------*/ + +#ifndef multicomponentFluid_H +#define multicomponentFluid_H + +#include "isothermalFluid.H" +#include "fluidMulticomponentThermo.H" +#include "combustionModel.H" +#include "fluidMulticomponentThermophysicalTransportModel.H" +#include "multivariateScheme.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + +/*---------------------------------------------------------------------------*\ + Class multicomponentFluid Declaration +\*---------------------------------------------------------------------------*/ + +class multicomponentFluid +: + public isothermalFluid +{ + +protected: + + // Compositon + + fluidMulticomponentThermo& thermo; + + basicSpecieMixture& composition; + PtrList& Y; + autoPtr reaction; + multivariateSurfaceInterpolationScheme::fieldTable fields; + + + // Thermophysical transport + + autoPtr + thermophysicalTransport; + + +private: + + // Private Member Functions + + //- Set rDeltaT for LTS + virtual void setRDeltaT(); + + +public: + + //- Runtime type information + TypeName("multicomponentFluid"); + + + // Constructors + + //- Construct from region mesh + multicomponentFluid(fvMesh& mesh); + + //- Disallow default bitwise copy construction + multicomponentFluid(const multicomponentFluid&) = delete; + + + //- Destructor + virtual ~multicomponentFluid(); + + + // Member Functions + + //- Construct and solve the energy equation, + // convert to temperature + // and update thermophysical and transport properties + virtual void thermophysicalPredictor(); + + //- Correct the thermophysical transport modelling + virtual void thermophysicalTransportCorrector(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const multicomponentFluid&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solvers +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/combustion/reactingFoam/setRDeltaT.H b/applications/solvers/modules/fluid/multicomponentFluid/setRDeltaT.C similarity index 93% rename from applications/solvers/combustion/reactingFoam/setRDeltaT.H rename to applications/solvers/modules/fluid/multicomponentFluid/setRDeltaT.C index 7e806d0997..62155be612 100644 --- a/applications/solvers/combustion/reactingFoam/setRDeltaT.H +++ b/applications/solvers/modules/fluid/multicomponentFluid/setRDeltaT.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,6 +23,12 @@ License \*---------------------------------------------------------------------------*/ +#include "multicomponentFluid.H" +#include "fvcSmooth.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::solvers::multicomponentFluid::setRDeltaT() { volScalarField& rDeltaT = trDeltaT.ref(); @@ -70,7 +76,7 @@ License { volScalarField::Internal rDeltaTT ( - mag(reaction->Qdot())/(alphaTemp*rho*thermo.Cp()*T) + mag(reaction->Qdot())/(alphaTemp*rho*thermo.Cp()*thermo.T()) ); Info<< " Temperature = " @@ -137,7 +143,7 @@ License } else { - IOWarningIn(args.executable().c_str(), Yref) + WarningInFunction << "Cannot find any active species in Yref " << Yref << endl; } diff --git a/applications/solvers/modules/fluid/multicomponentFluid/thermophysicalPredictor.C b/applications/solvers/modules/fluid/multicomponentFluid/thermophysicalPredictor.C new file mode 100644 index 0000000000..778ef2173c --- /dev/null +++ b/applications/solvers/modules/fluid/multicomponentFluid/thermophysicalPredictor.C @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "multicomponentFluid.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::multicomponentFluid::thermophysicalPredictor() +{ + tmp> mvConvection + ( + fv::convectionScheme::New + ( + mesh, + fields, + phi, + mesh.schemes().div("div(phi,Yi_h)") + ) + ); + + reaction->correct(); + + forAll(Y, i) + { + if (composition.solve(i)) + { + volScalarField& Yi = Y[i]; + + fvScalarMatrix YiEqn + ( + fvm::ddt(rho, Yi) + + mvConvection->fvmDiv(phi, Yi) + + thermophysicalTransport->divj(Yi) + == + reaction->R(Yi) + + fvModels().source(rho, Yi) + ); + + YiEqn.relax(); + + fvConstraints().constrain(YiEqn); + + YiEqn.solve("Yi"); + + fvConstraints().constrain(Yi); + } + } + + composition.normalise(); + + + volScalarField& he = thermo.he(); + + fvScalarMatrix EEqn + ( + fvm::ddt(rho, he) + mvConvection->fvmDiv(phi, he) + + fvc::ddt(rho, K) + fvc::div(phi, K) + + ( + he.name() == "e" + ? mvConvection->fvcDiv(fvc::absolute(phi, rho, U), p/rho) + : -dpdt + ) + + thermophysicalTransport->divq(he) + == + reaction->Qdot() + + ( + buoyancy.valid() + ? fvModels().source(rho, he) + rho*(U & buoyancy->g) + : fvModels().source(rho, he) + ) + ); + + EEqn.relax(); + + fvConstraints().constrain(EEqn); + + EEqn.solve(); + + fvConstraints().constrain(he); + + thermo.correct(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/foamMultiRun/Make/files b/applications/solvers/modules/foamMultiRun/Make/files new file mode 100644 index 0000000000..4f076b3cdc --- /dev/null +++ b/applications/solvers/modules/foamMultiRun/Make/files @@ -0,0 +1,5 @@ +regionSolvers/regionSolvers.C +setDeltaT.C +foamMultiRun.C + +EXE = $(FOAM_APPBIN)/foamMultiRun diff --git a/applications/solvers/modules/foamMultiRun/Make/options b/applications/solvers/modules/foamMultiRun/Make/options new file mode 100644 index 0000000000..95ae640b5a --- /dev/null +++ b/applications/solvers/modules/foamMultiRun/Make/options @@ -0,0 +1,6 @@ +EXE_INC = \ + -IregionSolvers \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +EXE_LIBS = \ + -lfiniteVolume diff --git a/applications/solvers/modules/foamMultiRun/foamMultiRun.C b/applications/solvers/modules/foamMultiRun/foamMultiRun.C new file mode 100644 index 0000000000..1105fdb0ec --- /dev/null +++ b/applications/solvers/modules/foamMultiRun/foamMultiRun.C @@ -0,0 +1,209 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Application + foamMultiRun + +Description + Loads and executes an OpenFOAM solver modules for each region of a + multiregion simulation e.g. for conjugate heat transfer. + + The region solvers are specified in the \c regionSolvers dictionary entry in + \c controlDict, containing a list of pairs of region and solver names, + e.g. for a two region case with one fluid region named + liquid and one solid region named tubeWall: + \verbatim + regionSolvers + { + liquid fluid; + tubeWall solid; + } + \endverbatim + + The \c regionSolvers entry is a dictionary to support name substitutions to + simplify the specification of a single solver type for a set of + regions, e.g. + \verbatim + fluidSolver fluid; + solidSolver solid; + + regionSolvers + { + tube1 $fluidSolver; + tubeWall1 solid; + tube2 $fluidSolver; + tubeWall2 solid; + tube3 $fluidSolver; + tubeWall3 solid; + } + \endverbatim + + Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and + pseudo-transient and steady simulations. + +Usage + \b foamMultiRun [OPTION] + + - \par -libs '(\"lib1.so\" ... \"libN.so\")' + Specify the additional libraries loaded + + Example usage: + - To update and run a \c chtMultiRegion case add the following entries to + the controlDict: + \verbatim + application foamMultiRun; + + regionSolvers + { + fluid fluid; + solid solid; + } + \endverbatim + then execute \c foamMultiRun + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "solver.H" +#include "regionSolvers.H" +#include "pimpleMultiRegionControl.H" +#include "setDeltaT.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + + regionSolvers regionSolvers(runTime); + PtrList regions(regionSolvers.size()); + PtrList solvers(regionSolvers.size()); + + forAll(regionSolvers, i) + { + regions.set + ( + i, + new fvMesh + ( + IOobject + ( + regionSolvers[i].first(), + runTime.timeName(), + runTime, + IOobject::MUST_READ + ) + ) + ); + + solvers.set + ( + i, + solver::New(regionSolvers[i].second(), regions[i]) + ); + } + + // Create the outer PIMPLE loop and control structure + pimpleMultiRegionControl pimple(runTime, solvers); + + // Set the initial time-step + setDeltaT(runTime, solvers); + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (pimple.run(runTime)) + { + forAll(solvers, i) + { + solvers[i].preSolve(); + } + + // Adjust the time-step according to the solver maxDeltaT + adjustDeltaT(runTime, solvers); + + runTime++; + + Info<< "Time = " << runTime.userTimeName() << nl << endl; + + // Multi-region PIMPLE corrector loop + while (pimple.loop()) + { + forAll(solvers, i) + { + solvers[i].moveMesh(); + } + + forAll(solvers, i) + { + solvers[i].prePredictor(); + } + + forAll(solvers, i) + { + solvers[i].momentumPredictor(); + } + + while (pimple.correctEnergy()) + { + forAll(solvers, i) + { + solvers[i].thermophysicalPredictor(); + } + } + + forAll(solvers, i) + { + solvers[i].pressureCorrector(); + } + + forAll(solvers, i) + { + solvers[i].momentumTransportCorrector(); + solvers[i].thermophysicalTransportCorrector(); + } + } + + forAll(solvers, i) + { + solvers[i].postSolve(); + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionProperties/regionProperties.C b/applications/solvers/modules/foamMultiRun/regionSolvers/regionSolvers.C similarity index 51% rename from src/regionModels/regionModel/regionProperties/regionProperties.C rename to applications/solvers/modules/foamMultiRun/regionSolvers/regionSolvers.C index aeb813ba7d..22a2b8d856 100644 --- a/src/regionModels/regionModel/regionProperties/regionProperties.C +++ b/applications/solvers/modules/foamMultiRun/regionSolvers/regionSolvers.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,85 +23,80 @@ License \*---------------------------------------------------------------------------*/ -#include "regionProperties.H" -#include "IOdictionary.H" -#include "argList.H" -#include "polyMesh.H" +#include "regionSolvers.H" +#include "Time.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::regionProperties::regionProperties(const Time& runTime) -: - HashTable - ( - IOdictionary +Foam::regionSolvers::regionSolvers(const Time& runTime) +{ + if (runTime.controlDict().found("regionSolvers")) + { + const dictionary& regionSolversDict = + runTime.controlDict().subDict("regionSolvers"); + + forAllConstIter(dictionary, regionSolversDict, iter) + { + append(Pair(iter().keyword(), iter().stream())); + } + } + else + { + // Partial backward-compatibility + // Converts the regions entry in the regionProperties dictionary into + // the regionSolvers list + + typeIOobject regionPropertiesHeader ( IOobject ( "regionProperties", runTime.time().constant(), runTime.db(), - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE + IOobject::MUST_READ ) - ).lookup("regions") - ) -{} + ); + + if (regionPropertiesHeader.headerOk()) + { + HashTable regions + ( + IOdictionary(regionPropertiesHeader).lookup("regions") + ); + + if (regions.found("solid")) + { + const wordList& fluidRegions = regions["solid"]; + forAll(fluidRegions, i) + { + append(Pair(fluidRegions[i], "solid")); + } + } + + if (regions.found("fluid")) + { + const wordList& fluidRegions = regions["fluid"]; + forAll(fluidRegions, i) + { + append(Pair(fluidRegions[i], "fluid")); + } + } + } + else + { + FatalIOErrorInFunction(runTime.controlDict()) + << "regionSolvers list missing from " + << runTime.controlDict().name() + << exit(FatalIOError); + } + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::regionProperties::~regionProperties() +Foam::regionSolvers::~regionSolvers() {} -// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // - -const Foam::word& Foam::regionDir(const word& regionName) -{ - return - regionName == polyMesh::defaultRegion - ? word::null - : regionName; -} - - -Foam::wordList Foam::selectRegionNames(const argList& args, const Time& runTime) -{ - const bool allRegions = args.optionFound("allRegions"); - - wordList regionNames; - - if (allRegions) - { - const regionProperties rp(runTime); - forAllConstIter(HashTable, rp, iter) - { - const wordList& regions = iter(); - forAll(regions, i) - { - if (findIndex(regionNames, regions[i]) == -1) - { - regionNames.append(regions[i]); - } - } - } - } - else - { - word regionName; - if (args.optionReadIfPresent("region", regionName)) - { - regionNames = wordList(1, regionName); - } - else - { - regionNames = wordList(1, polyMesh::defaultRegion); - } - } - - return regionNames; -} - - // ************************************************************************* // diff --git a/src/regionModels/regionModel/regionProperties/regionProperties.H b/applications/solvers/modules/foamMultiRun/regionSolvers/regionSolvers.H similarity index 68% rename from src/regionModels/regionModel/regionProperties/regionProperties.H rename to applications/solvers/modules/foamMultiRun/regionSolvers/regionSolvers.H index 25baf2771b..a15888ed47 100644 --- a/src/regionModels/regionModel/regionProperties/regionProperties.H +++ b/applications/solvers/modules/foamMultiRun/regionSolvers/regionSolvers.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,66 +22,59 @@ License along with OpenFOAM. If not, see . Class - Foam::regionProperties + Foam::regionSolvers Description - Simple class to hold region information for coupled region simulations. - - Gives per physics ('fluid', 'solid') the names of the regions. There - is no assumption on this level that one region should only have one - set of physics. + Simple class to hold the list of region solvers SourceFiles - regionProperties.C + regionSolvers.C \*---------------------------------------------------------------------------*/ -#ifndef regionProperties_H -#define regionProperties_H +#ifndef regionSolvers_H +#define regionSolvers_H -#include "Time.H" -#include "HashTable.H" +#include "word.H" +#include "Pair.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +class Time; + /*---------------------------------------------------------------------------*\ - Class regionProperties Declaration + Class regionSolvers Declaration \*---------------------------------------------------------------------------*/ -class regionProperties +class regionSolvers : - public HashTable + public List> { public: // Constructors //- Construct from components - regionProperties(const Time& runTime); + regionSolvers(const Time& runTime); //- Disallow default bitwise copy construction - regionProperties(const regionProperties&) = delete; + regionSolvers(const regionSolvers&) = delete; //- Destructor - ~regionProperties(); + ~regionSolvers(); // Member Operators //- Disallow default bitwise assignment - void operator=(const regionProperties&) = delete; + void operator=(const regionSolvers&) = delete; }; -const word& regionDir(const word& regionName); - -wordList selectRegionNames(const argList& args, const Time& runTime); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/applications/solvers/modules/foamMultiRun/setDeltaT.C b/applications/solvers/modules/foamMultiRun/setDeltaT.C new file mode 100644 index 0000000000..616fd1789d --- /dev/null +++ b/applications/solvers/modules/foamMultiRun/setDeltaT.C @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "setDeltaT.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +void Foam::setDeltaT(Time& runTime, const PtrList& solvers) +{ + if + ( + runTime.timeIndex() == 0 + && runTime.controlDict().lookupOrDefault("adjustTimeStep", false) + ) + { + scalar deltaT = great; + + forAll(solvers, i) + { + if (solvers[i].transient()) + { + deltaT = min(deltaT, solvers[i].maxDeltaT()); + } + } + + if (deltaT != great) + { + runTime.setDeltaT(deltaT); + } + } +} + + +void Foam::adjustDeltaT(Time& runTime, const PtrList& solvers) +{ + if (runTime.controlDict().lookupOrDefault("adjustTimeStep", false)) + { + scalar deltaT = great; + + forAll(solvers, i) + { + if (solvers[i].transient()) + { + const scalar maxDeltaTi = solvers[i].maxDeltaT(); + + deltaT = min + ( + deltaT, + min + ( + min + ( + maxDeltaTi, + runTime.deltaTValue() + 0.1*maxDeltaTi + ), + 1.2*runTime.deltaTValue() + ) + ); + } + } + + if (deltaT != great) + { + runTime.setDeltaT(deltaT); + Info<< "deltaT = " << runTime.deltaTValue() << endl; + } + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/foamMultiRun/setDeltaT.H b/applications/solvers/modules/foamMultiRun/setDeltaT.H new file mode 100644 index 0000000000..7eb7768b9b --- /dev/null +++ b/applications/solvers/modules/foamMultiRun/setDeltaT.H @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Global + Foam::setDeltaT + +Description + Foam::setDeltaT sets the initial time-step according to the solver maxDeltaT + Foam::adjustDeltaT adjust the time-step according to the solver maxDeltaT + +SourceFiles + setDeltaT.C + +\*---------------------------------------------------------------------------*/ + +#ifndef setDeltaT_H +#define setDeltaT_H + +#include "solver.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Set the initial time-step according to the solver maxDeltaT +void setDeltaT(Time& runTime, const PtrList& solvers); + +//- Adjust the time-step according to the solver maxDeltaT +void adjustDeltaT(Time& runTime, const PtrList& solvers); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/foamRun/Make/files b/applications/solvers/modules/foamRun/Make/files new file mode 100644 index 0000000000..2b1fee90a9 --- /dev/null +++ b/applications/solvers/modules/foamRun/Make/files @@ -0,0 +1,4 @@ +setDeltaT.C +foamRun.C + +EXE = $(FOAM_APPBIN)/foamRun diff --git a/applications/solvers/modules/foamRun/Make/options b/applications/solvers/modules/foamRun/Make/options new file mode 100644 index 0000000000..fa15f12452 --- /dev/null +++ b/applications/solvers/modules/foamRun/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +EXE_LIBS = \ + -lfiniteVolume diff --git a/applications/solvers/modules/foamRun/foamRun.C b/applications/solvers/modules/foamRun/foamRun.C new file mode 100644 index 0000000000..b396c02e2b --- /dev/null +++ b/applications/solvers/modules/foamRun/foamRun.C @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Application + foamRun + +Description + Loads and executes an OpenFOAM solver module either specified by the + optional \c solver entry in the \c controlDict or as a command-line + argument. + + Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and + pseudo-transient and steady simulations. + +Usage + \b foamRun [OPTION] + + - \par -solver + Solver name + + - \par -libs '(\"lib1.so\" ... \"libN.so\")' + Specify the additional libraries loaded + + Example usage: + - To run a \c rhoPimpleFoam case by specifying the solver on the + command line: + \verbatim + foamRun -solver fluid + \endverbatim + + - To update and run a \c rhoPimpleFoam case add the following entries to + the controlDict: + \verbatim + application foamRun; + + solver fluid; + \endverbatim + then execute \c foamRun + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "solver.H" +#include "pimpleSingleRegionControl.H" +#include "setDeltaT.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + argList::addOption + ( + "solver", + "name", + "Solver name" + ); + + #include "setRootCase.H" + #include "createTime.H" + + // Read the solverName from the optional solver entry in controlDict + word solverName + ( + runTime.controlDict().lookupOrDefault("solver", word::null) + ); + + // Optionally reset the solver name from the -solver command-line argument + args.optionReadIfPresent("solver", solverName); + + // Check the solverName has been set + if (solverName == word::null) + { + args.printUsage(); + + FatalErrorIn(args.executable()) + << "solver not specified in the controlDict or on the command-line" + << exit(FatalError); + } + + // Load the solver library + libs.open("lib" + solverName + ".so"); + + // Create the default single region mesh + #include "createMesh.H" + + // Instantiate the selected solver + autoPtr solverPtr(solver::New(solverName, mesh)); + solver& solver = solverPtr(); + + // Create the outer PIMPLE loop and control structure + pimpleSingleRegionControl pimple(solver.pimple); + + // Set the initial time-step + setDeltaT(runTime, solver); + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (pimple.run(runTime)) + { + solver.preSolve(); + + // Adjust the time-step according to the solver maxDeltaT + adjustDeltaT(runTime, solver); + + runTime++; + + Info<< "Time = " << runTime.userTimeName() << nl << endl; + + // PIMPLE corrector loop + while (pimple.loop()) + { + solver.moveMesh(); + solver.prePredictor(); + solver.momentumPredictor(); + solver.thermophysicalPredictor(); + solver.pressureCorrector(); + solver.momentumTransportCorrector(); + solver.thermophysicalTransportCorrector(); + } + + solver.postSolve(); + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setMultiRegionDeltaT.H b/applications/solvers/modules/foamRun/setDeltaT.C similarity index 57% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/include/setMultiRegionDeltaT.H rename to applications/solvers/modules/foamRun/setDeltaT.C index c46eafa2db..bcc554c4ce 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setMultiRegionDeltaT.H +++ b/applications/solvers/modules/foamRun/setDeltaT.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,48 +21,45 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Global - setMultiRegionDeltaT - -Description - Reset the timestep to maintain a constant maximum courant and - diffusion Numbers. Reduction of time-step is immediate, but - increase is damped to avoid unstable oscillations. - \*---------------------------------------------------------------------------*/ -if (adjustTimeStep) +#include "setDeltaT.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +void Foam::setDeltaT(Time& runTime, const solver& solver) { - if (CoNum == -great) - { - CoNum = small; - } - - if (DiNum == -great) - { - DiNum = small; - } - - scalar maxDeltaTFluid = maxCo/(CoNum + small); - scalar maxDeltaTSolid = maxDi/(DiNum + small); - - scalar deltaTFluid = - min - ( - min(maxDeltaTFluid, 1.0 + 0.1*maxDeltaTFluid), - 1.2 - ); - - runTime.setDeltaT + if ( - min - ( - min(deltaTFluid, maxDeltaTSolid)*runTime.deltaT().value(), - maxDeltaT - ) - ); - - Info<< "deltaT = " << runTime.deltaT().value() << endl; + runTime.timeIndex() == 0 + && solver.transient() + && runTime.controlDict().lookupOrDefault("adjustTimeStep", false) + ) + { + runTime.setDeltaT(solver.maxDeltaT()); + } } + +void Foam::adjustDeltaT(Time& runTime, const solver& solver) +{ + // Update the time-step from the solver maxDeltaT + if + ( + solver.transient() + && runTime.controlDict().lookupOrDefault("adjustTimeStep", false) + ) + { + scalar deltaT = solver.maxDeltaT(); + deltaT = min + ( + min(deltaT, runTime.deltaTValue() + 0.1*deltaT), + 1.2*runTime.deltaTValue() + ); + runTime.setDeltaT(deltaT); + Info<< "deltaT = " << runTime.deltaTValue() << endl; + } +} + + // ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.H b/applications/solvers/modules/foamRun/setDeltaT.H similarity index 57% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.H rename to applications/solvers/modules/foamRun/setDeltaT.H index bdb3a2b221..f2143933c6 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.H +++ b/applications/solvers/modules/foamRun/setDeltaT.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,27 +21,42 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . +Global + Foam::setDeltaT + Description - Calculates and outputs the mean and maximum Courant Numbers for the fluid - regions + Foam::setDeltaT sets the initial time-step according to the solver maxDeltaT + Foam::adjustDeltaT adjust the time-step according to the solver maxDeltaT + +SourceFiles + setDeltaT.C \*---------------------------------------------------------------------------*/ -#ifndef compressibleCourantNo_H -#define compressibleCourantNo_H +#ifndef setDeltaT_H +#define setDeltaT_H -#include "fvMesh.H" +#include "solver.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - scalar compressibleCourantNo - ( - const fvMesh& mesh, - const Time& runTime, - const volScalarField& rho, - const surfaceScalarField& phi - ); -} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Set the initial time-step according to the solver maxDeltaT +void setDeltaT(Time& runTime, const solver& solver); + +//- Adjust the time-step according to the solver maxDeltaT +void adjustDeltaT(Time& runTime, const solver& solver); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/applications/solvers/modules/solid/solid/Make/files b/applications/solvers/modules/solid/solid/Make/files new file mode 100644 index 0000000000..4e47f1e243 --- /dev/null +++ b/applications/solvers/modules/solid/solid/Make/files @@ -0,0 +1,3 @@ +solid.C + +LIB = $(FOAM_LIBBIN)/libsolid diff --git a/applications/solvers/modules/solid/solid/Make/options b/applications/solvers/modules/solid/solid/Make/options new file mode 100644 index 0000000000..c6a1c40496 --- /dev/null +++ b/applications/solvers/modules/solid/solid/Make/options @@ -0,0 +1,17 @@ +EXE_INC = \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ + -I$(LIB_SRC)/finiteVolume/cfdTools \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +LIB_LIBS = \ + -lsolidThermo \ + -lspecie \ + -lfiniteVolume \ + -lmeshTools \ + -lsampling \ + -lfvModels \ + -lfvConstraints diff --git a/applications/solvers/modules/solid/solid/solid.C b/applications/solvers/modules/solid/solid/solid.C new file mode 100644 index 0000000000..1724c65d10 --- /dev/null +++ b/applications/solvers/modules/solid/solid/solid.C @@ -0,0 +1,211 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "solid.H" +#include "localEulerDdtScheme.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + defineTypeNameAndDebug(solid, 0); + addToRunTimeSelectionTable(solver, solid, fvMesh); +} +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::solvers::solid::read() +{ + maxDi = + runTime.controlDict().lookupOrDefault("maxDi", 1.0); + + maxDeltaT_ = + runTime.controlDict().lookupOrDefault("maxDeltaT", great); +} + + +void Foam::solvers::solid::correctDiNum() +{ + const volScalarField kappa + ( + thermo.isotropic() + ? thermo.kappa() + : mag(thermo.Kappa())() + ); + + const surfaceScalarField kapparhoCpbyDelta + ( + sqr(mesh.surfaceInterpolation::deltaCoeffs()) + *fvc::interpolate(kappa) + /fvc::interpolate(thermo.rho()*thermo.Cp()) + ); + + DiNum = max(kapparhoCpbyDelta).value()*runTime.deltaTValue(); + const scalar meanDiNum = + average(kapparhoCpbyDelta).value()*runTime.deltaTValue(); + + Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum + << " max: " << DiNum << endl; +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solvers::solid::solid(fvMesh& mesh) +: + solver(mesh), + + pThermo(solidThermo::New(mesh)), + thermo(pThermo()), + + T(thermo.T()), + + DiNum(0) +{ + // Read the controls + read(); + + thermo.validate("solid", "h", "e"); + + if (transient()) + { + correctDiNum(); + } + else if (LTS) + { + FatalError + << type() + << " solver does not support LTS, use 'steadyState' ddtScheme" + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::solvers::solid::~solid() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::scalar Foam::solvers::solid::maxDeltaT() const +{ + if (DiNum > small) + { + const scalar deltaT = maxDi*runTime.deltaTValue()/DiNum; + return min(min(deltaT, fvModels().maxDeltaT()), maxDeltaT_); + } + else + { + return maxDeltaT_; + } +} + + +void Foam::solvers::solid::preSolve() +{ + // Read the controls + read(); + + fvModels().preUpdateMesh(); + + // Update the mesh for topology change, mesh to mesh mapping + mesh.update(); + + if (transient()) + { + correctDiNum(); + } +} + + +bool Foam::solvers::solid::moveMesh() +{ + return true; +} + + +void Foam::solvers::solid::prePredictor() +{} + + +void Foam::solvers::solid::momentumPredictor() +{} + + +void Foam::solvers::solid::thermophysicalPredictor() +{ + volScalarField& e = thermo.he(); + const volScalarField& rho = thermo.rho(); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix eEqn + ( + fvm::ddt(rho, e) + + thermo.divq(e) + == + fvModels().source(rho, e) + ); + + eEqn.relax(); + + fvConstraints().constrain(eEqn); + + eEqn.solve(); + + fvConstraints().constrain(e); + } + + thermo.correct(); +} + + +void Foam::solvers::solid::pressureCorrector() +{} + + +void Foam::solvers::solid::momentumTransportCorrector() +{} + + +void Foam::solvers::solid::thermophysicalTransportCorrector() +{} + + +void Foam::solvers::solid::postSolve() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/solid/solid/solid.H b/applications/solvers/modules/solid/solid/solid.H new file mode 100644 index 0000000000..24d7fbf81e --- /dev/null +++ b/applications/solvers/modules/solid/solid/solid.H @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::solvers::solid + +Description + Solver module for turbulent flow of compressible fluids for conjugate heat + transfer, HVAC and similar applications, with optional mesh motion and mesh + topology changes. + +SourceFiles + solid.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solid_H +#define solid_H + +#include "solver.H" +#include "solidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + +/*---------------------------------------------------------------------------*\ + Class solid Declaration +\*---------------------------------------------------------------------------*/ + +class solid +: + public solver +{ + +protected: + + // Control parameters + + scalar maxDi; + + scalar maxDeltaT_; + + + // Thermophysical properties + + autoPtr pThermo; + + solidThermo& thermo; + + volScalarField& T; + + + // Time-step controls + + scalar DiNum; + + +private: + + // Private Member Functions + + //- Read controls + void read(); + + //- Set rDeltaT for LTS + // void setRDeltaT(); + + //- Correct the cached Courant numbers + void correctDiNum(); + + +public: + + //- Runtime type information + TypeName("solid"); + + + // Constructors + + //- Construct from region mesh + solid(fvMesh& mesh); + + //- Disallow default bitwise copy construction + solid(const solid&) = delete; + + + //- Destructor + virtual ~solid(); + + + // Member Functions + + //- Return the current maximum time-step for stable solution + virtual scalar maxDeltaT() const; + + //- Called at the start of the time-step, before the PIMPLE loop + virtual void preSolve(); + + //- Called at the start of the PIMPLE loop to move the mesh + virtual bool moveMesh(); + + //- Called at the beginning of the PIMPLE loop + virtual void prePredictor(); + + //- Construct and optionally solve the momentum equation + virtual void momentumPredictor(); + + //- Construct and solve the energy equation, + // convert to temperature + // and update thermophysical and transport properties + virtual void thermophysicalPredictor(); + + //- Construct and solve the pressure equation in the PISO loop + virtual void pressureCorrector(); + + //- Correct the momentum transport modelling + // Newtonian, non-Newtonian or turbulent + virtual void momentumTransportCorrector(); + + //- Correct the thermophysical transport modelling + virtual void thermophysicalTransportCorrector(); + + //- Called after the PIMPLE loop at the end of the time-step + virtual void postSolve(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const solid&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solvers +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/cavitatingFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/pEqn.H index a426f5a64d..2a0be0a589 100644 --- a/applications/solvers/multiphase/cavitatingFoam/pEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/pEqn.H @@ -1,5 +1,5 @@ { - if (pimple.nCorrPimple() == 1) + if (pimple.nCorr() == 1) { p = ( diff --git a/applications/solvers/multiphase/compressibleInterFoam/createFieldRefs.H b/applications/solvers/multiphase/compressibleInterFoam/createFieldRefs.H index 3080d67b02..2732904096 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/createFieldRefs.H +++ b/applications/solvers/multiphase/compressibleInterFoam/createFieldRefs.H @@ -1,4 +1,4 @@ -twoPhaseChangeModel& phaseChange = phaseChangePtr(); +compressible::twoPhaseChangeModel& phaseChange = phaseChangePtr(); volScalarField& alpha2(mixture.alpha2()); diff --git a/applications/solvers/multiphase/compressibleInterFoam/createFields.H b/applications/solvers/multiphase/compressibleInterFoam/createFields.H index 9a2cd67713..a710549db8 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleInterFoam/createFields.H @@ -33,9 +33,9 @@ volVectorField U Info<< "Constructing compressibleTwoPhaseMixture\n" << endl; compressibleTwoPhaseMixture mixture(U, phi); -autoPtr phaseChangePtr +autoPtr phaseChangePtr ( - twoPhaseChangeModel::New(mixture) + compressible::twoPhaseChangeModel::New(mixture) ); volScalarField& alpha1(mixture.alpha1()); diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Kunz/Kunz.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Kunz/Kunz.C index 0c28cd521e..cbe95629fd 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Kunz/Kunz.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Kunz/Kunz.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,16 +30,20 @@ License namespace Foam { +namespace compressible +{ namespace twoPhaseChangeModels { defineTypeNameAndDebug(Kunz, 0); addToRunTimeSelectionTable(cavitationModel, Kunz, dictionary); } } +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::twoPhaseChangeModels::Kunz::Kunz +Foam::compressible::twoPhaseChangeModels::Kunz::Kunz ( const compressibleTwoPhaseMixture& mixture ) @@ -60,7 +64,7 @@ Foam::twoPhaseChangeModels::Kunz::Kunz // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::Pair> -Foam::twoPhaseChangeModels::Kunz::mDotAlphal() const +Foam::compressible::twoPhaseChangeModels::Kunz::mDotAlphal() const { const volScalarField::Internal& p = mixture_.alpha1().db().lookupObject("p"); @@ -87,7 +91,7 @@ Foam::twoPhaseChangeModels::Kunz::mDotAlphal() const Foam::Pair> -Foam::twoPhaseChangeModels::Kunz::mDotP() const +Foam::compressible::twoPhaseChangeModels::Kunz::mDotP() const { const volScalarField::Internal& p = mixture_.alpha1().db().lookupObject("p"); @@ -113,13 +117,13 @@ Foam::twoPhaseChangeModels::Kunz::mDotP() const } -void Foam::twoPhaseChangeModels::Kunz::correct() +void Foam::compressible::twoPhaseChangeModels::Kunz::correct() { cavitationModel::correct(); } -bool Foam::twoPhaseChangeModels::Kunz::read() +bool Foam::compressible::twoPhaseChangeModels::Kunz::read() { if (cavitationModel::read()) { diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Kunz/Kunz.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Kunz/Kunz.H index eda82ad2af..e9715b1fe2 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Kunz/Kunz.H +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Kunz/Kunz.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,6 +55,8 @@ SourceFiles namespace Foam { +namespace compressible +{ namespace twoPhaseChangeModels { @@ -118,6 +120,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace twoPhaseChangeModels +} // End namespace compressible } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Merkle/Merkle.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Merkle/Merkle.C index 4b60dce596..aa10e43aab 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Merkle/Merkle.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Merkle/Merkle.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,16 +30,20 @@ License namespace Foam { +namespace compressible +{ namespace twoPhaseChangeModels { defineTypeNameAndDebug(Merkle, 0); addToRunTimeSelectionTable(cavitationModel, Merkle, dictionary); } } +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::twoPhaseChangeModels::Merkle::Merkle +Foam::compressible::twoPhaseChangeModels::Merkle::Merkle ( const compressibleTwoPhaseMixture& mixture ) @@ -62,7 +66,7 @@ Foam::twoPhaseChangeModels::Merkle::Merkle // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::Pair> -Foam::twoPhaseChangeModels::Merkle::mDotAlphal() const +Foam::compressible::twoPhaseChangeModels::Merkle::mDotAlphal() const { const volScalarField::Internal& p = mixture_.alpha1().db().lookupObject("p"); @@ -81,7 +85,7 @@ Foam::twoPhaseChangeModels::Merkle::mDotAlphal() const Foam::Pair> -Foam::twoPhaseChangeModels::Merkle::mDotP() const +Foam::compressible::twoPhaseChangeModels::Merkle::mDotP() const { const volScalarField::Internal& p = mixture_.alpha1().db().lookupObject("p"); @@ -105,13 +109,13 @@ Foam::twoPhaseChangeModels::Merkle::mDotP() const } -void Foam::twoPhaseChangeModels::Merkle::correct() +void Foam::compressible::twoPhaseChangeModels::Merkle::correct() { cavitationModel::correct(); } -bool Foam::twoPhaseChangeModels::Merkle::read() +bool Foam::compressible::twoPhaseChangeModels::Merkle::read() { if (cavitationModel::read()) { diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Merkle/Merkle.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Merkle/Merkle.H index 594b237044..918618e057 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Merkle/Merkle.H +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/Merkle/Merkle.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,6 +49,8 @@ SourceFiles namespace Foam { +namespace compressible +{ namespace twoPhaseChangeModels { @@ -114,6 +116,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace twoPhaseChangeModels +} // End namespace compressible } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/SchnerrSauer/SchnerrSauer.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/SchnerrSauer/SchnerrSauer.C index c32bc1a11c..6ce1e1abce 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/SchnerrSauer/SchnerrSauer.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/SchnerrSauer/SchnerrSauer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,8 @@ License namespace Foam { +namespace compressible +{ namespace twoPhaseChangeModels { defineTypeNameAndDebug(SchnerrSauer, 0); @@ -42,11 +44,12 @@ namespace twoPhaseChangeModels ); } } +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::twoPhaseChangeModels::SchnerrSauer::SchnerrSauer +Foam::compressible::twoPhaseChangeModels::SchnerrSauer::SchnerrSauer ( const compressibleTwoPhaseMixture& mixture ) @@ -67,7 +70,7 @@ Foam::twoPhaseChangeModels::SchnerrSauer::SchnerrSauer // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::tmp -Foam::twoPhaseChangeModels::SchnerrSauer::rRb +Foam::compressible::twoPhaseChangeModels::SchnerrSauer::rRb ( const volScalarField::Internal& limitedAlpha1 ) const @@ -82,7 +85,7 @@ Foam::twoPhaseChangeModels::SchnerrSauer::rRb Foam::dimensionedScalar -Foam::twoPhaseChangeModels::SchnerrSauer::alphaNuc() const +Foam::compressible::twoPhaseChangeModels::SchnerrSauer::alphaNuc() const { dimensionedScalar Vnuc = n_*constant::mathematical::pi*pow3(dNuc_)/6; return Vnuc/(1 + Vnuc); @@ -90,7 +93,7 @@ Foam::twoPhaseChangeModels::SchnerrSauer::alphaNuc() const Foam::tmp -Foam::twoPhaseChangeModels::SchnerrSauer::pCoeff +Foam::compressible::twoPhaseChangeModels::SchnerrSauer::pCoeff ( const volScalarField::Internal& p ) const @@ -113,7 +116,7 @@ Foam::twoPhaseChangeModels::SchnerrSauer::pCoeff Foam::Pair> -Foam::twoPhaseChangeModels::SchnerrSauer::mDotAlphal() const +Foam::compressible::twoPhaseChangeModels::SchnerrSauer::mDotAlphal() const { const volScalarField::Internal& p = mixture_.alpha1().db().lookupObject("p"); @@ -135,7 +138,7 @@ Foam::twoPhaseChangeModels::SchnerrSauer::mDotAlphal() const Foam::Pair> -Foam::twoPhaseChangeModels::SchnerrSauer::mDotP() const +Foam::compressible::twoPhaseChangeModels::SchnerrSauer::mDotP() const { const volScalarField::Internal& p = mixture_.alpha1().db().lookupObject("p"); @@ -158,13 +161,13 @@ Foam::twoPhaseChangeModels::SchnerrSauer::mDotP() const } -void Foam::twoPhaseChangeModels::SchnerrSauer::correct() +void Foam::compressible::twoPhaseChangeModels::SchnerrSauer::correct() { cavitationModel::correct(); } -bool Foam::twoPhaseChangeModels::SchnerrSauer::read() +bool Foam::compressible::twoPhaseChangeModels::SchnerrSauer::read() { if (cavitationModel::read()) { diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/SchnerrSauer/SchnerrSauer.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/SchnerrSauer/SchnerrSauer.H index 8cc77a6371..381f2d9097 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/SchnerrSauer/SchnerrSauer.H +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/SchnerrSauer/SchnerrSauer.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,6 +49,8 @@ SourceFiles namespace Foam { +namespace compressible +{ namespace twoPhaseChangeModels { @@ -134,6 +136,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace twoPhaseChangeModels +} // End namespace compressible } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/cavitationModel/cavitationModel.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/cavitationModel/cavitationModel.C index c0c3515a33..40b59dba74 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/cavitationModel/cavitationModel.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/cavitationModel/cavitationModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,15 +32,19 @@ License namespace Foam { +namespace compressible +{ namespace twoPhaseChangeModels { defineTypeNameAndDebug(cavitationModel, 0); } } +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::twoPhaseChangeModels::cavitationModel::cavitationModel +Foam::compressible::twoPhaseChangeModels::cavitationModel::cavitationModel ( const word& type, const compressibleTwoPhaseMixture& mixture @@ -54,7 +58,7 @@ Foam::twoPhaseChangeModels::cavitationModel::cavitationModel // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::Pair> -Foam::twoPhaseChangeModels::cavitationModel::Salpha +Foam::compressible::twoPhaseChangeModels::cavitationModel::Salpha ( volScalarField& alpha ) const @@ -78,7 +82,7 @@ Foam::twoPhaseChangeModels::cavitationModel::Salpha Foam::tmp -Foam::twoPhaseChangeModels::cavitationModel::Sp_rgh +Foam::compressible::twoPhaseChangeModels::cavitationModel::Sp_rgh ( const volScalarField& rho, const volScalarField& gh, @@ -98,7 +102,7 @@ Foam::twoPhaseChangeModels::cavitationModel::Sp_rgh Foam::tmp -Foam::twoPhaseChangeModels::cavitationModel::SU +Foam::compressible::twoPhaseChangeModels::cavitationModel::SU ( const volScalarField& rho, const surfaceScalarField& rhoPhi, @@ -109,7 +113,7 @@ Foam::twoPhaseChangeModels::cavitationModel::SU } -bool Foam::twoPhaseChangeModels::cavitationModel::read() +bool Foam::compressible::twoPhaseChangeModels::cavitationModel::read() { if (twoPhaseChangeModel::read()) { diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/cavitationModel/cavitationModel.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/cavitationModel/cavitationModel.H index cccac41d44..81dc8d48f4 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/cavitationModel/cavitationModel.H +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/cavitation/cavitationModel/cavitationModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::twoPhaseChangeModels::cavitationModel + Foam::compressible::twoPhaseChangeModels::cavitationModel Description Abstract base class for cavitation models @@ -41,6 +41,8 @@ SourceFiles namespace Foam { +namespace compressible +{ namespace twoPhaseChangeModels { @@ -128,6 +130,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace twoPhaseChangeModels +} // End namespace compressible } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/noPhaseChange/noPhaseChange.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/noPhaseChange/noPhaseChange.C index 99468c201c..1e0151550e 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/noPhaseChange/noPhaseChange.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/noPhaseChange/noPhaseChange.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,16 +31,20 @@ License namespace Foam { +namespace compressible +{ namespace twoPhaseChangeModels { defineTypeNameAndDebug(noPhaseChange, 0); addToRunTimeSelectionTable(twoPhaseChangeModel, noPhaseChange, dictionary); } } +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::twoPhaseChangeModels::noPhaseChange::noPhaseChange +Foam::compressible::twoPhaseChangeModels::noPhaseChange::noPhaseChange ( const compressibleTwoPhaseMixture& mixture ) @@ -52,7 +56,7 @@ Foam::twoPhaseChangeModels::noPhaseChange::noPhaseChange // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::Pair> -Foam::twoPhaseChangeModels::noPhaseChange::mDotAlphal() const +Foam::compressible::twoPhaseChangeModels::noPhaseChange::mDotAlphal() const { return Pair> ( @@ -63,7 +67,7 @@ Foam::twoPhaseChangeModels::noPhaseChange::mDotAlphal() const Foam::Pair> -Foam::twoPhaseChangeModels::noPhaseChange::mDotP() const +Foam::compressible::twoPhaseChangeModels::noPhaseChange::mDotP() const { return Pair> ( @@ -74,7 +78,7 @@ Foam::twoPhaseChangeModels::noPhaseChange::mDotP() const Foam::Pair> -Foam::twoPhaseChangeModels::noPhaseChange::Salpha +Foam::compressible::twoPhaseChangeModels::noPhaseChange::Salpha ( volScalarField& alpha ) const @@ -88,7 +92,7 @@ Foam::twoPhaseChangeModels::noPhaseChange::Salpha Foam::tmp -Foam::twoPhaseChangeModels::noPhaseChange::Sp_rgh +Foam::compressible::twoPhaseChangeModels::noPhaseChange::Sp_rgh ( const volScalarField& rho, const volScalarField& gh, @@ -100,7 +104,7 @@ Foam::twoPhaseChangeModels::noPhaseChange::Sp_rgh Foam::tmp -Foam::twoPhaseChangeModels::noPhaseChange::SU +Foam::compressible::twoPhaseChangeModels::noPhaseChange::SU ( const volScalarField& rho, const surfaceScalarField& rhoPhi, @@ -114,13 +118,13 @@ Foam::twoPhaseChangeModels::noPhaseChange::SU } -void Foam::twoPhaseChangeModels::noPhaseChange::correct() +void Foam::compressible::twoPhaseChangeModels::noPhaseChange::correct() { twoPhaseChangeModel::correct(); } -bool Foam::twoPhaseChangeModels::noPhaseChange::read() +bool Foam::compressible::twoPhaseChangeModels::noPhaseChange::read() { return twoPhaseChangeModel::read(); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/noPhaseChange/noPhaseChange.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/noPhaseChange/noPhaseChange.H index b3c1bc7915..f94a782830 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/noPhaseChange/noPhaseChange.H +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/noPhaseChange/noPhaseChange.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,6 +41,8 @@ SourceFiles namespace Foam { +namespace compressible +{ namespace twoPhaseChangeModels { @@ -119,6 +121,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace twoPhaseChangeModels +} // End namespace compressible } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModel.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModel.C index 5bb4e4d0f1..085963c0a8 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModel.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,12 +28,16 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam +{ +namespace compressible { defineTypeNameAndDebug(twoPhaseChangeModel, 0); defineRunTimeSelectionTable(twoPhaseChangeModel, dictionary); } +} -const Foam::word Foam::twoPhaseChangeModel::phaseChangePropertiesName +const Foam::word +Foam::compressible::twoPhaseChangeModel::phaseChangePropertiesName ( "phaseChangeProperties" ); @@ -41,7 +45,7 @@ const Foam::word Foam::twoPhaseChangeModel::phaseChangePropertiesName // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -Foam::IOobject Foam::twoPhaseChangeModel::createIOobject +Foam::IOobject Foam::compressible::twoPhaseChangeModel::createIOobject ( const compressibleTwoPhaseMixture& mixture ) const @@ -70,7 +74,7 @@ Foam::IOobject Foam::twoPhaseChangeModel::createIOobject // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::twoPhaseChangeModel::twoPhaseChangeModel +Foam::compressible::twoPhaseChangeModel::twoPhaseChangeModel ( const word& type, const compressibleTwoPhaseMixture& mixture @@ -84,11 +88,11 @@ Foam::twoPhaseChangeModel::twoPhaseChangeModel // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -void Foam::twoPhaseChangeModel::correct() +void Foam::compressible::twoPhaseChangeModel::correct() {} -bool Foam::twoPhaseChangeModel::read() +bool Foam::compressible::twoPhaseChangeModel::read() { if (regIOobject::read()) { diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModel.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModel.H index a961f82b02..c0412e1d23 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModel.H +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,6 +43,8 @@ SourceFiles namespace Foam { +namespace compressible +{ /*---------------------------------------------------------------------------*\ Class twoPhaseChangeModel Declaration @@ -176,6 +178,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace compressible } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModelNew.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModelNew.C index f7384ef5c0..3618d92506 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModelNew.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModelNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,8 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -Foam::autoPtr Foam::twoPhaseChangeModel::New +Foam::autoPtr +Foam::compressible::twoPhaseChangeModel::New ( const compressibleTwoPhaseMixture& mixture ) diff --git a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C index d1bb2cc9b5..2e4048a942 100644 --- a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C +++ b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C @@ -68,7 +68,6 @@ See also #include "argList.H" #include "fvMesh.H" -#include "regionProperties.H" #include "volFields.H" #include "surfaceFields.H" #include "ReadFields.H" @@ -191,7 +190,7 @@ int main(int argc, char *argv[]) #include "createTransforms.H" - const wordList regionNames(selectRegionNames(args, runTime)); + #include "setRegionNames.H" const bool doRotateFields = args.optionFound("rotateFields"); @@ -209,9 +208,13 @@ int main(int argc, char *argv[]) forAll(regionNames, regioni) { const word& regionName = regionNames[regioni]; - const word& regionDir = Foam::regionDir(regionName); - fileName meshDir(regionDir/polyMesh::meshSubDir); + const word& regionDir = + regionName == polyMesh::defaultRegion + ? word::null + : regionName; + + const fileName meshDir(regionDir/polyMesh::meshSubDir); pointIOField points ( diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index e01ba16a89..663a3f64f6 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -40,7 +40,7 @@ Usage Decompose named region. Does not check for existence of processor*. - \par -allRegions \n - Decompose all regions in regionProperties. Does not check for + Decompose all regions in regionSolvers. Does not check for existence of processor*. - \par -copyZero \n @@ -76,7 +76,6 @@ Usage #include "decompositionMethod.H" #include "argList.H" #include "timeSelector.H" -#include "regionProperties.H" #include "labelIOField.H" #include "labelFieldIOField.H" @@ -275,9 +274,9 @@ int main(int argc, char *argv[]) // Allow override of time const instantList times = runTimes.selectComplete(args); - // Get region names - const wordList regionNames = - selectRegionNames(args, runTimes.completeTime()); + const Time& runTime = runTimes.completeTime(); + + #include "setRegionNames.H" // Remove existing processor directories if requested if (forceOverwrite) @@ -362,7 +361,11 @@ int main(int argc, char *argv[]) forAll(regionNames, regioni) { const word& regionName = regionNames[regioni]; - const word& regionDir = Foam::regionDir(regionName); + + const word& regionDir = + regionName == polyMesh::defaultRegion + ? word::null + : regionName; Info<< "\n\nDecomposing mesh " << regionName << nl << endl; diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index f4c7fbcb1d..f42964b199 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -36,7 +36,6 @@ Description #include "IOobjectList.H" #include "processorRunTimes.H" #include "domainDecomposition.H" -#include "regionProperties.H" #include "fvFieldReconstructor.H" #include "pointFieldReconstructor.H" #include "reconstructLagrangian.H" @@ -205,13 +204,19 @@ int main(int argc, char *argv[]) // Allow override of time const instantList times = runTimes.selectProc(args); - // Get region names - const wordList regionNames = - selectRegionNames(args, runTimes.procTimes()[0]); + const Time& runTime = runTimes.procTimes()[0]; + + #include "setRegionNames.H" // Determine the processor count - const label nProcs = - fileHandler().nProcs(args.path(), regionDir(regionNames[0])); + const label nProcs = fileHandler().nProcs + ( + args.path(), + regionNames[0] == polyMesh::defaultRegion + ? word::null + : regionNames[0] + ); + if (!nProcs) { FatalErrorInFunction @@ -261,7 +266,11 @@ int main(int argc, char *argv[]) forAll(regionNames, regioni) { const word& regionName = regionNames[regioni]; - const word& regionDir = Foam::regionDir(regionName); + + const word& regionDir = + regionName == polyMesh::defaultRegion + ? word::null + : regionName; // Create meshes Info<< "\n\nReconstructing mesh " << regionName << nl << endl; diff --git a/applications/utilities/preProcessing/foamSetupCHT/foamSetupCHT.C b/applications/utilities/preProcessing/foamSetupCHT/foamSetupCHT.C index 560a01e95a..7074d1f2da 100644 --- a/applications/utilities/preProcessing/foamSetupCHT/foamSetupCHT.C +++ b/applications/utilities/preProcessing/foamSetupCHT/foamSetupCHT.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,15 +28,14 @@ Description This utility sets up a multi-region case using template files for material properties, field and system files. - The utility reads constant/materialProperties to create a - regionProperties file and to create region directories containing - required files within the 0, system and constant directories. The - materialProperties file contains mesh region names with an - associated physical region type and a material: + The utility reads constant/materialProperties to create a regionSolvers list + and to create region directories containing required files within the 0, + system and constant directories. The materialProperties file contains mesh + region names with an associated solver and a material: bottomAir { - type fluid; + solver fluid; material air; } @@ -61,6 +60,8 @@ Description #include "argList.H" #include "Time.H" #include "IOdictionary.H" +#include "dictionaryEntry.H" +#include "OFstream.H" using namespace Foam; @@ -87,58 +88,35 @@ int main(int argc, char *argv[]) ) ); - IOdictionary regionProperties - ( - IOobject - ( - "regionProperties", - runTime.constant(), - runTime - ), - dictionary::null - ); - const fileName currentDir(runTime.path()); const fileName materialsDir(currentDir/"templates"/"materials"); const fileName systemDir(currentDir/"templates"/"system"); const fileName constantDir(currentDir/"templates"/"constant"); const fileName timeDir(currentDir/"templates"/"0"); - HashTable regionInfo; + dictionaryEntry regionSolvers + ( + "regionSolvers", + dictionary::null, + dictionary::null + ); forAllConstIter(dictionary, materialProperties, regionIter) { // Read region subdict name, then its type and material entries const word& regionName = regionIter().keyword(); const dictionary& regionDict = regionIter().dict(); - const word regionType(regionDict.lookup("type")); + const word regionSolver(regionDict.lookup("solver")); const word regionMaterial(regionDict.lookup("material")); Info<< "\nRegion " << regionName << ":\n" << "\tCreating 0/" << regionName << " directory" << endl; - // Create fluid and solid lists for regionProperties, e.g. - // fluid ( bottomAir ... ) - HashTable::iterator iter = regionInfo.find(regionType); - - if (iter == regionInfo.end()) - { - // Add fluid or solid list if does not exist - regionInfo.insert(regionType, wordList(1, regionName)); - } - else - { - wordList& regionNames = iter(); - if (findIndex(regionNames, regionName) == -1) - { - // Append region name to fluid/solid list - regionNames.append(regionName); - } - } + regionSolvers.add(regionName, regionSolver); // 0/: from fluid/solid template - const fileName sourceDir(timeDir/regionType); + const fileName sourceDir(timeDir/regionSolver); if (isDir(sourceDir)) { cpFiles(sourceDir, currentDir/"0"/regionName); @@ -156,13 +134,13 @@ int main(int argc, char *argv[]) Info<< "\tCreating constant/" << regionName << " directory with " << regionMaterial << " material" << endl; - cpFiles(constantDir/regionType, currentDir/"constant"/regionName); + cpFiles(constantDir/regionSolver, currentDir/"constant"/regionName); cpFiles(matDir, currentDir/"constant"/regionName); // system/: from fluid or solid template Info<< "\tCreating system/" << regionName << " directory" << endl; - cpFiles(systemDir/regionType, currentDir/"system"/regionName); + cpFiles(systemDir/regionSolver, currentDir/"system"/regionName); } else { @@ -172,11 +150,11 @@ int main(int argc, char *argv[]) } } - regionProperties.add("regions", regionInfo); - - Info<< "\nWriting region properties\n" << endl; - - regionProperties.regIOobject::write(); + Info<< "\nWriting regionSolvers\n" << endl; + { + OFstream regionSolversFile(currentDir/runTime.system()/"regionSolvers"); + regionSolvers.write(regionSolversFile); + } Info<< "End\n" << endl; diff --git a/bin/buoyantSimpleFoam b/bin/buoyantFoam similarity index 78% rename from bin/buoyantSimpleFoam rename to bin/buoyantFoam index e69379d0b1..2038594826 100755 --- a/bin/buoyantSimpleFoam +++ b/bin/buoyantFoam @@ -23,17 +23,23 @@ # along with OpenFOAM. If not, see . # # Script -# buoyantSimpleFoam +# buoyantFoam # # Description -# Script to inform the user that the buoyantSimpleFoam solver -# has been replaced by the more general buoyantFoam which can be used -# for both steady and transient cases. +# Script to inform the user that buoyantFoam has been superseded +# and replaced by the more general foamMultiRun solver. # #------------------------------------------------------------------------------ -echo "The buoyantSimpleFoam solver has been replaced" -echo "by the more general buoyantFoam solver" -echo "which can be used for both steady and transient cases." +cat <. # # Script -# rhoReactingBuoyantFoam +# buoyantReactingFoam # # Description -# Script to inform the user that rhoReactingBuoyantFoam has been rename -# buoyantReactingFoam +# Script to inform the user that buoyantReactingFoam has been superseded +# and replaced by the more general foamMultiRun solver. # #------------------------------------------------------------------------------ -cat << EOF +cat <. -# -# Script -# buoyantReactingParticleFoam -# -# Description -# Script to inform the user that buoyantReactingParticleFoam has been -# replaced by the more general buoyantReactingFoam solver. -# -#------------------------------------------------------------------------------ - -cat << EOF - -The buoyantReactingParticleFoam solver has solver has been replaced by the more -general buoyantReactingFoam solver, which supports buoyant compressible reacting -flow coupled to multiple run-time-selectable lagrangian clouds and surface film -modelling. - -To run a buoyantReactingParticleFoam case in buoyantReactingFoam add the following entry -constant/fvModels: - -clouds -{ - type clouds; - libs ("liblagrangianParcel.so"); -} - -to add support for Lagrangian clouds and/or - -surfaceFilm -{ - type surfaceFilm; - libs ("libsurfaceFilmModels.so"); -} - -to add support for surface film. - -See the following cases for examples converted from buoyantReactingParticleFoam: - - \$FOAM_TUTORIALS/combustion/buoyantReactingFoam/Lagrangian - -EOF - -#------------------------------------------------------------------------------ diff --git a/bin/buoyantPimpleFoam b/bin/chtMultiRegionFoam similarity index 78% rename from bin/buoyantPimpleFoam rename to bin/chtMultiRegionFoam index 8fa5af36e6..83daba295b 100755 --- a/bin/buoyantPimpleFoam +++ b/bin/chtMultiRegionFoam @@ -23,17 +23,21 @@ # along with OpenFOAM. If not, see . # # Script -# buoyantPimpleFoam +# chtMultiRegionFoam # # Description -# Script to inform the user that the buoyantPimpleFoam solver -# has been replaced by the more general buoyantFoam which can be used -# for both steady and transient cases. +# Script to inform the user that chtMultiRegionFoam has been superseded +# and replaced by the more general foamMultiRun solver. # #------------------------------------------------------------------------------ -echo "The buoyantPimpleFoam solver has been replaced" -echo "by the more general buoyantFoam solver" -echo "which can be used for both steady and transient cases." +cat <. -# -# Script -# coalChemistryFoam -# -# Description -# Script to inform the user that coalChemistryFoam has been replaced by the -# more general reactingFoam solver. -# -#------------------------------------------------------------------------------ - -cat << EOF - -The coalChemistryFoam solver has solver has been replaced by the more general -reactingFoam solver, which supports compressible reacting flow coupled -to multiple run-time-selectable lagrangian clouds and surface film modelling. - -To run with a single cloud rename the constant/*CloudProperties file to -constant/cloudProperties. - -To run with a multiple clouds create a constant/clouds file with a list of the -names of clouds in it. Each cloud then has a corresponding -constant/Properties file. - -In addition, cloud properties files also now require a "type" entry to specify -the type of cloud model used (e.g., thermoCloud, reactingMultiphaseCloud, -collidingCloud, etc ...). - -See the following case for an example converted from coalChemistryFoam: - - \$FOAM_TUTORIALS/lagrangian/reactingFoam/simplifiedSiwek - -EOF - -#------------------------------------------------------------------------------ diff --git a/bin/coldEngineFoam b/bin/coldEngineFoam index 2a9ee61616..800e299a8b 100755 --- a/bin/coldEngineFoam +++ b/bin/coldEngineFoam @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -27,19 +27,22 @@ # # Description # Script to inform the user that coldEngineFoam has been replaced by the -# more general rhoPimpleFoam solver. +# more general fluid solver module. # #------------------------------------------------------------------------------ cat << EOF -The coldEngineFoam solver has solver has been replaced by the more general rhoPimpleFoam -solver, which supports engine mesh motion using an appropriate +The coldEngineFoam solver has solver has been replaced by the more general +fluid solver module, which supports engine mesh motion using an appropriate fvMeshMover. e.g. layeredEngine -To run a coldEngineFoam case in rhoPimpleFoam add a mover entry in -constant/dynamicMeshDict -e.g. from the tutorials/combustion/rhoPimpleFoam/RAS/kivaTest case: +To run a coldEngineFoam case with + + foamRun -solver fluid + +add a mover entry in constant/dynamicMeshDict +e.g. from the tutorials/modules/fluid/RAS/kivaTest case: mover { diff --git a/bin/engineFoam b/bin/engineFoam deleted file mode 100755 index 048466a0ea..0000000000 --- a/bin/engineFoam +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh -#------------------------------------------------------------------------------ -# ========= | -# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox -# \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation -# \\/ M anipulation | -#------------------------------------------------------------------------------ -# License -# This file is part of OpenFOAM. -# -# OpenFOAM is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenFOAM. If not, see . -# -# Script -# engineFoam -# -# Description -# Script to inform the user that engineFoam has been replaced by the more -# general reactingFoam solver. -# -#------------------------------------------------------------------------------ - -cat << EOF - -The engineFoam solver has solver has been replaced by the more general reactingFoam -solver, which supports engine mesh motion using an appropriate -fvMeshMover. e.g. layeredEngine - -To run a engineFoam case in reactingFoam add a mover entry in -constant/dynamicMeshDict -e.g. from the tutorials/combustion/reactingFoam/RAS/kivaTest case: - -mover -{ - type layeredEngine; - - libs ("libfvMeshMovers.so"); - - conRodLength 0.147; - bore 0.092; - stroke 0.08423; - clearance 0.00115; - pistonLayers 0; -} - -EOF - -#------------------------------------------------------------------------------ diff --git a/bin/fireFoam b/bin/fireFoam deleted file mode 100755 index af2371f74e..0000000000 --- a/bin/fireFoam +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -#------------------------------------------------------------------------------ -# ========= | -# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox -# \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation -# \\/ M anipulation | -#------------------------------------------------------------------------------ -# License -# This file is part of OpenFOAM. -# -# OpenFOAM is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenFOAM. If not, see . -# -# Script -# fireFoam -# -# Description -# Script to inform the user that fireFoam has been replaced by the -# more general buoyantReactingFoam solver. -# -#------------------------------------------------------------------------------ - -cat << EOF - -The fireFoam solver has solver has been replaced by the more general -buoyantReactingFoam solver, which supports buoyant compressible -reacting flow coupled to multiple run-time-selectable lagrangian clouds and -surface film modelling. - -See the following cases for examples transferred from fireFoam: - - \$FOAM_TUTORIALS/combustion/buoyantReactingFoam/RAS - -EOF - -#------------------------------------------------------------------------------ diff --git a/bin/foamInfo b/bin/foamInfo index 98d75a570c..7f8e38bc7e 100755 --- a/bin/foamInfo +++ b/bin/foamInfo @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -59,7 +59,7 @@ Otherwise the user can try a broader keyword match with "-keyword | -k" option. Examples foamInfo simpleFoam - foamInfo buoyantReactingFoam + foamInfo interFoam foamInfo fixedValue foamInfo -k fixedValue foamInfo -a turbulentIntensityKineticEnergyInlet diff --git a/bin/rhoReactingFoam b/bin/reactingFoam similarity index 73% rename from bin/rhoReactingFoam rename to bin/reactingFoam index 04538d1af9..53697f6cba 100755 --- a/bin/rhoReactingFoam +++ b/bin/reactingFoam @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -23,22 +23,23 @@ # along with OpenFOAM. If not, see . # # Script -# rhoReactingFoam +# reactingFoam # # Description -# Script to inform the user that rhoReactingFoam has been removed as -# reactingFoam now provides the necessary functionality +# Script to inform the user that reactingFoam has been superseded +# and replaced by the more general foamMultiRun solver. # #------------------------------------------------------------------------------ -cat << EOF +cat <. -# -# Script -# reactingParcelFoam -# -# Description -# Script to inform the user that reactingParcelFoam has been replaced by the -# more general buoyantReactingFoam solver. -# -#------------------------------------------------------------------------------ - -cat << EOF - -The reactingParcelFoam solver has solver has been replaced by the more general -buoyantReactingFoam solver, which supports buoyant compressible -reacting flow coupled to multiple run-time-selectable lagrangian clouds and -surface film modelling. - -To run a reactingParcelFoam case in reactingFoam add the following entries in -constant/fvModels: - -buoyancyForce -{ - type buoyancyForce; -} - -clouds -{ - type clouds; - libs ("liblagrangianParcel.so"); -} - -which add the acceleration due to gravity needed by Lagrangian clouds and the -clouds themselves. - -To run with a single cloud rename the constant/*CloudProperties file to -constant/cloudProperties. - -To run with a multiple clouds create a constant/clouds file with a list of the -names of clouds in it. Each cloud then has a corresponding -constant/Properties file. - -In addition, cloud properties files also now require a "type" entry to specify -the type of cloud model used (e.g., thermoCloud, reactingMultiphaseCloud, -collidingCloud, etc ...). - -See the following cases for examples converted from reactingParcelFoam: - - \$FOAM_TUTORIALS/combustion/buoyantReactingFoam/Lagrangian - -EOF - -#------------------------------------------------------------------------------ diff --git a/bin/reactingParticleFoam b/bin/reactingParticleFoam deleted file mode 100755 index 6f5266b6b4..0000000000 --- a/bin/reactingParticleFoam +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh -#------------------------------------------------------------------------------ -# ========= | -# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox -# \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation -# \\/ M anipulation | -#------------------------------------------------------------------------------ -# License -# This file is part of OpenFOAM. -# -# OpenFOAM is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenFOAM. If not, see . -# -# Script -# reactingParticleFoam -# -# Description -# Script to inform the user that reactingParticleFoam has been replaced -# by the more general reactingFoam solver. -# -#------------------------------------------------------------------------------ - -cat << EOF - -The reactingParticleFoam solver has solver has been replaced by the more -general reactingFoam solver, which supports buoyant compressible -reacting flow coupled to multiple run-time-selectable lagrangian clouds and -surface film modelling. - -To run a reactingParticleFoam case in reactingFoam add the following entries in -constant/fvModels: - -buoyancyForce -{ - type buoyancyForce; -} - -clouds -{ - type clouds; - libs ("liblagrangianParcel.so"); -} - -which add the acceleration due to gravity needed by Lagrangian clouds and the -clouds themselves. - -See the following cases for examples converted from reactingParticleFoam: - - \$FOAM_TUTORIALS/combustion/reactingFoam/Lagrangian - -EOF - -#------------------------------------------------------------------------------ diff --git a/bin/reconstructParMesh b/bin/reconstructParMesh index fb6e16486d..cbc195cc52 100755 --- a/bin/reconstructParMesh +++ b/bin/reconstructParMesh @@ -33,8 +33,8 @@ cat <. +# +# Script +# rhoPimpleFoam +# +# Description +# Script to inform the user that rhoPimpleFoam has been superseded +# and replaced by the more general foamMultiRun solver. +# +#------------------------------------------------------------------------------ + +cat <. +# +# Script +# rhoSimpleFoam +# +# Description +# Script to inform the user that rhoSimpleFoam has been superseded +# and replaced by the more general foamMultiRun solver. +# +#------------------------------------------------------------------------------ + +cat <. -# -# Script -# simpleReactingParcelFoam -# -# Description -# Script to inform the user that simpleReactingParcelFoam has been replaced -# by the more general reactingFoam solver. -# -#------------------------------------------------------------------------------ - -cat << EOF - -The simpleReactingParcelFoam solver has solver has been replaced by the more -general reactingFoam solver, which supports buoyant compressible -reacting flow coupled to multiple run-time-selectable lagrangian clouds and -surface film modelling. - -To run a simpleReactingParcelFoam case in reactingFoam add the following entries -in constant/fvModels: - -buoyancyForce -{ - type buoyancyForce; -} - -clouds -{ - type clouds; - libs ("liblagrangianParcel.so"); -} - -which add the acceleration due to gravity needed by Lagrangian clouds and the -clouds themselves. - -To run with a single cloud rename the constant/*CloudProperties file to -constant/cloudProperties. - -To run with a multiple clouds create a constant/clouds file with a list of the -names of clouds in it. Each cloud then has a corresponding -constant/Properties file. - -In addition, cloud properties files also now require a "type" entry to specify -the type of cloud model used (e.g., thermoCloud, reactingMultiphaseCloud, -collidingCloud, etc ...). - -See the following case for an example converted from simpleReactingParcelFoam: - - \$FOAM_TUTORIALS/reactingFoam/Lagrangian/verticalChannelSteady - -EOF - -#------------------------------------------------------------------------------ diff --git a/bin/simpleReactingParticleFoam b/bin/simpleReactingParticleFoam deleted file mode 100755 index 55d1ef039b..0000000000 --- a/bin/simpleReactingParticleFoam +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh -#------------------------------------------------------------------------------ -# ========= | -# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox -# \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation -# \\/ M anipulation | -#------------------------------------------------------------------------------ -# License -# This file is part of OpenFOAM. -# -# OpenFOAM is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenFOAM. If not, see . -# -# Script -# simpleReactingParticleFoam -# -# Description -# Script to inform the user that simpleReactingParticleFoam has been replaced -# by the more general reactingFoam solver. -# -#------------------------------------------------------------------------------ - -cat << EOF - -The simpleReactingParticleFoam solver has solver has been replaced by the more -general reactingFoam solver, which supports buoyant compressible -reacting flow coupled to multiple run-time-selectable lagrangian clouds and -surface film modelling. - -To run a simpleReactingParticleFoam case in reactingFoam add the following entries -in constant/fvModels: - -buoyancyForce -{ - type buoyancyForce; -} - -clouds -{ - type clouds; - libs ("liblagrangianParticle.so"); -} - -which add the acceleration due to gravity needed by Lagrangian clouds and the -clouds themselves. - -See the following case for an example converted from simpleReactingParticleFoam: - - \$FOAM_TUTORIALS/reactingFoam/Lagrangian/verticalChannelSteady - -EOF - -#------------------------------------------------------------------------------ diff --git a/bin/sprayFoam b/bin/sprayFoam deleted file mode 100755 index 8bfdbe1835..0000000000 --- a/bin/sprayFoam +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -#------------------------------------------------------------------------------ -# ========= | -# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox -# \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation -# \\/ M anipulation | -#------------------------------------------------------------------------------ -# License -# This file is part of OpenFOAM. -# -# OpenFOAM is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenFOAM. If not, see . -# -# Script -# sprayFoam -# -# Description -# Script to inform the user that sprayFoam has been replaced by the -# more general reactingFoam solver. -# -#------------------------------------------------------------------------------ - -cat << EOF - -The sprayFoam solver has solver has been replaced by the more general -reactingFoam solver, which supports compressible reacting flow coupled -to multiple run-time-selectable lagrangian clouds and surface film modelling. - -To run with a single cloud rename the constant/*CloudProperties file to -constant/cloudProperties. - -To run with a multiple clouds create a constant/clouds file with a list of the -names of clouds in it. Each cloud then has a corresponding -constant/Properties file. - -In addition, cloud properties files also now require a "type" entry to specify -the type of cloud model used (e.g., thermoCloud, reactingMultiphaseCloud, -collidingCloud, etc ...). - -See the following case for an example converted from sprayFoam: - - \$FOAM_TUTORIALS/lagrangian/reactingFoam/aachenBomb - -EOF - -#------------------------------------------------------------------------------ diff --git a/bin/surfaceFeatureExtract b/bin/surfaceFeatureExtract index 3c175f9dcb..69bf4af0d8 100755 --- a/bin/surfaceFeatureExtract +++ b/bin/surfaceFeatureExtract @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -33,8 +33,8 @@ cat < /dev/null 2>&1 -rm -rf constant/regionProperties > /dev/null 2>&1 +rm -rf system/regionSolvers > /dev/null 2>&1 rm -rf constant/extendedFeatureEdgeMesh > /dev/null 2>&1 # ----------------------------------------------------------------- end-of-file diff --git a/etc/templates/singleFluidCHT/system/controlDict b/etc/templates/singleFluidCHT/system/controlDict index 60a16cd2b0..258674f1ce 100644 --- a/etc/templates/singleFluidCHT/system/controlDict +++ b/etc/templates/singleFluidCHT/system/controlDict @@ -13,7 +13,9 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application chtMultiRegionFoam; +application foamMultiRun; + +#includeIfPresent "regionSolvers" startFrom startTime; diff --git a/src/OpenFOAM/db/runTimeSelection/construction/addToRunTimeSelectionTable.H b/src/OpenFOAM/db/runTimeSelection/construction/addToRunTimeSelectionTable.H index cc52a4b495..e3073d8dd3 100644 --- a/src/OpenFOAM/db/runTimeSelection/construction/addToRunTimeSelectionTable.H +++ b/src/OpenFOAM/db/runTimeSelection/construction/addToRunTimeSelectionTable.H @@ -29,15 +29,18 @@ Description #ifndef addToRunTimeSelectionTable_H #define addToRunTimeSelectionTable_H +#include "macros.H" + namespace Foam { class word; bool addToRunTimeSelectionTableToC ( - const word& baseType, - const word& baseTypeName, - const word& thisTypeName + const char* baseType, + const char* baseTypeName, + const word& thisTypeName, + const char* libName ); } @@ -54,7 +57,7 @@ namespace Foam \ bool add##thisType##argNames##To##baseType##ToC_ = \ addToRunTimeSelectionTableToC \ - (#baseType, baseType::typeName_(), thisType::typeName) + (#baseType, baseType::typeName_(), thisType::typeName, STR(LIB_NAME)) //- Add to hash-table of functions with 'lookup' as the key @@ -67,7 +70,8 @@ namespace Foam (#lookup); \ \ bool add_##lookup##_##thisType##argNames##To##baseType##ToC_ = \ - addToRunTimeSelectionTableToC(#baseType, baseType::typeName_(), #lookup) + addToRunTimeSelectionTableToC \ + (#baseType, baseType::typeName_(), #lookup, STR(LIB_NAME)) //- Add to hash-table of functions with typename as the key @@ -80,7 +84,7 @@ namespace Foam \ bool addRemovable##thisType##argNames##To##baseType##ToC_ = \ addToRunTimeSelectionTableToC \ - (#baseType, baseType::typeName_(), thisType::typeName) + (#baseType, baseType::typeName_(), thisType::typeName, STR(LIB_NAME)) //- Add to hash-table of functions with 'lookup' as the key @@ -93,7 +97,8 @@ namespace Foam ##baseType##Table_(#lookup); \ \ bool addRemovable_##lookup##_##thisType##argNames##To##baseType##ToC_ = \ - addToRunTimeSelectionTableToC(#baseType, baseType::typeName_(), #lookup) + addToRunTimeSelectionTableToC \ + (#baseType, baseType::typeName_(), #lookup, STR(LIB_NAME)) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/runTimeSelectionToC/runTimeSelectionToC.C b/src/OpenFOAM/global/runTimeSelectionToC/runTimeSelectionToC.C index 9f7dad1e7f..2cb5ce9f73 100644 --- a/src/OpenFOAM/global/runTimeSelectionToC/runTimeSelectionToC.C +++ b/src/OpenFOAM/global/runTimeSelectionToC/runTimeSelectionToC.C @@ -39,9 +39,10 @@ Foam::debug::runTimeSelectionToCType Foam::debug::runTimeSelectionToC; bool Foam::addToRunTimeSelectionTableToC ( - const word& baseType, - const word& baseTypeName, - const word& thisTypeName + const char* baseType, + const char* baseTypeName, + const word& thisTypeName, + const char* libName ) { if (debug::enableRunTimeSelectionToC) @@ -51,11 +52,15 @@ bool Foam::addToRunTimeSelectionTableToC debug::runTimeSelectionToC.insert ( baseType, - Tuple2(baseTypeName, wordHashSet()) + Tuple2>(baseTypeName, HashTable()) ); } - debug::runTimeSelectionToC[baseType].second().insert(thisTypeName); + debug::runTimeSelectionToC[baseType].second().insert + ( + thisTypeName, + libName + ); } return debug::enableRunTimeSelectionToC; diff --git a/src/OpenFOAM/global/runTimeSelectionToC/runTimeSelectionToC.H b/src/OpenFOAM/global/runTimeSelectionToC/runTimeSelectionToC.H index d66839bff3..77b9bc33b2 100644 --- a/src/OpenFOAM/global/runTimeSelectionToC/runTimeSelectionToC.H +++ b/src/OpenFOAM/global/runTimeSelectionToC/runTimeSelectionToC.H @@ -35,7 +35,7 @@ SourceFiles #ifndef runTimeSelectionToC_H #define runTimeSelectionToC_H -#include "HashSet.H" +#include "HashTable.H" #include "Tuple2.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,7 +47,7 @@ namespace debug //- Switch to enable runTimeSelectionToC collection and caching extern bool enableRunTimeSelectionToC; - typedef HashTable> runTimeSelectionToCType; + typedef HashTable>> runTimeSelectionToCType; //- Run-time selectable objects extern runTimeSelectionToCType runTimeSelectionToC; diff --git a/src/OpenFOAM/include/addAllRegionsOption.H b/src/OpenFOAM/include/addAllRegionsOption.H index 31a1e01ef3..202b1266c2 100644 --- a/src/OpenFOAM/include/addAllRegionsOption.H +++ b/src/OpenFOAM/include/addAllRegionsOption.H @@ -1,5 +1,5 @@ Foam::argList::addBoolOption ( "allRegions", - "operate on all regions in regionProperties" + "operate on all regions in regionSolvers" ); diff --git a/src/OpenFOAM/include/setRegionNames.H b/src/OpenFOAM/include/setRegionNames.H new file mode 100644 index 0000000000..e99f05d599 --- /dev/null +++ b/src/OpenFOAM/include/setRegionNames.H @@ -0,0 +1,12 @@ +const Foam::wordList regionNames +( + args.optionFound("allRegions") + ? runTime .controlDict().subDict("regionSolvers").toc() + : wordList + ( + 1, + args.optionFound("region") + ? args.optionRead("region") + : polyMesh::defaultRegion + ) +); diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 67109d4f85..8d35e45039 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -467,13 +467,11 @@ $(solutionControl)/solutionControl/fluidSolutionControl/fluidSolutionControl.C $(solutionControl)/simpleControl/simpleControl.C $(solutionControl)/pisoControl/pisoControl.C -solidControl = $(solutionControl)/solidControl -$(solidControl)/solidNoLoopControl/solidNoLoopControl.C - pimpleControl = $(solutionControl)/pimpleControl $(pimpleControl)/pimpleControl/pimpleControl.C $(pimpleControl)/pimpleNoLoopControl/pimpleNoLoopControl.C $(pimpleControl)/pimpleLoop/pimpleLoop.C +$(pimpleControl)/pimpleSingleRegionControl/pimpleSingleRegionControl.C $(pimpleControl)/pimpleMultiRegionControl/pimpleMultiRegionControl.C convergenceControl = $(solutionControl)/convergenceControl @@ -519,4 +517,7 @@ $(cellSources)/fieldToCell/fieldToCell.C faceSources = sets/faceSources $(faceSources)/patchFluxToFace/patchFluxToFace.C +solver/solver.C +solver/solverNew.C + LIB = $(FOAM_LIBBIN)/libfiniteVolume diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.C index 7b1d747d24..08adc4c787 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,33 +37,9 @@ namespace Foam Foam::pimpleControl::pimpleControl(fvMesh& mesh, const word& algorithmName) : - pimpleNoLoopControl(mesh, algorithmName, *this), - pimpleLoop(static_cast(*this)) -{ - read(); - - printResidualControls(); - - if (nCorrPimple_ > 1) - { - printCorrResidualControls(nCorrPimple_); - } - - Info<< nl << algorithmName << ": Operating solver in " - << (mesh.schemes().steady() - ? "steady-state" - : mesh.schemes().transient() ? "transient" : - "mixed steady-state/transient") << " mode with " << nCorrPimple_ - << " outer corrector" << (nCorrPimple_ == 1 ? "" : "s") << nl; - - if (nCorrPimple_ == 1) - { - Info<< algorithmName << ": Operating solver in " - << (mesh.schemes().steady() ? "SIMPLE" : "PISO") << " mode" << nl; - } - - Info<< nl << endl; -} + pimpleNoLoopControl(mesh, algorithmName), + pimpleSingleRegionControl(static_cast(*this)) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -72,57 +48,4 @@ Foam::pimpleControl::~pimpleControl() {} -// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // - -bool Foam::pimpleControl::read() -{ - return pimpleNoLoopControl::read() && pimpleLoop::read(); -} - - -bool Foam::pimpleControl::loop() -{ - read(); - - if (!pimpleLoop::loop(*this)) - { - updateFinal(); - - return false; - } - - storePrevIterFields(); - - updateFinal(); - - return true; -} - - -bool Foam::pimpleControl::run(Time& time) -{ - read(); - - if (!endIfConverged(time)) - { - storePrevIterFields(); - } - - return time.run(); -} - - -bool Foam::pimpleControl::loop(Time& time) -{ - read(); - - if (!endIfConverged(time)) - { - storePrevIterFields(); - } - - return time.loop(); -} - - // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.H b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.H index 4ae3436b6e..8e856249c3 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl/pimpleControl.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,32 +25,8 @@ Class Foam::pimpleControl Description - Pimple control class. Provides time-loop control methods which exit the - simulation once convergence criteria have been reached. Also provides - Pimple-loop control methods which exit the iteration once corrector - convergence criteria have been met. Example usage: - - \verbatim - pimpleControl pimple(mesh); - - while (pimple.run(runTime)) - { - // pre-time-increment operations ... - - runTime ++; - Info<< "Time = " << runTime.userTimeName() << nl << endl; - - while (pimple.loop()) - { - // solve ... - } - - // post-solve operations ... - } - \endverbatim SourceFiles - pimpleControlI.H pimpleControl.C \*---------------------------------------------------------------------------*/ @@ -58,10 +34,7 @@ SourceFiles #ifndef pimpleControl_H #define pimpleControl_H -#include "pimpleNoLoopControl.H" -#include "pimpleLoop.H" -#include "singleRegionConvergenceControl.H" -#include "singleRegionCorrectorConvergenceControl.H" +#include "pimpleSingleRegionControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -75,7 +48,7 @@ namespace Foam class pimpleControl : public pimpleNoLoopControl, - public pimpleLoop + public pimpleSingleRegionControl { public: @@ -97,26 +70,27 @@ public: // Member Functions - // IO + using pimpleSingleRegionControl::loop; - //- Read controls - virtual bool read(); + using pimpleSingleRegionControl::run; - // Access + //- Flag to indicate whether to correct the transport properties + bool turbCorr() const + { + return transportCorr(); + } - //- Flag to indicate whether to solve the turbulence - inline bool turbCorr() const; + //- Flag to indicate the first iteration + bool firstPimpleIter() const + { + return pimpleSingleRegionControl::firstIter(); + } - // Evolution - - //- Pimple loop - bool loop(); - - //- Time run loop - bool run(Time& time); - - //- Time loop loop - bool loop(Time& time); + //- Flag to indicate the final iteration + bool finalPimpleIter() const + { + return pimpleSingleRegionControl::finalIter(); + } }; @@ -126,10 +100,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "pimpleControlI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.C index 21bcb1b4e7..f5b7e3ef77 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleLoop/pimpleLoop.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,7 +37,7 @@ namespace Foam bool Foam::pimpleLoop::read() { - nCorrPimple_ = + nCorr_ = control_.dict().lookupOrDefault