mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Update of interCondensingEvaporatingFoam and its tutorial
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(rhoPhi, U)
|
||||
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
|
||||
+ turbulence->divDevRhoReff(rho, U)
|
||||
);
|
||||
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
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;
|
||||
|
||||
@ -28,20 +28,6 @@
|
||||
|
||||
#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));
|
||||
@ -54,9 +40,10 @@
|
||||
|
||||
volScalarField& T = thermo->T();
|
||||
volScalarField& e = thermo->he();
|
||||
e.oldTime();
|
||||
|
||||
// Correct e from T and alpha
|
||||
thermo->correct();
|
||||
//thermo->correct();
|
||||
|
||||
volScalarField& alpha1(thermo->alpha1());
|
||||
volScalarField& alpha2(thermo->alpha2());
|
||||
@ -80,7 +67,6 @@
|
||||
);
|
||||
rho.oldTime();
|
||||
|
||||
|
||||
// Construct interface from alpha1 distribution
|
||||
interfaceProperties interface
|
||||
(
|
||||
@ -100,8 +86,7 @@
|
||||
volScalarField gh("gh", g & mesh.C());
|
||||
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
||||
|
||||
//Update p with rho
|
||||
p = p_rgh + rho*gh;
|
||||
volScalarField& p = thermo->p();
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
|
||||
@ -14,9 +14,7 @@
|
||||
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
|
||||
);
|
||||
|
||||
@ -63,20 +63,21 @@ int main(int argc, char *argv[])
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "createTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
turbulence->validate();
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "createTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
@ -101,9 +102,12 @@ int main(int argc, char *argv[])
|
||||
dimensionedScalar("0", dimMass/dimTime, 0)
|
||||
);
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
mixture->correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
|
||||
solve(fvm::ddt(rho) + fvc::div(rhoPhi));
|
||||
|
||||
#include "UEqn.H"
|
||||
#include "eEqn.H"
|
||||
|
||||
@ -113,14 +117,14 @@ int main(int argc, char *argv[])
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
#include "continuityError.H"
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence->correct();
|
||||
}
|
||||
}
|
||||
|
||||
rho = alpha1*rho1 + alpha2*rho2;
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
{
|
||||
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
|
||||
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
@ -53,8 +51,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p == p_rgh + rho*gh;
|
||||
p = p_rgh + rho*gh;
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
|
||||
@ -78,8 +78,8 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotAlphal() const
|
||||
|
||||
return Pair<tmp<volScalarField>>
|
||||
(
|
||||
coeffC_*mixture_.rho2()*max(TSat - T, T0),
|
||||
-coeffE_*mixture_.rho1()*max(T - TSat, T0)
|
||||
coeffC_*mixture_.rho2()*max(TSat - T.oldTime(), T0),
|
||||
-coeffE_*mixture_.rho1()*max(T.oldTime() - TSat, T0)
|
||||
);
|
||||
}
|
||||
|
||||
@ -112,8 +112,8 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDot() const
|
||||
|
||||
return Pair<tmp<volScalarField>>
|
||||
(
|
||||
coeffC_*mixture_.rho2()*limitedAlpha2*max(TSat - T, T0),
|
||||
coeffE_*mixture_.rho1()*limitedAlpha1*max(T - TSat, T0)
|
||||
coeffC_*mixture_.rho2()*limitedAlpha2*max(TSat - T.oldTime(), T0),
|
||||
coeffE_*mixture_.rho1()*limitedAlpha1*max(T.oldTime() - TSat, T0)
|
||||
);
|
||||
}
|
||||
|
||||
@ -144,8 +144,8 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotDeltaT() const
|
||||
|
||||
return Pair<tmp<volScalarField>>
|
||||
(
|
||||
coeffC_*mixture_.rho2()*limitedAlpha2*pos(TSat - T),
|
||||
coeffE_*mixture_.rho1()*limitedAlpha1*pos(T - TSat)
|
||||
coeffC_*mixture_.rho2()*limitedAlpha2*pos(TSat - T.oldTime()),
|
||||
coeffE_*mixture_.rho1()*limitedAlpha1*pos(T.oldTime() - TSat)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ FoamFile
|
||||
|
||||
dimensions [0 0 0 1 0 0 0];
|
||||
|
||||
internalField uniform 368;
|
||||
internalField uniform 375;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
@ -32,12 +32,8 @@ boundaryField
|
||||
}
|
||||
left
|
||||
{
|
||||
type compressible::turbulentHeatFluxTemperature;
|
||||
heatSource flux;
|
||||
q uniform -40e3;
|
||||
kappaMethod fluidThermo;
|
||||
kappa none;
|
||||
value $internalField;
|
||||
type fixedValue;
|
||||
value uniform 360;
|
||||
}
|
||||
right
|
||||
{
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object epsilon;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 2 -3 0 0 0 0];
|
||||
|
||||
internalField uniform 1;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
bottom
|
||||
{
|
||||
type epsilonWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
top
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
left
|
||||
{
|
||||
type epsilonWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
right
|
||||
{
|
||||
type epsilonWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -17,7 +17,7 @@ FoamFile
|
||||
|
||||
dimensions [ 0 2 -2 0 0 0 0 ];
|
||||
|
||||
internalField uniform 2e-3;
|
||||
internalField uniform 0.1;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object p;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 1 -1 -2 0 0 0 0 ];
|
||||
|
||||
internalField uniform 1e5;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
bottom
|
||||
{
|
||||
type calculated;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
top
|
||||
{
|
||||
type calculated;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
left
|
||||
{
|
||||
type calculated;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
right
|
||||
{
|
||||
type calculated;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -4,7 +4,9 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
# Source tutorial run functions
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||
|
||||
application=$(getApplication)
|
||||
|
||||
runApplication blockMesh
|
||||
runApplication $(getApplication)
|
||||
runApplication $application
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -16,6 +16,6 @@ FoamFile
|
||||
|
||||
TSat TSat [0 0 0 1 0] 366; // saturation temperature
|
||||
|
||||
pDivU true;
|
||||
pDivU false;
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -17,7 +17,7 @@ FoamFile
|
||||
phases (liquid vapour);// FC-72
|
||||
|
||||
|
||||
sigma sigma [1 0 -2 0 0 0 0] 0.07;
|
||||
sigma sigma [1 0 -2 0 0 0 0] 0.0;
|
||||
|
||||
liquid
|
||||
{
|
||||
|
||||
@ -19,7 +19,7 @@ simulationType RAS;
|
||||
|
||||
RAS
|
||||
{
|
||||
RASModel kOmega;
|
||||
RASModel kOmegaSST;
|
||||
|
||||
turbulence on;
|
||||
printCoeffs on;
|
||||
|
||||
@ -25,11 +25,11 @@ stopAt endTime;
|
||||
|
||||
endTime 4;
|
||||
|
||||
deltaT 1e-5;
|
||||
deltaT 1e-4;
|
||||
|
||||
writeControl adjustableRunTime;
|
||||
|
||||
writeInterval 1e-1;
|
||||
writeInterval 0.1;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
@ -45,11 +45,9 @@ timePrecision 6;
|
||||
|
||||
runTimeModifiable yes;
|
||||
|
||||
adjustTimeStep yes;
|
||||
adjustTimeStep no;
|
||||
|
||||
maxCo 6.0;
|
||||
|
||||
maxAlphaCo 6.0;
|
||||
maxCo 1.0;
|
||||
|
||||
maxDeltaT 1e-2;
|
||||
|
||||
|
||||
@ -29,10 +29,11 @@ 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,U) Gauss upwind;
|
||||
div(phi,omega) Gauss upwind;
|
||||
div(phi,epsilon) Gauss upwind;
|
||||
div(phi,k) Gauss upwind;
|
||||
div(rhoPhi,e) Gauss upwind;
|
||||
div(rhoPhi,K) Gauss upwind;
|
||||
div(phi,alpha) Gauss vanLeer;
|
||||
div(phirb,alpha) Gauss linear;
|
||||
@ -42,7 +43,7 @@ divSchemes
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default Gauss linear orthogonal;
|
||||
default Gauss linear corrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
@ -52,7 +53,7 @@ interpolationSchemes
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default orthogonal;
|
||||
default corrected;
|
||||
}
|
||||
|
||||
wallDist
|
||||
|
||||
@ -17,9 +17,14 @@ FoamFile
|
||||
|
||||
solvers
|
||||
{
|
||||
".*(rho|rhoFinal)"
|
||||
{
|
||||
solver diagonal;
|
||||
}
|
||||
|
||||
"alpha.liquid.*"
|
||||
{
|
||||
cAlpha 1;
|
||||
cAlpha 0;
|
||||
nAlphaCorr 2;
|
||||
nAlphaSubCycles 2;
|
||||
|
||||
@ -55,6 +60,7 @@ solvers
|
||||
nCellsInCoarsestLevel 10;
|
||||
agglomerator faceAreaPair;
|
||||
mergeLevels 1;
|
||||
maxIter 100;
|
||||
};
|
||||
|
||||
p_rghFinal
|
||||
@ -111,7 +117,7 @@ PIMPLE
|
||||
{
|
||||
momentumPredictor false;
|
||||
nOuterCorrectors 1;
|
||||
nCorrectors 3;
|
||||
nCorrectors 2;
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user