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() -= talphaPhi();
66 
67  volScalarField alpha100("alpha100", alpha10);
68  alpha10 = alpha1;
69 
71  (
72  geometricOneField(),
73  alpha1,
74  talphaPhi(),
75  talphaPhiCorr(),
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() += talphaPhiCorr();
89  }
90  else
91  {
92  alpha1 = 0.5*alpha1 + 0.5*alpha10;
93  talphaPhi() += 0.5*talphaPhiCorr();
94  }
95  }
96  else
97  {
99  (
100  geometricOneField(),
101  alpha1,
102  phi,
103  talphaPhiCorr(),
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 }
void explicitSolve(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su)
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > flux(const surfaceScalarField &phi, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcFlux.C:45
volScalarField divU(fvc::div(fvc::absolute(phi, U)))
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/dm2/henry/OpenFOAM/OpenFOAM-3.0.x/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:74
tmp< GeometricField< Type, fvPatchField, volMesh > > Sp(const volScalarField &sp, const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcSup.C:67
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
messageStream Info
dynamicFvMesh & mesh
surfaceScalarField phir("phir", phic *interface.nHatf())
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
surfaceScalarField phic(mixture.cAlpha()*mag(phi/mesh.magSf()))
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")))
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
rho1
Definition: pEqn.H:124
rho2
Definition: pEqn.H:125
volScalarField & alpha1
Definition: createFields.H:15
surfaceScalarField & phi
alpha2
Definition: alphaEqn.H:112
bool MULESCorr(alphaControls.lookupOrDefault< Switch >("MULESCorr", false))
volScalarField alpha10("alpha10", alpha1)
rhoPhi
Definition: alphaEqn.H:116
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
tmp< surfaceScalarField > talphaPhi
Definition: alphaEqn.H:13
word alpharScheme("div(phirb,alpha)")
interfaceProperties interface(alpha1, U, mixture())
const volScalarField vDotvmcAlphal(vDotvAlphal-vDotcAlphal)