55 word(
"interfaceCompression"),
71 void Foam::solvers::twoPhaseSolver::alphaSolve
102 mesh.schemes().ddt(
"ddt(alpha)")
120 <<
"Sub-cycling is not supported "
121 "with the CrankNicolson ddt scheme"
128 || mesh.time().timeIndex() > mesh.time().startTimeIndex() + 1
132 refCast<const fv::CrankNicolsonDdtScheme<scalar>>(ddtAlpha)
139 <<
"Only Euler and CrankNicolson ddt schemes are supported"
145 const scalar cnCoeff = 1.0/(1.0 + ocCoeff);
147 tmp<surfaceScalarField> phiCN(phi);
155 cnCoeff*phi + (1.0 - cnCoeff)*phi.oldTime()
159 tmp<volScalarField> divU;
171 tmp<volScalarField::Internal>
Su;
172 tmp<volScalarField::Internal>
Sp;
182 ? fv::localEulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
183 : fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
185 + fv::gaussConvectionScheme<scalar>
189 upwind<scalar>(mesh, phiCN)
190 ).fvmDiv(phiCN, alpha1)
195 alpha1Eqn -=
Su() +
fvm::Sp(
Sp() + divU(), alpha1);
200 Info<<
"Phase-1 volume fraction = "
201 << alpha1.weightedAverage(mesh.Vsc()).value()
202 <<
" Min(" << alpha1.name() <<
") = " <<
min(alpha1).value()
203 <<
" Max(" << alpha1.name() <<
") = " <<
max(alpha1).value()
206 tmp<surfaceScalarField> talphaPhi1UD(alpha1Eqn.flux());
207 alphaPhi1 = talphaPhi1UD();
211 Info<<
"Applying the previous iteration compression flux" <<
endl;
217 talphaPhi1Corr0.ref(),
222 alphaPhi1 += talphaPhi1Corr0();
226 talphaPhi1Corr0 = talphaPhi1UD;
228 alpha2 = scalar(1) - alpha1;
229 alphaPhi2 = phi - alphaPhi1;
236 tmp<volScalarField> talpha1CN(alpha1);
241 talpha1CN = alpha1.clone();
243 (cnCoeff*alpha1 + (1.0 - cnCoeff)*alpha1.oldTime())();
247 tmp<surfaceScalarField> talphaPhi1Un
259 tmp<surfaceScalarField> talphaPhi1Corr(talphaPhi1Un() - alphaPhi1);
269 talphaPhi1Corr.ref(),
271 (-(
Sp() + divU())*alpha1)(),
283 talphaPhi1Corr.ref(),
292 alphaPhi1 += talphaPhi1Corr();
296 alpha1 = 0.5*alpha1 + 0.5*alpha10;
297 alphaPhi1 += 0.5*talphaPhi1Corr();
302 alphaPhi1 = talphaPhi1Un;
313 (
Su() + divU()*
min(alpha1(), scalar(1)))(),
332 alpha2 = scalar(1) - alpha1;
333 alphaPhi2 = phi - alphaPhi1;
341 talphaPhi1Corr0 = alphaPhi1 - talphaPhi1Corr0;
344 talphaPhi1Corr0.ref().rename
348 talphaPhi1Corr0.ref().checkIn();
352 talphaPhi1Corr0.clear();
357 word(mesh.schemes().ddt(
"ddt(rho,U)"))
358 != fv::EulerDdtScheme<vector>::typeName
359 && word(mesh.schemes().ddt(
"ddt(rho,U)"))
360 != fv::localEulerDdtScheme<vector>::typeName
367 (alphaPhi1 - (1.0 - cnCoeff)*alphaPhi1.oldTime())/cnCoeff;
368 alphaPhi2 = phi - alphaPhi1;
372 Info<<
"Phase-1 volume fraction = "
373 << alpha1.weightedAverage(mesh.Vsc()).value()
374 <<
" Min(" << alpha1.name() <<
") = " <<
min(alpha1).value()
375 <<
" Max(" << alpha1.name() <<
") = " <<
max(alpha1).value()
418 !(++alphaSubCycle).end();
422 talphaPhi1.
ref() += (runTime.deltaT()/totalDeltaT)*alphaPhi1;
425 alphaPhi1 = talphaPhi1();
426 alphaPhi2 = phi - talphaPhi1();
CMULES: Multidimensional universal limiter for explicit corrected implicit solution.
const label nAlphaSubCycles(alphaControls.lookup< label >("nAlphaSubCycles"))
const dictionary & alphaControls
const bool MULESCorr(alphaControls.lookupOrDefault< Switch >("MULESCorr", false))
const label nAlphaCorr(alphaControls.lookup< label >("nAlphaCorr"))
const bool alphaApplyPrevCorr(alphaControls.lookupOrDefault< Switch >("alphaApplyPrevCorr", false))
Generic GeometricField class.
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, const Internal &, const PtrList< PatchField< Type >> &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
bool found(const Key &) const
Return true if hashedEntry is found in table.
static word groupName(Name name, const word &group)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
A list of keyword definitions, which are a keyword followed by any number of values (e....
const fvSchemes & schemes() const
Return the fvSchemes.
ITstream & div(const word &name) const
Second-oder Crank-Nicolson implicit ddt using the current and previous time-step fields as well as th...
Basic first-order Euler implicit/explicit ddt using only the current and previous time-step values.
Abstract base class for ddt schemes.
Local time-step first-order Euler implicit/explicit ddt.
static tmp< volScalarField > localRSubDeltaT(const fvMesh &mesh, const label nAlphaSubCycles)
Calculate and return the reciprocal of the local sub-cycling.
const fvMesh & mesh
Region mesh.
const word divAlphaName
Name of the alpha convection scheme.
const surfaceScalarField & phi
Reference to the mass-flux field.
void alphaPredictor()
Solve for the phase-fractions.
virtual tmp< surfaceScalarField > alphaPhi(const surfaceScalarField &phi, const volScalarField &alpha, const dictionary &alphaControls)
Perform a subCycleTime on a field or list of fields.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Calculate the face-flux of the given field.
Calculate the matrix for implicit and explicit sources.
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
void explicitSolve(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su)
void correct(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiCorr, const SpType &Sp, const SuType &Su)
tmp< SurfaceField< typename innerProduct< vector, Type >::type > > flux(const VolField< Type > &vf)
Return the face-flux field obtained from the given volVectorField.
tmp< VolField< Type > > Su(const VolField< Type > &su, const VolField< Type > &vf)
tmp< VolField< Type > > Sp(const volScalarField &sp, const VolField< Type > &vf)
tmp< VolField< Type > > div(const SurfaceField< Type > &ssf)
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
fvMatrix< scalar > fvScalarMatrix
bool isType(const Type &t)
Check the typeid.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const wordHashSet compressionSchemes
VolField< scalar > volScalarField
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.