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  - (fvModels.source(phase(), rho)&rho)
45  ).ptr()
46  );
47 
48  phasei++;
49  }
50 
51  // Cache p_rgh prior to solve for density update
53 
54  while (pimple.correctNonOrthogonal())
55  {
56  fvScalarMatrix p_rghEqnIncomp
57  (
60  );
61 
62  tmp<fvScalarMatrix> p_rghEqnComp;
63 
64  phasei = 0;
66  (
67  PtrDictionary<phaseModel>,
68  mixture.phases(),
69  phase
70  )
71  {
72  tmp<fvScalarMatrix> p_rghEqnCompi
73  (
74  (max(phase(), scalar(0))/phase().thermo().rho())
75  *p_rghEqnComps[phasei]
76  );
77 
78  if (phasei == 0)
79  {
80  p_rghEqnComp = p_rghEqnCompi;
81  }
82  else
83  {
84  p_rghEqnComp.ref() += p_rghEqnCompi;
85  }
86 
87  phasei++;
88  }
89 
90  solve(p_rghEqnComp + p_rghEqnIncomp);
91 
92  if (pimple.finalNonOrthogonalIter())
93  {
94  p = max(p_rgh + mixture.rho()*gh, pMin);
95  p_rgh = p - rho*gh;
96 
97  phasei = 0;
99  (
100  PtrDictionary<phaseModel>,
101  mixture.phases(),
102  phase
103  )
104  {
105  phase().dgdt() =
106  pos0(phase())
107  *(p_rghEqnComps[phasei] & p_rgh)/phase().thermo().rho();
108 
109  phasei++;
110  }
111 
112  phi = phiHbyA + p_rghEqnIncomp.flux();
113 
114  U = HbyA
115  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
116  U.correctBoundaryConditions();
118  }
119  }
120 
121  // Update densities from change in p_rgh
122  mixture.correctRho(p_rgh - p_rgh_0);
123  mixture.correct();
124 
125  // Correct p_rgh for consistency with p and the updated densities
126  p_rgh = p - rho*gh;
127  p_rgh.correctBoundaryConditions();
128 
129  K = 0.5*magSqr(U);
130 
131  Info<< "max(U) " << max(mag(U)).value() << endl;
132  Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
133 }
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
rAU
Definition: pEqn.H:1
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
fluidReactionThermo & thermo
Definition: createFields.H:28
pimpleNoLoopControl & pimple
label phasei
Definition: pEqn.H:27
p_rgh
Definition: pEqn.H:160
U
Definition: pEqn.H:72
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:459
dimensionedScalar pMin("pMin", dimPressure, mixture)
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:251
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:59
fvMesh & mesh
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
p
Definition: pEqn.H:125
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:58
phiHbyA
Definition: pEqn.H:30
Foam::fvConstraints & fvConstraints
volScalarField p_rgh_0(p_rgh)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
tmp< volVectorField > constrainHbyA(const tmp< volVectorField > &tHbyA, const volVectorField &U, const volScalarField &p)
Definition: constrainHbyA.C:34
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:29
dimensioned< scalar > magSqr(const dimensioned< Type > &)
dimensionedScalar pos0(const dimensionedScalar &ds)
const surfaceScalarField & ghf
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.
const tmp< volScalarField::Internal > & Sp
Definition: alphaSuSp.H:7
bool constrain(fvMatrix< Type > &eqn) const
Apply constraints to an equation.
Foam::fvModels & fvModels
phi
Definition: pEqn.H:98
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
rhoEqn solve()
volVectorField & HbyA
Definition: pEqn.H:13
const surfaceScalarField phig(-rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
const volScalarField & gh
messageStream Info
dimensioned< scalar > mag(const dimensioned< Type > &)
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))
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
constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF)
rho
Definition: pEqn.H:1
fvVectorMatrix & UEqn
Definition: UEqn.H:13