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();
9  const volScalarField& vDotcAlphal = vDotAlphal[0]();
10  const volScalarField& vDotvAlphal = vDotAlphal[1]();
11  const volScalarField vDotvmcAlphal(vDotvAlphal - vDotcAlphal);
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)
79  - vDotvmcAlphal*alpha10
80  )(),
81  1,
82  0
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  1,
107  0
108  );
109 
110  talphaPhi = talphaPhiCorr;
111  }
112 
113  alpha2 = 1.0 - alpha1;
114  }
115 
117 
118  Info<< "Liquid phase volume fraction = "
119  << alpha1.weightedAverage(mesh.V()).value()
120  << " Min(" << alpha1.name() << ") = " << min(alpha1).value()
121  << " Max(" << alpha1.name() << ") = " << max(alpha1).value()
122  << endl;
123 }
tmp< surfaceScalarField > talphaPhi
Definition: alphaEqn.H:13
surfaceScalarField & phi
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
interfaceProperties interface(alpha1, U, mixture())
word alpharScheme("div(phirb,alpha)")
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
tmp< GeometricField< Type, fvPatchField, volMesh > > Sp(const volScalarField &sp, const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcSup.C:67
const volScalarField & vDotcAlphal
Definition: alphaEqn.H:9
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")))
rho1
Definition: pEqn.H:114
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
dynamicFvMesh & mesh
rhoPhi
Definition: alphaEqn.H:116
void explicitSolve(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su)
rho2
Definition: pEqn.H:115
volScalarField alpha10("alpha10", alpha1)
surfaceScalarField phir("phir", phic *interface.nHatf())
alpha2
Definition: alphaEqn.H:112
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(psi *p+alphal *rhol0+((alphav *psiv+alphal *psil)-psi)*pSat, rhoMin);#1"/home/ubuntu/OpenFOAM-4.1/applications/solvers/multiphase/cavitatingFoam/alphavPsi.H"1{alphav=max(min((rho-rholSat)/(rhovSat-rholSat), scalar(1)), scalar(0));alphal=1.0-alphav;Info<< "max-min alphav: "<< max(alphav).value()<< " "<< min(alphav).value()<< endl;psiModel-> correct()
Definition: pEqn.H:72
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
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
volScalarField & alpha1
const volScalarField vDotvmcAlphal(vDotvAlphal-vDotcAlphal)
messageStream Info
volScalarField divU(fvc::div(fvc::absolute(phi, U)))
surfaceScalarField phic(mixture.cAlpha()*mag(phi/mesh.magSf()))
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
Definition: fvcFlux.C:32
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
bool MULESCorr(alphaControls.lookupOrDefault< Switch >("MULESCorr", false))