pEqn.H
Go to the documentation of this file.
1{
2 volScalarField rAU("rAU", 1.0/UEqn.A());
3 surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
4 volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
5 //tUEqn.clear();
6
7 surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
8
9 surfaceScalarField phiHbyA
10 (
11 "phiHbyA",
12 fvc::flux(rho*HbyA)
13 );
14
15 MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
16
18
20
21 // Update the pressure BCs to ensure flux consistency
23
24 dimensionedScalar compressibility = fvc::domainIntegrate(psi);
25 bool compressible = (compressibility.value() > SMALL);
26
27 // Solve pressure
28 for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
29 {
30 fvScalarMatrix p_rghEqn
31 (
32 fvm::laplacian(rhorAUf, p_rgh) == fvc::div(phiHbyA)
33 );
34
35 p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
36
37 p_rghEqn.solve();
38
39 if (nonOrth == nNonOrthCorr)
40 {
41 // Calculate the conservative fluxes
42 phi = phiHbyA - p_rghEqn.flux();
43
44 // Explicitly relax pressure for momentum corrector
45 p_rgh.relax();
46
47 // Correct the momentum source with the pressure gradient flux
48 // calculated from the relaxed pressure
49 U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rhorAUf);
50 U.correctBoundaryConditions();
51 fvOptions.correct(U);
52 }
53 }
54
56
57 #include "continuityErrs.H"
58
59 // For closed-volume cases adjust the pressure level
60 // to obey overall mass continuity
62 {
63 if (!compressible)
64 {
65 p += dimensionedScalar
66 (
67 "p",
68 p.dimensions(),
69 pRefValue - getRefCellValue(p, pRefCell)
70 );
71 }
72 else
73 {
74 p += (initialMass - fvc::domainIntegrate(psi*p))
76 }
77 p_rgh = p - rho*gh;
78 }
79
80 rho = thermo.rho();
81 rho = max(rho, rhoMin[i]);
82 rho = min(rho, rhoMax[i]);
83 rho.relax();
84
85 Info<< "Min/max rho:" << min(rho).value() << ' '
86 << max(rho).value() << endl;
87}
Y[inertIndex] max(0.0)
volScalarField & p_rgh
fv::options & fvOptions
surfaceScalarField & phi
const scalar pRefValue
const surfaceScalarField & ghf
const label pRefCell
IOMRFZoneList & MRF
const volScalarField & gh
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
U
Definition: pEqn.H:72
volScalarField & p
const volScalarField & psi
surfaceScalarField phig("phig", -rhorAUf *ghf *fvc::snGrad(rho) *mesh.magSf())
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho *rAU))
fvVectorMatrix & UEqn
Definition: UEqn.H:13
phiHbyA
Definition: pcEqn.H:73
HbyA
Definition: pcEqn.H:74
bool closedVolume
Definition: pEqn.H:10
dynamicFvMesh & mesh
const dimensionedScalar rhoMin
const dimensionedScalar rhoMax
adjustPhi(phiHbyA, U, p_rgh)
dimensionedScalar compressibility
Definition: pEqn.H:1
bool compressible
Definition: pEqn.H:2
tmp< volScalarField > rAU
Definition: initCorrectPhi.H:1
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
const int nNonOrthCorr
dimensionedScalar initialMass
Definition: createFields.H:57