From d141b3c9b5472b2f655c9f6faba8ed2eb646f962 Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 31 May 2016 14:41:47 -0700 Subject: [PATCH] ENH: Adding interCondensingEvaporatingFoam and tutorial --- .../interCondensingEvaporatingFoam/Allwclean | 8 + .../interCondensingEvaporatingFoam/Allwmake | 12 + .../interCondensingEvaporatingFoam/Make/files | 3 + .../Make/options | 30 + .../interCondensingEvaporatingFoam/UEqn.H | 26 + .../continuityError.H | 12 + .../createFields.H | 158 +++++ .../interCondensingEvaporatingFoam/eEqn.H | 31 + .../interCondensatingEvaporatingFoam.C | 137 ++++ .../interCondensingEvaporatingFoam/pEqn.H | 77 +++ .../Make/files | 7 + .../Make/options | 16 + .../constant/constant.C | 174 +++++ .../constant/constant.H | 118 ++++ ...newtemperaturePhaseChangeTwoPhaseMixture.C | 83 +++ .../temperaturePhaseChangeTwoPhaseMixture.C | 109 ++++ .../temperaturePhaseChangeTwoPhaseMixture.H | 168 +++++ .../thermoIncompressibleTwoPhaseMixture.C | 133 ++++ .../thermoIncompressibleTwoPhaseMixture.H | 156 +++++ .../twoPhaseMixtureEThermo.C | 592 ++++++++++++++++++ .../twoPhaseMixtureEThermo.H | 313 +++++++++ .../temperatureCoupledBase.C | 9 +- .../interCondensingEvaporatingFoam/0/T | 53 ++ .../interCondensingEvaporatingFoam/0/U | 49 ++ .../0/alpha.liquid | 48 ++ .../interCondensingEvaporatingFoam/0/k | 56 ++ .../interCondensingEvaporatingFoam/0/nut | 55 ++ .../interCondensingEvaporatingFoam/0/omega | 56 ++ .../interCondensingEvaporatingFoam/0/p_rgh | 59 ++ .../interCondensingEvaporatingFoam/Allclean | 9 + .../interCondensingEvaporatingFoam/Allrun | 12 + .../interCondensingEvaporatingFoam/constant/g | 22 + .../constant/phaseChangeProperties | 26 + .../constant/thermophysicalProperties | 21 + .../constant/transportProperties | 50 ++ .../constant/turbulenceProperties | 29 + .../system/blockMeshDict | 82 +++ .../system/controlDict | 57 ++ .../system/fvSchemes | 71 +++ .../system/fvSolution | 130 ++++ 40 files changed, 3256 insertions(+), 1 deletion(-) create mode 100755 applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwclean create mode 100755 applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwmake create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/Make/files create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/Make/options create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/UEqn.H create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/continuityError.H create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/createFields.H create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/eEqn.H create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/interCondensatingEvaporatingFoam.C create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/pEqn.H create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/Make/files create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/Make/options create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.H create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/newtemperaturePhaseChangeTwoPhaseMixture.C create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.C create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.H create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.H create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C create mode 100644 applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.H create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/0/T create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/0/U create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/0/alpha.liquid create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/0/k create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/0/nut create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/0/omega create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/0/p_rgh create mode 100755 tutorials/multiphase/interCondensingEvaporatingFoam/Allclean create mode 100755 tutorials/multiphase/interCondensingEvaporatingFoam/Allrun create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/constant/g create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/constant/phaseChangeProperties create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/constant/thermophysicalProperties create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/constant/transportProperties create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/constant/turbulenceProperties create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/system/blockMeshDict create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/system/controlDict create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/system/fvSchemes create mode 100644 tutorials/multiphase/interCondensingEvaporatingFoam/system/fvSolution diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwclean b/applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwclean new file mode 100755 index 0000000000..8717ef8953 --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwclean @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +set -x + +wclean libso temperaturePhaseChangeTwoPhaseMixtures +wclean + +#------------------------------------------------------------------------------ diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwmake b/applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwmake new file mode 100755 index 0000000000..523c10c33c --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwmake @@ -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 + +#------------------------------------------------------------------------------ diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/Make/files b/applications/solvers/multiphase/interCondensingEvaporatingFoam/Make/files new file mode 100644 index 0000000000..7e0882ec64 --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/Make/files @@ -0,0 +1,3 @@ +interCondensatingEvaporatingFoam.C + +EXE = $(FOAM_APPBIN)/interCondensatingEvaporatingFoam diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/Make/options b/applications/solvers/multiphase/interCondensingEvaporatingFoam/Make/options new file mode 100644 index 0000000000..373084db4b --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/Make/options @@ -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 diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/UEqn.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/UEqn.H new file mode 100644 index 0000000000..1e27597292 --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/UEqn.H @@ -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() + ) + ); + } diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/continuityError.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/continuityError.H new file mode 100644 index 0000000000..9a33fb896d --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/continuityError.H @@ -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; + diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/createFields.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/createFields.H new file mode 100644 index 0000000000..20d3677bfc --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/createFields.H @@ -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 thermo; + thermo.set(new twoPhaseMixtureEThermo(U, phi)); + + // Create mixture and + Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n" << endl; + autoPtr 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 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) + ); diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/eEqn.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/eEqn.H new file mode 100644 index 0000000000..291d574d8a --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/eEqn.H @@ -0,0 +1,31 @@ +{ + tmp 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() <. + +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; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/pEqn.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/pEqn.H new file mode 100644 index 0000000000..254c7801a7 --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/pEqn.H @@ -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 + ( + p_rgh.boundaryField(), + ( + phiHbyA.boundaryField() + - (mesh.Sf().boundaryField() & U.boundaryField()) + )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) + ); + + Pair > 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; + } +} diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/Make/files b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/Make/files new file mode 100644 index 0000000000..407c604655 --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/Make/files @@ -0,0 +1,7 @@ +temperaturePhaseChangeTwoPhaseMixtures/newtemperaturePhaseChangeTwoPhaseMixture.C +temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.C +thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C +twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C +constant/constant.C + +LIB = $(FOAM_LIBBIN)/libphaseTemperatureChangeTwoPhaseMixtures diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/Make/options b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/Make/options new file mode 100644 index 0000000000..4a85a0ae9f --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/Make/options @@ -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 diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C new file mode 100644 index 0000000000..adc2598e86 --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotAlphal() const +{ + const volScalarField& T = mesh_.lookupObject("T"); + + const twoPhaseMixtureEThermo& thermo = + refCast + ( + mesh_.lookupObject(basicThermo::dictName) + ); + + const dimensionedScalar& TSat = thermo.TSat(); + + dimensionedScalar T0("0", dimTemperature, 0.0); + + return Pair > + ( + coeffC_*mixture_.rho2()*max(TSat - T, T0), + -coeffE_*mixture_.rho1()*max(T - TSat, T0) + ); +} + + +Foam::Pair > +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("T"); + + const twoPhaseMixtureEThermo& thermo = + refCast + ( + mesh_.lookupObject(basicThermo::dictName) + ); + + const dimensionedScalar& TSat = thermo.TSat(); + + dimensionedScalar T0("0", dimTemperature, 0.0); + + return Pair > + ( + coeffC_*mixture_.rho2()*limitedAlpha2*max(TSat - T, T0), + coeffE_*mixture_.rho1()*limitedAlpha1*max(T - TSat, T0) + ); +} + + +Foam::Pair > +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("T"); + + const twoPhaseMixtureEThermo& thermo = + refCast + ( + mesh_.lookupObject(basicThermo::dictName) + ); + + const dimensionedScalar& TSat = thermo.TSat(); + + + return Pair > + ( + 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; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.H new file mode 100644 index 0000000000..424a8a7c2a --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.H @@ -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 . + +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 > mDotAlphal() const; + + //- Return the mass condensation and vaporisation rates as coefficients + virtual Pair > 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 > 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 + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/newtemperaturePhaseChangeTwoPhaseMixture.C b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/newtemperaturePhaseChangeTwoPhaseMixture.C new file mode 100644 index 0000000000..a43b164bd1 --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/newtemperaturePhaseChangeTwoPhaseMixture.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "temperaturePhaseChangeTwoPhaseMixture.H" +#include "basicThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr +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 + (cstrIter()(thermo, mesh)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.C b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.C new file mode 100644 index 0000000000..9727f5978d --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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::temperaturePhaseChangeTwoPhaseMixture::vDotAlphal() const +{ + volScalarField alphalCoeff + ( + 1.0/mixture_.rho1() - mixture_.alpha1() + *(1.0/mixture_.rho1() - 1.0/mixture_.rho2()) + ); + + Pair > mDotAlphal = this->mDotAlphal(); + + return Pair > + ( + alphalCoeff*mDotAlphal[0], + alphalCoeff*mDotAlphal[1] + ); +} + + +Foam::Pair > +Foam::temperaturePhaseChangeTwoPhaseMixture::vDot() const +{ + dimensionedScalar pCoeff(1.0/mixture_.rho1() - 1.0/mixture_.rho2()); + Pair > mDot = this->mDot(); + + return Pair >(pCoeff*mDot[0], pCoeff*mDot[1]); +} + + +bool Foam::temperaturePhaseChangeTwoPhaseMixture::read() +{ + if (regIOobject::read()) + { + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.H new file mode 100644 index 0000000000..9ecd5a544d --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.H @@ -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 . + +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 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 > mDotAlphal() const = 0; + + //- Return the mass condensation and vaporisation rates as coefficients + virtual Pair > 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 > 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 > vDotAlphal() const; + + //- Return the volumetric condensation and vaporisation rates as + // coefficients + Pair > vDot() const; + + //- Correct the phaseChange model + virtual void correct() = 0; + + //- Read the transportProperties dictionary and update + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C new file mode 100644 index 0000000000..6822e0bbc5 --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.H new file mode 100644 index 0000000000..ea2bec1b5d --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.H @@ -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 . + +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 + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C new file mode 100644 index 0000000000..19eb8ddca7 --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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(hbf[patchi])) + { + refCast(hbf[patchi]).gradient() + = hbf[patchi].fvPatchField::snGrad(); + } + else if (isA(hbf[patchi])) + { + refCast(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("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::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::twoPhaseMixtureEThermo::he +( + const scalarField& p, + const scalarField& T, + const labelList& cells +) const +{ + tmp 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::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::twoPhaseMixtureEThermo::hc() const +{ + + const fvMesh& mesh = this->T_.mesh(); + + return tmp + ( + new volScalarField + ( + IOobject + ( + "hc", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("hc",Hf2() - Hf1()) + ) + ); +} + + +Foam::tmp Foam::twoPhaseMixtureEThermo::THE +( + const scalarField& h, + const scalarField& p, + const scalarField& T0, // starting temperature + const labelList& cells +) const +{ + NotImplemented; + return tmp(); +} + + +Foam::tmp Foam::twoPhaseMixtureEThermo::THE +( + const scalarField& h, + const scalarField& p, + const scalarField& T0, // starting temperature + const label patchi +) const +{ + NotImplemented; + return tmp(); +} + + +Foam::tmp +Foam::twoPhaseMixtureEThermo::Cp() const +{ + const volScalarField limitedAlpha1 + ( + min(max(alpha1_, scalar(0)), scalar(1)) + ); + + return tmp + ( + new volScalarField + ( + "cp", + limitedAlpha1*Cp1() + (scalar(1) - limitedAlpha1)*Cp2() + ) + ); +} + + +Foam::tmp 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::twoPhaseMixtureEThermo::rho() const +{ + const volScalarField limitedAlpha1 + ( + min(max(alpha1_, scalar(0)), scalar(1)) + ); + + return tmp + ( + new volScalarField + ( + "rho", + limitedAlpha1*rho1().value() + + (scalar(1) - limitedAlpha1)*rho2().value() + ) + ); +} + + +Foam::tmp +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::twoPhaseMixtureEThermo::Cv() const +{ + const volScalarField limitedAlpha1 + ( + min(max(alpha1_, scalar(0)), scalar(1)) + ); + + return tmp + ( + new volScalarField + ( + "cv", + limitedAlpha1*Cv1() + (scalar(1) - limitedAlpha1)*Cv2() + ) + ); +} + + +Foam::tmp +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::twoPhaseMixtureEThermo::gamma() const +{ + return tmp + ( + (alpha1_*Cp1() + alpha2_*Cp2()) / (alpha1_*Cv1() + alpha2_*Cv2()) + ); +} + + +Foam::tmp Foam::twoPhaseMixtureEThermo::gamma +( + const scalarField& p, + const scalarField& T, + const label patchi +) const +{ + return + ( + gamma()().boundaryField()[patchi] + ); +} + + +Foam::tmp +Foam::twoPhaseMixtureEThermo::Cpv() const +{ + // This is an e thermo (Cpv = Cv) + return Cv(); +} + + +Foam::tmp 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::twoPhaseMixtureEThermo::CpByCpv() const +{ + NotImplemented; + return tmp(); +} + + +Foam::tmp +Foam::twoPhaseMixtureEThermo::CpByCpv +( + const scalarField& p, + const scalarField& T, + const label patchi +) const +{ + NotImplemented; + return tmp(); +} + + +Foam::tmp +Foam::twoPhaseMixtureEThermo::kappa() const +{ + const volScalarField limitedAlpha1 + ( + min(max(alpha1_, scalar(0)), scalar(1)) + ); + + return tmp + ( + new volScalarField + ( + "kappa", + limitedAlpha1*kappa1() + (scalar(1) - limitedAlpha1)*kappa2() + ) + ); +} + + +Foam::tmp +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::twoPhaseMixtureEThermo::kappaEff +( + const volScalarField& kappat +) const +{ + tmp kappaEff(kappa() + kappat); + kappaEff.ref().rename("kappaEff"); + return kappaEff; +} + + +Foam::tmp +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::twoPhaseMixtureEThermo::alphaEff +( + const volScalarField& alphat +) const +{ + const volScalarField rho + ( + alpha1_*rho1() + (1.0 - alpha1_)*rho2() + ); + + + return (kappa()/Cp()/rho + alphat); +} + +Foam::tmp +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; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.H new file mode 100644 index 0000000000..8616713b19 --- /dev/null +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.H @@ -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 . + +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 he + ( + const volScalarField& p, + const volScalarField& T + ) const; + + //- Enthalpy/Internal energy for cell-set [J/kg] + virtual tmp he + ( + const scalarField& p, + const scalarField& T, + const labelList& cells + ) const; + + //- Enthalpy/Internal energy for patch [J/kg] + virtual tmp he + ( + const scalarField& p, + const scalarField& T, + const label patchi + ) const; + + //- Chemical enthalpy [J/kg] + virtual tmp hc() const; + + //- Temperature from enthalpy/internal energy for cell-set + virtual tmp 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 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 rho() const; + + //- Return rho for patch + virtual tmp rho(const label patchi) const; + + //- Return Cp of the mixture + virtual tmp Cp() const; + + //- Heat capacity at constant pressure for patch [J/kg/K] + virtual tmp Cp + ( + const scalarField& p, + const scalarField& T, + const label patchi + ) const; + + //- Return Cv of the mixture + virtual tmp Cv() const; + + //- Heat capacity at constant volume for patch [J/kg/K] + virtual tmp Cv + ( + const scalarField& p, + const scalarField& T, + const label patchI + ) const; + + //- Gamma = Cp/Cv [] + virtual tmp gamma() const; + + //- Gamma = Cp/Cv for patch [] + virtual tmp gamma + ( + const scalarField& p, + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure/volume [J/kg/K] + virtual tmp Cpv() const; + + //- Heat capacity at constant pressure/volume for patch [J/kg/K] + virtual tmp Cpv + ( + const scalarField& p, + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity ratio [] + virtual tmp CpByCpv() const; + + //- Heat capacity ratio for patch [] + virtual tmp CpByCpv + ( + const scalarField& p, + const scalarField& T, + const label patchi + ) const; + + //- Thermal diffusivity for temperature of mixture [J/m/s/K] + virtual tmp kappa() const; + + //- Thermal diffusivity for temperature + // of mixture for patch [J/m/s/K] + virtual tmp kappa + ( + const label patchi + ) const; + + //- Effective thermal diffusivity for temperature + // of mixture [J/m/s/K] + virtual tmp kappaEff + ( + const volScalarField& + ) const; + + //- Effective thermal diffusivity for temperature + // of mixture for patch [J/m/s/K] + virtual tmp kappaEff + ( + const scalarField& alphat, + const label patchi + ) const; + + //- Effective thermal diffusivity of mixture [kg/m/s] + virtual tmp alphaEff + ( + const volScalarField& alphat + ) const; + + //- Effective thermal diffusivity of mixture for patch [kg/m/s] + virtual tmp 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 + +// ************************************************************************* // diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C index 9ed2dd3648..89dfbbf9db 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C @@ -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::temperatureCoupledBase::kappa return thermo.kappa(patchI); } + else if (mesh.foundObject(basicThermo::dictName)) + { + const basicThermo& thermo = + mesh.lookupObject(basicThermo::dictName); + + return thermo.kappa(patchI); + } else { FatalErrorInFunction diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/0/T b/tutorials/multiphase/interCondensingEvaporatingFoam/0/T new file mode 100644 index 0000000000..b9eb18ab4e --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/0/T @@ -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; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/0/U b/tutorials/multiphase/interCondensingEvaporatingFoam/0/U new file mode 100644 index 0000000000..78f898c918 --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/0/U @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/0/alpha.liquid b/tutorials/multiphase/interCondensingEvaporatingFoam/0/alpha.liquid new file mode 100644 index 0000000000..945b4a7dbf --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/0/alpha.liquid @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/0/k b/tutorials/multiphase/interCondensingEvaporatingFoam/0/k new file mode 100644 index 0000000000..477ea8b0c4 --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/0/k @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/0/nut b/tutorials/multiphase/interCondensingEvaporatingFoam/0/nut new file mode 100644 index 0000000000..b66f88e63a --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/0/nut @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/0/omega b/tutorials/multiphase/interCondensingEvaporatingFoam/0/omega new file mode 100644 index 0000000000..ef28765034 --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/0/omega @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/0/p_rgh b/tutorials/multiphase/interCondensingEvaporatingFoam/0/p_rgh new file mode 100644 index 0000000000..f7da7b27bd --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/0/p_rgh @@ -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; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/Allclean b/tutorials/multiphase/interCondensingEvaporatingFoam/Allclean new file mode 100755 index 0000000000..6b45f82a41 --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/Allclean @@ -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 + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/Allrun b/tutorials/multiphase/interCondensingEvaporatingFoam/Allrun new file mode 100755 index 0000000000..2d455d1fbc --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/Allrun @@ -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 + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/constant/g b/tutorials/multiphase/interCondensingEvaporatingFoam/constant/g new file mode 100644 index 0000000000..371140f708 --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/constant/g @@ -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); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/constant/phaseChangeProperties b/tutorials/multiphase/interCondensingEvaporatingFoam/constant/phaseChangeProperties new file mode 100644 index 0000000000..4b460bbbb3 --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/constant/phaseChangeProperties @@ -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; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/constant/thermophysicalProperties b/tutorials/multiphase/interCondensingEvaporatingFoam/constant/thermophysicalProperties new file mode 100644 index 0000000000..095d02e683 --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/constant/thermophysicalProperties @@ -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; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/constant/transportProperties b/tutorials/multiphase/interCondensingEvaporatingFoam/constant/transportProperties new file mode 100644 index 0000000000..7c5b0e47bf --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/constant/transportProperties @@ -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; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/constant/turbulenceProperties b/tutorials/multiphase/interCondensingEvaporatingFoam/constant/turbulenceProperties new file mode 100644 index 0000000000..72d5f5c4d4 --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/constant/turbulenceProperties @@ -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; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/system/blockMeshDict b/tutorials/multiphase/interCondensingEvaporatingFoam/system/blockMeshDict new file mode 100644 index 0000000000..c198f8665a --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/system/blockMeshDict @@ -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) + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/system/controlDict b/tutorials/multiphase/interCondensingEvaporatingFoam/system/controlDict new file mode 100644 index 0000000000..bd31bba570 --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/system/controlDict @@ -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; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/system/fvSchemes b/tutorials/multiphase/interCondensingEvaporatingFoam/system/fvSchemes new file mode 100644 index 0000000000..919c38770f --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/system/fvSchemes @@ -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; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/system/fvSolution b/tutorials/multiphase/interCondensingEvaporatingFoam/system/fvSolution new file mode 100644 index 0000000000..08cc0ed7ce --- /dev/null +++ b/tutorials/multiphase/interCondensingEvaporatingFoam/system/fvSolution @@ -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; + } +} + + +// ************************************************************************* //