Update of interCondensingEvaporatingFoam and its tutorial

This commit is contained in:
sergio
2016-12-15 12:36:48 -08:00
parent 141dd02477
commit d5301772f7
18 changed files with 157 additions and 74 deletions

View File

@ -2,7 +2,6 @@
( (
fvm::ddt(rho, U) fvm::ddt(rho, U)
+ fvm::div(rhoPhi, U) + fvm::div(rhoPhi, U)
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
+ turbulence->divDevRhoReff(rho, U) + turbulence->divDevRhoReff(rho, U)
); );

View File

@ -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;

View File

@ -28,20 +28,6 @@
#include "createPhi.H" #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 // Creating e based thermo
autoPtr<twoPhaseMixtureEThermo> thermo; autoPtr<twoPhaseMixtureEThermo> thermo;
thermo.set(new twoPhaseMixtureEThermo(U, phi)); thermo.set(new twoPhaseMixtureEThermo(U, phi));
@ -54,9 +40,10 @@
volScalarField& T = thermo->T(); volScalarField& T = thermo->T();
volScalarField& e = thermo->he(); volScalarField& e = thermo->he();
e.oldTime();
// Correct e from T and alpha // Correct e from T and alpha
thermo->correct(); //thermo->correct();
volScalarField& alpha1(thermo->alpha1()); volScalarField& alpha1(thermo->alpha1());
volScalarField& alpha2(thermo->alpha2()); volScalarField& alpha2(thermo->alpha2());
@ -80,7 +67,6 @@
); );
rho.oldTime(); rho.oldTime();
// Construct interface from alpha1 distribution // Construct interface from alpha1 distribution
interfaceProperties interface interfaceProperties interface
( (
@ -100,8 +86,7 @@
volScalarField gh("gh", g & mesh.C()); volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("ghf", g & mesh.Cf()); surfaceScalarField ghf("ghf", g & mesh.Cf());
//Update p with rho volScalarField& p = thermo->p();
p = p_rgh + rho*gh;
label pRefCell = 0; label pRefCell = 0;
scalar pRefValue = 0.0; scalar pRefValue = 0.0;

View File

@ -14,9 +14,7 @@
fvScalarMatrix eEqn fvScalarMatrix eEqn
( (
fvm::ddt(rho, e) fvm::ddt(rho, e)
+ fvc::ddt(rho, K) + fvc::div(rhoPhi, K)
+ fvm::div(rhoPhi, e) + fvm::div(rhoPhi, e)
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), e)
- fvm::laplacian(kappaEff/cp, e) - fvm::laplacian(kappaEff/cp, e)
+ pDivU + pDivU
); );

View File

@ -63,20 +63,21 @@ int main(int argc, char *argv[])
pimpleControl pimple(mesh); pimpleControl pimple(mesh);
#include "readGravitationalAcceleration.H" #include "readGravitationalAcceleration.H"
#include "initContinuityErrs.H"
#include "createFields.H" #include "createFields.H"
#include "createFvOptions.H" #include "createFvOptions.H"
#include "createTimeControls.H" #include "createTimeControls.H"
#include "CourantNo.H" #include "CourantNo.H"
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
turbulence->validate();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
while (runTime.run()) while (runTime.run())
{ {
#include "readTimeControls.H" #include "createTimeControls.H"
#include "CourantNo.H" #include "CourantNo.H"
#include "setDeltaT.H" #include "setDeltaT.H"
@ -101,9 +102,12 @@ int main(int argc, char *argv[])
dimensionedScalar("0", dimMass/dimTime, 0) dimensionedScalar("0", dimMass/dimTime, 0)
); );
#include "alphaEqnSubCycle.H"
mixture->correct(); mixture->correct();
#include "alphaEqnSubCycle.H"
solve(fvm::ddt(rho) + fvc::div(rhoPhi));
#include "UEqn.H" #include "UEqn.H"
#include "eEqn.H" #include "eEqn.H"
@ -113,14 +117,14 @@ int main(int argc, char *argv[])
#include "pEqn.H" #include "pEqn.H"
} }
#include "continuityError.H"
if (pimple.turbCorr()) if (pimple.turbCorr())
{ {
turbulence->correct(); turbulence->correct();
} }
} }
rho = alpha1*rho1 + alpha2*rho2;
runTime.write(); runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -1,9 +1,7 @@
{ {
volScalarField rAU("rAU", 1.0/UEqn.A()); volScalarField rAU("rAU", 1.0/UEqn.A());
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
surfaceScalarField phiHbyA surfaceScalarField phiHbyA
( (
"phiHbyA", "phiHbyA",
@ -53,8 +51,7 @@
} }
} }
p = p_rgh + rho*gh;
p == p_rgh + rho*gh;
if (p_rgh.needReference()) if (p_rgh.needReference())
{ {

View File

@ -78,8 +78,8 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotAlphal() const
return Pair<tmp<volScalarField>> return Pair<tmp<volScalarField>>
( (
coeffC_*mixture_.rho2()*max(TSat - T, T0), coeffC_*mixture_.rho2()*max(TSat - T.oldTime(), T0),
-coeffE_*mixture_.rho1()*max(T - TSat, T0) -coeffE_*mixture_.rho1()*max(T.oldTime() - TSat, T0)
); );
} }
@ -112,8 +112,8 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDot() const
return Pair<tmp<volScalarField>> return Pair<tmp<volScalarField>>
( (
coeffC_*mixture_.rho2()*limitedAlpha2*max(TSat - T, T0), coeffC_*mixture_.rho2()*limitedAlpha2*max(TSat - T.oldTime(), T0),
coeffE_*mixture_.rho1()*limitedAlpha1*max(T - TSat, T0) coeffE_*mixture_.rho1()*limitedAlpha1*max(T.oldTime() - TSat, T0)
); );
} }
@ -144,8 +144,8 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotDeltaT() const
return Pair<tmp<volScalarField>> return Pair<tmp<volScalarField>>
( (
coeffC_*mixture_.rho2()*limitedAlpha2*pos(TSat - T), coeffC_*mixture_.rho2()*limitedAlpha2*pos(TSat - T.oldTime()),
coeffE_*mixture_.rho1()*limitedAlpha1*pos(T - TSat) coeffE_*mixture_.rho1()*limitedAlpha1*pos(T.oldTime() - TSat)
); );
} }

