pEqn.H
Go to the documentation of this file.
1 {
2  volScalarField rAU("rAU", 1.0/UEqn.A());
4 
5  volVectorField HbyA("HbyA", U);
6  HbyA = rAU*UEqn.H();
7 
9  (
10  "phiHbyA",
11  (fvc::interpolate(HbyA) & mesh.Sf())
13  );
14 
16  (
17  (
18  mixture.surfaceTensionForce()
20  )*rAUf*mesh.magSf()
21  );
22 
24 
25  // Update the fixedFluxPressure BCs to ensure flux consistency
27  (
28  p_rgh.boundaryField(),
29  (
30  phiHbyA.boundaryField()
31  - (mesh.Sf().boundaryField() & U.boundaryField())
32  )/(mesh.magSf().boundaryField()*rAUf.boundaryField())
33  );
34 
35  PtrList<fvScalarMatrix> p_rghEqnComps(mixture.phases().size());
36 
37  label phasei = 0;
39  (
40  PtrDictionary<phaseModel>,
41  mixture.phases(),
42  phase
43  )
44  {
45  const rhoThermo& thermo = phase().thermo();
46  const volScalarField& rho = thermo.rho()();
47 
48  p_rghEqnComps.set
49  (
50  phasei,
51  (
52  fvc::ddt(rho) + thermo.psi()*correction(fvm::ddt(p_rgh))
53  + fvc::div(phi, rho) - fvc::Sp(fvc::div(phi), rho)
54  ).ptr()
55  );
56 
57  phasei++;
58  }
59 
60  // Cache p_rgh prior to solve for density update
62 
63  while (pimple.correctNonOrthogonal())
64  {
65  fvScalarMatrix p_rghEqnIncomp
66  (
69  );
70 
71  tmp<fvScalarMatrix> p_rghEqnComp;
72 
73  phasei = 0;
75  (
76  PtrDictionary<phaseModel>,
77  mixture.phases(),
78  phase
79  )
80  {
81  tmp<fvScalarMatrix> hmm
82  (
83  (max(phase(), scalar(0))/phase().thermo().rho())
84  *p_rghEqnComps[phasei]
85  );
86 
87  if (phasei == 0)
88  {
89  p_rghEqnComp = hmm;
90  }
91  else
92  {
93  p_rghEqnComp() += hmm;
94  }
95 
96  phasei++;
97  }
98 
99  solve
100  (
101  p_rghEqnComp
102  + p_rghEqnIncomp,
103  mesh.solver(p_rgh.select(pimple.finalInnerIter()))
104  );
105 
106  if (pimple.finalNonOrthogonalIter())
107  {
108  // p = max(p_rgh + mixture.rho()*gh, pMin);
109  // p_rgh = p - mixture.rho()*gh;
110 
111  phasei = 0;
112  forAllIter
113  (
114  PtrDictionary<phaseModel>,
115  mixture.phases(),
116  phase
117  )
118  {
119  phase().dgdt() =
120  pos(phase())
121  *(p_rghEqnComps[phasei] & p_rgh)/phase().thermo().rho();
122  }
123 
124  phi = phiHbyA + p_rghEqnIncomp.flux();
125 
126  U = HbyA
127  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
128  U.correctBoundaryConditions();
129  }
130  }
131 
132  p = max(p_rgh + mixture.rho()*gh, pMin);
133 
134  // Update densities from change in p_rgh
135  mixture.correctRho(p_rgh - p_rgh_0);
136  rho = mixture.rho();
137 
138  K = 0.5*magSqr(U);
139 
140  Info<< "max(U) " << max(mag(U)).value() << endl;
141  Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
142 }
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
phi
Definition: pEqn.H:20
dimensioned< scalar > mag(const dimensioned< Type > &)
label phasei
Definition: pEqn.H:37
CGAL::Exact_predicates_exact_constructions_kernel K
setSnGrad< fixedFluxPressureFvPatchScalarField >(p_rgh.boundaryField(),( phiHbyA.boundaryField() -MRF.relative(mesh.Sf().boundaryField()&U.boundaryField()) *rho.boundaryField() )/(mesh.magSf().boundaryField()*rhorAUf.boundaryField()))
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))
dimensioned< scalar > magSqr(const dimensioned< Type > &)
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
PtrList< fvScalarMatrix > p_rghEqnComps(mixture.phases().size())
tmp< GeometricField< typename flux< Type >::type, fvsPatchField, surfaceMesh > > ddtCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const GeometricField< Type, fvsPatchField, surfaceMesh > &Uf)
Definition: fvcDdt.C:155
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
tmp< GeometricField< Type, fvPatchField, volMesh > > Sp(const volScalarField &sp, const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcSup.C:67
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
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
volScalarField & p_rgh
messageStream Info
tmp< surfaceScalarField > interpolate(const RhoType &rho)
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:45
dynamicFvMesh & mesh
surfaceScalarField phig(-rhorAUf *ghf *fvc::snGrad(rho)*mesh.magSf())
const dictionary & pimple
p
Definition: pEqn.H:59
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
rhoEqn solve()
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
fvVectorMatrix UEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+turbulence->divDevRhoReff(U)==fvOptions(rho, U))
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
forAllIter(PtrDictionary< phaseModel >, fluid.phases(), iter)
Definition: pEqn.H:34
volScalarField p_rgh_0(p_rgh)
phiHbyA
Definition: pEqn.H:21
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
volScalarField rAU(1.0/UEqn.A())
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
dimensionedScalar pos(const dimensionedScalar &ds)
rho
Definition: pEqn.H:1
psiReactionThermo & thermo
Definition: createFields.H:32
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedScalar pMin("pMin", dimPressure, fluid)
U
Definition: pEqn.H:82
const surfaceScalarField & ghf
HbyA
Definition: pEqn.H:7
const volScalarField & gh