From 3db12bbdef993f3dd7bb9366d8e4d597a1c54b49 Mon Sep 17 00:00:00 2001 From: Sergio Ferraris <s.ferraris@opencfd.co.uk> Date: Wed, 16 Dec 2020 17:57:45 +0000 Subject: [PATCH] ENH: adding non-uniform rho to incompressible two-phase turbulent models 1) PhaseIncompressibleTurbulenceModel class was changed to use uniform alpha and non-uniform rho templates. This fits the need of incompressible two phase turbulence models. 2) A new type DPMIncompressibleTurbulenceModel was created for non-uniform alpha and uniform rho. It is used in single phase flows in DPM solvers where alpha represents the volumen occupancy. 3) A new type incompressibleRhoTurbulenceModel was created where non-uniform rho is allowed. 4) A new base templated turbulent class for two-phase VOF named VoFphaseTurbulentTransportModel was implemented which is created templating on PhaseIncompressibleTurbulenceModel and incompressibleRhoTurbulenceModel 5) In order to make the chnage to rho based VOF turbulence a help class was added incompressibleInterPhaseTransportModel templated on the mixing. --- .../DPMIncompressibleTurbulenceModel.C | 186 ++++++++++++++++++ .../DPMIncompressibleTurbulenceModel.H | 144 ++++++++++++++ .../DPMTurbulenceModels/DPMTurbulenceModels.C | 14 +- .../solvers/multiphase/interFoam/Make/options | 7 +- .../solvers/multiphase/interFoam/UEqn.H | 2 +- .../multiphase/interFoam/createFields.H | 9 +- .../solvers/multiphase/interFoam/interFoam.C | 6 +- .../multiphase/interIsoFoam/Make/options | 7 +- .../multiphase/interIsoFoam/createFields.H | 7 +- .../multiphase/interIsoFoam/interIsoFoam.C | 7 +- .../incompressible/Make/files | 1 + .../incompressibleRhoTurbulenceModel.C | 103 ++++++++++ .../incompressibleRhoTurbulenceModel.H | 155 +++++++++++++++ .../incompressibleTurbulenceModel.H | 5 + .../PhaseIncompressibleTurbulenceModel.C | 17 +- .../PhaseIncompressibleTurbulenceModel.H | 16 +- src/phaseSystemModels/Allwmake | 1 + src/phaseSystemModels/twoPhaseInter/Allwclean | 8 + src/phaseSystemModels/twoPhaseInter/Allwmake | 8 + .../Make/files | 3 + .../Make/options | 15 ++ .../VoFphaseTurbulentTransportModel.C | 63 ++++++ .../VoFphaseTurbulentTransportModel.H | 97 +++++++++ .../VoFphaseTurbulentTransportModels.C | 132 +++++++++++++ .../VoFphaseTurbulentTransportModels.H | 61 ++++++ .../Make/files | 3 + .../Make/options | 20 ++ .../incompressibleInterPhaseTransportModel.C | 147 ++++++++++++++ .../incompressibleInterPhaseTransportModel.H | 153 ++++++++++++++ .../incompressibleInterPhaseTransportModels.C | 41 ++++ .../incompressibleInterPhaseTransportModels.H | 55 ++++++ .../damBreak/constant/turbulenceProperties | 2 + .../RAS/damBreak/damBreak/system/fvSchemes | 4 +- 33 files changed, 1452 insertions(+), 47 deletions(-) create mode 100644 applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMIncompressibleTurbulenceModel.C create mode 100644 applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMIncompressibleTurbulenceModel.H create mode 100644 src/TurbulenceModels/incompressible/incompressibleRhoTurbulenceModel.C create mode 100644 src/TurbulenceModels/incompressible/incompressibleRhoTurbulenceModel.H create mode 100755 src/phaseSystemModels/twoPhaseInter/Allwclean create mode 100755 src/phaseSystemModels/twoPhaseInter/Allwmake create mode 100644 src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/Make/files create mode 100644 src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/Make/options create mode 100644 src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModel.C create mode 100644 src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModel.H create mode 100644 src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModels.C create mode 100644 src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModels.H create mode 100644 src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/Make/files create mode 100644 src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/Make/options create mode 100644 src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.C create mode 100644 src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.H create mode 100644 src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModels.C create mode 100644 src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModels.H diff --git a/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMIncompressibleTurbulenceModel.C b/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMIncompressibleTurbulenceModel.C new file mode 100644 index 00000000000..b8313c57253 --- /dev/null +++ b/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMIncompressibleTurbulenceModel.C @@ -0,0 +1,186 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "DPMIncompressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class TransportModel> +Foam::DPMIncompressibleTurbulenceModel<TransportModel>:: +DPMIncompressibleTurbulenceModel +( + const word& type, + const volScalarField& alpha, + const geometricOneField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const TransportModel& transportModel, + const word& propertiesName +) +: + TurbulenceModel + < + volScalarField, + geometricOneField, + incompressibleTurbulenceModel, + TransportModel + > + ( + alpha, + rho, + U, + alphaRhoPhi, + phi, + transportModel, + propertiesName + ) +{} + + +// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // + +template<class TransportModel> +Foam::autoPtr<Foam::DPMIncompressibleTurbulenceModel<TransportModel>> +Foam::DPMIncompressibleTurbulenceModel<TransportModel>::New +( + const volScalarField& alpha, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const TransportModel& transportModel, + const word& propertiesName +) +{ + return autoPtr<DPMIncompressibleTurbulenceModel> + ( + static_cast<DPMIncompressibleTurbulenceModel*>( + TurbulenceModel + < + volScalarField, + geometricOneField, + incompressibleTurbulenceModel, + TransportModel + >::New + ( + alpha, + geometricOneField(), + U, + alphaRhoPhi, + phi, + transportModel, + propertiesName + ).ptr()) + ); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class TransportModel> +Foam::tmp<Foam::volScalarField> +Foam::DPMIncompressibleTurbulenceModel<TransportModel>::pPrime() const +{ + return tmp<volScalarField>::New + ( + IOobject + ( + IOobject::groupName("pPrime", this->alphaRhoPhi_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->mesh_, + dimensionedScalar(dimPressure, Zero) + ); +} + + +template<class TransportModel> +Foam::tmp<Foam::surfaceScalarField> +Foam::DPMIncompressibleTurbulenceModel<TransportModel>::pPrimef() const +{ + return tmp<surfaceScalarField>::New + ( + IOobject + ( + IOobject::groupName("pPrimef", this->alphaRhoPhi_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->mesh_, + dimensionedScalar(dimPressure, Zero) + ); +} + + +template<class TransportModel> +Foam::tmp<Foam::volSymmTensorField> +Foam::DPMIncompressibleTurbulenceModel<TransportModel>::devReff() const +{ + return devRhoReff(); +} + + +template<class TransportModel> +Foam::tmp<Foam::fvVectorMatrix> +Foam::DPMIncompressibleTurbulenceModel<TransportModel>::divDevReff +( + volVectorField& U +) const +{ + return divDevRhoReff(U); +} + + +template<class TransportModel> +Foam::tmp<Foam::volSymmTensorField> +Foam::DPMIncompressibleTurbulenceModel<TransportModel>::devRhoReff() const +{ + NotImplemented; + + return devReff(); +} + + +template<class TransportModel> +Foam::tmp<Foam::fvVectorMatrix> +Foam::DPMIncompressibleTurbulenceModel<TransportModel>::divDevRhoReff +( + volVectorField& U +) const +{ + NotImplemented; + + return divDevReff(U); +} + + +// ************************************************************************* // diff --git a/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMIncompressibleTurbulenceModel.H b/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMIncompressibleTurbulenceModel.H new file mode 100644 index 00000000000..914c93d72ff --- /dev/null +++ b/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMIncompressibleTurbulenceModel.H @@ -0,0 +1,144 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 <http://www.gnu.org/licenses/>. + +Class + Foam::DPMIncompressibleTurbulenceModel + +Description + Templated abstract base class for volumen occupancy incompressible + turbulence models. + +SourceFiles + DPMIncompressibleTurbulenceModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DPMIncompressibleTurbulenceModel_H +#define DPMIncompressibleTurbulenceModel_H + +#include "TurbulenceModel.H" +#include "incompressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class DPMIncompressibleTurbulenceModel Declaration +\*---------------------------------------------------------------------------*/ + +template<class TransportModel> +class DPMIncompressibleTurbulenceModel +: + public TurbulenceModel + < + volScalarField, + geometricOneField, + incompressibleTurbulenceModel, + TransportModel + > +{ + +public: + + typedef volScalarField alphaField; + typedef geometricOneField rhoField; + typedef TransportModel transportModel; + + + // Constructors + + //- Construct + DPMIncompressibleTurbulenceModel + ( + const word& type, + const alphaField& alpha, + const geometricOneField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const TransportModel& transportModel, + const word& propertiesName + ); + + + // Selectors + + //- Return a reference to the selected turbulence model + static autoPtr<DPMIncompressibleTurbulenceModel> New + ( + const alphaField& alpha, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const TransportModel& transportModel, + const word& propertiesName = turbulenceModel::propertiesName + ); + + + //- Destructor + virtual ~DPMIncompressibleTurbulenceModel() = default; + + + // Member Functions + + //- Return the phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp<volScalarField> pPrime() const; + + //- Return the face-phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp<surfaceScalarField> pPrimef() const; + + //- Return the effective stress tensor + virtual tmp<volSymmTensorField> devReff() const; + + //- Return the source term for the momentum equation + virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const; + + //- Return the effective stress tensor + virtual tmp<volSymmTensorField> devRhoReff() const; + + //- Return the source term for the momentum equation + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "DPMIncompressibleTurbulenceModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMTurbulenceModels.C b/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMTurbulenceModels.C index 73d8e56e657..9b19ec6d88e 100644 --- a/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMTurbulenceModels.C +++ b/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMTurbulenceModels.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2013-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ -#include "PhaseIncompressibleTurbulenceModel.H" +#include "DPMIncompressibleTurbulenceModel.H" #include "singlePhaseTransportModel.H" #include "addToRunTimeSelectionTable.H" #include "makeTurbulenceModel.H" @@ -41,7 +41,7 @@ defineTurbulenceModelTypes volScalarField, geometricOneField, incompressibleTurbulenceModel, - PhaseIncompressibleTurbulenceModel, + DPMIncompressibleTurbulenceModel, singlePhaseTransportModel ); @@ -50,21 +50,21 @@ makeBaseTurbulenceModel volScalarField, geometricOneField, incompressibleTurbulenceModel, - PhaseIncompressibleTurbulenceModel, + DPMIncompressibleTurbulenceModel, singlePhaseTransportModel ); #define makeLaminarModel(Type) \ makeTemplatedTurbulenceModel \ - (singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, laminar, Type) + (singlePhaseTransportModelDPMIncompressibleTurbulenceModel, laminar, Type) #define makeRASModel(Type) \ makeTemplatedTurbulenceModel \ - (singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, RAS, Type) + (singlePhaseTransportModelDPMIncompressibleTurbulenceModel, RAS, Type) #define makeLESModel(Type) \ makeTemplatedTurbulenceModel \ - (singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, LES, Type) + (singlePhaseTransportModelDPMIncompressibleTurbulenceModel, LES, Type) #include "Stokes.H" makeLaminarModel(Stokes); diff --git a/applications/solvers/multiphase/interFoam/Make/options b/applications/solvers/multiphase/interFoam/Make/options index a14b34a21fd..8a9ec092de5 100644 --- a/applications/solvers/multiphase/interFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/Make/options @@ -1,5 +1,7 @@ EXE_INC = \ -I../VoF \ + -I$(LIB_SRC)/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/lnInclude \ + -I$(LIB_SRC)/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ @@ -10,6 +12,7 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \ -I$(LIB_SRC)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude EXE_LIBS = \ @@ -23,4 +26,6 @@ EXE_LIBS = \ -limmiscibleIncompressibleTwoPhaseMixture \ -lturbulenceModels \ -lincompressibleTurbulenceModels \ - -lwaveModels + -lwaveModels \ + -lVoFphaseTurbulentTransportModels \ + -lincompressibleInterPhaseTransportModels diff --git a/applications/solvers/multiphase/interFoam/UEqn.H b/applications/solvers/multiphase/interFoam/UEqn.H index 77d1dcd83e8..4d079b77cf1 100644 --- a/applications/solvers/multiphase/interFoam/UEqn.H +++ b/applications/solvers/multiphase/interFoam/UEqn.H @@ -4,7 +4,7 @@ ( fvm::ddt(rho, U) + fvm::div(rhoPhi, U) + MRF.DDt(rho, U) - + turbulence->divDevRhoReff(rho, U) + + turbulence.divDevRhoReff(rho, U) == fvOptions(rho, U) ); diff --git a/applications/solvers/multiphase/interFoam/createFields.H b/applications/solvers/multiphase/interFoam/createFields.H index 9d7f7e74020..fa3d3fb8f2a 100644 --- a/applications/solvers/multiphase/interFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/createFields.H @@ -70,13 +70,8 @@ surfaceScalarField rhoPhi fvc::interpolate(rho)*phi ); - -// Construct incompressible turbulence model -autoPtr<incompressible::turbulenceModel> turbulence -( - incompressible::turbulenceModel::New(U, phi, mixture) -); - +incompressibleInterPhaseTransportModel<immiscibleIncompressibleTwoPhaseMixture> + turbulence(rho, U, phi, rhoPhi, mixture); #include "readGravitationalAcceleration.H" #include "readhRef.H" diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index 0f45b72b25b..b43eb78a7e7 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,6 +46,7 @@ Description #include "CrankNicolsonDdtScheme.H" #include "subCycle.H" #include "immiscibleIncompressibleTwoPhaseMixture.H" +#include "incompressibleInterPhaseTransportModel.H" #include "turbulentTransportModel.H" #include "pimpleControl.H" #include "fvOptions.H" @@ -76,8 +78,6 @@ int main(int argc, char *argv[]) #include "initCorrectPhi.H" #include "createUfIfPresent.H" - turbulence->validate(); - if (!LTS) { #include "CourantNo.H" @@ -168,7 +168,7 @@ int main(int argc, char *argv[]) if (pimple.turbCorr()) { - turbulence->correct(); + turbulence.correct(); } } diff --git a/applications/solvers/multiphase/interIsoFoam/Make/options b/applications/solvers/multiphase/interIsoFoam/Make/options index 2eb27791a71..3a3d5bb109c 100644 --- a/applications/solvers/multiphase/interIsoFoam/Make/options +++ b/applications/solvers/multiphase/interIsoFoam/Make/options @@ -1,5 +1,7 @@ EXE_INC = \ -I../VoF \ + -I$(LIB_SRC)/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/lnInclude \ + -I$(LIB_SRC)/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/lnInclude \ -I../interFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ @@ -14,6 +16,7 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \ -I$(LIB_SRC)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude EXE_LIBS = \ @@ -29,4 +32,6 @@ EXE_LIBS = \ -lturbulenceModels \ -lincompressibleTurbulenceModels \ -lwaveModels \ - -lgeometricVoF + -lgeometricVoF \ + -lVoFphaseTurbulentTransportModels \ + -lincompressibleInterPhaseTransportModels diff --git a/applications/solvers/multiphase/interIsoFoam/createFields.H b/applications/solvers/multiphase/interIsoFoam/createFields.H index 7b5a80a9981..e214f4e482c 100644 --- a/applications/solvers/multiphase/interIsoFoam/createFields.H +++ b/applications/solvers/multiphase/interIsoFoam/createFields.H @@ -71,11 +71,8 @@ surfaceScalarField rhoPhi ); -// Construct incompressible turbulence model -autoPtr<incompressible::turbulenceModel> turbulence -( - incompressible::turbulenceModel::New(U, phi, mixture) -); +incompressibleInterPhaseTransportModel<immiscibleIncompressibleTwoPhaseMixture> + turbulence(rho, U, phi, rhoPhi, mixture); #include "readGravitationalAcceleration.H" diff --git a/applications/solvers/multiphase/interIsoFoam/interIsoFoam.C b/applications/solvers/multiphase/interIsoFoam/interIsoFoam.C index 6a694e4a814..6f492f865ce 100644 --- a/applications/solvers/multiphase/interIsoFoam/interIsoFoam.C +++ b/applications/solvers/multiphase/interIsoFoam/interIsoFoam.C @@ -10,6 +10,7 @@ Copyright (C) 2017 OpenCFD Ltd. Copyright (C) 2018 Johan Roenby Copyright (C) 2019-2020 DLR + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,7 +60,7 @@ Description #include "CrankNicolsonDdtScheme.H" #include "subCycle.H" #include "immiscibleIncompressibleTwoPhaseMixture.H" -#include "turbulentTransportModel.H" +#include "incompressibleInterPhaseTransportModel.H" #include "pimpleControl.H" #include "fvOptions.H" #include "CorrectPhi.H" @@ -91,8 +92,6 @@ int main(int argc, char *argv[]) #include "initCorrectPhi.H" #include "createUfIfPresent.H" - turbulence->validate(); - #include "CourantNo.H" #include "setInitialDeltaT.H" @@ -181,7 +180,7 @@ int main(int argc, char *argv[]) if (pimple.turbCorr()) { - turbulence->correct(); + turbulence.correct(); } } diff --git a/src/TurbulenceModels/incompressible/Make/files b/src/TurbulenceModels/incompressible/Make/files index 389c934efdb..661b934a5a0 100644 --- a/src/TurbulenceModels/incompressible/Make/files +++ b/src/TurbulenceModels/incompressible/Make/files @@ -1,4 +1,5 @@ incompressibleTurbulenceModel.C +incompressibleRhoTurbulenceModel.C turbulentTransportModels/turbulentTransportModels.C diff --git a/src/TurbulenceModels/incompressible/incompressibleRhoTurbulenceModel.C b/src/TurbulenceModels/incompressible/incompressibleRhoTurbulenceModel.C new file mode 100644 index 00000000000..e2b74c4e7b4 --- /dev/null +++ b/src/TurbulenceModels/incompressible/incompressibleRhoTurbulenceModel.C @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "incompressibleRhoTurbulenceModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(incompressibleRhoTurbulenceModel, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +Foam::incompressibleRhoTurbulenceModel::incompressibleRhoTurbulenceModel +( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const word& propertiesName +) +: + turbulenceModel + ( + U, + alphaRhoPhi, + phi, + propertiesName + ), + rho_(rho) +{} + + +Foam::tmp<Foam::volScalarField> +Foam::incompressibleRhoTurbulenceModel::mu() const +{ + return rho_*nu(); +} + + +Foam::tmp<Foam::scalarField> +Foam::incompressibleRhoTurbulenceModel::mu(const label patchi) const +{ + return rho_.boundaryField()[patchi]*nu(patchi); +} + + +Foam::tmp<Foam::volScalarField> +Foam::incompressibleRhoTurbulenceModel::mut() const +{ + return rho_*nut(); +} + + +Foam::tmp<Foam::scalarField> +Foam::incompressibleRhoTurbulenceModel::mut(const label patchi) const +{ + return rho_.boundaryField()[patchi]*nut(patchi); +} + + +Foam::tmp<Foam::volScalarField> +Foam::incompressibleRhoTurbulenceModel::muEff() const +{ + return rho_*nuEff(); +} + + +Foam::tmp<Foam::scalarField> +Foam::incompressibleRhoTurbulenceModel::muEff(const label patchi) const +{ + return rho_.boundaryField()[patchi]*nuEff(patchi); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/incompressibleRhoTurbulenceModel.H b/src/TurbulenceModels/incompressible/incompressibleRhoTurbulenceModel.H new file mode 100644 index 00000000000..14715b344ee --- /dev/null +++ b/src/TurbulenceModels/incompressible/incompressibleRhoTurbulenceModel.H @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 <http://www.gnu.org/licenses/>. + +Class + Foam::incompressibleRhoTurbulenceModel + +Description + Abstract base class for turbulence models (RAS, LES and laminar). + +SourceFiles + incompressibleRhoTurbulenceModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef incompressibleRhoTurbulenceModel_H +#define incompressibleRhoTurbulenceModel_H + +#include "turbulenceModel.H" +#include "geometricOneField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declarations +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class incompressibleRhoTurbulenceModel Declaration +\*---------------------------------------------------------------------------*/ + +class incompressibleRhoTurbulenceModel +: + public turbulenceModel +{ + +protected: + + // Protected data + + //- Pointer to actual rho + const volScalarField& rho_; + + + // Protected member functions + + //- ***HGW Temporary function to be removed when the run-time selectable + // thermal transport layer is complete + virtual void correctNut() + {} + + +private: + + // Private Member Functions + + //- No copy construct + incompressibleRhoTurbulenceModel + ( + const incompressibleRhoTurbulenceModel& + ) = delete; + + //- No copy assignment + void operator=(const incompressibleRhoTurbulenceModel&) = delete; + + +public: + + //- Runtime type information + TypeName("incompressibleRhoTurbulenceModel"); + + + // Constructors + + + //- Construct from components + incompressibleRhoTurbulenceModel + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const word& propertiesName + ); + + + //- Destructor + virtual ~incompressibleRhoTurbulenceModel() = default; + + + // Member Functions + + // Access functipons + + //- Return rho + + + //- Return the laminar dynamic viscosity + virtual tmp<volScalarField> mu() const; + + //- Return the laminar dynamic viscosity on patch + virtual tmp<scalarField> mu(const label patchi) const; + + //- Return the turbulence dynamic viscosity + virtual tmp<volScalarField> mut() const; + + //- Return the turbulence dynamic viscosity on patch + virtual tmp<scalarField> mut(const label patchi) const; + + //- Return the effective dynamic viscosity + virtual tmp<volScalarField> muEff() const; + + //- Return the effective dynamic viscosity on patch + virtual tmp<scalarField> muEff(const label patchi) const; + + //- Return the effective stress tensor including the laminar stress + virtual tmp<volSymmTensorField> devReff() const = 0; + + //- Return the source term for the momentum equation + virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/incompressibleTurbulenceModel.H b/src/TurbulenceModels/incompressible/incompressibleTurbulenceModel.H index 6ff1d0b0688..adb8438702f 100644 --- a/src/TurbulenceModels/incompressible/incompressibleTurbulenceModel.H +++ b/src/TurbulenceModels/incompressible/incompressibleTurbulenceModel.H @@ -112,6 +112,11 @@ public: // Member Functions + // Access functipons + + //- Return rho + + //- Return the laminar dynamic viscosity virtual tmp<volScalarField> mu() const; diff --git a/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.C b/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.C index f739c9b32b1..137c92a0373 100644 --- a/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.C +++ b/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,8 +35,8 @@ Foam::PhaseIncompressibleTurbulenceModel<TransportModel>:: PhaseIncompressibleTurbulenceModel ( const word& type, - const volScalarField& alpha, - const geometricOneField& rho, + const geometricOneField& alpha, + const volScalarField& rho, const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, @@ -45,9 +46,9 @@ PhaseIncompressibleTurbulenceModel : TurbulenceModel < - volScalarField, geometricOneField, - incompressibleTurbulenceModel, + volScalarField, + incompressibleRhoTurbulenceModel, TransportModel > ( @@ -68,7 +69,7 @@ template<class TransportModel> Foam::autoPtr<Foam::PhaseIncompressibleTurbulenceModel<TransportModel>> Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::New ( - const volScalarField& alpha, + const volScalarField& rho, const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, @@ -81,14 +82,14 @@ Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::New static_cast<PhaseIncompressibleTurbulenceModel*>( TurbulenceModel < - volScalarField, geometricOneField, - incompressibleTurbulenceModel, + volScalarField, + incompressibleRhoTurbulenceModel, TransportModel >::New ( - alpha, geometricOneField(), + rho, U, alphaRhoPhi, phi, diff --git a/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.H b/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.H index a67cf9c98aa..b25692493e1 100644 --- a/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.H +++ b/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,7 +40,7 @@ SourceFiles #define PhaseIncompressibleTurbulenceModel_H #include "TurbulenceModel.H" -#include "incompressibleTurbulenceModel.H" +#include "incompressibleRhoTurbulenceModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,17 +56,17 @@ class PhaseIncompressibleTurbulenceModel : public TurbulenceModel < - volScalarField, geometricOneField, - incompressibleTurbulenceModel, + volScalarField, + incompressibleRhoTurbulenceModel, TransportModel > { public: - typedef volScalarField alphaField; - typedef geometricOneField rhoField; + typedef volScalarField rhoField; + typedef geometricOneField alphaField; typedef TransportModel transportModel; @@ -77,7 +77,7 @@ public: ( const word& type, const alphaField& alpha, - const geometricOneField& rho, + const rhoField& rho, const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, @@ -91,7 +91,7 @@ public: //- Return a reference to the selected turbulence model static autoPtr<PhaseIncompressibleTurbulenceModel> New ( - const alphaField& alpha, + const rhoField& rho, const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, diff --git a/src/phaseSystemModels/Allwmake b/src/phaseSystemModels/Allwmake index 7239a7a7536..64e3943b1db 100755 --- a/src/phaseSystemModels/Allwmake +++ b/src/phaseSystemModels/Allwmake @@ -7,5 +7,6 @@ multiphaseInter/Allwmake $targetType $* multiphaseEuler/Allwmake $targetType $* reactingEuler/Allwmake $targetType $* twoPhaseEuler/Allwmake $targetType $* +twoPhaseInter/Allwmake $targetType $* #------------------------------------------------------------------------------ diff --git a/src/phaseSystemModels/twoPhaseInter/Allwclean b/src/phaseSystemModels/twoPhaseInter/Allwclean new file mode 100755 index 00000000000..b4f827d2c62 --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/Allwclean @@ -0,0 +1,8 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +#------------------------------------------------------------------------------ + +wclean libso VoFphaseIncompressibleTurbulenceModels +wclean libso incompressibleInterPhaseTransportModel + +#------------------------------------------------------------------------------ diff --git a/src/phaseSystemModels/twoPhaseInter/Allwmake b/src/phaseSystemModels/twoPhaseInter/Allwmake new file mode 100755 index 00000000000..fa5d0ace8e3 --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/Allwmake @@ -0,0 +1,8 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments +#------------------------------------------------------------------------------ + +wmake $targetType VoFphaseIncompressibleTurbulenceModels +wmake $targetType incompressibleInterPhaseTransportModel +#------------------------------------------------------------------------------ diff --git a/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/Make/files b/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/Make/files new file mode 100644 index 00000000000..903cd8bafa0 --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/Make/files @@ -0,0 +1,3 @@ +VoFphaseTurbulentTransportModels.C + +LIB = $(FOAM_LIBBIN)/libVoFphaseTurbulentTransportModels diff --git a/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/Make/options b/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/Make/options new file mode 100644 index 00000000000..5baaf94def3 --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/Make/options @@ -0,0 +1,15 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -lmeshTools \ + -lfluidThermophysicalModels \ + -lspecie \ + -lincompressibleTransportModels \ + -lturbulenceModels diff --git a/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModel.C b/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModel.C new file mode 100644 index 00000000000..08eddef0866 --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModel.C @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "VoFphaseTurbulentTransportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + namespace incompressible + { + template<class BasicCompressibleTurbulenceModel> + autoPtr<BasicCompressibleTurbulenceModel> New + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const typename BasicCompressibleTurbulenceModel::transportModel& + transport, + const word& propertiesName + ) + { + return BasicCompressibleTurbulenceModel::New + ( + geometricOneField(), + rho, + U, + alphaRhoPhi, + phi, + transport, + propertiesName + ); + } + } +} + + +// ************************************************************************* // diff --git a/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModel.H b/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModel.H new file mode 100644 index 00000000000..efe9c3ed14d --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModel.H @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 <http://www.gnu.org/licenses/>. + +Typedef + Foam::incompressible::turbulenceModel + +Typedef + Foam::incompressible::RASModel + +Typedef + Foam::incompressible::LESModel + +Description + Typedefs for turbulence, RAS and LES models for incompressible flow + based on the standard laminar transport package. Density is explicity + referenced to consider the isothermal variable-density effect, as + described in: + \verbatim + Fan, W. & Anglart, H. (2020). + varRhoTurbVOF: A new set of volume of fluid solvers for turbulent + isothermal multiphase flows in OpenFOAM. + Computer Physics Communications, 247, 106876 + \endverbatim +VoFphaseTurbulentTransportModel.H +SourceFiles + VoFphaseTurbulentTransportModel.C + VoFphaseTurbulentTransportModels.C + + +\*---------------------------------------------------------------------------*/ + +#ifndef VoFphaseTurbulentTransportModel_H +#define VoFphaseTurbulentTransportModel_H + +#include "PhaseIncompressibleTurbulenceModel.H" +#include "laminarModel.H" +#include "RASModel.H" +#include "LESModel.H" +#include "incompressible/transportModel/transportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + namespace incompressible + { + typedef PhaseIncompressibleTurbulenceModel<transportModel> + phaseIncompressibleTurbulenceModel; + + template<class BasicCompressibleTurbulenceModel> + autoPtr<BasicCompressibleTurbulenceModel> New + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const typename BasicCompressibleTurbulenceModel::transportModel& + transport, + const word& propertiesName = turbulenceModel::propertiesName + ); + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "VoFphaseTurbulentTransportModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModels.C b/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModels.C new file mode 100644 index 00000000000..45d0a3718d5 --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModels.C @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "VoFphaseTurbulentTransportModels.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makeBaseTurbulenceModel +( + geometricOneField, + volScalarField, + incompressibleRhoTurbulenceModel, + PhaseIncompressibleTurbulenceModel, + transportModel +); + + +// -------------------------------------------------------------------------- // +// Laminar models +// -------------------------------------------------------------------------- // + +#include "Stokes.H" +makeLaminarModel(Stokes); + +#include "Maxwell.H" +makeLaminarModel(Maxwell); + + +// -------------------------------------------------------------------------- // +// RAS models +// -------------------------------------------------------------------------- // + +#include "SpalartAllmaras.H" +makeRASModel(SpalartAllmaras); + +#include "kEpsilon.H" +makeRASModel(kEpsilon); + +#include "RNGkEpsilon.H" +makeRASModel(RNGkEpsilon); + +#include "realizableKE.H" +makeRASModel(realizableKE); + +#include "LaunderSharmaKE.H" +makeRASModel(LaunderSharmaKE); + +#include "kOmega.H" +makeRASModel(kOmega); + +#include "kOmegaSST.H" +makeRASModel(kOmegaSST); + +#include "kOmegaSSTSAS.H" +makeRASModel(kOmegaSSTSAS); + +#include "kOmegaSSTLM.H" +makeRASModel(kOmegaSSTLM); + +#include "LRR.H" +makeRASModel(LRR); + +#include "SSG.H" +makeRASModel(SSG); + + +// -------------------------------------------------------------------------- // +// LES models +// -------------------------------------------------------------------------- // + +#include "Smagorinsky.H" +makeLESModel(Smagorinsky); + +#include "WALE.H" +makeLESModel(WALE); + +#include "kEqn.H" +makeLESModel(kEqn); + +#include "dynamicKEqn.H" +makeLESModel(dynamicKEqn); + +#include "dynamicLagrangian.H" +makeLESModel(dynamicLagrangian); + +#include "SpalartAllmarasDES.H" +makeLESModel(SpalartAllmarasDES); + +#include "SpalartAllmarasDDES.H" +makeLESModel(SpalartAllmarasDDES); + +#include "SpalartAllmarasIDDES.H" +makeLESModel(SpalartAllmarasIDDES); + +#include "DeardorffDiffStress.H" +makeLESModel(DeardorffDiffStress); + +#include "kOmegaSSTDES.H" +makeLESModel(kOmegaSSTDES); + +#include "kOmegaSSTDDES.H" +makeLESModel(kOmegaSSTDDES); + +#include "kOmegaSSTIDDES.H" +makeLESModel(kOmegaSSTIDDES); + + +// ************************************************************************* // diff --git a/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModels.H b/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModels.H new file mode 100644 index 00000000000..e3a6ecf24da --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/VoFphaseIncompressibleTurbulenceModels/VoFphaseTurbulentTransportModels.H @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "PhaseIncompressibleTurbulenceModel.H" +#include "incompressible/transportModel/transportModel.H" +#include "addToRunTimeSelectionTable.H" +#include "makeTurbulenceModel.H" + +#include "laminarModel.H" +#include "RASModel.H" +#include "LESModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makeTurbulenceModelTypes +( + geometricOneField, + volScalarField, + incompressibleRhoTurbulenceModel, + PhaseIncompressibleTurbulenceModel, + transportModel +); + +#define makeLaminarModel(Type) \ + makeTemplatedTurbulenceModel \ + (transportModelPhaseIncompressibleTurbulenceModel, laminar, Type) + +#define makeRASModel(Type) \ + makeTemplatedTurbulenceModel \ + (transportModelPhaseIncompressibleTurbulenceModel, RAS, Type) + +#define makeLESModel(Type) \ + makeTemplatedTurbulenceModel \ + (transportModelPhaseIncompressibleTurbulenceModel, LES, Type) + + +// ************************************************************************* // diff --git a/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/Make/files b/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/Make/files new file mode 100644 index 00000000000..d76df25669f --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/Make/files @@ -0,0 +1,3 @@ +incompressibleInterPhaseTransportModels.C + +LIB = $(FOAM_LIBBIN)/libincompressibleInterPhaseTransportModels diff --git a/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/Make/options b/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/Make/options new file mode 100644 index 00000000000..fd43d606e9a --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/Make/options @@ -0,0 +1,20 @@ +EXE_INC = \ + -I../VoFphaseIncompressibleTurbulenceModels/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ + -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude\ + -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude\ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -lmeshTools \ + -lfluidThermophysicalModels \ + -lspecie \ + -lincompressibleTransportModels \ + -lturbulenceModels diff --git a/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.C b/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.C new file mode 100644 index 00000000000..ad99feb467e --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.C @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "incompressibleInterPhaseTransportModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Mixture> +Foam::incompressibleInterPhaseTransportModel<Mixture>:: +incompressibleInterPhaseTransportModel +( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const surfaceScalarField& rhoPhi, + const Mixture& mixture +) +: + rhoType_(rhoType::UNIFORM), + phi_(phi), + rhoPhi_(rhoPhi) +{ + { + IOdictionary turbulenceProperties + ( + IOobject + ( + turbulenceModel::propertiesName, + U.time().constant(), + U.db(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + if (turbulenceProperties.found("density")) + { + const word densityMethod + ( + turbulenceProperties.getWord("density") + ); + if (densityMethod == "variable") + { + rhoType_ = rhoType::VARIABLE; + } + else if (densityMethod == "uniform") + { + rhoType_ = rhoType::UNIFORM; + } + else + { + FatalErrorInFunction + << "The rho type provided is not correct " << nl + << " Available types are : " << nl + << " variable or uniform. " << nl + << nl << exit(FatalError); + } + } + } + + if (rhoType_ == rhoType::VARIABLE) + { + rhoIncTurbulence_ = + ( + incompressible::phaseIncompressibleTurbulenceModel::New + ( + rho, + U, + rhoPhi, + phi, + mixture + ) + ); + } + else + { + incTurbulence_ = incompressible::turbulenceModel::New + ( + U, + phi, + mixture + ); + + incTurbulence_->validate(); + } +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template<class Mixture> +Foam::tmp<Foam::fvVectorMatrix> +Foam::incompressibleInterPhaseTransportModel<Mixture>::divDevRhoReff +( + const volScalarField& rho, + volVectorField& U +) const +{ + if (rhoType_ == rhoType::VARIABLE) + { + return rhoIncTurbulence_->divDevRhoReff(U); + } + else + { + return incTurbulence_->divDevRhoReff(rho, U); + } +} + +template<class Mixture> +void Foam::incompressibleInterPhaseTransportModel<Mixture>::correct() +{ + if (rhoType_ == rhoType::VARIABLE) + { + rhoIncTurbulence_->correct(); + } + else + { + incTurbulence_->correct(); + } +} + + +// ************************************************************************* // diff --git a/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.H b/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.H new file mode 100644 index 00000000000..7ecb44bdedc --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.H @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 <http://www.gnu.org/licenses/>. + +Class + Foam::incompressibleInterPhaseTransportModel + +Description + Transport model selection class for the incompressibleInterFoam family of + solvers. + + By default the standard mixture transport modelling approach is used in + which a single momentum stress model (laminar, non-Newtonian, LES or RAS) is + constructed for the mixture. However if the \c simulationType in + constant/turbulenceProperties is set to \c twoPhaseTransport the alternative + Euler-Euler two-phase transport modelling approach is used in which separate + stress models (laminar, non-Newtonian, LES or RAS) are instantiated for each + of the two phases allowing for different modeling for the phases. + +SourceFiles + incompressibleInterPhaseTransportModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef incompressibleInterPhaseTransportModel_H +#define incompressibleInterPhaseTransportModel_H + + +#include "turbulentTransportModel.H" +#include "VoFphaseTurbulentTransportModel.H" +#include "demandDrivenEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class incompressibleInterPhaseTransportModel Declaration +\*---------------------------------------------------------------------------*/ + +template<class Mixture> +class incompressibleInterPhaseTransportModel +{ + // Private data + + //- Enum to select uniform or variable rho transport modelling + enum rhoType + { + UNIFORM, + VARIABLE + }; + + //- Rho type + label rhoType_; + + //- Mixture volumetric flux + const surfaceScalarField& phi_; + + //- Mixture mass flux + const surfaceScalarField& rhoPhi_; + + //- Mixture incompressible turbulence with constant rho + autoPtr<incompressible::turbulenceModel> incTurbulence_; + + //- Mixture incompressible turbulence with variable rho + autoPtr<incompressible::phaseIncompressibleTurbulenceModel> + rhoIncTurbulence_; + + + // Private Member Functions + + //- No copy construct + incompressibleInterPhaseTransportModel + ( + const incompressibleInterPhaseTransportModel& + ) = delete; + + //- No copy assignment + void operator=(const incompressibleInterPhaseTransportModel&) = delete; + + +public: + + TypeName("incompressibleInterPhaseTransportModel"); + + // Constructors + + //- Construct from components + incompressibleInterPhaseTransportModel + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const surfaceScalarField& rhoPhi, + const Mixture& + ); + + + //- Destructor + virtual ~incompressibleInterPhaseTransportModel() = default; + + + // Member Functions + + //- Return the effective momentum stress divergence + tmp<fvVectorMatrix> divDevRhoReff + ( + const volScalarField& rho, + volVectorField& U + ) const; + + //- Correct the phase or mixture transport models + void correct(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "incompressibleInterPhaseTransportModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModels.C b/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModels.C new file mode 100644 index 00000000000..b536a99ccac --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModels.C @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "incompressibleInterPhaseTransportModels.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTemplateTypeNameWithName + ( + incompImmiscibleTwoPhaseMixture, + "immiscibleTwoPhaseMixture" + ); +} + +// ************************************************************************* // diff --git a/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModels.H b/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModels.H new file mode 100644 index 00000000000..7ac8ecd2f18 --- /dev/null +++ b/src/phaseSystemModels/twoPhaseInter/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModels.H @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef incompressibleInterPhaseTransportModels_H +#define incompressibleInterPhaseTransportModels_H + +#include "incompressibleInterPhaseTransportModel.H" +#include "immiscibleIncompressibleTwoPhaseMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +typedef + incompressibleInterPhaseTransportModel + < + immiscibleIncompressibleTwoPhaseMixture + > incompImmiscibleTwoPhaseMixture; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/damBreak/damBreak/constant/turbulenceProperties b/tutorials/multiphase/interFoam/RAS/damBreak/damBreak/constant/turbulenceProperties index 805de79582d..40e5bd2d1b6 100644 --- a/tutorials/multiphase/interFoam/RAS/damBreak/damBreak/constant/turbulenceProperties +++ b/tutorials/multiphase/interFoam/RAS/damBreak/damBreak/constant/turbulenceProperties @@ -17,6 +17,8 @@ FoamFile simulationType RAS; +density variable; + RAS { RASModel kEpsilon; diff --git a/tutorials/multiphase/interFoam/RAS/damBreak/damBreak/system/fvSchemes b/tutorials/multiphase/interFoam/RAS/damBreak/damBreak/system/fvSchemes index 80bf4cf26dc..3d248f76c99 100644 --- a/tutorials/multiphase/interFoam/RAS/damBreak/damBreak/system/fvSchemes +++ b/tutorials/multiphase/interFoam/RAS/damBreak/damBreak/system/fvSchemes @@ -30,8 +30,8 @@ divSchemes div(rhoPhi,U) Gauss linearUpwind grad(U); div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss linear; - div(phi,k) Gauss upwind; - div(phi,epsilon) Gauss upwind; + div(rhoPhi,k) Gauss upwind; + div(rhoPhi,epsilon) Gauss upwind; div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; } -- GitLab