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 while (simple.correctNonOrthogonal())
28 {
29 fvScalarMatrix p_rghEqn
30 (
31 fvm::laplacian(rhorAUf, p_rgh) == fvc::div(phiHbyA)
32 );
33
34 p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
35
36 p_rghEqn.solve();
37
38 if (simple.finalNonOrthogonalIter())
39 {
40 // Calculate the conservative fluxes
41 phi = phiHbyA - p_rghEqn.flux();
42
43 // Explicitly relax pressure for momentum corrector
44 p_rgh.relax();
45
46 // Correct the momentum source with the pressure gradient flux
47 // calculated from the relaxed pressure
48 U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rhorAUf);
49 U.correctBoundaryConditions();
50 fvOptions.correct(U);
51 }
52 }
53
55
56 #include "continuityErrs.H"
57
58 // For closed-volume cases adjust the pressure level
59 // to obey overall mass continuity
61 {
62 if(!compressible)
63 {
64 p += dimensionedScalar
65 (
66 "p",
67 p.dimensions(),
68 pRefValue - getRefCellValue(p, pRefCell)
69 );
70 }
71 else
72 {
73 p += (initialMass - fvc::domainIntegrate(psi*p))
74 /fvc::domainIntegrate(psi);
75
76 }
77 p_rgh = p - rho*gh;
78 }
79
80 rho = thermo.rho();
81 rho.relax();
82 Info<< "rho min/max : " << min(rho).value() << " " << max(rho).value()
83 << endl;
84}
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))
tmp< fvVectorMatrix > tUEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+MRF.DDt(rho, U)+turbulence->divDevRhoReff(U)==fvOptions(rho, U))
fvVectorMatrix & UEqn
Definition: UEqn.H:13
phiHbyA
Definition: pcEqn.H:73
HbyA
Definition: pcEqn.H:74
bool closedVolume
Definition: pEqn.H:10
dynamicFvMesh & mesh
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 dictionary & simple
dimensionedScalar initialMass
Definition: createFields.H:57