From 629bca4de9ba8947fdae523b719bbaf9b4e2efe9 Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Mon, 16 Apr 2012 15:54:08 +0100 Subject: [PATCH] compressibleInterFoam: Add support for run-time selectable equation of state --- .../compressibleInterFoam/Allwclean | 1 + .../multiphase/compressibleInterFoam/Allwmake | 1 + .../compressibleInterFoam/Make/options | 2 + .../multiphase/compressibleInterFoam/TEqn.H | 4 +- .../compressibleInterDyMFoam/Make/options | 2 + .../compressibleInterDyMFoam.C | 1 + .../compressibleInterFoam.C | 1 + .../compressibleInterFoam/createFields.H | 115 ++++++++-------- .../multiphase/compressibleInterFoam/pEqn.H | 15 +-- .../phaseEquationsOfState/Make/files | 7 + .../phaseEquationsOfState/Make/options | 6 + .../phaseEquationsOfState/constant/constant.C | 114 ++++++++++++++++ .../phaseEquationsOfState/constant/constant.H | 106 +++++++++++++++ .../phaseEquationsOfState/linear/linear.C | 114 ++++++++++++++++ .../phaseEquationsOfState/linear/linear.H | 109 +++++++++++++++ .../perfectFluid/perfectFluid.C | 113 ++++++++++++++++ .../perfectFluid/perfectFluid.H | 109 +++++++++++++++ .../newPhaseEquationOfState.C | 60 +++++++++ .../phaseEquationOfState.C | 54 ++++++++ .../phaseEquationOfState.H | 127 ++++++++++++++++++ .../constant/transportProperties | 36 +++-- .../constant/transportProperties | 36 +++-- 22 files changed, 1037 insertions(+), 96 deletions(-) create mode 100644 applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/files create mode 100644 applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/options create mode 100644 applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.C create mode 100644 applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.H create mode 100644 applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.C create mode 100644 applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.H create mode 100644 applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.C create mode 100644 applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.H create mode 100644 applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/newPhaseEquationOfState.C create mode 100644 applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.C create mode 100644 applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.H diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwclean b/applications/solvers/multiphase/compressibleInterFoam/Allwclean index 2b936f934b8..2f4544cb4c0 100755 --- a/applications/solvers/multiphase/compressibleInterFoam/Allwclean +++ b/applications/solvers/multiphase/compressibleInterFoam/Allwclean @@ -2,6 +2,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x +wclean libso phaseEquationsOfState wclean wclean compressibleInterDyMFoam diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwmake b/applications/solvers/multiphase/compressibleInterFoam/Allwmake index 644094d070c..b4b7f6ffa7f 100755 --- a/applications/solvers/multiphase/compressibleInterFoam/Allwmake +++ b/applications/solvers/multiphase/compressibleInterFoam/Allwmake @@ -2,6 +2,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x +wmake libso phaseEquationsOfState wmake wmake compressibleInterDyMFoam diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/Make/options index c8ce69c074b..ca9a90cf77f 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/Make/options @@ -2,12 +2,14 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ + -IphaseEquationsOfState/lnInclude \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ -ltwoPhaseInterfaceProperties \ -lincompressibleTransportModels \ + -lphaseEquationsOfState \ -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ diff --git a/applications/solvers/multiphase/compressibleInterFoam/TEqn.H b/applications/solvers/multiphase/compressibleInterFoam/TEqn.H index 34b6bd35dd5..2605ce345a9 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/TEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/TEqn.H @@ -15,6 +15,6 @@ ); // Update compressibilities - psi1 = 1.0/(R1*T); - psi2 = 1.0/(R2*T); + psi1 = eos1->psi(p, T); + psi2 = eos2->psi(p, T); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options index b9b0ec54daa..db259cfbc01 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ + -I../phaseEquationsOfState/lnInclude \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ @@ -12,6 +13,7 @@ EXE_INC = \ EXE_LIBS = \ -ltwoPhaseInterfaceProperties \ -lincompressibleTransportModels \ + -lphaseEquationsOfState \ -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C index a4cfc215fcc..b9f52944e84 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -43,6 +43,7 @@ Description #include "subCycle.H" #include "interfaceProperties.H" #include "twoPhaseMixture.H" +#include "phaseEquationOfState.H" #include "turbulenceModel.H" #include "pimpleControl.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 58dd7e68669..7c24e05a1af 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -40,6 +40,7 @@ Description #include "subCycle.H" #include "interfaceProperties.H" #include "twoPhaseMixture.H" +#include "phaseEquationOfState.H" #include "turbulenceModel.H" #include "pimpleControl.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/createFields.H b/applications/solvers/multiphase/compressibleInterFoam/createFields.H index 4930743887e..9a67dc5da57 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleInterFoam/createFields.H @@ -28,6 +28,34 @@ #include "createPhi.H" + Info<< "Reading field T\n" << endl; + volScalarField T + ( + IOobject + ( + "T", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + volScalarField p + ( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + p_rgh + ); + + Info<< "Reading transportProperties\n" << endl; twoPhaseMixture twoPhaseProperties(U, phi); @@ -41,24 +69,10 @@ scalar(1) - alpha1 ); - dimensionedScalar rho10 - ( - twoPhaseProperties.subDict - ( - twoPhaseProperties.phase1Name() - ).lookup("rho0") - ); - - dimensionedScalar rho20 - ( - twoPhaseProperties.subDict - ( - twoPhaseProperties.phase2Name() - ).lookup("rho0") - ); - dimensionedScalar k1 ( + "k", + dimensionSet(1, 1, -3, -1, 0), twoPhaseProperties.subDict ( twoPhaseProperties.phase1Name() @@ -67,6 +81,8 @@ dimensionedScalar k2 ( + "k", + dimensionSet(1, 1, -3, -1, 0), twoPhaseProperties.subDict ( twoPhaseProperties.phase2Name() @@ -75,6 +91,8 @@ dimensionedScalar Cv1 ( + "Cv", + dimensionSet(0, 2, -2, -1, 0), twoPhaseProperties.subDict ( twoPhaseProperties.phase1Name() @@ -83,40 +101,34 @@ dimensionedScalar Cv2 ( + "Cv", + dimensionSet(0, 2, -2, -1, 0), twoPhaseProperties.subDict ( twoPhaseProperties.phase2Name() ).lookup("Cv") ); - dimensionedScalar R1 + autoPtr<phaseEquationOfState> eos1 ( - twoPhaseProperties.subDict - ( - twoPhaseProperties.phase1Name() - ).lookup("R") - ); - - dimensionedScalar R2 - ( - twoPhaseProperties.subDict + phaseEquationOfState::New ( - twoPhaseProperties.phase2Name() - ).lookup("R") + twoPhaseProperties.subDict + ( + twoPhaseProperties.phase1Name() + ) + ) ); - Info<< "Reading field T\n" << endl; - volScalarField T + autoPtr<phaseEquationOfState> eos2 ( - IOobject + phaseEquationOfState::New ( - "T", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh + twoPhaseProperties.subDict + ( + twoPhaseProperties.phase2Name() + ) + ) ); volScalarField psi1 @@ -127,8 +139,9 @@ runTime.timeName(), mesh ), - 1.0/(R1*T) + eos1->psi(p, T) ); + psi1.oldTime(); volScalarField psi2 ( @@ -138,7 +151,7 @@ runTime.timeName(), mesh ), - 1.0/(R2*T) + eos2->psi(p, T) ); psi2.oldTime(); @@ -148,26 +161,8 @@ volScalarField gh("gh", g & mesh.C()); surfaceScalarField ghf("ghf", g & mesh.Cf()); - volScalarField p - ( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - max - ( - (p_rgh + gh*(alpha1*rho10 + alpha2*rho20)) - /(1.0 - gh*(alpha1*psi1 + alpha2*psi2)), - pMin - ) - ); - - volScalarField rho1(rho10 + psi1*p); - volScalarField rho2(rho20 + psi2*p); + volScalarField rho1(eos1->rho(p, T)); + volScalarField rho2(eos2->rho(p, T)); volScalarField rho ( diff --git a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H index b803b1ac189..fc700f81faa 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H @@ -1,6 +1,6 @@ { - rho1 = rho10 + psi1*p; - rho2 = rho20 + psi2*p; + rho1 = eos1->rho(p, T); + rho2 = eos2->rho(p, T); volScalarField rAU = 1.0/UEqn.A(); surfaceScalarField rAUf = fvc::interpolate(rAU); @@ -81,15 +81,10 @@ U += rAU*fvc::reconstruct((phi - phiU)/rAUf); U.correctBoundaryConditions(); - p = max - ( - (p_rgh + gh*(alpha1*rho10 + alpha2*rho20)) - /(1.0 - gh*(alpha1*psi1 + alpha2*psi2)), - pMin - ); + p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin); - rho1 = rho10 + psi1*p; - rho2 = rho20 + psi2*p; + rho1 = eos1->rho(p, T); + rho2 = eos2->rho(p, T); Info<< "max(U) " << max(mag(U)).value() << endl; Info<< "min(p_rgh) " << min(p_rgh).value() << endl; diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/files b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/files new file mode 100644 index 00000000000..4984fb848c7 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/files @@ -0,0 +1,7 @@ +phaseEquationOfState/phaseEquationOfState.C +phaseEquationOfState/newPhaseEquationOfState.C +constant/constant.C +linear/linear.C +perfectFluid/perfectFluid.C + +LIB = $(FOAM_LIBBIN)/libphaseEquationsOfState diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/options b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/options new file mode 100644 index 00000000000..0ec11392098 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/options @@ -0,0 +1,6 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude + +LIB_LIBS = \ + -lincompressibleTransportModels diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.C b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.C new file mode 100644 index 00000000000..ba17170b56d --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.C @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "constant.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseEquationsOfState +{ + defineTypeNameAndDebug(constant, 0); + + addToRunTimeSelectionTable + ( + phaseEquationOfState, + constant, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseEquationsOfState::constant::constant +( + const dictionary& dict +) +: + phaseEquationOfState(dict), + rho_("rho", dimDensity, dict.lookup("rho")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::phaseEquationsOfState::constant::~constant() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::constant::rho +( + const volScalarField& p, + const volScalarField& T +) const +{ + return tmp<Foam::volScalarField> + ( + new volScalarField + ( + IOobject + ( + "rho", + p.time().timeName(), + p.mesh() + ), + p.mesh(), + rho_ + ) + ); +} + + +Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::constant::psi +( + const volScalarField& p, + const volScalarField& T +) const +{ + return tmp<Foam::volScalarField> + ( + new volScalarField + ( + IOobject + ( + "psi", + p.time().timeName(), + p.mesh() + ), + p.mesh(), + dimensionedScalar("psi", dimDensity/dimPressure, 0) + ) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.H b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.H new file mode 100644 index 00000000000..cb39b8ee6d4 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.H @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::phaseEquationsOfState::constant + +Description + Constant phase density model. + +SourceFiles + constant.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constant_H +#define constant_H + +#include "phaseEquationOfState.H" +#include "dimensionedTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseEquationsOfState +{ + +/*---------------------------------------------------------------------------*\ + Class constant Declaration +\*---------------------------------------------------------------------------*/ + +class constant +: + public phaseEquationOfState +{ + // Private data + + //- The constant density of the phase + dimensionedScalar rho_; + + +public: + + //- Runtime type information + TypeName("constant"); + + + // Constructors + + //- Construct from components + constant + ( + const dictionary& dict + ); + + + //- Destructor + virtual ~constant(); + + + // Member Functions + + tmp<volScalarField> rho + ( + const volScalarField& p, + const volScalarField& T + ) const; + + tmp<volScalarField> psi + ( + const volScalarField& p, + const volScalarField& T + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace phaseEquationsOfState +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.C b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.C new file mode 100644 index 00000000000..6f27a878de9 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.C @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "linear.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseEquationsOfState +{ + defineTypeNameAndDebug(linear, 0); + + addToRunTimeSelectionTable + ( + phaseEquationOfState, + linear, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseEquationsOfState::linear::linear +( + const dictionary& dict +) +: + phaseEquationOfState(dict), + rho0_("rho0", dimDensity, dict.lookup("rho0")), + psi_("psi", dimDensity/dimPressure, dict.lookup("psi")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::phaseEquationsOfState::linear::~linear() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::linear::rho +( + const volScalarField& p, + const volScalarField& T +) const +{ + return tmp<Foam::volScalarField> + ( + new volScalarField + ( + IOobject + ( + "rho", + p.time().timeName(), + p.mesh() + ), + rho0_ + psi_*p + ) + ); +} + + +Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::linear::psi +( + const volScalarField& p, + const volScalarField& T +) const +{ + return tmp<Foam::volScalarField> + ( + new volScalarField + ( + IOobject + ( + "psi", + p.time().timeName(), + p.mesh() + ), + p.mesh(), + psi_ + ) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.H b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.H new file mode 100644 index 00000000000..d357bb3ec08 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.H @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::phaseEquationsOfState::linear + +Description + Linear phase density model. + +SourceFiles + linear.C + +\*---------------------------------------------------------------------------*/ + +#ifndef linear_H +#define linear_H + +#include "phaseEquationOfState.H" +#include "dimensionedTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseEquationsOfState +{ + +/*---------------------------------------------------------------------------*\ + Class linear Declaration +\*---------------------------------------------------------------------------*/ + +class linear +: + public phaseEquationOfState +{ + // Private data + + //- The reference density of the phase + dimensionedScalar rho0_; + + //- The constant compressibility of the phase + dimensionedScalar psi_; + + +public: + + //- Runtime type information + TypeName("linear"); + + + // Constructors + + //- Construct from components + linear + ( + const dictionary& dict + ); + + + //- Destructor + virtual ~linear(); + + + // Member Functions + + tmp<volScalarField> rho + ( + const volScalarField& p, + const volScalarField& T + ) const; + + tmp<volScalarField> psi + ( + const volScalarField& p, + const volScalarField& T + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace phaseEquationsOfState +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.C b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.C new file mode 100644 index 00000000000..32327a5ffc0 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.C @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "perfectFluid.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseEquationsOfState +{ + defineTypeNameAndDebug(perfectFluid, 0); + + addToRunTimeSelectionTable + ( + phaseEquationOfState, + perfectFluid, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseEquationsOfState::perfectFluid::perfectFluid +( + const dictionary& dict +) +: + phaseEquationOfState(dict), + rho0_("rho0", dimDensity, dict.lookup("rho0")), + R_("R", dimensionSet(0, 2, -2, -1, 0), dict.lookup("R")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::phaseEquationsOfState::perfectFluid::~perfectFluid() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::perfectFluid::rho +( + const volScalarField& p, + const volScalarField& T +) const +{ + return tmp<Foam::volScalarField> + ( + new volScalarField + ( + IOobject + ( + "rho", + p.time().timeName(), + p.mesh() + ), + rho0_ + psi(p, T)*p + ) + ); +} + + +Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::perfectFluid::psi +( + const volScalarField& p, + const volScalarField& T +) const +{ + return tmp<Foam::volScalarField> + ( + new volScalarField + ( + IOobject + ( + "psi", + p.time().timeName(), + p.mesh() + ), + 1.0/(R_*T) + ) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.H b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.H new file mode 100644 index 00000000000..b854f1d84fb --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.H @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::phaseEquationsOfState::perfectFluid + +Description + PerfectFluid phase density model. + +SourceFiles + perfectFluid.C + +\*---------------------------------------------------------------------------*/ + +#ifndef perfectFluid_H +#define perfectFluid_H + +#include "phaseEquationOfState.H" +#include "dimensionedTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseEquationsOfState +{ + +/*---------------------------------------------------------------------------*\ + Class perfectFluid Declaration +\*---------------------------------------------------------------------------*/ + +class perfectFluid +: + public phaseEquationOfState +{ + // Private data + + //- The reference density of the phase + dimensionedScalar rho0_; + + //- The fluid constant of the phase + dimensionedScalar R_; + + +public: + + //- Runtime type information + TypeName("perfectFluid"); + + + // Constructors + + //- Construct from components + perfectFluid + ( + const dictionary& dict + ); + + + //- Destructor + virtual ~perfectFluid(); + + + // Member Functions + + tmp<volScalarField> rho + ( + const volScalarField& p, + const volScalarField& T + ) const; + + tmp<volScalarField> psi + ( + const volScalarField& p, + const volScalarField& T + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace phaseEquationsOfState +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/newPhaseEquationOfState.C b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/newPhaseEquationOfState.C new file mode 100644 index 00000000000..3d9a842a9f3 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/newPhaseEquationOfState.C @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "phaseEquationOfState.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::phaseEquationOfState> Foam::phaseEquationOfState::New +( + const dictionary& dict +) +{ + word phaseEquationOfStateType + ( + dict.subDict("equationOfState").lookup("type") + ); + + Info<< "Selecting phaseEquationOfState " + << phaseEquationOfStateType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(phaseEquationOfStateType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn("phaseEquationOfState::New") + << "Unknown phaseEquationOfStateType type " + << phaseEquationOfStateType << endl << endl + << "Valid phaseEquationOfState types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict.subDict("equationOfState")); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.C b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.C new file mode 100644 index 00000000000..41ed49322b2 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.C @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "phaseEquationOfState.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(phaseEquationOfState, 0); + defineRunTimeSelectionTable(phaseEquationOfState, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseEquationOfState::phaseEquationOfState +( + const dictionary& dict +) +: + dict_(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::phaseEquationOfState::~phaseEquationOfState() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.H b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.H new file mode 100644 index 00000000000..45a5079d0d9 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.H @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::phaseEquationOfState + +Description + A2stract base-class for dispersed-phase particle diameter models. + +SourceFiles + phaseEquationOfState.C + newDiameterModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseEquationOfState_H +#define phaseEquationOfState_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "dictionary.H" +#include "volFieldsFwd.H" +#include "runTimeSelectionTables.H" + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class phaseEquationOfState Declaration +\*---------------------------------------------------------------------------*/ + +class phaseEquationOfState +{ +protected: + + // Protected data + + const dictionary& dict_; + + +public: + + //- Runtime type information + TypeName("phaseEquationOfState"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + phaseEquationOfState, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + phaseEquationOfState + ( + const dictionary& dict + ); + + + //- Destructor + virtual ~phaseEquationOfState(); + + + // Selectors + + static autoPtr<phaseEquationOfState> New + ( + const dictionary& dict + ); + + + // Member Functions + + //- Return the phase density + virtual tmp<volScalarField> rho + ( + const volScalarField& p, + const volScalarField& T + ) const = 0; + + //- Return the phase compressibility + virtual tmp<volScalarField> psi + ( + const volScalarField& p, + const volScalarField& T + ) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/transportProperties b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/transportProperties index 1803697ff73..564df56f208 100644 --- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/transportProperties +++ b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/transportProperties @@ -20,23 +20,35 @@ phases (water air); water { transportModel Newtonian; - nu nu [ 0 2 -1 0 0 0 0 ] 1e-06; - k k [1 1 -3 -1 0 0 0] 0; //0.613; - rho rho [ 1 -3 0 0 0 0 0 ] 1000; - rho0 rho0 [ 1 -3 0 0 0 0 0 ] 1000; - R R [0 2 -2 -1 0] 3000; - Cv Cv [0 2 -2 -1 0] 4179; + nu 1e-06; + rho 1000; + k 0; // 0.613; + Cv 4179; + + equationOfState + { + type perfectFluid; + + rho0 1000; + R 3000; + } } air { transportModel Newtonian; - nu nu [ 0 2 -1 0 0 0 0 ] 1.589e-05; - k k [1 1 -3 -1 0 0 0] 0; //2.63e-2; - rho rho [ 1 -3 0 0 0 0 0 ] 1; - rho0 rho0 [ 1 -3 0 0 0 0 0 ] 0; - R R [0 2 -2 -1 0] 287; - Cv Cv [0 2 -2 -1 0] 721; + nu 1.589e-05; + rho 1; + k 0; // 2.63e-2; + Cv 721; + + equationOfState + { + type perfectFluid; + + rho0 0; + R 287; + } } pMin pMin [ 1 -1 -2 0 0 0 0 ] 10000; diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/transportProperties b/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/transportProperties index 1803697ff73..564df56f208 100644 --- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/transportProperties +++ b/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/transportProperties @@ -20,23 +20,35 @@ phases (water air); water { transportModel Newtonian; - nu nu [ 0 2 -1 0 0 0 0 ] 1e-06; - k k [1 1 -3 -1 0 0 0] 0; //0.613; - rho rho [ 1 -3 0 0 0 0 0 ] 1000; - rho0 rho0 [ 1 -3 0 0 0 0 0 ] 1000; - R R [0 2 -2 -1 0] 3000; - Cv Cv [0 2 -2 -1 0] 4179; + nu 1e-06; + rho 1000; + k 0; // 0.613; + Cv 4179; + + equationOfState + { + type perfectFluid; + + rho0 1000; + R 3000; + } } air { transportModel Newtonian; - nu nu [ 0 2 -1 0 0 0 0 ] 1.589e-05; - k k [1 1 -3 -1 0 0 0] 0; //2.63e-2; - rho rho [ 1 -3 0 0 0 0 0 ] 1; - rho0 rho0 [ 1 -3 0 0 0 0 0 ] 0; - R R [0 2 -2 -1 0] 287; - Cv Cv [0 2 -2 -1 0] 721; + nu 1.589e-05; + rho 1; + k 0; // 2.63e-2; + Cv 721; + + equationOfState + { + type perfectFluid; + + rho0 0; + R 287; + } } pMin pMin [ 1 -1 -2 0 0 0 0 ] 10000; -- GitLab