Loading...
Searching...
No Matches
pEqn.H
1
2if (!pimple.SIMPLErho())
3{
4 rho = thermo.rho();
5}
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(1.0 / UEqn.A());
12surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
13volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
14
15if (pimple.nCorrPISO() <= 1)
16{
17 tUEqn.clear();
18}
19
20surfaceScalarField phiHbyA
21(
22 "phiHbyA",
23 fvc::interpolate(rho)*fvc::flux(HbyA)
24 + MRF.zeroFilter(rhorAUf * fvc::ddtCorr(rho, U, phi, rhoUf))
25);
26
27fvc::makeRelative(phiHbyA, rho, U);
28MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
29
30// Update the pressure BCs to ensure flux consistency
31constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF);
32
33if (pimple.transonic())
34{
35 surfaceScalarField phid
36 (
37 "phid",
38 (fvc::interpolate(psi) / fvc::interpolate(rho))*phiHbyA
39 );
40 phiHbyA -= fvc::interpolate(psi * p) * phiHbyA / fvc::interpolate(rho);
41 fvScalarMatrix pDDtEqn
42 (
43 fvc::ddt(rho)
44 + psi * correction(fvm::ddt(p))
45 + fvc::div(phiHbyA)
46 + fvm::div(phid, p)
47 ==
48 fvOptions(psi, p, rho.name())
49 );
50
51 while (pimple.correctNonOrthogonal())
52 {
53 fvScalarMatrix pEqn
54 (
55 pDDtEqn
56 - fvm::laplacian(rhorAUf, p)
57 );
58 // Relax the pressure equation to ensure diagonal-dominance
59 pEqn.relax();
60 pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
61
62 if (pimple.finalNonOrthogonalIter())
63 {
64 phi = phiHbyA + pEqn.flux();
65 }
66 }
67}
68else
69{
70 fvScalarMatrix pDDtEqn
71 (
72 fvc::ddt(rho) + psi * correction(fvm::ddt(p))
73 + fvc::div(phiHbyA)
74 ==
75 fvOptions(psi, p, rho.name())
76 );
77
78 while (pimple.correctNonOrthogonal())
79 {
80 fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAUf, p));
81 pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
82
83 if (pimple.finalNonOrthogonalIter())
84 {
85 phi = phiHbyA + pEqn.flux();
86 }
87 }
88}
89
90
91// Explicitly relax pressure for momentum corrector
92p.relax();
93
94U = HbyA - rAU * fvc::grad(p);
95U.correctBoundaryConditions();
96fvOptions.correct(U);
97K = 0.5 * magSqr(U);
98
99if (pressureControl.limit(p))
100{
101 p.correctBoundaryConditions();
102}
103
104thermo.correctRho(psi * p - psip0, rhoMin, rhoMax) ;
105
106#include "rhoEqn.H"
107#include "compressibleContinuityErrs.H"
108
109rho = thermo.rho();
110
111// Correct rhoUf if the mesh is moving
112fvc::correctRhoUf(rhoUf, rho, U, phi);
113
114if (thermo.dpdt())
115{
116 dpdt = fvc::ddt(p);
117
118 if (mesh.moving())
119 {
120 dpdt -= fvc::div(fvc::meshPhi(rho, U), p);
121 }
122}