pEqn.H
Go to the documentation of this file.
1 {
2  rho = thermo.rho();
3  rho = max(rho, rhoMin[i]);
4  rho = min(rho, rhoMax[i]);
5  rho.relax();
6 
7  volScalarField rAU("rAU", 1.0/UEqn.A());
10  tUEqn.clear();
11 
13 
15  (
16  "phiHbyA",
18  );
19 
20  MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
21 
22  bool closedVolume = adjustPhi(phiHbyA, U, p_rgh);
23 
25 
26  // Update the pressure BCs to ensure flux consistency
28 
30  bool compressible = (compressibility.value() > SMALL);
31 
32  // Solve pressure
33  for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
34  {
35  fvScalarMatrix p_rghEqn
36  (
38  );
39 
40  p_rghEqn.setReference
41  (
42  pRefCell,
43  compressible ? getRefCellValue(p_rgh, pRefCell) : pRefValue
44  );
45 
46  p_rghEqn.solve();
47 
48  if (nonOrth == nNonOrthCorr)
49  {
50  // Calculate the conservative fluxes
51  phi = phiHbyA - p_rghEqn.flux();
52 
53  // Explicitly relax pressure for momentum corrector
54  p_rgh.relax();
55 
56  // Correct the momentum source with the pressure gradient flux
57  // calculated from the relaxed pressure
58  U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rhorAUf);
59  U.correctBoundaryConditions();
60  fvOptions.correct(U);
61  }
62  }
63 
64  p = p_rgh + rho*gh;
65 
66  #include "continuityErrs.H"
67 
68  // For closed-volume cases adjust the pressure level
69  // to obey overall mass continuity
70  if (closedVolume && compressible)
71  {
74  p_rgh = p - rho*gh;
75  }
76 
77  rho = thermo.rho();
78  rho = max(rho, rhoMin[i]);
79  rho = min(rho, rhoMax[i]);
80  rho.relax();
81 
82  Info<< "Min/max rho:" << min(rho).value() << ' '
83  << max(rho).value() << endl;
84 }
PtrList< dimensionedScalar > rhoMax(fluidRegions.size())
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
U
Definition: pEqn.H:83
dimensionedScalar initialMass
Definition: createFields.H:82
p
Definition: pEqn.H:50
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
PtrList< dimensionedScalar > rhoMin(fluidRegions.size())
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
dimensionedScalar compressibility
Definition: pEqn.H:29
tmp< fvVectorMatrix > tUEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+MRF.DDt(rho, U)+turbulence->divDevRhoReff(U)==fvOptions(rho, U))
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
tmp< surfaceScalarField > interpolate(const RhoType &rho)
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
scalar getRefCellValue(const volScalarField &field, const label refCelli)
Return the current value of field in the reference cell.
Definition: findRefCell.C:130
const int nNonOrthCorr
fv::options & fvOptions
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho *rAU))
const surfaceScalarField & ghf
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
psiReactionThermo & thermo
Definition: createFields.H:31
dynamicFvMesh & mesh
IOMRFZoneList & MRF
surfaceScalarField phig("phig",-rhorAUf *ghf *fvc::snGrad(rho)*mesh.magSf())
tmp< volVectorField > constrainHbyA(const tmp< volVectorField > &tHbyA, const volVectorField &U, const volScalarField &p)
Definition: constrainHbyA.C:33
p_rgh
Definition: pEqn.H:120
constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF)
adjustPhi(phiHbyA, U, p_rgh)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const scalar pRefValue
const label pRefCell
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
volVectorField & HbyA
Definition: pEqn.H:13
fvVectorMatrix & UEqn
Definition: UEqn.H:13
const volScalarField & gh
messageStream Info
phi
Definition: pEqn.H:18
const volScalarField & psi
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
rho
Definition: pEqn.H:1
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
volScalarField rAU(1.0/UEqn.A())