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;
28  forAllConstIters(mixture.phases(), phase)
29  {
30  const rhoThermo& thermo = phase().thermo();
31  const tmp<volScalarField> trho(thermo.rho());
32  const volScalarField& rho = trho();
33 
34  p_rghEqnComps.set
35  (
36  phasei,
37  (
40  ).ptr()
41  );
42 
43  ++phasei;
44  }
45 
46  // Cache p_rgh prior to solve for density update
48 
49  while (pimple.correctNonOrthogonal())
50  {
51  fvScalarMatrix p_rghEqnIncomp
52  (
55  );
56 
57  tmp<fvScalarMatrix> p_rghEqnComp;
58 
59  phasei = 0;
60  forAllConstIters(mixture.phases(), phase)
61  {
62  tmp<fvScalarMatrix> hmm
63  (
64  (max(phase(), scalar(0))/phase().thermo().rho())
66  );
67 
68  if (phasei == 0)
69  {
70  p_rghEqnComp = hmm;
71  }
72  else
73  {
74  p_rghEqnComp.ref() += hmm;
75  }
76 
77  ++phasei;
78  }
79 
80  solve
81  (
82  p_rghEqnComp
83  + p_rghEqnIncomp,
84  p_rgh.select(pimple.finalInnerIter())
85  );
86 
87  if (pimple.finalNonOrthogonalIter())
88  {
89  phasei = 0;
90  for (phaseModel& phase : mixture.phases())
91  {
92  phase.dgdt() =
93  pos0(phase)
94  *(p_rghEqnComps[phasei] & p_rgh)/phase.thermo().rho();
95 
96  ++phasei;
97  }
98 
99  phi = phiHbyA + p_rghEqnIncomp.flux();
100 
101  U = HbyA
102  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
103  U.correctBoundaryConditions();
104  }
105  }
106 
107  p = max(p_rgh + mixture.rho()*gh, pMin);
108 
109  // Update densities from change in p_rgh
110  mixture.correctRho(p_rgh - p_rgh_0);
111  rho = mixture.rho();
112 
113  // Correct p_rgh for consistency with p and the updated densities
114  p_rgh = p - rho*gh;
115  p_rgh.correctBoundaryConditions();
116 
117  K = 0.5*magSqr(U);
118 
119  Info<< "max(U) " << max(mag(U)).value() << endl;
120  Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
121 }
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:37
rho
Definition: pEqn.H:1
p
Definition: pEqn.H:50
label phasei
Definition: pEqn.H:27
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
volScalarField rAU(1.0/UEqn.A())
const dimensionedScalar & pMin
phiHbyA
Definition: pEqn.H:20
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
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:165
tmp< GeometricField< Type, faPatchField, areaMesh > > div(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facDiv.C:43
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\"<< endl;autoPtr< temperaturePhaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:39
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
tmp< volScalarField > trho
tmp< GeometricField< Type, faPatchField, areaMesh > > ddt(const dimensioned< Type > dt, const faMesh &mesh)
Definition: facDdt.C:40
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:76
CGAL::Exact_predicates_exact_constructions_kernel K
CEqn solve()
const surfaceScalarField & ghf
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:72
psiReactionThermo & thermo
Definition: createFields.H:28
dynamicFvMesh & mesh
tmp< GeometricField< Type, faPatchField, areaMesh > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Definition: facLaplacian.C:40
tmp< volVectorField > constrainHbyA(const tmp< volVectorField > &tHbyA, const volVectorField &U, const volScalarField &p)
Definition: constrainHbyA.C:28
HbyA
Definition: pEqn.H:4
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:26
p_rgh
Definition: pEqn.H:139
dimensionedScalar pos0(const dimensionedScalar &ds)
pimpleControl & pimple
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
mesh interpolate(rAU)
fvVectorMatrix & UEqn
Definition: UEqn.H:13
const volScalarField & gh
volScalarField p_rgh_0(p_rgh)
messageStream Info
Information stream (stdout output on master, null elsewhere)
constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF)
phi
Definition: pEqn.H:18
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
PtrList< fvScalarMatrix > p_rghEqnComps(mixture.phases().size())
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:40
forAllConstIters(mixture.phases(), phase)
Definition: pEqn.H:28
zeroField Sp
Definition: alphaSuSp.H:2