pEqn.H
Go to the documentation of this file.
1 {
2  volScalarField rAU("rAU", 1.0/UEqn.A());
6  (
7  "phiHbyA",
10  );
11 
13  (
14  (
15  mixture.surfaceTensionForce()
17  )*rAUf*mesh.magSf()
18  );
19 
21 
22  // Update the pressure BCs to ensure flux consistency
24 
25  PtrList<fvScalarMatrix> p_rghEqnComps(mixture.phases().size());
26 
27  label phasei = 0;
29  (
30  PtrDictionary<phaseModel>,
31  mixture.phases(),
32  phase
33  )
34  {
35  const rhoThermo& thermo = phase().thermo();
36  const volScalarField& rho = thermo.rho()();
37 
38  p_rghEqnComps.set
39  (
40  phasei,
41  (
42  fvc::ddt(rho) + thermo.psi()*correction(fvm::ddt(p_rgh))
43  + fvc::div(phi, rho) - fvc::Sp(fvc::div(phi), rho)
44  ).ptr()
45  );
46 
47  phasei++;
48  }
49 
50  // Cache p_rgh prior to solve for density update
52 
53  while (pimple.correctNonOrthogonal())
54  {
55  fvScalarMatrix p_rghEqnIncomp
56  (
59  );
60 
61  tmp<fvScalarMatrix> p_rghEqnComp;
62 
63  phasei = 0;
65  (
66  PtrDictionary<phaseModel>,
67  mixture.phases(),
68  phase
69  )
70  {
71  tmp<fvScalarMatrix> hmm
72  (
73  (max(phase(), scalar(0))/phase().thermo().rho())
74  *p_rghEqnComps[phasei]
75  );
76 
77  if (phasei == 0)
78  {
79  p_rghEqnComp = hmm;
80  }
81  else
82  {
83  p_rghEqnComp.ref() += hmm;
84  }
85 
86  phasei++;
87  }
88 
89  solve
90  (
91  p_rghEqnComp
92  + p_rghEqnIncomp,
93  mesh.solver(p_rgh.select(pimple.finalInnerIter()))
94  );
95 
96  if (pimple.finalNonOrthogonalIter())
97  {
98  phasei = 0;
100  (
101  PtrDictionary<phaseModel>,
102  mixture.phases(),
103  phase
104  )
105  {
106  phase().dgdt() =
107  pos0(phase())
108  *(p_rghEqnComps[phasei] & p_rgh)/phase().thermo().rho();
109 
110  phasei++;
111  }
112 
113  phi = phiHbyA + p_rghEqnIncomp.flux();
114 
115  U = HbyA
116  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
117  U.correctBoundaryConditions();
118  }
119  }
120 
121  p = max(p_rgh + mixture.rho()*gh, pMin);
122 
123  // Update densities from change in p_rgh
124  mixture.correctRho(p_rgh - p_rgh_0);
125  rho = mixture.rho();
126 
127  // Correct p_rgh for consistency with p and the updated densities
128  p_rgh = p - rho*gh;
129  p_rgh.correctBoundaryConditions();
130 
131  K = 0.5*magSqr(U);
132 
133  Info<< "max(U) " << max(mag(U)).value() << endl;
134  Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
135 }
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
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
rho
Definition: pEqn.H:1
pimpleNoLoopControl & pimple
p
Definition: pEqn.H:50
label phasei
Definition: pEqn.H:27
volScalarField rAU(1.0/UEqn.A())
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
phiHbyA
Definition: pEqn.H:20
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
surfaceScalarField phig("phig", -rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
tmp< GeometricField< typename flux< Type >::type, fvsPatchField, surfaceMesh > > ddtCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const GeometricField< Type, fvsPatchField, surfaceMesh > &Uf)
Definition: fvcDdt.C:170
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
rhoReactionThermo & thermo
Definition: createFields.H:28
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
CGAL::Exact_predicates_exact_constructions_kernel K
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:45
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
dynamicFvMesh & mesh
rhoEqn solve()
tmp< volVectorField > constrainHbyA(const tmp< volVectorField > &tHbyA, const volVectorField &U, const volScalarField &p)
Definition: constrainHbyA.C:33
forAllIter(PtrDictionary< phaseModel >, fluid.phases(), iter)
Definition: pEqn.H:34
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:29
p_rgh
Definition: pEqn.H:152
dimensioned< scalar > magSqr(const dimensioned< Type > &)
dimensionedScalar pos0(const dimensionedScalar &ds)
const surfaceScalarField & ghf
Info<< "Reading field p_rgh\"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Creating phaseChangeTwoPhaseMixture\"<< endl;autoPtr< phaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:33
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedScalar pMin("pMin", dimPressure, fluid)
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
U
Definition: pEqn.H:72
volVectorField & HbyA
Definition: pEqn.H:13
fvVectorMatrix & UEqn
Definition: UEqn.H:13
volScalarField p_rgh_0(p_rgh)
const volScalarField & gh
messageStream Info
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)
dimensioned< scalar > mag(const dimensioned< Type > &)
phi
Definition: pEqn.H:18
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
PtrList< fvScalarMatrix > p_rghEqnComps(mixture.phases().size())
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
zeroField Sp
Definition: alphaSuSp.H:2