ENH: Adding interCondensingEvaporatingFoam and tutorial

This commit is contained in:
sergio
2016-05-31 14:41:47 -07:00
parent e8d73e5546
commit d141b3c9b5
40 changed files with 3256 additions and 1 deletions

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
set -x
wclean libso temperaturePhaseChangeTwoPhaseMixtures
wclean
#------------------------------------------------------------------------------

View File

@ -0,0 +1,12 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType temperaturePhaseChangeTwoPhaseMixtures
wmake
#------------------------------------------------------------------------------

View File

@ -0,0 +1,3 @@
interCondensatingEvaporatingFoam.C
EXE = $(FOAM_APPBIN)/interCondensatingEvaporatingFoam

View File

@ -0,0 +1,30 @@
interPhaseChangePath = $(FOAM_SOLVERS)/multiphase/interPhaseChangeFoam
EXE_INC = \
-ItemperaturePhaseChangeTwoPhaseMixtures/lnInclude \
-I$(interPhaseChangePath) \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude\
-I$(LIB_SRC)/sampling/lnInclude
EXE_LIBS = \
-lphaseTemperatureChangeTwoPhaseMixtures \
-ltwoPhaseMixture \
-linterfaceProperties \
-ltwoPhaseProperties \
-lincompressibleTransportModels \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lfiniteVolume \
-lmeshTools \
-lfvOptions \
-lsampling \
-lfluidThermophysicalModels

View File

@ -0,0 +1,26 @@
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(rhoPhi, U)
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
+ turbulence->divDevRhoReff(rho, U)
);
UEqn.relax();
if (pimple.momentumPredictor())
{
solve
(
UEqn
==
fvc::reconstruct
(
(
interface.surfaceTensionForce()
- ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
) * mesh.magSf()
)
);
}

View File

@ -0,0 +1,12 @@
volScalarField contErr(fvc::ddt(rho) + fvc::div(rhoPhi));
scalar sumLocalContErr = runTime.deltaTValue()*
mag(contErr)().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaTValue()*
contErr.weightedAverage(mesh.V()).value();
Info<< "time step continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
<< endl;

View File

@ -0,0 +1,158 @@
Info<< "Reading field p_rgh\n" << endl;
volScalarField p_rgh
(
IOobject
(
"p_rgh",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "createPhi.H"
// Create p before the thermo
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
p_rgh
);
// Creating e based thermo
autoPtr<twoPhaseMixtureEThermo> thermo;
thermo.set(new twoPhaseMixtureEThermo(U, phi));
// Create mixture and
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n" << endl;
autoPtr<temperaturePhaseChangeTwoPhaseMixture> mixture =
temperaturePhaseChangeTwoPhaseMixture::New(thermo(), mesh);
volScalarField& T = thermo->T();
volScalarField& e = thermo->he();
// Correct e from T and alpha
thermo->correct();
volScalarField& alpha1(thermo->alpha1());
volScalarField& alpha2(thermo->alpha2());
const dimensionedScalar& rho1 = thermo->rho1();
const dimensionedScalar& rho2 = thermo->rho2();
// Need to store rho for ddt(rho, U)
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
alpha1*rho1 + alpha2*rho2,
alpha1.boundaryField().types()
);
rho.oldTime();
// Construct interface from alpha1 distribution
interfaceProperties interface
(
alpha1,
U,
thermo->transportPropertiesDict()
);
// Construct incompressible turbulence model
autoPtr<incompressible::turbulenceModel> turbulence
(
incompressible::turbulenceModel::New(U, phi, thermo())
);
Info<< "Calculating field g.h\n" << endl;
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("ghf", g & mesh.Cf());
//Update p with rho
p = p_rgh + rho*gh;
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell
(
p,
p_rgh,
pimple.dict(),
pRefCell,
pRefValue
);
if (p_rgh.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell)
);
p_rgh = p - rho*gh;
}
// Turbulent Prandtl number
dimensionedScalar Prt("Prt", dimless, thermo->transportPropertiesDict());
volScalarField kappaEff
(
IOobject
(
"kappaEff",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
thermo->kappa()
);
Info<< "Creating field kinetic energy K\n" << endl;
volScalarField K("K", 0.5*magSqr(U));
Info<< "Creating field pDivU\n" << endl;
volScalarField pDivU
(
IOobject
(
"pDivU",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("pDivU", p.dimensions()/dimTime, 0)
);

View File

@ -0,0 +1,31 @@
{
tmp<volScalarField> tcp(thermo->Cp());
const volScalarField& cp = tcp();
kappaEff = thermo->kappa() + rho*cp*turbulence->nut()/Prt;
pDivU = dimensionedScalar("pDivU", p.dimensions()/dimTime, 0.0);
if (thermo->pDivU())
{
pDivU = (p*fvc::div(rhoPhi/fvc::interpolate(rho)));
}
fvScalarMatrix eEqn
(
fvm::ddt(rho, e)
+ fvc::ddt(rho, K) + fvc::div(rhoPhi, K)
+ fvm::div(rhoPhi, e)
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), e)
- fvm::laplacian(kappaEff/cp, e)
+ pDivU
);
eEqn.relax();
eEqn.solve();
thermo->correct();
Info<< "min/max(T) = " << min(T).value() << ", "
<< max(T).value() <<endl;
}

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ 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/>.
Application
interCondensatingEvaporatingFoam
Group
grpMultiphaseSolvers
Description
Solver for 2 incompressible, non-isothermal immiscible fluids with
phase-change (evaporation-condensation) between a fluid and its vapour.
Uses a VOF (volume of fluid) phase-fraction based interface capturing
approach.
The momentum, energy and other fluid properties are of the "mixture" and a
single momentum equation is solved.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "CMULES.H"
#include "subCycle.H"
#include "interfaceProperties.H"
#include "twoPhaseMixtureEThermo.H"
#include "temperaturePhaseChangeTwoPhaseMixture.H"
#include "turbulentTransportModel.H"
#include "turbulenceModel.H"
#include "pimpleControl.H"
#include "fvOptions.H"
#include "fixedFluxPressureFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
pimpleControl pimple(mesh);
#include "readGravitationalAcceleration.H"
#include "initContinuityErrs.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "createTimeControls.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "alphaControls.H"
surfaceScalarField rhoPhi
(
IOobject
(
"rhoPhi",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("0", dimMass/dimTime, 0)
);
#include "alphaEqnSubCycle.H"
mixture->correct();
#include "UEqn.H"
#include "eEqn.H"
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
#include "continuityError.H"
if (pimple.turbCorr())
{
turbulence->correct();
}
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,77 @@
{
volScalarField rAU("rAU", 1.0/UEqn.A());
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
surfaceScalarField phiHbyA
(
"phiHbyA",
(fvc::interpolate(HbyA) & mesh.Sf())
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi)
);
adjustPhi(phiHbyA, U, p_rgh);
surfaceScalarField phig
(
(
interface.surfaceTensionForce()
- ghf*fvc::snGrad(rho)
)*rAUf*mesh.magSf()
);
phiHbyA += phig;
// Update the fixedFluxPressure BCs to ensure flux consistency
setSnGrad<fixedFluxPressureFvPatchScalarField>
(
p_rgh.boundaryField(),
(
phiHbyA.boundaryField()
- (mesh.Sf().boundaryField() & U.boundaryField())
)/(mesh.magSf().boundaryField()*rAUf.boundaryField())
);
Pair<tmp<volScalarField> > vDot = mixture->vDot();
const volScalarField& vDotc = vDot[0]();
const volScalarField& vDotv = vDot[1]();
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix p_rghEqn
(
fvc::div(phiHbyA)
- fvm::laplacian(rAUf, p_rgh)
- (vDotc - vDotv)
);
p_rghEqn.setReference(pRefCell, pRefValue);
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
{
phi = phiHbyA + p_rghEqn.flux();
U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
U.correctBoundaryConditions();
fvOptions.correct(U);
K = 0.5*magSqr(U);
}
}
p == p_rgh + rho*gh;
if (p_rgh.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell)
);
p_rgh = p - rho*gh;
}
}

