diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/files b/applications/solvers/multiphase/compressibleInterFoam/Make/files index 0e009f09bcd767c85f1541acab665277ce0f5175..de5437219c00fd0ec616736c21ad3b570b7d9f5e 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/Make/files +++ b/applications/solvers/multiphase/compressibleInterFoam/Make/files @@ -1,4 +1,3 @@ -derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C compressibleInterFoam.C EXE = $(FOAM_APPBIN)/compressibleInterFoam diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/Make/options index 48c253b21316c4e8b76158cc9627723d73fba48b..a6a130754a20800314f89a91ac4ae1a5dbf556d7 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/Make/options @@ -1,16 +1,19 @@ EXE_INC = \ + -ItwoPhaseThermo \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -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 = \ + -ltwoPhaseThermo \ + -lfluidThermophysicalModels \ + -lspecie \ -linterfaceProperties \ -ltwoPhaseInterfaceProperties \ -lincompressibleTransportModels \ - -lphaseEquationsOfState \ -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ diff --git a/applications/solvers/multiphase/compressibleInterFoam/TEqn.H b/applications/solvers/multiphase/compressibleInterFoam/TEqn.H index 2605ce345a973f19d71f43f83bbc18a2070de16d..d5183d5c4e9aee2f84882b39b1dce1736b4e5fcf 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/TEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/TEqn.H @@ -1,20 +1,14 @@ { - volScalarField kByCv - ( - "kByCv", - (alpha1*k1/Cv1 + alpha2*k2/Cv2) - + (alpha1*rho1 + alpha2*rho2)*turbulence->nut() - ); - solve ( fvm::ddt(rho, T) + fvm::div(rhoPhi, T) - - fvm::laplacian(kByCv, T) - + p*fvc::div(phi)*(alpha1/Cv1 + alpha2/Cv2) + - fvm::laplacian(thermo.alphaEff(rho*turbulence->nut()), T) + + ( + p*fvc::div(phi) + + fvc::ddt(rho, K) + fvc::div(rhoPhi, K) + )*(alpha1/thermo.thermo1().Cv() + alpha2/thermo.thermo2().Cv()) ); - // Update compressibilities - psi1 = eos1->psi(p, T); - psi2 = eos2->psi(p, T); + thermo.correct(); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/UEqn.H b/applications/solvers/multiphase/compressibleInterFoam/UEqn.H index 7cc250a66a2ab15a22680ab352f321e731b17c17..1c216a8bf7668894e57f08e4e80169c50b5fbfd9 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/UEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/UEqn.H @@ -22,4 +22,6 @@ ) * mesh.magSf() ) ); + + K = 0.5*magSqr(U); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options index d4d0fa9b5ab36194421b3a8e160265dff04dd6ef..48c21dfee59ebc6d83fd04bc213f36c2e5cd89df 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options @@ -1,5 +1,7 @@ EXE_INC = \ -I.. \ + -I../twoPhaseThermo \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ @@ -11,6 +13,9 @@ EXE_INC = \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude EXE_LIBS = \ + -ltwoPhaseThermo \ + -lfluidThermophysicalModels \ + -lspecie \ -linterfaceProperties \ -ltwoPhaseInterfaceProperties \ -lincompressibleTransportModels \ diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C index acf563fc8e2d4e1591a93c184eab5f40b86ee96e..2ebecc2bdb084c672132cf80d4dafe8ff53fdc34 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -43,7 +43,7 @@ Description #include "subCycle.H" #include "interfaceProperties.H" #include "twoPhaseMixture.H" -#include "phaseEquationOfState.H" +#include "twoPhaseThermo.H" #include "turbulenceModel.H" #include "pimpleControl.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 54c246f203b5f5ed9083d192fa3d0013ee01af3a..d9ceb5868341d8816db4e82bf885e42093d01c01 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -38,9 +38,10 @@ Description #include "fvCFD.H" #include "MULES.H" #include "subCycle.H" +#include "rhoThermo.H" #include "interfaceProperties.H" #include "twoPhaseMixture.H" -#include "phaseEquationOfState.H" +#include "twoPhaseThermo.H" #include "turbulenceModel.H" #include "pimpleControl.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/createFields.H b/applications/solvers/multiphase/compressibleInterFoam/createFields.H index 1c22600170bc1a4dbfa189d0041c341ee6256e63..e31e4c34bf94f221be73b269e4f1641e74d6e065 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleInterFoam/createFields.H @@ -28,34 +28,6 @@ #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); @@ -69,91 +41,31 @@ scalar(1) - alpha1 ); - dimensionedScalar k1 - ( - "k", - dimensionSet(1, 1, -3, -1, 0), - twoPhaseProperties.subDict - ( - twoPhaseProperties.phase1Name() - ).lookup("k") - ); - - dimensionedScalar k2 - ( - "k", - dimensionSet(1, 1, -3, -1, 0), - twoPhaseProperties.subDict - ( - twoPhaseProperties.phase2Name() - ).lookup("k") - ); + Info<< "Reading thermophysical properties\n" << endl; - dimensionedScalar Cv1 - ( - "Cv", - dimensionSet(0, 2, -2, -1, 0), - twoPhaseProperties.subDict - ( - twoPhaseProperties.phase1Name() - ).lookup("Cv") - ); - - dimensionedScalar Cv2 - ( - "Cv", - dimensionSet(0, 2, -2, -1, 0), - twoPhaseProperties.subDict - ( - twoPhaseProperties.phase2Name() - ).lookup("Cv") - ); - - autoPtr<phaseEquationOfState> eos1 - ( - phaseEquationOfState::New - ( - twoPhaseProperties.subDict - ( - twoPhaseProperties.phase1Name() - ) - ) - ); + twoPhaseThermo thermo(mesh, alpha1, alpha2); - autoPtr<phaseEquationOfState> eos2 - ( - phaseEquationOfState::New - ( - twoPhaseProperties.subDict - ( - twoPhaseProperties.phase2Name() - ) - ) - ); + volScalarField& rho = thermo.rho(); + volScalarField& p = thermo.p(); + volScalarField& T = thermo.T(); + const volScalarField& rho1 = thermo.thermo1().rho(); + const volScalarField& psi1 = thermo.thermo1().psi(); + const volScalarField& rho2 = thermo.thermo2().rho(); + const volScalarField& psi2 = thermo.thermo2().psi(); - volScalarField psi1 - ( - IOobject - ( - "psi1", - runTime.timeName(), - mesh - ), - eos1->psi(p, T) - ); - psi1.oldTime(); + // volScalarField rho + // ( + // IOobject + // ( + // "rho", + // runTime.timeName(), + // mesh, + // IOobject::READ_IF_PRESENT, + // IOobject::AUTO_WRITE + // ), + // alpha1*rho1 + alpha2*rho2 + // ); - volScalarField psi2 - ( - IOobject - ( - "psi2", - runTime.timeName(), - mesh - ), - eos2->psi(p, T) - ); - psi2.oldTime(); dimensionedScalar pMin(twoPhaseProperties.lookup("pMin")); @@ -161,23 +73,6 @@ volScalarField gh("gh", g & mesh.C()); surfaceScalarField ghf("ghf", g & mesh.Cf()); - volScalarField rho1("rho1", eos1->rho(p, T)); - volScalarField rho2("rho2", eos2->rho(p, T)); - - volScalarField rho - ( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - alpha1*rho1 + alpha2*rho2 - ); - - // Mass flux // Initialisation does not matter because rhoPhi is reset after the // alpha1 solution before it is used in the U equation. @@ -207,3 +102,19 @@ ( incompressible::turbulenceModel::New(U, phi, twoPhaseProperties) ); + + Info<< "Creating field dpdt\n" << endl; + volScalarField dpdt + ( + IOobject + ( + "dpdt", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) + ); + + Info<< "Creating field kinetic energy K\n" << endl; + volScalarField K("K", 0.5*magSqr(U)); diff --git a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H index 3197a72beeed1203b6248d6394e27dcdcf940269..dba9058f30bcf16faffe99c04c470285bf51c537 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H @@ -1,7 +1,4 @@ { - rho1 = eos1->rho(p, T); - rho2 = eos2->rho(p, T); - volScalarField rAU("rAU", 1.0/UEqn.A()); surfaceScalarField rAUf("Dp", fvc::interpolate(rAU)); @@ -91,9 +88,15 @@ p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin); - rho1 = eos1->rho(p, T); - rho2 = eos2->rho(p, T); + // thermo.correct(); Info<< "max(U) " << max(mag(U)).value() << endl; Info<< "min(p_rgh) " << min(p_rgh).value() << endl; + + K = 0.5*magSqr(U); + + if (thermo.dpdt()) + { + dpdt = fvc::ddt(p); + } } diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseThermo/Make/files b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseThermo/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..64771e2f6ea0a4eadf36fc495f8e38129e289a9b --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseThermo/Make/files @@ -0,0 +1,3 @@ +twoPhaseThermo.C + +LIB = $(FOAM_LIBBIN)/libtwoPhaseThermo diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseThermo/Make/options b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseThermo/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..eab8cce15dde3c729b68afecb9510af3bb5967e1 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseThermo/Make/options @@ -0,0 +1,8 @@ +EXE_INC = \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +LIB_LIBS = \ + -lfluidThermophysicalModels \ + -lspecie \ + -lfiniteVolume diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseThermo/twoPhaseThermo.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseThermo/twoPhaseThermo.C new file mode 100644 index 0000000000000000000000000000000000000000..e600ee328892cb85e12ab35e79f9e1b6d78ffb3c --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseThermo/twoPhaseThermo.C @@ -0,0 +1,365 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 "twoPhaseThermo.H" +#include "gradientEnergyFvPatchScalarField.H" +#include "mixedEnergyFvPatchScalarField.H" + + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(twoPhaseThermo, 0); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::twoPhaseThermo::twoPhaseThermo +( + const fvMesh& mesh, + const volScalarField& alpha1, + const volScalarField& alpha2, + const word& phaseName +) +: + rhoThermo(mesh, phaseName), + phaseName1_("1"), + phaseName2_("2"), + alpha1_(alpha1), + alpha2_(alpha2), + thermo1_(rhoThermo::New(mesh, phaseName1_)), + thermo2_(rhoThermo::New(mesh, phaseName2_)), + he_ + ( + IOobject + ( + phasePropertyName + ( + "he" + ), + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimMass, + heBoundaryTypes(), + heBoundaryBaseTypes() + ) +{ + thermo1_->validate("phaseModel 1", "e"); + thermo2_->validate("phaseModel 2", "e"); + + rho_ = alpha1_*thermo1_->rho() + alpha2_*thermo2_->rho(); + + he_ = + ( + alpha1_*thermo1_->rho()*thermo1_->he() + + alpha2_*thermo2_->rho()*thermo2_->he() + )/rho_; + + volScalarField::GeometricBoundaryField& hbf = he_.boundaryField(); + + forAll(hbf, patchi) + { + if (isA<gradientEnergyFvPatchScalarField>(hbf[patchi])) + { + refCast<gradientEnergyFvPatchScalarField>(hbf[patchi]).gradient() + = hbf[patchi].fvPatchField::snGrad(); + } + else if (isA<mixedEnergyFvPatchScalarField>(hbf[patchi])) + { + refCast<mixedEnergyFvPatchScalarField>(hbf[patchi]).refGrad() + = hbf[patchi].fvPatchField::snGrad(); + } + } + + correct(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::twoPhaseThermo::~twoPhaseThermo() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::twoPhaseThermo::correct() +{ + thermo1_->he() = thermo1_->he(p_, T_); + thermo1_->correct(); + + thermo2_->he() = thermo2_->he(p_, T_); + thermo2_->correct(); + + psi_ = alpha1_*thermo1_->psi() + alpha2_*thermo2_->psi(); + mu_ = alpha1_*thermo1_->mu() + alpha2_*thermo2_->mu(); + alpha_ = alpha1_*thermo1_->alpha() + alpha2_*thermo2_->alpha(); +} + + +bool Foam::twoPhaseThermo::incompressible() const +{ + return thermo1_->incompressible() && thermo2_->incompressible(); +} + + +bool Foam::twoPhaseThermo::isochoric() const +{ + return thermo1_->isochoric() && thermo2_->isochoric(); +} + + +Foam::tmp<Foam::volScalarField> Foam::twoPhaseThermo::he +( + const volScalarField& p, + const volScalarField& T +) const +{ + return alpha1_*thermo1_->he(p, T) + alpha2_*thermo2_->he(p, T); +} + + +Foam::tmp<Foam::scalarField> Foam::twoPhaseThermo::he +( + const scalarField& p, + const scalarField& T, + const labelList& cells +) const +{ + return + scalarField(alpha1_, cells)*thermo1_->he(p, T, cells) + + scalarField(alpha2_, cells)*thermo2_->he(p, T, cells); +} + + +Foam::tmp<Foam::scalarField> Foam::twoPhaseThermo::he +( + const scalarField& p, + const scalarField& T, + const label patchi +) const +{ + return + alpha1_.boundaryField()[patchi]*thermo1_->he(p, T, patchi) + + alpha2_.boundaryField()[patchi]*thermo2_->he(p, T, patchi); +} + + +Foam::tmp<Foam::volScalarField> Foam::twoPhaseThermo::hc() const +{ + return alpha1_*thermo1_->hc() + alpha2_*thermo2_->hc(); +} + + +Foam::tmp<Foam::scalarField> Foam::twoPhaseThermo::THE +( + const scalarField& h, + const scalarField& p, + const scalarField& T0, + const labelList& cells +) const +{ + notImplemented("Foam::twoPhaseThermo::THE"); + return T0; +} + + +Foam::tmp<Foam::scalarField> Foam::twoPhaseThermo::THE +( + const scalarField& h, + const scalarField& p, + const scalarField& T0, + const label patchi +) const +{ + notImplemented("Foam::twoPhaseThermo::THE"); + return T0; +} + + +Foam::tmp<Foam::volScalarField> Foam::twoPhaseThermo::Cp() const +{ + return alpha1_*thermo1_->Cp() + alpha2_*thermo2_->Cp(); +} + + +Foam::tmp<Foam::scalarField> Foam::twoPhaseThermo::Cp +( + const scalarField& p, + const scalarField& T, + const label patchi +) const +{ + return + alpha1_.boundaryField()[patchi]*thermo1_->Cp(p, T, patchi) + + alpha2_.boundaryField()[patchi]*thermo2_->Cp(p, T, patchi); +} + + +Foam::tmp<Foam::volScalarField> Foam::twoPhaseThermo::Cv() const +{ + return alpha1_*thermo1_->Cv() + alpha2_*thermo2_->Cv(); +} + + +Foam::tmp<Foam::scalarField> Foam::twoPhaseThermo::Cv +( + const scalarField& p, + const scalarField& T, + const label patchi +) const +{ + return + alpha1_.boundaryField()[patchi]*thermo1_->Cv(p, T, patchi) + + alpha2_.boundaryField()[patchi]*thermo2_->Cv(p, T, patchi); +} + + +Foam::tmp<Foam::volScalarField> Foam::twoPhaseThermo::gamma() const +{ + return alpha1_*thermo1_->gamma() + alpha2_*thermo2_->gamma(); +} + + +Foam::tmp<Foam::scalarField> Foam::twoPhaseThermo::gamma +( + const scalarField& p, + const scalarField& T, + const label patchi +) const +{ + return + alpha1_.boundaryField()[patchi]*thermo1_->gamma(p, T, patchi) + + alpha2_.boundaryField()[patchi]*thermo2_->gamma(p, T, patchi); +} + + +Foam::tmp<Foam::volScalarField> Foam::twoPhaseThermo::Cpv() const +{ + return alpha1_*thermo1_->Cpv() + alpha2_*thermo2_->Cpv(); +} + + +Foam::tmp<Foam::scalarField> Foam::twoPhaseThermo::Cpv +( + const scalarField& p, + const scalarField& T, + const label patchi +) const +{ + return + alpha1_.boundaryField()[patchi]*thermo1_->Cpv(p, T, patchi) + + alpha2_.boundaryField()[patchi]*thermo2_->Cpv(p, T, patchi); +} + + +Foam::tmp<Foam::volScalarField> Foam::twoPhaseThermo::CpByCpv() const +{ + return alpha1_*thermo1_->CpByCpv() + alpha2_*thermo2_->CpByCpv(); +} + + +Foam::tmp<Foam::scalarField> Foam::twoPhaseThermo::CpByCpv +( + const scalarField& p, + const scalarField& T, + const label patchi +) const +{ + return + alpha1_.boundaryField()[patchi]*thermo1_->CpByCpv(p, T, patchi) + + alpha2_.boundaryField()[patchi]*thermo2_->CpByCpv(p, T, patchi); +} + + +Foam::tmp<Foam::volScalarField> Foam::twoPhaseThermo::kappa() const +{ + return alpha1_*thermo1_->kappa() + alpha2_*thermo2_->kappa(); +} + + +Foam::tmp<Foam::scalarField> Foam::twoPhaseThermo::kappa +( + const label patchi +) const +{ + return + alpha1_.boundaryField()[patchi]*thermo1_->kappa(patchi) + + alpha2_.boundaryField()[patchi]*thermo2_->kappa(patchi); +} + + +Foam::tmp<Foam::volScalarField> Foam::twoPhaseThermo::kappaEff +( + const volScalarField& alphat +) const +{ + return + alpha1_*thermo1_->kappaEff(alphat) + + alpha2_*thermo2_->kappaEff(alphat); +} + + +Foam::tmp<Foam::scalarField> Foam::twoPhaseThermo::kappaEff +( + const scalarField& alphat, + const label patchi +) const +{ + return + alpha1_.boundaryField()[patchi]*thermo1_->kappaEff(alphat, patchi) + + alpha2_.boundaryField()[patchi]*thermo2_->kappaEff(alphat, patchi); +} + + +Foam::tmp<Foam::volScalarField> Foam::twoPhaseThermo::alphaEff +( + const volScalarField& alphat +) const +{ + return + alpha1_*thermo1_->alphaEff(alphat) + + alpha2_*thermo2_->alphaEff(alphat); +} + + +Foam::tmp<Foam::scalarField> Foam::twoPhaseThermo::alphaEff +( + const scalarField& alphat, + const label patchi +) const +{ + return + alpha1_.boundaryField()[patchi]*thermo1_->alphaEff(alphat, patchi) + + alpha2_.boundaryField()[patchi]*thermo2_->alphaEff(alphat, patchi); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseThermo/twoPhaseThermo.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseThermo/twoPhaseThermo.H new file mode 100644 index 0000000000000000000000000000000000000000..cfbada321b36206a2736abe7c789673c0e564ab3 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseThermo/twoPhaseThermo.H @@ -0,0 +1,290 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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::twoPhaseThermo + +Description + +SourceFiles + twoPhaseThermoI.H + twoPhaseThermo.C + twoPhaseThermoIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef twoPhaseThermo_H +#define twoPhaseThermo_H + +#include "rhoThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class twoPhaseThermo Declaration +\*---------------------------------------------------------------------------*/ + +class twoPhaseThermo +: + public rhoThermo +{ + // Private data + + //- Name of phase 1 + word phaseName1_; + + //- Name of phase 2 + word phaseName2_; + + //- Phase-fraction of phase 1 + const volScalarField& alpha1_; + + //- Phase-fraction of phase2 + const volScalarField& alpha2_; + + //- Thermo-package of phase 1 + autoPtr<rhoThermo> thermo1_; + + //- Thermo-package of phase 2 + autoPtr<rhoThermo> thermo2_; + + //- Energy field + volScalarField he_; + + +public: + + //- Runtime type information + TypeName("twoPhaseThermo"); + + + // Constructors + + //- Construct from mesh and phase fractions + twoPhaseThermo + ( + const fvMesh&, + const volScalarField& alpha1, + const volScalarField& alpha2, + const word& phaseName=word::null + ); + + + //- Destructor + virtual ~twoPhaseThermo(); + + + // Member Functions + + const rhoThermo& thermo1() const + { + return thermo1_(); + } + + const rhoThermo& thermo2() const + { + return thermo2_(); + } + + //- Update properties + virtual void correct(); + + //- Return true if the equation of state is incompressible + // i.e. rho != f(p) + virtual bool incompressible() const; + + //- Return true if the equation of state is isochoric + // i.e. rho = const + virtual bool isochoric() const; + + + // Access to thermodynamic state variables + + //- Enthalpy/Internal energy [J/kg] + // Non-const access allowed for transport equations + virtual volScalarField& he() + { + return he_; + } + + //- Enthalpy/Internal energy [J/kg] + virtual const volScalarField& he() const + { + return he_; + } + + //- Enthalpy/Internal energy + // for given pressure and temperature [J/kg] + virtual tmp<volScalarField> he + ( + const volScalarField& p, + const volScalarField& T + ) const; + + //- Enthalpy/Internal energy for cell-set [J/kg] + virtual tmp<scalarField> he + ( + const scalarField& p, + const scalarField& T, + const labelList& cells + ) const; + + //- Enthalpy/Internal energy for patch [J/kg] + virtual tmp<scalarField> he + ( + const scalarField& p, + const scalarField& T, + const label patchi + ) const; + + //- Chemical enthalpy [J/kg] + virtual tmp<volScalarField> hc() const; + + //- Temperature from enthalpy/internal energy for cell-set + virtual tmp<scalarField> THE + ( + const scalarField& h, + const scalarField& p, + const scalarField& T0, // starting temperature + const labelList& cells + ) const; + + //- Temperature from enthalpy/internal energy for patch + virtual tmp<scalarField> THE + ( + const scalarField& h, + const scalarField& p, + const scalarField& T0, // starting temperature + const label patchi + ) const; + + + // Fields derived from thermodynamic state variables + + //- Heat capacity at constant pressure [J/kg/K] + virtual tmp<volScalarField> Cp() const; + + //- Heat capacity at constant pressure for patch [J/kg/K] + virtual tmp<scalarField> Cp + ( + const scalarField& p, + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant volume [J/kg/K] + virtual tmp<volScalarField> Cv() const; + + //- Heat capacity at constant volume for patch [J/kg/K] + virtual tmp<scalarField> Cv + ( + const scalarField& p, + const scalarField& T, + const label patchi + ) const; + + //- gamma = Cp/Cv [] + virtual tmp<volScalarField> gamma() const; + + //- gamma = Cp/Cv for patch [] + virtual tmp<scalarField> gamma + ( + const scalarField& p, + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure/volume [J/kg/K] + virtual tmp<volScalarField> Cpv() const; + + //- Heat capacity at constant pressure/volume for patch [J/kg/K] + virtual tmp<scalarField> Cpv + ( + const scalarField& p, + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity ratio [] + virtual tmp<volScalarField> CpByCpv() const; + + //- Heat capacity ratio for patch [] + virtual tmp<scalarField> CpByCpv + ( + const scalarField& p, + const scalarField& T, + const label patchi + ) const; + + + // Fields derived from transport state variables + + //- Thermal diffusivity for temperature of mixture [J/m/s/K] + virtual tmp<volScalarField> kappa() const; + + //- Thermal diffusivity of mixture for patch [J/m/s/K] + virtual tmp<scalarField> kappa + ( + const label patchi + ) const; + + //- Effective thermal diffusivity of mixture [J/m/s/K] + virtual tmp<volScalarField> kappaEff + ( + const volScalarField& alphat + ) const; + + //- Effective thermal diffusivity of mixture for patch [J/m/s/K] + virtual tmp<scalarField> kappaEff + ( + const scalarField& alphat, + const label patchi + ) const; + + //- Effective thermal diffusivity of mixture [J/m/s/K] + virtual tmp<volScalarField> alphaEff + ( + const volScalarField& alphat + ) const; + + //- Effective thermal diffusivity of mixture for patch [J/m/s/K] + virtual tmp<scalarField> alphaEff + ( + const scalarField& alphat, + const label patchi + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/thermophysicalProperties b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/thermophysicalProperties new file mode 100644 index 0000000000000000000000000000000000000000..3c26cf1692ad357236bb940734e078d27d8d1ac3 --- /dev/null +++ b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/thermophysicalProperties @@ -0,0 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/thermophysicalProperties1 b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/thermophysicalProperties1 new file mode 100644 index 0000000000000000000000000000000000000000..57295cafbddae1ebb95e37c40b4281620431352b --- /dev/null +++ b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/thermophysicalProperties1 @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState perfectFluid; + specie specie; + energy sensibleInternalEnergy; +} + +mixture +{ + specie + { + nMoles 1; + molWeight 28.9; //2.77; + } + equationOfState + { + rho0 1027; + } + thermodynamics + { + Cp 4195; + Hf 0; + } + transport + { + mu 3.645e-4; + Pr 2.289; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/thermophysicalProperties2 b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/thermophysicalProperties2 new file mode 100644 index 0000000000000000000000000000000000000000..e61009c10be927d2af1b6981cc75ad368e85d5c3 --- /dev/null +++ b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/thermophysicalProperties2 @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState perfectGas; + specie specie; + energy sensibleInternalEnergy; +} + +mixture +{ + specie + { + nMoles 1; + molWeight 28.9; + } + thermodynamics + { + Cp 1007; + Hf 0; + } + transport + { + mu 1.84e-05; + Pr 0.7; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/transportProperties b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/transportProperties index 564df56f2083c586a247b9a7276aba1b90d3a4f2..78f85f47a2d7fd6c44c040653766d237404fba31 100644 --- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/transportProperties +++ b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/transportProperties @@ -22,16 +22,6 @@ water transportModel Newtonian; nu 1e-06; rho 1000; - k 0; // 0.613; - Cv 4179; - - equationOfState - { - type perfectFluid; - - rho0 1000; - R 3000; - } } air @@ -39,16 +29,6 @@ air transportModel Newtonian; 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/depthCharge2D/system/fvSchemes b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSchemes index 903d94d30c6e6ac6ecc85e0d048a668f7d3cb220..0c204f053f8dad1f6c9cf2ebace5172c11f77ea5 100644 --- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSchemes +++ b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSchemes @@ -33,6 +33,7 @@ divSchemes div(phid1,p_rgh) Gauss upwind; div(phid2,p_rgh) Gauss upwind; div(rho*phi,T) Gauss upwind; + div(rho*phi,K) Gauss upwind; div(phi,k) Gauss vanLeer; div((muEff*dev(T(grad(U))))) Gauss linear; } diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSolution b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSolution index 461897454640df6743233c416536bbb89b0fa6a0..9066c1c700c4ba078eae024acd15d76d07f45f55 100644 --- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSolution +++ b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSolution @@ -39,7 +39,7 @@ solvers maxIter 100; } - "(rho|rhoFinal)" + ".*(rho|rhoFinal)" { solver diagonal; }