alphaEqn.H
Go to the documentation of this file.
1 {
2  word alphaScheme("div(phi,alpha)");
3  word alpharScheme("div(phirb,alpha)");
4 
5  if (MULESCorr)
6  {
7  fvScalarMatrix alpha1Eqn
8  (
9  fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
10  + fv::gaussConvectionScheme<scalar>
11  (
12  mesh,
13  phi,
14  upwind<scalar>(mesh, phi)
15  ).fvmDiv(phi, alpha1)
16  );
17 
18  solve(alpha1Eqn);
19 
20  Info<< "Phase-1 volume fraction = "
21  << alpha1.weightedAverage(mesh.Vsc()).value()
22  << " Min(" << alpha1.name() << ") = " << min(alpha1).value()
23  << " Max(" << alpha1.name() << ") = " << max(alpha1).value()
24  << endl;
25 
26  tmp<surfaceScalarField> talphaPhiUD(alpha1Eqn.flux());
27  alphaPhi = talphaPhiUD();
28 
29  if (alphaApplyPrevCorr && talphaPhiCorr0.valid())
30  {
31  Info<< "Applying the previous iteration correction flux" << endl;
32 
34  (
35  alpha1,
36  alphaPhi,
38  mixture.alphaMax(),
39  0
40  );
41 
43  }
44 
45  // Cache the upwind-flux
46  talphaPhiCorr0 = talphaPhiUD;
47  }
48 
49  for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
50  {
51  tmp<surfaceScalarField> talphaPhiUn
52  (
53  fvc::flux
54  (
55  phi,
56  alpha1,
57  alphaScheme
58  )
59  + fvc::flux
60  (
61  phir,
62  alpha1,
64  )
65  );
66 
67  if (MULESCorr)
68  {
69  tmp<surfaceScalarField> talphaPhiCorr(talphaPhiUn() - alphaPhi);
70  volScalarField alpha10("alpha10", alpha1);
71 
73  (
74  alpha1,
75  talphaPhiUn(),
76  talphaPhiCorr(),
77  mixture.alphaMax(),
78  0
79  );
80 
81  // Under-relax the correction for all but the 1st corrector
82  if (aCorr == 0)
83  {
84  alphaPhi += talphaPhiCorr();
85  }
86  else
87  {
88  alpha1 = 0.5*alpha1 + 0.5*alpha10;
89  alphaPhi += 0.5*talphaPhiCorr();
90  }
91  }
92  else
93  {
94  alphaPhi = talphaPhiUn;
95 
97  (
98  alpha1,
99  phi,
100  alphaPhi,
101  mixture.alphaMax(),
102  0
103  );
104  }
105  }
106 
108  {
110  }
111 
112  alpha2 = 1.0 - alpha1;
113 
114  Info<< "Phase-1 volume fraction = "
115  << alpha1.weightedAverage(mesh.Vsc()).value()
116  << " Min(" << alpha1.name() << ") = " << min(alpha1).value()
117  << " Max(" << alpha1.name() << ") = " << max(alpha1).value()
118  << endl;
119 }
Foam::MULES::explicitSolve
void explicitSolve(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su)
Definition: MULESTemplates.C:38
talphaPhiCorr0
tmp< surfaceScalarField > talphaPhiCorr0
Definition: createFields.H:138
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:261
alpharScheme
word alpharScheme("div(phirb,alpha)")
alphaApplyPrevCorr
bool alphaApplyPrevCorr(alphaControls.lookupOrDefault< Switch >("alphaApplyPrevCorr", false))
mixture
Info<< "Reading field p_rgh\n"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field U\n"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Creating phaseChangeTwoPhaseMixture\n"<< endl;autoPtr< phaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:33
solve
rhoEqn solve()
phir
surfaceScalarField phir("phir", phic *interface.nHatf())
Foam::fvScalarMatrix
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
alphaPhi
surfaceScalarField alphaPhi(phi.name()+alpha1.name(), fvc::flux(phi, alpha1, alphaScheme))
Foam::Info
messageStream Info
correct
fvOptions correct(rho)
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
MULESCorr
bool MULESCorr(alphaControls.lookupOrDefault< Switch >("MULESCorr", false))
alpha2
alpha2
Definition: alphaEqn.H:112
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
alpha1
volScalarField & alpha1
Definition: createFields.H:15
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
nAlphaCorr
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")))
alpha10
volScalarField alpha10("alpha10", alpha1)
Foam::fvc::flux
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > flux(const surfaceScalarField &phi, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcFlux.C:45
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)