View File

@ -16,7 +16,7 @@ FoamFile
dimensions [0 0 0 1 0 0 0]; dimensions [0 0 0 1 0 0 0];
internalField uniform 368; internalField uniform 375;
boundaryField boundaryField
{ {
@ -32,12 +32,8 @@ boundaryField
} }
left left
{ {
type compressible::turbulentHeatFluxTemperature; type fixedValue;
heatSource flux; value uniform 360;
q uniform -40e3;
kappaMethod fluidThermo;
kappa none;
value $internalField;
} }
right right
{ {

View File

@ -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;
}
}
// ************************************************************************* //

View File

@ -17,7 +17,7 @@ FoamFile
dimensions [ 0 2 -2 0 0 0 0 ]; dimensions [ 0 2 -2 0 0 0 0 ];
internalField uniform 2e-3; internalField uniform 0.1;
boundaryField boundaryField
{ {

View File

@ -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;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -4,7 +4,9 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions # Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions . $WM_PROJECT_DIR/bin/tools/RunFunctions
application=$(getApplication)
runApplication blockMesh runApplication blockMesh
runApplication $(getApplication) runApplication $application
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -16,6 +16,6 @@ FoamFile
TSat TSat [0 0 0 1 0] 366; // saturation temperature TSat TSat [0 0 0 1 0] 366; // saturation temperature
pDivU true; pDivU false;
// ************************************************************************* // // ************************************************************************* //

View File

@ -17,7 +17,7 @@ FoamFile
phases (liquid vapour);// FC-72 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 liquid
{ {

View File

@ -19,7 +19,7 @@ simulationType RAS;
RAS RAS
{ {
RASModel kOmega; RASModel kOmegaSST;
turbulence on; turbulence on;
printCoeffs on; printCoeffs on;

View File

@ -25,11 +25,11 @@ stopAt endTime;
endTime 4; endTime 4;
deltaT 1e-5; deltaT 1e-4;
writeControl adjustableRunTime; writeControl adjustableRunTime;
writeInterval 1e-1; writeInterval 0.1;
purgeWrite 0; purgeWrite 0;
@ -45,11 +45,9 @@ timePrecision 6;
runTimeModifiable yes; runTimeModifiable yes;
adjustTimeStep yes; adjustTimeStep no;
maxCo 6.0; maxCo 1.0;
maxAlphaCo 6.0;
maxDeltaT 1e-2; maxDeltaT 1e-2;

View File

@ -29,10 +29,11 @@ divSchemes
{ {
default none; default none;
div(rhoPhi,U) Gauss linear; div(rhoPhi,U) Gauss upwind;
div(phi,omega) Gauss linear; div(phi,omega) Gauss upwind;
div(phi,k) Gauss linear; div(phi,epsilon) Gauss upwind;
div(rhoPhi,e) Gauss linear; div(phi,k) Gauss upwind;
div(rhoPhi,e) Gauss upwind;
div(rhoPhi,K) Gauss upwind; div(rhoPhi,K) Gauss upwind;
div(phi,alpha) Gauss vanLeer; div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss linear; div(phirb,alpha) Gauss linear;
@ -42,7 +43,7 @@ divSchemes
laplacianSchemes laplacianSchemes
{ {
default Gauss linear orthogonal; default Gauss linear corrected;
} }
interpolationSchemes interpolationSchemes
@ -52,7 +53,7 @@ interpolationSchemes
snGradSchemes snGradSchemes
{ {
default orthogonal; default corrected;
} }
wallDist wallDist

View File

@ -17,9 +17,14 @@ FoamFile
solvers solvers
{ {
".*(rho|rhoFinal)"
{
solver diagonal;
}
"alpha.liquid.*" "alpha.liquid.*"
{ {
cAlpha 1; cAlpha 0;
nAlphaCorr 2; nAlphaCorr 2;
nAlphaSubCycles 2; nAlphaSubCycles 2;
@ -55,6 +60,7 @@ solvers
nCellsInCoarsestLevel 10; nCellsInCoarsestLevel 10;
agglomerator faceAreaPair; agglomerator faceAreaPair;
mergeLevels 1; mergeLevels 1;
maxIter 100;
}; };
p_rghFinal p_rghFinal
@ -111,7 +117,7 @@ PIMPLE
{ {
momentumPredictor false; momentumPredictor false;
nOuterCorrectors 1; nOuterCorrectors 1;
nCorrectors 3; nCorrectors 2;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }