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::div(rhoPhi, U)
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), 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"
// 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;

View File

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

View File

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

View File

@ -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())
{

View File

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