pEqn.H
Go to the documentation of this file.
1bool closedVolume = p_rgh.needReference();
2dimensionedScalar compressibility = fvc::domainIntegrate(psi);
3bool compressible = (compressibility.value() > SMALL);
4
5rho = thermo.rho();
6
7// Thermodynamic density needs to be updated by psi*d(p) after the
8// pressure solution
9const volScalarField psip0(psi*p);
10
11volScalarField rAU("rAU", 1.0/UEqn.A());
12surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
13volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
14
15surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
16
17surfaceScalarField phiHbyA
18(
19 "phiHbyA",
20 (
21 fvc::flux(rho*HbyA)
22 + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
23 )
24 + phig
25);
26
27MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
28
29// Update the pressure BCs to ensure flux consistency
31
32{
33 fvScalarMatrix p_rghDDtEqn
34 (
35 fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
36 + fvc::div(phiHbyA)
37 );
38
39 for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
40 {
41 fvScalarMatrix p_rghEqn
42 (
44 - fvm::laplacian(rhorAUf, p_rgh)
45 );
46
47 p_rghEqn.setReference
48 (
50 compressible ? getRefCellValue(p_rgh, pRefCell) : pRefValue
51 );
52
53 p_rghEqn.solve
54 (
55 mesh.solver
56 (
57 p_rgh.select
58 (
59 (
60 oCorr == nOuterCorr-1
61 && corr == nCorr-1
62 && nonOrth == nNonOrthCorr
63 )
64 )
65 )
66 );
67
68 if (nonOrth == nNonOrthCorr)
69 {
70 phi = phiHbyA + p_rghEqn.flux();
71
72 p_rgh.relax();
73
74 U = HbyA
75 + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf);
76 U.correctBoundaryConditions();
77 fvOptions.correct(U);
78 K = 0.5*magSqr(U);
79 }
80 }
81
83
84}
85
87
88// For closed-volume cases adjust the pressure and density levels
89// to obey overall mass continuity
91{
92 if (!compressible)
93 {
94 p += dimensionedScalar
95 (
96 "p",
97 p.dimensions(),
98 pRefValue - getRefCellValue(p, pRefCell)
99 );
100 }
101 else
102 {
103 p += (initialMass - fvc::domainIntegrate(psi*p))
105 thermo.correctRho(psi*p - psip0, rhoMin, rhoMax);
106 rho = thermo.rho();
107 p_rgh = p - rho*gh;
108 p_rgh.correctBoundaryConditions();
109 }
110}
111else
112{
113 thermo.correctRho(psi*p - psip0, rhoMin, rhoMax);
114}
115
116#include "rhoEqn.H"
118
119rho = thermo.rho();
120
121// Update pressure time derivative if needed
122if (thermo.dpdt())
123{
124 dpdt = fvc::ddt(p);
125}
CGAL::Exact_predicates_exact_constructions_kernel K
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
const volScalarField psip0(psi *p)
fvScalarMatrix p_rghDDtEqn(fvc::ddt(rho)+psi *correction(fvm::ddt(p_rgh))+fvc::div(phiHbyA)==fvOptions(psi, p_rgh, rho.name()))
bool closedVolume
Definition: pEqn.H:10
dynamicFvMesh & mesh
const dimensionedScalar rhoMin
const dimensionedScalar rhoMax
volScalarField & dpdt
const pressureControl & pressureControl
dimensionedScalar compressibility
Definition: pEqn.H:1
bool compressible
Definition: pEqn.H:2
tmp< volScalarField > rAU
Definition: initCorrectPhi.H:1
const int nNonOrthCorr
const int nOuterCorr
dimensionedScalar initialMass
Definition: createFields.H:57