View File

@ -0,0 +1,7 @@
temperaturePhaseChangeTwoPhaseMixtures/newtemperaturePhaseChangeTwoPhaseMixture.C
temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.C
thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C
twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C
constant/constant.C
LIB = $(FOAM_LIBBIN)/libphaseTemperatureChangeTwoPhaseMixtures

View File

@ -0,0 +1,16 @@
EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-ltwoPhaseMixture \
-linterfaceProperties \
-ltwoPhaseProperties \
-lincompressibleTransportModels \
-lfiniteVolume \
-lfluidThermophysicalModels

View File

@ -0,0 +1,174 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ 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 "addToRunTimeSelectionTable.H"
#include "fvcGrad.H"
#include "twoPhaseMixtureEThermo.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace temperaturePhaseChangeTwoPhaseMixtures
{
defineTypeNameAndDebug(constant, 0);
addToRunTimeSelectionTable
(
temperaturePhaseChangeTwoPhaseMixture,
constant,
components
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::constant
(
const thermoIncompressibleTwoPhaseMixture& mixture,
const fvMesh& mesh
)
:
temperaturePhaseChangeTwoPhaseMixture(mixture, mesh),
coeffC_(subDict(type() + "Coeffs").lookup("coeffC")),
coeffE_(subDict(type() + "Coeffs").lookup("coeffE"))
{
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::Pair<Foam::tmp<Foam::volScalarField> >
Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotAlphal() const
{
const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
const twoPhaseMixtureEThermo& thermo =
refCast<const twoPhaseMixtureEThermo>
(
mesh_.lookupObject<basicThermo>(basicThermo::dictName)
);
const dimensionedScalar& TSat = thermo.TSat();
dimensionedScalar T0("0", dimTemperature, 0.0);
return Pair<tmp<volScalarField> >
(
coeffC_*mixture_.rho2()*max(TSat - T, T0),
-coeffE_*mixture_.rho1()*max(T - TSat, T0)
);
}
Foam::Pair<Foam::tmp<Foam::volScalarField> >
Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDot() const
{
volScalarField limitedAlpha1
(
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
);
volScalarField limitedAlpha2
(
min(max(mixture_.alpha2(), scalar(0)), scalar(1))
);
const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
const twoPhaseMixtureEThermo& thermo =
refCast<const twoPhaseMixtureEThermo>
(
mesh_.lookupObject<basicThermo>(basicThermo::dictName)
);
const dimensionedScalar& TSat = thermo.TSat();
dimensionedScalar T0("0", dimTemperature, 0.0);
return Pair<tmp<volScalarField> >
(
coeffC_*mixture_.rho2()*limitedAlpha2*max(TSat - T, T0),
coeffE_*mixture_.rho1()*limitedAlpha1*max(T - TSat, T0)
);
}
Foam::Pair<Foam::tmp<Foam::volScalarField> >
Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotDeltaT() const
{
volScalarField limitedAlpha1
(
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
);
volScalarField limitedAlpha2
(
min(max(mixture_.alpha2(), scalar(0)), scalar(1))
);
const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
const twoPhaseMixtureEThermo& thermo =
refCast<const twoPhaseMixtureEThermo>
(
mesh_.lookupObject<basicThermo>(basicThermo::dictName)
);
const dimensionedScalar& TSat = thermo.TSat();
return Pair<tmp<volScalarField> >
(
coeffC_*mixture_.rho2()*limitedAlpha2*pos(TSat - T),
coeffE_*mixture_.rho1()*limitedAlpha1*pos(T - TSat)
);
}
void Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::correct()
{
}
bool Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::read()
{
if (temperaturePhaseChangeTwoPhaseMixture::read())
{
subDict(type() + "Coeffs").lookup("coeffC") >> coeffC_;
subDict(type() + "Coeffs").lookup("coeffE") >> coeffE_;
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ 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::phaseChangeTwoPhaseMixtures::constant
Description
constant condensation/saturation model.
SourceFiles
constant.C
\*--------------------------------------------------------------------*/
#ifndef constant_H
#define constant_H
#include "temperaturePhaseChangeTwoPhaseMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace temperaturePhaseChangeTwoPhaseMixtures
{
/*--------------------------------------------------------------------*\
Class constant
\*--------------------------------------------------------------------*/
class constant
:
public temperaturePhaseChangeTwoPhaseMixture
{
// Private data
//- Condensation coefficient [1/s/K]
dimensionedScalar coeffC_;
//- Evaporation coefficient [1/s/K]
dimensionedScalar coeffE_;
public:
//- Runtime type information
TypeName("constant");
// Constructors
//- Construct from components
constant
(
const thermoIncompressibleTwoPhaseMixture& mixture,
const fvMesh& mesh
);
//- Destructor
virtual ~constant()
{}
// Member Functions
//- Return the mass condensation and vaporisation rates as a
// coefficient to multiply (1 - alphal) for the condensation rate
// and a coefficient to multiply alphal for the vaporisation rate
virtual Pair<tmp<volScalarField> > mDotAlphal() const;
//- Return the mass condensation and vaporisation rates as coefficients
virtual Pair<tmp<volScalarField> > mDot() const;
//- Return the mass condensation and vaporisation rates as a
// coefficient to multiply (Tsat - T) for the condensation rate
// and a coefficient to multiply (T - Tsat) for the vaporisation rate
virtual Pair<tmp<volScalarField> > mDotDeltaT() const;
//- Correct the constant phaseChange model
virtual void correct();
//- Read the transportProperties dictionary and update
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace temperaturePhaseChangeTwoPhaseMixtures
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,83 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ 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 "temperaturePhaseChangeTwoPhaseMixture.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::temperaturePhaseChangeTwoPhaseMixture>
Foam::temperaturePhaseChangeTwoPhaseMixture::New
(
const thermoIncompressibleTwoPhaseMixture& thermo,
const fvMesh& mesh
)
{
IOdictionary phaseChangePropertiesDict
(
IOobject
(
"phaseChangeProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
word temperaturePhaseChangeTwoPhaseMixtureTypeName
(
phaseChangePropertiesDict.lookup
(
"phaseChangeTwoPhaseModel"
)
);
Info<< "Selecting phaseChange model "
<< temperaturePhaseChangeTwoPhaseMixtureTypeName << endl;
componentsConstructorTable::iterator cstrIter =
componentsConstructorTablePtr_
->find(temperaturePhaseChangeTwoPhaseMixtureTypeName);
if (cstrIter == componentsConstructorTablePtr_->end())
{
FatalErrorIn
(
"temperaturePhaseChangeTwoPhaseMixture::New"
) << "Unknown temperaturePhaseChangeTwoPhaseMixture type "
<< temperaturePhaseChangeTwoPhaseMixtureTypeName << endl << endl
<< "Valid temperaturePhaseChangeTwoPhaseMixtures are : " << endl
<< componentsConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<temperaturePhaseChangeTwoPhaseMixture>
(cstrIter()(thermo, mesh));
}
// ************************************************************************* //

View File

@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ 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 "temperaturePhaseChangeTwoPhaseMixture.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(temperaturePhaseChangeTwoPhaseMixture, 0);
defineRunTimeSelectionTable
(
temperaturePhaseChangeTwoPhaseMixture,
components
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::temperaturePhaseChangeTwoPhaseMixture::
temperaturePhaseChangeTwoPhaseMixture
(
const thermoIncompressibleTwoPhaseMixture& mixture,
const fvMesh& mesh
)
:
IOdictionary
(
IOobject
(
"phaseChangeProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
mixture_(mixture),
mesh_(mesh)
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::Pair<Foam::tmp<Foam::volScalarField> >
Foam::temperaturePhaseChangeTwoPhaseMixture::vDotAlphal() const
{
volScalarField alphalCoeff
(
1.0/mixture_.rho1() - mixture_.alpha1()
*(1.0/mixture_.rho1() - 1.0/mixture_.rho2())
);
Pair<tmp<volScalarField> > mDotAlphal = this->mDotAlphal();
return Pair<tmp<volScalarField> >
(
alphalCoeff*mDotAlphal[0],
alphalCoeff*mDotAlphal[1]
);
}
Foam::Pair<Foam::tmp<Foam::volScalarField> >
Foam::temperaturePhaseChangeTwoPhaseMixture::vDot() const
{
dimensionedScalar pCoeff(1.0/mixture_.rho1() - 1.0/mixture_.rho2());
Pair<tmp<volScalarField> > mDot = this->mDot();
return Pair<tmp<volScalarField> >(pCoeff*mDot[0], pCoeff*mDot[1]);
}
bool Foam::temperaturePhaseChangeTwoPhaseMixture::read()
{
if (regIOobject::read())
{
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,168 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ 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::temperaturePhaseChangeTwoPhaseMixture
Description
SourceFiles
temperaturePhaseChangeTwoPhaseMixture.C
newtemperaturePhaseChangeTwoPhaseMixture.C
\*---------------------------------------------------------------------------*/
#ifndef temperaturePhaseChangeTwoPhaseMixture_H
#define temperaturePhaseChangeTwoPhaseMixture_H
#include "thermoIncompressibleTwoPhaseMixture.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
#include "volFields.H"
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class temperaturePhaseChangeTwoPhaseMixture Declaration
\*---------------------------------------------------------------------------*/
class temperaturePhaseChangeTwoPhaseMixture
:
public IOdictionary
{
protected:
// Protected data
//- Reference to the thermoIncompressibleTwoPhaseMixture
const thermoIncompressibleTwoPhaseMixture& mixture_;
//- Reference to fvMesh
const fvMesh& mesh_;
// Private Member Functions
//- Disallow copy construct
temperaturePhaseChangeTwoPhaseMixture
(
const temperaturePhaseChangeTwoPhaseMixture&
);
//- Disallow default bitwise assignment
void operator=(const temperaturePhaseChangeTwoPhaseMixture&);
public:
//- Runtime type information
TypeName("temperaturePhaseChangeTwoPhaseMixture");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
temperaturePhaseChangeTwoPhaseMixture,
components,
(
const thermoIncompressibleTwoPhaseMixture& mixture,
const fvMesh& mesh
),
(mixture, mesh)
);
// Selectors
//- Return a reference to the selected phaseChange model
static autoPtr<temperaturePhaseChangeTwoPhaseMixture> New
(
const thermoIncompressibleTwoPhaseMixture& mixture,
const fvMesh& mesh
);
// Constructors
//- Construct from components
temperaturePhaseChangeTwoPhaseMixture
(
const thermoIncompressibleTwoPhaseMixture& mixture,
const fvMesh& mesh
);
//- Destructor
virtual ~temperaturePhaseChangeTwoPhaseMixture()
{}
// Member Functions
//- Return the mass condensation and vaporisation rates as a
// coefficient to multiply (1 - alphal) for the condensation rate
// and a coefficient to multiply alphal for the vaporisation rate
virtual Pair<tmp<volScalarField> > mDotAlphal() const = 0;
//- Return the mass condensation and vaporisation rates as coefficients
virtual Pair<tmp<volScalarField> > mDot() const = 0;
//- Return the mass condensation and vaporisation rates as a
// coefficient to multiply (Tsat - T) for the condensation rate
// and a coefficient to multiply (T - Tsat) for the vaporisation rate
virtual Pair<tmp<volScalarField> > mDotDeltaT() const = 0;
//- Return the volumetric condensation and vaporisation rates as a
// coefficient to multiply (1 - alphal) for the condensation rate
// and a coefficient to multiply alphal for the vaporisation rate
Pair<tmp<volScalarField> > vDotAlphal() const;
//- Return the volumetric condensation and vaporisation rates as
// coefficients
Pair<tmp<volScalarField> > vDot() const;
//- Correct the phaseChange model
virtual void correct() = 0;
//- Read the transportProperties dictionary and update
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,133 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ 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 "thermoIncompressibleTwoPhaseMixture.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(thermoIncompressibleTwoPhaseMixture, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::thermoIncompressibleTwoPhaseMixture::thermoIncompressibleTwoPhaseMixture
(
const volVectorField& U,
const surfaceScalarField& phi
)
:
incompressibleTwoPhaseMixture(U, phi),
kappa1_
(
"kappa1",
dimEnergy/dimTime/dimLength/dimTemperature,
subDict(phase1Name_).lookup("kappa")
),
kappa2_
(
"kappa2",
kappa1_.dimensions(),
subDict(phase2Name_).lookup("kappa")
),
Cp1_
(
"Cp1",
dimEnergy/dimTemperature/dimMass,
subDict(phase1Name_).lookup("Cp")
),
Cp2_
(
"Cp2",
dimEnergy/dimTemperature/dimMass,
subDict(phase2Name_).lookup("Cp")
),
Cv1_
(
"Cv1",
dimEnergy/dimTemperature/dimMass,
subDict(phase1Name_).lookup("Cv")
),
Cv2_
(
"Cv2",
dimEnergy/dimTemperature/dimMass,
subDict(phase2Name_).lookup("Cv")
),
Hf1_
(
"Hf1",
dimEnergy/dimMass,
subDict(phase1Name_).lookup("hf")
),
Hf2_
(
"Hf2",
dimEnergy/dimMass,
subDict(phase2Name_).lookup("hf")
)
{
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::thermoIncompressibleTwoPhaseMixture::read()
{
if (incompressibleTwoPhaseMixture::read())
{
subDict(phase1Name_).lookup("kappa") >> kappa1_;
subDict(phase2Name_).lookup("kappa") >> kappa2_;
subDict(phase1Name_).lookup("Cp") >> Cp1_;
subDict(phase2Name_).lookup("Cp") >> Cp2_;
subDict(phase1Name_).lookup("Cv") >> Cv1_;
subDict(phase2Name_).lookup("Cv") >> Cv2_;
subDict(phase1Name_).lookup("hf") >> Hf1_;
subDict(phase2Name_).lookup("hf") >> Hf2_;
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,156 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ 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::thermoIncompressibleTwoPhaseMixture
Description
A two-phase incompressible transportModel
SourceFiles
thermoIncompressibleTwoPhaseMixture.C
\*---------------------------------------------------------------------------*/
#ifndef thermoIncompressibleTwoPhaseMixture_H
#define thermoIncompressibleTwoPhaseMixture_H
#include "incompressibleTwoPhaseMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class thermoIncompressibleTwoPhaseMixture Declaration
\*---------------------------------------------------------------------------*/
class thermoIncompressibleTwoPhaseMixture
:
public incompressibleTwoPhaseMixture
{
protected:
// Protected data
//- Thermal variables
dimensionedScalar kappa1_;
dimensionedScalar kappa2_;
dimensionedScalar Cp1_;
dimensionedScalar Cp2_;
dimensionedScalar Cv1_;
dimensionedScalar Cv2_;
dimensionedScalar Hf1_;
dimensionedScalar Hf2_;
public:
TypeName("thermoIncompressibleTwoPhaseMixture");
// Constructors
//- Construct from U and phi
thermoIncompressibleTwoPhaseMixture
(
const volVectorField& U,
const surfaceScalarField& phi
);
//- Destructor
virtual ~thermoIncompressibleTwoPhaseMixture()
{}
// Access function
//- Return const-access to phase2 kappa
const dimensionedScalar& kappa2() const
{
return kappa2_;
};
//- Return const-access to phase1 kappa
const dimensionedScalar& kappa1() const
{
return kappa1_;
};
//- Return const-access to phase1 Cp
const dimensionedScalar& Cp1() const
{
return Cp1_;
};
//- Return const-access to phase1 Cp
const dimensionedScalar& Cp2() const
{
return Cp2_;
};
//- Return const-access to phase1 Cv
const dimensionedScalar& Cv1() const
{
return Cv1_;
};
//- Return const-access to phase1 Cv
const dimensionedScalar& Cv2() const
{
return Cv2_;
};
//- Return latent heat for phase 1
const dimensionedScalar& Hf1() const
{
return Hf1_;
};
//- Return latent heat for phase 2
const dimensionedScalar& Hf2() const
{
return Hf2_;
};
//- Read base transportProperties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,592 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ 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 "twoPhaseMixtureEThermo.H"
#include "zeroGradientFvPatchFields.H"
#include "fixedEnergyFvPatchScalarField.H"
#include "gradientEnergyFvPatchScalarField.H"
#include "mixedEnergyFvPatchScalarField.H"
#include "twoPhaseMixtureEThermo.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(twoPhaseMixtureEThermo, 0);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::twoPhaseMixtureEThermo::eBoundaryCorrection(volScalarField& h)
{
volScalarField::GeometricBoundaryField& hbf = h.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();
}
}
}
void Foam::twoPhaseMixtureEThermo::init()
{
const volScalarField alpha1Rho1(alpha1()*rho1());
const volScalarField alpha2Rho2(alpha2()*rho2());
e_ =
(
(T_ - TSat_)*(alpha1Rho1*Cv1() + alpha2Rho2*Cv2())
+ (alpha1Rho1*Hf1() + alpha2Rho2*Hf2())
)
/(alpha1Rho1 + alpha2Rho2);
e_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
Foam::twoPhaseMixtureEThermo::twoPhaseMixtureEThermo
(
const volVectorField& U,
const surfaceScalarField& phi
)
:
basicThermo(U.mesh(), word::null),
thermoIncompressibleTwoPhaseMixture(U, phi),
e_
(
volScalarField
(
IOobject
(
"e",
U.mesh().time().timeName(),
U.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
U.mesh(),
dimensionedScalar("zero", dimEnergy/dimMass, 0.0),
heBoundaryTypes()
)
),
TSat_
(
"TSat",
dimTemperature,
basicThermo::lookup("TSat")
),
pDivU_(basicThermo::lookupOrDefault<Switch>("pDivU", true))
{
// Initialise e
init();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::twoPhaseMixtureEThermo::~twoPhaseMixtureEThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::twoPhaseMixtureEThermo::correct()
{
incompressibleTwoPhaseMixture::correct();
const volScalarField alpha1Rho1(alpha1()*rho1());
const volScalarField alpha2Rho2(alpha2()*rho2());
T_ =
(
(e_*(alpha1Rho1 + alpha2Rho2))
- (alpha1Rho1*Hf1() + alpha2Rho2*Hf2())
)
/(alpha1Rho1*Cv1() + alpha2Rho2*Cv2())
+ TSat_;
T().correctBoundaryConditions();
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::he
(
const volScalarField& p,
const volScalarField& T
) const
{
const volScalarField alpha1Rho1(alpha1()*rho1());
const volScalarField alpha2Rho2(alpha2()*rho2());
return
(
(T - TSat_)*(alpha1Rho1*Cv1() + alpha2Rho2*Cv2())
+ (alpha1Rho1*Hf1() + alpha2Rho2*Hf2())
)
/ (alpha1Rho1 + alpha2Rho2);
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::he
(
const scalarField& p,
const scalarField& T,
const labelList& cells
) const
{
tmp<scalarField> the(new scalarField(T.size()));
scalarField& he = the.ref();
const volScalarField alpha1Rho1(alpha1()*rho1());
const volScalarField alpha2Rho2(alpha2()*rho2());
forAll(T, i)
{
label celli = cells[i];
he[i] =
(
(T[i] - TSat_.value())
*(
alpha1Rho1[celli]*Cv1().value()
+ alpha2Rho2[celli]*Cv2().value()
)
+ (
alpha1Rho1[celli]*Hf1().value()
+ alpha2Rho2[celli]*Hf2().value()
)
)
/ (alpha1Rho1[celli] + alpha2Rho2[celli]);
}
return the;
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::he
(
const scalarField& p,
const scalarField& T,
const label patchI
) const
{
const scalarField& alpha1p = alpha1().boundaryField()[patchI];
const scalarField& alpha2p = alpha2().boundaryField()[patchI];
const scalarField& Tp = T_.boundaryField()[patchI];
return
(
(
(Tp - TSat_.value())
*(
alpha1p*rho1().value()*Cv1().value()
+ alpha2p*rho2().value()*Cv2().value()
)
+ (
alpha1p*rho1().value()*Hf1().value()
+ alpha2p*rho2().value()*Hf2().value()
)
)
/ (alpha1p*rho1().value() + alpha2p*rho2().value())
);
}
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureEThermo::hc() const
{
const fvMesh& mesh = this->T_.mesh();
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"hc",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("hc",Hf2() - Hf1())
)
);
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::THE
(
const scalarField& h,
const scalarField& p,
const scalarField& T0, // starting temperature
const labelList& cells
) const
{
NotImplemented;
return tmp<Foam::scalarField>();
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::THE
(
const scalarField& h,
const scalarField& p,
const scalarField& T0, // starting temperature
const label patchi
) const
{
NotImplemented;
return tmp<Foam::scalarField>();
}
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureEThermo::Cp() const
{
const volScalarField limitedAlpha1
(
min(max(alpha1_, scalar(0)), scalar(1))
);
return tmp<volScalarField>
(
new volScalarField
(
"cp",
limitedAlpha1*Cp1() + (scalar(1) - limitedAlpha1)*Cp2()
)
);
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::Cp
(
const scalarField& p,
const scalarField& T,
const label patchi
) const
{
const volScalarField limitedAlpha1
(
min(max(alpha1_, scalar(0)), scalar(1))
);
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
return
(
alpha1p*Cp1().value() + (scalar(1) - alpha1p)*Cp2().value()
);
}
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureEThermo::rho() const
{
const volScalarField limitedAlpha1
(
min(max(alpha1_, scalar(0)), scalar(1))
);
return tmp<volScalarField>
(
new volScalarField
(
"rho",
limitedAlpha1*rho1().value()
+ (scalar(1) - limitedAlpha1)*rho2().value()
)
);
}
Foam::tmp<Foam::scalarField>
Foam::twoPhaseMixtureEThermo::rho
(
const label patchi
) const
{
const volScalarField limitedAlpha1
(
min(max(alpha1_, scalar(0)), scalar(1))
);
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
return
(
alpha1p*rho1().value() + (scalar(1.0) - alpha1p)*rho2().value()
);
}
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureEThermo::Cv() const
{
const volScalarField limitedAlpha1
(
min(max(alpha1_, scalar(0)), scalar(1))
);
return tmp<volScalarField>
(
new volScalarField
(
"cv",
limitedAlpha1*Cv1() + (scalar(1) - limitedAlpha1)*Cv2()
)
);
}
Foam::tmp<Foam::scalarField>
Foam::twoPhaseMixtureEThermo::Cv
(
const scalarField& p,
const scalarField& T,
const label patchi
) const
{
const volScalarField limitedAlpha1
(
min(max(alpha1_, scalar(0)), scalar(1))
);
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
return
(
alpha1p*Cv1().value() + (scalar(1) - alpha1p)*Cv2().value()
);
}
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureEThermo::gamma() const
{
return tmp<volScalarField>
(
(alpha1_*Cp1() + alpha2_*Cp2()) / (alpha1_*Cv1() + alpha2_*Cv2())
);
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::gamma
(
const scalarField& p,
const scalarField& T,
const label patchi
) const
{
return
(
gamma()().boundaryField()[patchi]
);
}
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureEThermo::Cpv() const
{
// This is an e thermo (Cpv = Cv)
return Cv();
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::Cpv
(
const scalarField& p,
const scalarField& T,
const label patchI
) const
{
// This is a e thermo (Cpv = Cv)
return Cv(p, T, patchI);
}
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureEThermo::CpByCpv() const
{
NotImplemented;
return tmp<Foam::volScalarField>();
}
Foam::tmp<Foam::scalarField>
Foam::twoPhaseMixtureEThermo::CpByCpv
(
const scalarField& p,
const scalarField& T,
const label patchi
) const
{
NotImplemented;
return tmp<Foam::scalarField>();
}
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureEThermo::kappa() const
{
const volScalarField limitedAlpha1
(
min(max(alpha1_, scalar(0)), scalar(1))
);
return tmp<volScalarField>
(
new volScalarField
(
"kappa",
limitedAlpha1*kappa1() + (scalar(1) - limitedAlpha1)*kappa2()
)
);
}
Foam::tmp<Foam::scalarField>
Foam::twoPhaseMixtureEThermo::kappa(const label patchi) const
{
const volScalarField limitedAlpha1
(
min(max(alpha1_, scalar(0)), scalar(1))
);
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
return (alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value());
}
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureEThermo::kappaEff
(
const volScalarField& kappat
) const
{
tmp<Foam::volScalarField> kappaEff(kappa() + kappat);
kappaEff.ref().rename("kappaEff");
return kappaEff;
}
Foam::tmp<Foam::scalarField>
Foam::twoPhaseMixtureEThermo::kappaEff
(
const scalarField& kappat,
const label patchi
) const
{
const volScalarField limitedAlpha1
(
min(max(alpha1_, scalar(0)), scalar(1))
);
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
return
(alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value()) + kappat;
}
Foam::tmp<Foam::volScalarField>
Foam::twoPhaseMixtureEThermo::alphaEff
(
const volScalarField& alphat
) const
{
const volScalarField rho
(
alpha1_*rho1() + (1.0 - alpha1_)*rho2()
);
return (kappa()/Cp()/rho + alphat);
}
Foam::tmp<Foam::scalarField>
Foam::twoPhaseMixtureEThermo::alphaEff
(
const scalarField& alphat,
const label patchi
) const
{
const volScalarField limitedAlpha1
(
min(max(alpha1_, scalar(0)), scalar(1))
);
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
const scalarField rho
(
alpha1p*rho1().value() + (1.0 - alpha1p)*rho2().value()
);
const scalarField kappa
(
alpha1p*kappa1().value() + (1.0 - alpha1p)*kappa2().value()
);
const scalarField Cp
(
alpha1p*Cp1().value() + (1.0 - alpha1p)*Cp2().value()
);
return kappa/Cp/rho + alphat;
}
bool Foam::twoPhaseMixtureEThermo::read()
{
if (basicThermo::read() && thermoIncompressibleTwoPhaseMixture::read())
{
basicThermo::lookup("pDivU") >> pDivU_;
basicThermo::lookup("TSat") >> TSat_;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,313 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
\\/ 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::twoPhaseMixtureEThermo
Description
Two phases thermo Internal energy mixture Defined as:
e1 = Cv1(T - Tsat) + Hv1
e2 = Cv2(T - Tsat) + Hv2
e = (alpha1*rho1*e1 + alpha2*rho2*e2) / (alpha1*rho1 + alpha2*rho2)
SourceFiles
twoPhaseMixtureEThermo.C
\*---------------------------------------------------------------------------*/
#ifndef flashThermo_H
#define flashThermo_H
#include "volFields.H"
#include "basicThermo.H"
#include "thermoIncompressibleTwoPhaseMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class twoPhaseMixtureEThermo Declaration
\*---------------------------------------------------------------------------*/
class twoPhaseMixtureEThermo
:
public basicThermo,
public thermoIncompressibleTwoPhaseMixture
{
protected:
// Protected Data
//- Internal energy field [J]
volScalarField e_;
//- Saturation Temperature
dimensionedScalar TSat_;
//- Should the p*div(U) term be included in the energy equation
Switch pDivU_;
// Protected Member Functions
//- Correct boundary for e
void eBoundaryCorrection (volScalarField& h);
//- Initialize
void init();
public:
TypeName("twoPhaseMixtureEThermo");
// Constructor
twoPhaseMixtureEThermo
(
const volVectorField& U,
const surfaceScalarField& phi
);
//- Destructor
virtual ~twoPhaseMixtureEThermo();
// Member Functions
//- Return access to the inernal energy field [J/Kg]
virtual volScalarField& he()
{
return e_;
}
//- Return access to the inernal energy field [J/Kg]
virtual const volScalarField& he() const
{
return e_;
}
//- 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;
//- Return true if the equation of state is incompressible
// i.e. rho != f(p)
bool incompressible() const
{
return (true);
}
//- Return true if the equation of state is isochoric
// i.e. rho = const
bool isochoric() const
{
return (false);
}
//- Return rho of the mixture
virtual tmp<volScalarField> rho() const;
//- Return rho for patch
virtual tmp<scalarField> rho(const label patchi) const;
//- Return Cp of the mixture
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;
//- Return Cv of the mixture
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;
//- Thermal diffusivity for temperature of mixture [J/m/s/K]
virtual tmp<volScalarField> kappa() const;
//- Thermal diffusivity for temperature
// of mixture for patch [J/m/s/K]
virtual tmp<scalarField> kappa
(
const label patchi
) const;
//- Effective thermal diffusivity for temperature
// of mixture [J/m/s/K]
virtual tmp<volScalarField> kappaEff
(
const volScalarField&
) const;
//- Effective thermal diffusivity for temperature
// of mixture for patch [J/m/s/K]
virtual tmp<scalarField> kappaEff
(
const scalarField& alphat,
const label patchi
) const;
//- Effective thermal diffusivity of mixture [kg/m/s]
virtual tmp<volScalarField> alphaEff
(
const volScalarField& alphat
) const;
//- Effective thermal diffusivity of mixture for patch [kg/m/s]
virtual tmp<scalarField> alphaEff
(
const scalarField& alphat,
const label patchi
) const;
//- Correct the thermo fields
virtual void correct();
//- Read properties
virtual bool read();
// Access to thermodynamic state variables
//- Return const-access to the saturation temperature
const dimensionedScalar& TSat() const
{
return TSat_;
}
//- Return transport properties dictionary
const incompressibleTwoPhaseMixture& transportPropertiesDict()
{
return *this;
}
//- Should the dpdt term be included in the enthalpy equation
Switch pDivU() const
{
return pDivU_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -130,6 +130,13 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
return thermo.kappa(patchI);
}
else if (mesh.foundObject<basicThermo>(basicThermo::dictName))
{
const basicThermo& thermo =
mesh.lookupObject<basicThermo>(basicThermo::dictName);
return thermo.kappa(patchI);
}
else
{
FatalErrorInFunction

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object Tair;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 368;
boundaryField
{
bottom
{
type zeroGradient;
}
top
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
left
{
type compressible::turbulentHeatFluxTemperature;
heatSource flux;
q uniform -40e3;
kappa fluidThermo;
kappaName none;
value $internalField;
}
right
{
type zeroGradient;
value $internalField;
}
frontAndBack
{
type empty;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class volVectorField;
object U.air;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
bottom
{
type fixedValue;
value $internalField;
}
top
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
left
{
type fixedValue;
value $internalField;
}
right
{
type fixedValue;
value $internalField;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object alpha.liquid;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
bottom
{
type zeroGradient;
}
top
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
left
{
type zeroGradient;
}
right
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 2 -2 0 0 0 0 ];
internalField uniform 2e-3;
boundaryField
{
bottom
{
type kqRWallFunction;
value $internalField;
}
top
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
left
{
type kqRWallFunction;
value $internalField;
}
right
{
type kqRWallFunction;
value $internalField;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,55 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 2 -1 0 0 0 0 ];
internalField uniform 0;
boundaryField
{
bottom
{
type nutkWallFunction;
value $internalField;
}
top
{
type calculated;
value $internalField;
}
left
{
type nutkWallFunction;
value $internalField;
}
right
{
type nutkWallFunction;
value $internalField;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 0 -1 0 0 0 0 ];
internalField uniform 1;
boundaryField
{
bottom
{
type omegaWallFunction;
value $internalField;
}
top
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
left
{
type omegaWallFunction;
value $internalField;
}
right
{
type omegaWallFunction;
value $internalField;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 1 -1 -2 0 0 0 0 ];
internalField uniform 1e5;
boundaryField
{
bottom
{
type fixedFluxPressure;
value $internalField;
}
top
{
type totalPressure;
p0 $internalField;
U U;
phi phi;
rho rho;
psi none;
gamma 1;
value $internalField;
}
left
{
type fixedFluxPressure;
value $internalField;
}
right
{
type fixedFluxPressure;
value $internalField;
}
frontAndBack
{
type empty;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
#------------------------------------------------------------------------------

View File

@ -0,0 +1,12 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application=`getApplication`
runApplication blockMesh
runApplication $application
#------------------------------------------------------------------------------

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value (0 -9.81 0);
// ************************************************************************* //

View File

@ -0,0 +1,26 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object phaseChangeProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phaseChangeTwoPhaseModel constant;
constantCoeffs
{
coeffC coeffC [0 0 -1 -1 0 0 0] 250;
coeffE coeffE [0 0 -1 -1 0 0 0] 250;
}
// ************************************************************************* //

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
TSat TSat [0 0 0 1 0] 366; // saturation temperature
pDivU true;
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phases (liquid vapour);// FC-72
sigma sigma [1 0 -2 0 0 0 0] 0.07;
liquid
{
transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 2.64e-7;
rho rho [1 -3 0 0 0 0 0] 1583.4;
Cp Cp [0 2 -2 -1 0 0 0] 1.1072e3;
Cv cv [0 2 -2 -1 0 0 0] 1.1072e3; //assume Cp for liquid
kappa kappa [1 1 -3 -1 0 0 0] 0.057;
hf hf [0 2 -2 0 0 0 0] 0;
}
vapour
{
transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 5e-7;
rho rho [1 -3 0 0 0 0 0] 14.9;
Cp Cp [0 2 -2 -1 0 0 0] 895.2; //FC72 vapour
Cv Cv [0 2 -2 -1 0 0 0] 870.4; // Cv = Cp - R/w
kappa kappa [1 1 -3 -1 0 0 0] 0.01; //FC72 vapour
hf hf [0 2 -2 0 0 0 0] 93.0e3;
}
Prt 0.7;
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties.air;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kOmega;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,82 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1e-2;
vertices
(
(0 0 0)
(0.2 0 0)
(0.2 1 0)
(0 1 0)
(0 0 1)
(0.2 0 1)
(0.2 1 1)
(0 1 1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (60 50 1) simpleGrading (3 1 1)
);
boundary
(
bottom
{
type wall;
faces
(
(1 5 4 0)
);
}
top
{
type patch;
faces
(
(3 7 6 2)
);
}
left
{
type wall;
faces
(
(0 4 7 3)
);
}
right
{
type wall;
faces
(
(2 6 5 1)
);
}
frontAndBack
{
type empty;
faces
(
(4 5 6 7)
(0 1 2 3)
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,57 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application interCondensatingEvaporatingFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 4;
deltaT 1e-5;
writeControl adjustableRunTime;
writeInterval 1e-1;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 6.0;
maxAlphaCo 6.0;
maxDeltaT 1e-2;
// ************************************************************************* //

View File

@ -0,0 +1,71 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(rhoPhi,U) Gauss linear;
div(phi,omega) Gauss linear;
div(phi,k) Gauss linear;
div(rhoPhi,e) Gauss linear;
div(rhoPhi,K) Gauss upwind;
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss linear;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
div((muEff*dev(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
wallDist
{
method meshWave;
}
fluxRequired
{
default none;
p_rgh;
alpha.liquid;
}
// ************************************************************************* //

View File

@ -0,0 +1,130 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"alpha.liquid.*"
{
cAlpha 1;
nAlphaCorr 2;
nAlphaSubCycles 2;
MULESCorr yes;
nLimiterIter 1;
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-8;
relTol 0;
}
"U.*"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-7;
relTol 0;
};
p_rgh
{
solver GAMG;
tolerance 1e-8;
relTol 0.01;
smoother DICGaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
};
p_rghFinal
{
solver PCG;
preconditioner
{
preconditioner GAMG;
tolerance 1e-6;
relTol 0;
nVcycles 2;
smoother DICGaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
nFinestSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
};
tolerance 1e-9;
relTol 0;
maxIter 300;
};
pcorr
{
$p_rgh;
relTol 0;
};
"e.*"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-7;
relTol 0.0;
}
"(k.*|omega.*|Theta.*).*"
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-7;
relTol 0;
}
}
PIMPLE
{
momentumPredictor false;
nOuterCorrectors 1;
nCorrectors 3;
nNonOrthogonalCorrectors 0;
}
relaxationFactors
{
fields
{
}
equations
{
".*" 1;
}
}
// ************************************************************************* //