mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
MRG: Integrated Foundation code to commit ba4dbed
This commit is contained in:
@ -182,6 +182,11 @@
|
||||
if (alphaApplyPrevCorr && MULESCorr)
|
||||
{
|
||||
talphaPhiCorr0 = alphaPhi - talphaPhiCorr0;
|
||||
talphaPhiCorr0.ref().rename("alphaPhiCorr0");
|
||||
}
|
||||
else
|
||||
{
|
||||
talphaPhiCorr0.clear();
|
||||
}
|
||||
|
||||
if
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -128,6 +128,9 @@ int main(int argc, char *argv[])
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
// Do not apply previous time-step mesh compression flux
|
||||
talphaPhiCorr0.clear();
|
||||
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -64,11 +64,8 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
|
||||
forAllIter(PtrDictionary<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase1 = iter();
|
||||
volScalarField& alpha1 = phase1;
|
||||
|
||||
phase1.alphaPhi() =
|
||||
dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0);
|
||||
phaseModel& phase = iter();
|
||||
volScalarField& alpha1 = phase;
|
||||
|
||||
alphaPhiCorrs.set
|
||||
(
|
||||
@ -79,7 +76,7 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
fvc::flux
|
||||
(
|
||||
phi_,
|
||||
phase1,
|
||||
phase,
|
||||
"div(phi," + alpha1.name() + ')'
|
||||
)
|
||||
)
|
||||
@ -92,13 +89,13 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
phaseModel& phase2 = iter2();
|
||||
volScalarField& alpha2 = phase2;
|
||||
|
||||
if (&phase2 == &phase1) continue;
|
||||
if (&phase2 == &phase) continue;
|
||||
|
||||
surfaceScalarField phir(phase1.phi() - phase2.phi());
|
||||
surfaceScalarField phir(phase.phi() - phase2.phi());
|
||||
|
||||
scalarCoeffSymmTable::const_iterator cAlpha
|
||||
(
|
||||
cAlphas_.find(interfacePair(phase1, phase2))
|
||||
cAlphas_.find(interfacePair(phase, phase2))
|
||||
);
|
||||
|
||||
if (cAlpha != cAlphas_.end())
|
||||
@ -108,7 +105,7 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
(mag(phi_) + mag(phir))/mesh_.magSf()
|
||||
);
|
||||
|
||||
phir += min(cAlpha()*phic, max(phic))*nHatf(phase1, phase2);
|
||||
phir += min(cAlpha()*phic, max(phic))*nHatf(phase, phase2);
|
||||
}
|
||||
|
||||
word phirScheme
|
||||
@ -119,39 +116,18 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
alphaPhiCorr += fvc::flux
|
||||
(
|
||||
-fvc::flux(-phir, phase2, phirScheme),
|
||||
phase1,
|
||||
phase,
|
||||
phirScheme
|
||||
);
|
||||
}
|
||||
|
||||
surfaceScalarField::Boundary& alphaPhiCorrBf =
|
||||
alphaPhiCorr.boundaryFieldRef();
|
||||
|
||||
// Ensure that the flux at inflow BCs is preserved
|
||||
forAll(alphaPhiCorrBf, patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhiCorrp = alphaPhiCorrBf[patchi];
|
||||
|
||||
if (!alphaPhiCorrp.coupled())
|
||||
{
|
||||
const scalarField& phi1p = phase1.phi().boundaryField()[patchi];
|
||||
const scalarField& alpha1p = alpha1.boundaryField()[patchi];
|
||||
|
||||
forAll(alphaPhiCorrp, facei)
|
||||
{
|
||||
if (phi1p[facei] < 0)
|
||||
{
|
||||
alphaPhiCorrp[facei] = alpha1p[facei]*phi1p[facei];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
phase.correctInflowOutflow(alphaPhiCorr);
|
||||
|
||||
MULES::limit
|
||||
(
|
||||
1.0/mesh_.time().deltaT().value(),
|
||||
geometricOneField(),
|
||||
phase1,
|
||||
phase,
|
||||
phi_,
|
||||
alphaPhiCorr,
|
||||
zeroField(),
|
||||
@ -182,29 +158,30 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
|
||||
forAllIter(PtrDictionary<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase1 = iter();
|
||||
phaseModel& phase = iter();
|
||||
|
||||
surfaceScalarField& alphaPhi = alphaPhiCorrs[phasei];
|
||||
alphaPhi += upwind<scalar>(mesh_, phi_).flux(phase1);
|
||||
alphaPhi += upwind<scalar>(mesh_, phi_).flux(phase);
|
||||
phase.correctInflowOutflow(alphaPhi);
|
||||
|
||||
MULES::explicitSolve
|
||||
(
|
||||
geometricOneField(),
|
||||
phase1,
|
||||
phase,
|
||||
alphaPhi,
|
||||
zeroField(),
|
||||
zeroField()
|
||||
);
|
||||
|
||||
phase1.alphaPhi() += alphaPhi;
|
||||
phase.alphaPhi() = alphaPhi;
|
||||
|
||||
Info<< phase1.name() << " volume fraction, min, max = "
|
||||
<< phase1.weightedAverage(mesh_.V()).value()
|
||||
<< ' ' << min(phase1).value()
|
||||
<< ' ' << max(phase1).value()
|
||||
Info<< phase.name() << " volume fraction, min, max = "
|
||||
<< phase.weightedAverage(mesh_.V()).value()
|
||||
<< ' ' << min(phase).value()
|
||||
<< ' ' << max(phase).value()
|
||||
<< endl;
|
||||
|
||||
sumAlpha += phase1;
|
||||
sumAlpha += phase;
|
||||
|
||||
phasei++;
|
||||
}
|
||||
@ -215,6 +192,15 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
<< ' ' << max(sumAlpha).value()
|
||||
<< endl;
|
||||
|
||||
// Correct the sum of the phase-fractions to avoid 'drift'
|
||||
volScalarField sumCorr(1.0 - sumAlpha);
|
||||
forAllIter(PtrDictionary<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase = iter();
|
||||
volScalarField& alpha = phase;
|
||||
alpha += alpha*sumCorr;
|
||||
}
|
||||
|
||||
calcAlphas();
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -236,6 +236,24 @@ bool Foam::phaseModel::read(const dictionary& phaseDict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::phaseModel::correctInflowOutflow(surfaceScalarField& alphaPhi) const
|
||||
{
|
||||
surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef();
|
||||
const volScalarField::Boundary& alphaBf = boundaryField();
|
||||
const surfaceScalarField::Boundary& phiBf = phi().boundaryField();
|
||||
|
||||
forAll(alphaPhiBf, patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi];
|
||||
|
||||
if (!alphaPhip.coupled())
|
||||
{
|
||||
alphaPhip = phiBf[patchi]*alphaBf[patchi];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::d() const
|
||||
{
|
||||
return dPtr_().d();
|
||||
|
||||
@ -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-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -208,6 +208,9 @@ public:
|
||||
return alphaPhi_;
|
||||
}
|
||||
|
||||
//- Ensure that the flux at inflow/outflow BCs is preserved
|
||||
void correctInflowOutflow(surfaceScalarField& alphaPhi) const;
|
||||
|
||||
//- Correct the phase properties
|
||||
void correct();
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -681,6 +681,14 @@ void Foam::multiphaseMixture::solveAlphas
|
||||
<< ' ' << max(sumAlpha).value()
|
||||
<< endl;
|
||||
|
||||
// Correct the sum of the phase-fractions to avoid 'drift'
|
||||
volScalarField sumCorr(1.0 - sumAlpha);
|
||||
forAllIter(PtrDictionary<phase>, phases_, iter)
|
||||
{
|
||||
phase& alpha = iter();
|
||||
alpha += alpha*sumCorr;
|
||||
}
|
||||
|
||||
calcAlphas();
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -86,9 +86,7 @@ Foam::interfaceCompositionModels::Saturated<Thermo, OtherThermo>::update
|
||||
(
|
||||
const volScalarField& Tf
|
||||
)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -375,6 +375,18 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
||||
volScalarField hef1(phase1.thermo().he(phase1.thermo().p(), Tf));
|
||||
volScalarField hef2(phase2.thermo().he(phase2.thermo().p(), Tf));
|
||||
|
||||
volScalarField L
|
||||
(
|
||||
min
|
||||
(
|
||||
(pos(iDmdt)*he2 + neg(iDmdt)*hef2)
|
||||
- (neg(iDmdt)*he1 + pos(iDmdt)*hef1),
|
||||
0.3*mag(hef2 - hef1)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField iDmdtNew(iDmdt);
|
||||
|
||||
if (massTransfer_ )
|
||||
{
|
||||
volScalarField H1
|
||||
@ -389,28 +401,13 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
||||
|
||||
Tf = saturationModel_->Tsat(phase1.thermo().p());
|
||||
|
||||
scalar iDmdtRelax(this->mesh().fieldRelaxationFactor("iDmdt"));
|
||||
iDmdtNew =
|
||||
(H1*(Tf - T1) + H2*(Tf - T2))/L;
|
||||
|
||||
iDmdt =
|
||||
(1 - iDmdtRelax)*iDmdt
|
||||
+ iDmdtRelax*(H1*(Tf - T1) + H2*(Tf - T2))
|
||||
/min
|
||||
(
|
||||
(pos(iDmdt)*he2 + neg(iDmdt)*hef2)
|
||||
- (neg(iDmdt)*he1 + pos(iDmdt)*hef1),
|
||||
0.3*mag(hef2 - hef1)
|
||||
);
|
||||
|
||||
Info<< "iDmdt." << pair.name()
|
||||
<< ": min = " << min(iDmdt.primitiveField())
|
||||
<< ", mean = " << average(iDmdt.primitiveField())
|
||||
<< ", max = " << max(iDmdt.primitiveField())
|
||||
<< ", integral = " << fvc::domainIntegrate(iDmdt).value()
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
iDmdt == dimensionedScalar("0", dmdt.dimensions(), 0);
|
||||
iDmdtNew == dimensionedScalar("0",dmdt.dimensions(), 0);
|
||||
}
|
||||
|
||||
volScalarField H1(this->heatTransferModels_[pair][pair.first()]->K());
|
||||
@ -423,16 +420,7 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
||||
H2.boundaryFieldRef() =
|
||||
max(H2.boundaryField(), phase2.boundaryField()*HLimit);
|
||||
|
||||
volScalarField mDotL
|
||||
(
|
||||
iDmdt*
|
||||
(
|
||||
(pos(iDmdt)*he2 + neg(iDmdt)*hef2)
|
||||
- (neg(iDmdt)*he1 + pos(iDmdt)*hef1)
|
||||
)
|
||||
);
|
||||
|
||||
Tf = (H1*T1 + H2*T2 + mDotL)/(H1 + H2);
|
||||
Tf = (H1*T1 + H2*T2 + iDmdtNew*L)/(H1 + H2);
|
||||
|
||||
Info<< "Tf." << pair.name()
|
||||
<< ": min = " << min(Tf.primitiveField())
|
||||
@ -440,6 +428,19 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
||||
<< ", max = " << max(Tf.primitiveField())
|
||||
<< endl;
|
||||
|
||||
scalar iDmdtRelax(this->mesh().fieldRelaxationFactor("iDmdt"));
|
||||
iDmdt = (1 - iDmdtRelax)*iDmdt + iDmdtRelax*iDmdtNew;
|
||||
|
||||
if (massTransfer_ )
|
||||
{
|
||||
Info<< "iDmdt." << pair.name()
|
||||
<< ": min = " << min(iDmdt.primitiveField())
|
||||
<< ", mean = " << average(iDmdt.primitiveField())
|
||||
<< ", max = " << max(iDmdt.primitiveField())
|
||||
<< ", integral = " << fvc::domainIntegrate(iDmdt).value()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Accumulate dmdt contributions from boundaries
|
||||
volScalarField wDmdt
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -165,6 +165,24 @@ bool Foam::phaseModel::compressible() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::phaseModel::correctInflowOutflow(surfaceScalarField& alphaPhi) const
|
||||
{
|
||||
surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef();
|
||||
const volScalarField::Boundary& alphaBf = boundaryField();
|
||||
const surfaceScalarField::Boundary& phiBf = phi()().boundaryField();
|
||||
|
||||
forAll(alphaPhiBf, patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi];
|
||||
|
||||
if (!alphaPhip.coupled())
|
||||
{
|
||||
alphaPhip = phiBf[patchi]*alphaBf[patchi];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Foam::tmp<Foam::volScalarField>& Foam::phaseModel::divU() const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -283,6 +283,9 @@ public:
|
||||
//- Access the mass flux of the phase
|
||||
virtual surfaceScalarField& alphaRhoPhi() = 0;
|
||||
|
||||
//- Ensure that the flux at inflow/outflow BCs is preserved
|
||||
void correctInflowOutflow(surfaceScalarField& alphaPhi) const;
|
||||
|
||||
|
||||
// Transport
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -76,9 +76,7 @@ void Foam::phaseSystem::generatePairs
|
||||
|
||||
// pair already exists
|
||||
if (phasePairs_.found(key))
|
||||
{
|
||||
// do nothing ...
|
||||
}
|
||||
{}
|
||||
|
||||
// new ordered pair
|
||||
else if (key.ordered())
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -71,15 +71,17 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
{
|
||||
bool LTS = fv::localEulerDdt::enabled(mesh_);
|
||||
|
||||
forAll(phases(), phasei)
|
||||
{
|
||||
phases()[phasei].correctBoundaryConditions();
|
||||
}
|
||||
|
||||
PtrList<surfaceScalarField> alphaPhiCorrs(phases().size());
|
||||
forAll(phases(), phasei)
|
||||
{
|
||||
phaseModel& phase = phases()[phasei];
|
||||
volScalarField& alpha1 = phase;
|
||||
|
||||
phase.alphaPhi() =
|
||||
dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0);
|
||||
|
||||
alphaPhiCorrs.set
|
||||
(
|
||||
phasei,
|
||||
@ -134,28 +136,7 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
);
|
||||
}
|
||||
|
||||
surfaceScalarField::Boundary& alphaPhiCorrBf =
|
||||
alphaPhiCorr.boundaryFieldRef();
|
||||
|
||||
// Ensure that the flux at inflow BCs is preserved
|
||||
forAll(alphaPhiCorr.boundaryField(), patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhiCorrp = alphaPhiCorrBf[patchi];
|
||||
|
||||
if (!alphaPhiCorrp.coupled())
|
||||
{
|
||||
const scalarField& phi1p = phase.phi().boundaryField()[patchi];
|
||||
const scalarField& alpha1p = alpha1.boundaryField()[patchi];
|
||||
|
||||
forAll(alphaPhiCorrp, facei)
|
||||
{
|
||||
if (phi1p[facei] < 0)
|
||||
{
|
||||
alphaPhiCorrp[facei] = alpha1p[facei]*phi1p[facei];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
phase.correctInflowOutflow(alphaPhiCorr);
|
||||
|
||||
if (LTS)
|
||||
{
|
||||
@ -215,8 +196,9 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
phaseModel& phase = phases()[phasei];
|
||||
volScalarField& alpha = phase;
|
||||
|
||||
surfaceScalarField& alphaPhic = alphaPhiCorrs[phasei];
|
||||
alphaPhic += upwind<scalar>(mesh_, phi_).flux(phase);
|
||||
surfaceScalarField& alphaPhi = alphaPhiCorrs[phasei];
|
||||
alphaPhi += upwind<scalar>(mesh_, phi_).flux(phase);
|
||||
phase.correctInflowOutflow(alphaPhi);
|
||||
|
||||
volScalarField::Internal Sp
|
||||
(
|
||||
@ -298,12 +280,12 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
(
|
||||
geometricOneField(),
|
||||
alpha,
|
||||
alphaPhic,
|
||||
alphaPhi,
|
||||
Sp,
|
||||
Su
|
||||
);
|
||||
|
||||
phase.alphaPhi() += alphaPhic;
|
||||
phase.alphaPhi() = alphaPhi;
|
||||
|
||||
Info<< phase.name() << " volume fraction, min, max = "
|
||||
<< phase.weightedAverage(mesh_.V()).value()
|
||||
@ -319,6 +301,14 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
<< ' ' << min(sumAlpha).value()
|
||||
<< ' ' << max(sumAlpha).value()
|
||||
<< endl;
|
||||
|
||||
// Correct the sum of the phase-fractions to avoid 'drift'
|
||||
volScalarField sumCorr(1.0 - sumAlpha);
|
||||
forAll(phases(), phasei)
|
||||
{
|
||||
volScalarField& alpha = phases()[phasei];
|
||||
alpha += alpha*sumCorr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -37,7 +37,9 @@ License
|
||||
#include "saturationModel.H"
|
||||
#include "wallFvPatch.H"
|
||||
#include "uniformDimensionedFields.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
using namespace Foam::constant::mathematical;
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -157,6 +159,12 @@ alphatWallBoilingWallFunctionFvPatchScalarField
|
||||
(
|
||||
dict.subDict("departureFreqModel")
|
||||
);
|
||||
|
||||
if (dict.found("dDep"))
|
||||
{
|
||||
dDep_ = scalarField("dDep", dict, p.size());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -259,10 +267,9 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
// Lookup the fluid model
|
||||
const ThermalPhaseChangePhaseSystem
|
||||
<
|
||||
MomentumTransferPhaseSystem
|
||||
<
|
||||
twoPhaseSystem>
|
||||
>& fluid = refCast
|
||||
MomentumTransferPhaseSystem<twoPhaseSystem>
|
||||
>& fluid =
|
||||
refCast
|
||||
<
|
||||
const ThermalPhaseChangePhaseSystem
|
||||
<
|
||||
@ -477,9 +484,9 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
const scalarField Ja(rhoLiquidw*Cpw*Tsub/(rhoVaporw*L));
|
||||
const scalarField Al(fLiquid*4.8*exp(-Ja/80));
|
||||
|
||||
const scalarField A2(min(M_PI*sqr(dDep_)*N*Al/4, scalar(1)));
|
||||
const scalarField A2(min(pi*sqr(dDep_)*N*Al/4, scalar(1)));
|
||||
const scalarField A1(max(1 - A2, scalar(1e-4)));
|
||||
const scalarField A2E(min(M_PI*sqr(dDep_)*N*Al/4, scalar(5)));
|
||||
const scalarField A2E(min(pi*sqr(dDep_)*N*Al/4, scalar(5)));
|
||||
|
||||
// Wall evaporation heat flux [kg/s3 = J/m2s]
|
||||
const scalarField Qe((1.0/6.0)*A2E*dDep_*rhoVaporw*fDep*L);
|
||||
@ -495,7 +502,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
// Quenching heat transfer coefficient
|
||||
const scalarField hQ
|
||||
(
|
||||
2*(alphaw*Cpw)*fDep*sqrt((0.8/fDep)/(M_PI*alphaw/rhow))
|
||||
2*(alphaw*Cpw)*fDep*sqrt((0.8/fDep)/(pi*alphaw/rhow))
|
||||
);
|
||||
|
||||
// Quenching heat flux
|
||||
@ -622,11 +629,13 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
departureFreqModel_->write(os);
|
||||
os << decrIndent << indent << token::END_BLOCK << nl;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dmdt_.writeEntry("dmdt", os);
|
||||
dDep_.writeEntry("dDep", os);
|
||||
alphatConv_.writeEntry("alphatConv", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -269,7 +269,7 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Calculate and return the departure diameter field
|
||||
//- Return the departure diameter field
|
||||
const scalarField& dDeparture() const
|
||||
{
|
||||
return dDep_;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -201,7 +201,6 @@ void Foam::twoPhaseSystem::solve()
|
||||
word alphaScheme("div(phi," + alpha1.name() + ')');
|
||||
word alpharScheme("div(phir," + alpha1.name() + ')');
|
||||
|
||||
const surfaceScalarField& phi = this->phi();
|
||||
const surfaceScalarField& phi1 = phase1_.phi();
|
||||
const surfaceScalarField& phi2 = phase2_.phi();
|
||||
|
||||
@ -236,9 +235,7 @@ void Foam::twoPhaseSystem::solve()
|
||||
}
|
||||
|
||||
alpha1.correctBoundaryConditions();
|
||||
surfaceScalarField alpha1f(fvc::interpolate(max(alpha1, scalar(0))));
|
||||
|
||||
surfaceScalarField phic("phic", phi);
|
||||
surfaceScalarField phir("phir", phi1 - phi2);
|
||||
|
||||
tmp<surfaceScalarField> alphaDbyA;
|
||||
@ -279,7 +276,7 @@ void Foam::twoPhaseSystem::solve()
|
||||
),
|
||||
// Divergence term is handled explicitly to be
|
||||
// consistent with the explicit transport solution
|
||||
fvc::div(phi)*min(alpha1, scalar(1))
|
||||
fvc::div(phi_)*min(alpha1, scalar(1))
|
||||
);
|
||||
|
||||
if (tdgdt.valid())
|
||||
@ -300,11 +297,11 @@ void Foam::twoPhaseSystem::solve()
|
||||
}
|
||||
}
|
||||
|
||||
surfaceScalarField alphaPhic1
|
||||
surfaceScalarField alphaPhi1
|
||||
(
|
||||
fvc::flux
|
||||
(
|
||||
phic,
|
||||
phi_,
|
||||
alpha1,
|
||||
alphaScheme
|
||||
)
|
||||
@ -316,28 +313,7 @@ void Foam::twoPhaseSystem::solve()
|
||||
)
|
||||
);
|
||||
|
||||
surfaceScalarField::Boundary& alphaPhic1Bf =
|
||||
alphaPhic1.boundaryFieldRef();
|
||||
|
||||
// Ensure that the flux at inflow BCs is preserved
|
||||
forAll(alphaPhic1Bf, patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhic1p = alphaPhic1Bf[patchi];
|
||||
|
||||
if (!alphaPhic1p.coupled())
|
||||
{
|
||||
const scalarField& phi1p = phi1.boundaryField()[patchi];
|
||||
const scalarField& alpha1p = alpha1.boundaryField()[patchi];
|
||||
|
||||
forAll(alphaPhic1p, facei)
|
||||
{
|
||||
if (phi1p[facei] < 0)
|
||||
{
|
||||
alphaPhic1p[facei] = alpha1p[facei]*phi1p[facei];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
phase1_.correctInflowOutflow(alphaPhi1);
|
||||
|
||||
if (nAlphaSubCycles > 1)
|
||||
{
|
||||
@ -355,14 +331,14 @@ void Foam::twoPhaseSystem::solve()
|
||||
!(++alphaSubCycle).end();
|
||||
)
|
||||
{
|
||||
surfaceScalarField alphaPhic10(alphaPhic1);
|
||||
surfaceScalarField alphaPhi10(alphaPhi1);
|
||||
|
||||
MULES::explicitSolve
|
||||
(
|
||||
geometricOneField(),
|
||||
alpha1,
|
||||
phi,
|
||||
alphaPhic10,
|
||||
phi_,
|
||||
alphaPhi10,
|
||||
(alphaSubCycle.index()*Sp)(),
|
||||
(Su - (alphaSubCycle.index() - 1)*Sp*alpha1)(),
|
||||
phase1_.alphaMax(),
|
||||
@ -371,11 +347,11 @@ void Foam::twoPhaseSystem::solve()
|
||||
|
||||
if (alphaSubCycle.index() == 1)
|
||||
{
|
||||
phase1_.alphaPhi() = alphaPhic10;
|
||||
phase1_.alphaPhi() = alphaPhi10;
|
||||
}
|
||||
else
|
||||
{
|
||||
phase1_.alphaPhi() += alphaPhic10;
|
||||
phase1_.alphaPhi() += alphaPhi10;
|
||||
}
|
||||
}
|
||||
|
||||
@ -387,15 +363,15 @@ void Foam::twoPhaseSystem::solve()
|
||||
(
|
||||
geometricOneField(),
|
||||
alpha1,
|
||||
phi,
|
||||
alphaPhic1,
|
||||
phi_,
|
||||
alphaPhi1,
|
||||
Sp,
|
||||
Su,
|
||||
phase1_.alphaMax(),
|
||||
0
|
||||
);
|
||||
|
||||
phase1_.alphaPhi() = alphaPhic1;
|
||||
phase1_.alphaPhi() = alphaPhi1;
|
||||
}
|
||||
|
||||
if (alphaDbyA.valid())
|
||||
@ -415,8 +391,8 @@ void Foam::twoPhaseSystem::solve()
|
||||
phase1_.alphaRhoPhi() =
|
||||
fvc::interpolate(phase1_.rho())*phase1_.alphaPhi();
|
||||
|
||||
phase2_.alphaPhi() = phi - phase1_.alphaPhi();
|
||||
alpha2 = scalar(1) - alpha1;
|
||||
phase2_.alphaPhi() = phi_ - phase1_.alphaPhi();
|
||||
phase2_.correctInflowOutflow(phase2_.alphaPhi());
|
||||
phase2_.alphaRhoPhi() =
|
||||
fvc::interpolate(phase2_.rho())*phase2_.alphaPhi();
|
||||
|
||||
@ -425,6 +401,13 @@ void Foam::twoPhaseSystem::solve()
|
||||
<< " Min(alpha1) = " << min(alpha1).value()
|
||||
<< " Max(alpha1) = " << max(alpha1).value()
|
||||
<< endl;
|
||||
|
||||
// Ensure the phase-fractions are bounded
|
||||
alpha1.max(0);
|
||||
alpha1.min(1);
|
||||
|
||||
// Update the phase-fraction of the other phase
|
||||
alpha2 = scalar(1) - alpha1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -248,27 +248,19 @@ bool Foam::phaseModel::read(const dictionary& phaseProperties)
|
||||
}
|
||||
|
||||
|
||||
void Foam::phaseModel::correctInflowFlux(surfaceScalarField& alphaPhi) const
|
||||
void Foam::phaseModel::correctInflowOutflow(surfaceScalarField& alphaPhi) const
|
||||
{
|
||||
surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef();
|
||||
const volScalarField::Boundary& alphaBf = boundaryField();
|
||||
const surfaceScalarField::Boundary& phiBf = phi().boundaryField();
|
||||
|
||||
// Ensure that the flux at inflow BCs is preserved
|
||||
forAll(alphaPhiBf, patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi];
|
||||
|
||||
if (!alphaPhip.coupled())
|
||||
{
|
||||
const scalarField& phip = phi().boundaryField()[patchi];
|
||||
const scalarField& alphap = boundaryField()[patchi];
|
||||
|
||||
forAll(alphaPhip, facei)
|
||||
{
|
||||
if (phip[facei] < SMALL)
|
||||
{
|
||||
alphaPhip[facei] = alphap[facei]*phip[facei];
|
||||
}
|
||||
}
|
||||
alphaPhip = phiBf[patchi]*alphaBf[patchi];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -319,8 +319,8 @@ public:
|
||||
return alphaRhoPhi_;
|
||||
}
|
||||
|
||||
//- Ensure that the flux at inflow BCs is preserved
|
||||
void correctInflowFlux(surfaceScalarField& alphaPhi) const;
|
||||
//- Ensure that the flux at inflow/outflow BCs is preserved
|
||||
void correctInflowOutflow(surfaceScalarField& alphaPhi) const;
|
||||
|
||||
//- Correct the phase properties
|
||||
// other than the thermodynamics and turbulence
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -444,7 +444,7 @@ void Foam::twoPhaseSystem::solve()
|
||||
)
|
||||
);
|
||||
|
||||
phase1_.correctInflowFlux(alphaPhic1);
|
||||
phase1_.correctInflowOutflow(alphaPhic1);
|
||||
|
||||
if (nAlphaSubCycles > 1)
|
||||
{
|
||||
@ -515,8 +515,7 @@ void Foam::twoPhaseSystem::solve()
|
||||
fvc::interpolate(phase1_.rho())*phase1_.alphaPhi();
|
||||
|
||||
phase2_.alphaPhi() = phi_ - phase1_.alphaPhi();
|
||||
alpha2 = scalar(1) - alpha1;
|
||||
phase2_.correctInflowFlux(phase2_.alphaPhi());
|
||||
phase2_.correctInflowOutflow(phase2_.alphaPhi());
|
||||
phase2_.alphaRhoPhi() =
|
||||
fvc::interpolate(phase2_.rho())*phase2_.alphaPhi();
|
||||
|
||||
@ -525,6 +524,12 @@ void Foam::twoPhaseSystem::solve()
|
||||
<< " Min(" << alpha1.name() << ") = " << min(alpha1).value()
|
||||
<< " Max(" << alpha1.name() << ") = " << max(alpha1).value()
|
||||
<< endl;
|
||||
|
||||
// Ensure the phase-fractions are bounded
|
||||
alpha1.max(0);
|
||||
alpha1.min(1);
|
||||
|
||||
alpha2 = scalar(1) - alpha1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user