diff --git a/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMIncompressibleTurbulenceModel.C b/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMIncompressibleTurbulenceModel.C new file mode 100644 index 0000000000..b8313c5725 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#include "DPMIncompressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::DPMIncompressibleTurbulenceModel:: +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 +Foam::autoPtr> +Foam::DPMIncompressibleTurbulenceModel::New +( + const volScalarField& alpha, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const TransportModel& transportModel, + const word& propertiesName +) +{ + return autoPtr + ( + static_cast( + TurbulenceModel + < + volScalarField, + geometricOneField, + incompressibleTurbulenceModel, + TransportModel + >::New + ( + alpha, + geometricOneField(), + U, + alphaRhoPhi, + phi, + transportModel, + propertiesName + ).ptr()) + ); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::tmp +Foam::DPMIncompressibleTurbulenceModel::pPrime() const +{ + return tmp::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 +Foam::tmp +Foam::DPMIncompressibleTurbulenceModel::pPrimef() const +{ + return tmp::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 +Foam::tmp +Foam::DPMIncompressibleTurbulenceModel::devReff() const +{ + return devRhoReff(); +} + + +template +Foam::tmp +Foam::DPMIncompressibleTurbulenceModel::divDevReff +( + volVectorField& U +) const +{ + return divDevRhoReff(U); +} + + +template +Foam::tmp +Foam::DPMIncompressibleTurbulenceModel::devRhoReff() const +{ + NotImplemented; + + return devReff(); +} + + +template +Foam::tmp +Foam::DPMIncompressibleTurbulenceModel::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 0000000000..914c93d72f --- /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 . + +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 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 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 pPrime() const; + + //- Return the face-phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp pPrimef() const; + + //- Return the effective stress tensor + virtual tmp devReff() const; + + //- Return the source term for the momentum equation + virtual tmp divDevReff(volVectorField& U) const; + + //- Return the effective stress tensor + virtual tmp devRhoReff() const; + + //- Return the source term for the momentum equation + virtual tmp 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 73d8e56e65..9b19ec6d88 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 a14b34a21f..8a9ec092de 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 77d1dcd83e..4d079b77cf 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 9d7f7e7402..fa3d3fb8f2 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 turbulence -( - incompressible::turbulenceModel::New(U, phi, mixture) -); - +incompressibleInterPhaseTransportModel + 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 0f45b72b25..b43eb78a7e 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 2eb27791a7..3a3d5bb109 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 7b5a80a998..e214f4e482 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 turbulence -( - incompressible::turbulenceModel::New(U, phi, mixture) -); +incompressibleInterPhaseTransportModel + 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 6a694e4a81..6f492f865c 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 389c934efd..661b934a5a 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 0000000000..e2b74c4e7b --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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::incompressibleRhoTurbulenceModel::mu() const +{ + return rho_*nu(); +} + + +Foam::tmp +Foam::incompressibleRhoTurbulenceModel::mu(const label patchi) const +{ + return rho_.boundaryField()[patchi]*nu(patchi); +} + + +Foam::tmp +Foam::incompressibleRhoTurbulenceModel::mut() const +{ + return rho_*nut(); +} + + +Foam::tmp +Foam::incompressibleRhoTurbulenceModel::mut(const label patchi) const +{ + return rho_.boundaryField()[patchi]*nut(patchi); +} + + +Foam::tmp +Foam::incompressibleRhoTurbulenceModel::muEff() const +{ + return rho_*nuEff(); +} + + +Foam::tmp +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 0000000000..14715b344e --- /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 . + +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 mu() const; + + //- Return the laminar dynamic viscosity on patch + virtual tmp mu(const label patchi) const; + + //- Return the turbulence dynamic viscosity + virtual tmp mut() const; + + //- Return the turbulence dynamic viscosity on patch + virtual tmp mut(const label patchi) const; + + //- Return the effective dynamic viscosity + virtual tmp muEff() const; + + //- Return the effective dynamic viscosity on patch + virtual tmp muEff(const label patchi) const; + + //- Return the effective stress tensor including the laminar stress + virtual tmp devReff() const = 0; + + //- Return the source term for the momentum equation + virtual tmp divDevReff(volVectorField& U) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/incompressibleTurbulenceModel.H b/src/TurbulenceModels/incompressible/incompressibleTurbulenceModel.H index 6ff1d0b068..adb8438702 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 mu() const; diff --git a/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.C b/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.C index f739c9b32b..137c92a037 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:: 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 Foam::autoPtr> Foam::PhaseIncompressibleTurbulenceModel::New ( - const volScalarField& alpha, + const volScalarField& rho, const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, @@ -81,14 +82,14 @@ Foam::PhaseIncompressibleTurbulenceModel::New static_cast( 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 a67cf9c98a..b25692493e 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 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 7239a7a753..64e3943b1d 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 0000000000..b4f827d2c6 --- /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 0000000000..fa5d0ace8e --- /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 0000000000..903cd8bafa --- /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 0000000000..5baaf94def --- /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 0000000000..08eddef086 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#include "VoFphaseTurbulentTransportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + namespace incompressible + { + template + autoPtr 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 0000000000..efe9c3ed14 --- /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 . + +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 + phaseIncompressibleTurbulenceModel; + + template + autoPtr 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 0000000000..45d0a3718d --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..e3a6ecf24d --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..d76df25669 --- /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 0000000000..fd43d606e9 --- /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 0000000000..ad99feb467 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#include "incompressibleInterPhaseTransportModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::incompressibleInterPhaseTransportModel:: +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 +Foam::tmp +Foam::incompressibleInterPhaseTransportModel::divDevRhoReff +( + const volScalarField& rho, + volVectorField& U +) const +{ + if (rhoType_ == rhoType::VARIABLE) + { + return rhoIncTurbulence_->divDevRhoReff(U); + } + else + { + return incTurbulence_->divDevRhoReff(rho, U); + } +} + +template +void Foam::incompressibleInterPhaseTransportModel::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 0000000000..7ecb44bded --- /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 . + +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 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 incTurbulence_; + + //- Mixture incompressible turbulence with variable rho + autoPtr + 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 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 0000000000..b536a99cca --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..7ac8ecd2f1 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 805de79582..40e5bd2d1b 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 80bf4cf26d..3d248f76c9 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; }