alphaEqn.H
Go to the documentation of this file.
1 {
2  word alphaScheme("div(phi,alpha)");
3  word alpharScheme("div(phirb,alpha)");
4 
5  surfaceScalarField phir("phir", phic*interface.nHatf());
6 
7  Pair<tmp<volScalarField>> vDotAlphal =
8  mixture->vDotAlphal();
12 
13  tmp<surfaceScalarField> talphaPhi;
14 
15  if (MULESCorr)
16  {
17  fvScalarMatrix alpha1Eqn
18  (
19  fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
20  + fv::gaussConvectionScheme<scalar>
21  (
22  mesh,
23  phi,
24  upwind<scalar>(mesh, phi)
25  ).fvmDiv(phi, alpha1)
26  - fvm::Sp(divU, alpha1)
27  ==
29  + vDotcAlphal
30  );
31 
32  alpha1Eqn.solve();
33 
34  Info<< "Phase-1 volume fraction = "
35  << alpha1.weightedAverage(mesh.Vsc()).value()
36  << " Min(" << alpha1.name() << ") = " << min(alpha1).value()
37  << " Max(" << alpha1.name() << ") = " << max(alpha1).value()
38  << endl;
39 
40  talphaPhi = alpha1Eqn.flux();
41  }
42 
43  volScalarField alpha10("alpha10", alpha1);
44 
45  for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
46  {
47  tmp<surfaceScalarField> talphaPhiCorr
48  (
49  fvc::flux
50  (
51  phi,
52  alpha1,
53  alphaScheme
54  )
55  + fvc::flux
56  (
58  alpha1,
60  )
61  );
62 
63  if (MULESCorr)
64  {
65  talphaPhiCorr.ref() -= talphaPhi();
66 
67  volScalarField alpha100("alpha100", alpha10);
68  alpha10 = alpha1;
69 
71  (
72  geometricOneField(),
73  alpha1,
74  talphaPhi(),
75  talphaPhiCorr.ref(),
77  (
78  divU*(alpha10 - alpha100)
80  )(),
81  oneField(),
82  zeroField()
83  );
84 
85  // Under-relax the correction for all but the 1st corrector
86  if (aCorr == 0)
87  {
88  talphaPhi.ref() += talphaPhiCorr();
89  }
90  else
91  {
92  alpha1 = 0.5*alpha1 + 0.5*alpha10;
93  talphaPhi.ref() += 0.5*talphaPhiCorr();
94  }
95  }
96  else
97  {
99  (
100  geometricOneField(),
101  alpha1,
102  phi,
103  talphaPhiCorr.ref(),
105  (divU*alpha1 + vDotcAlphal)(),
106  oneField(),
107  zeroField()
108  );
109 
110  talphaPhi = talphaPhiCorr;
111  }
112 
113  alpha2 = 1.0 - alpha1;
114  }
115 
117 
118  // Cache alphaPhi
120 
121  Info<< "Liquid phase volume fraction = "
122  << alpha1.weightedAverage(mesh.V()).value()
123  << " Min(" << alpha1.name() << ") = " << min(alpha1).value()
124  << " Max(" << alpha1.name() << ") = " << max(alpha1).value()
125  << endl;
126 }
Foam::fvc::flux
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
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:41
vDotAlphal
Pair< tmp< volScalarField > > vDotAlphal
Definition: alphaEqn.H:7
alphaPhi10
alphaPhi10
Definition: alphaEqn.H:7
interface
interfaceProperties interface(alpha1, U, thermo->transportPropertiesDict())
Foam::vtk::Tools::zeroField
vtkSmartPointer< vtkFloatArray > zeroField(const word &name, const label size)
Create named field initialized to zero.
Definition: foamVtkToolsTemplates.C:327
Sp
zeroField Sp
Definition: alphaSuSp.H:2
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
alpha1
const volScalarField & alpha1
Definition: setRegionFluidFields.H:8
alpharScheme
word alpharScheme("div(phirb,alpha)")
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
phic
surfaceScalarField phic(mixture.cAlpha() *mag(alphaPhic/mesh.magSf()))
vDotcAlphal
const volScalarField & vDotcAlphal
Definition: alphaEqn.H:9
nAlphaCorr
label nAlphaCorr(alphaControls.get< label >("nAlphaCorr"))
Foam::fvScalarMatrix
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:44
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
vDotvAlphal
const volScalarField & vDotvAlphal
Definition: alphaEqn.H:10
MULESCorr
bool MULESCorr(alphaControls.getOrDefault("MULESCorr", false))
alpha2
alpha2
Definition: alphaEqn.H:9
divU
zeroField divU
Definition: alphaSuSp.H:3
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
rho2
volScalarField & rho2
Definition: setRegionFluidFields.H:30
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
rho1
volScalarField & rho1
Definition: setRegionFluidFields.H:27
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
phir
surfaceScalarField phir(IOobject("phir", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mixture.cAlpha() *mag(phi/mesh.magSf()) *mixture.nHatf())
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
talphaPhi
tmp< surfaceScalarField > talphaPhi
Definition: alphaEqn.H:13
alpha10
volScalarField alpha10("alpha10", alpha1)
mixture
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n"<< endl;autoPtr< temperaturePhaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:39
correct
mixture correct()
vDotvmcAlphal
const volScalarField vDotvmcAlphal(vDotvAlphal - vDotcAlphal)
rhoPhi
rhoPhi
Definition: alphaEqn.H:6