pcEqn.H
Go to the documentation of this file.
1 volScalarField rAU(1.0/UEqn().A());
2 volScalarField rAtU(1.0/(1.0/rAU - UEqn().H1()));
3 
4 volVectorField HbyA("HbyA", U);
5 HbyA = rAU*UEqn().H();
6 
7 UEqn.clear();
8 
9 bool closedVolume = false;
10 
11 if (simple.transonic())
12 {
14  (
15  "phid",
17  *(fvc::interpolate(HbyA) & mesh.Sf())
18  );
19 
20  MRF.makeRelative(fvc::interpolate(psi), phid);
21 
23  (
24  "phic",
26  );
27 
28  HbyA -= (rAU - rAtU)*fvc::grad(p);
29 
30  volScalarField rhorAtU("rhorAtU", rho*rAtU);
31 
32  while (simple.correctNonOrthogonal())
33  {
34  fvScalarMatrix pEqn
35  (
36  fvm::div(phid, p)
37  + fvc::div(phic)
39  ==
40  fvOptions(psi, p, rho.name())
41  );
42 
43  // Relax the pressure equation to maintain diagonal dominance
44  pEqn.relax();
45 
46  pEqn.setReference(pRefCell, pRefValue);
47 
48  pEqn.solve();
49 
50  if (simple.finalNonOrthogonalIter())
51  {
52  phi == phic + pEqn.flux();
53  }
54  }
55 }
56 else
57 {
59  (
60  "phiHbyA",
62  );
63 
64  MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
65 
67 
69  HbyA -= (rAU - rAtU)*fvc::grad(p);
70 
71  volScalarField rhorAtU("rhorAtU", rho*rAtU);
72 
73  while (simple.correctNonOrthogonal())
74  {
75  fvScalarMatrix pEqn
76  (
79  ==
80  fvOptions(psi, p, rho.name())
81  );
82 
83  pEqn.setReference(pRefCell, pRefValue);
84 
85  pEqn.solve();
86 
87  if (simple.finalNonOrthogonalIter())
88  {
89  phi = phiHbyA + pEqn.flux();
90  }
91  }
92 }
93 
94 // The incompressibe form of the continuity error check is appropriate for
95 // steady-state compressible also.
97 
98 // Explicitly relax pressure for momentum corrector
99 p.relax();
100 
102 U.correctBoundaryConditions();
103 fvOptions.correct(U);
104 
105 // For closed-volume cases adjust the pressure and density levels
106 // to obey overall mass continuity
108 {
111 }
112 
113 // Recalculate density from the relaxed pressure
114 rho = thermo.rho();
115 rho = max(rho, rhoMin);
116 rho = min(rho, rhoMax);
117 
118 if (!simple.transonic())
119 {
120  rho.relax();
121 }
122 
123 Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;
pRefCell
const label pRefCell
Definition: setRegionFluidFields.H:27
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
Foam::adjustPhi
bool adjustPhi(surfaceScalarField &phi, const volVectorField &U, volScalarField &p)
Adjust the balance of fluxes to obey continuity.
Definition: adjustPhi.C:34
Foam::fvc::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:52
p
p
Definition: pEqn.H:62
phid
surfaceScalarField phid("phid", fvc::interpolate(psi) *((mesh.Sf() &fvc::interpolate(HbyA))+rhorAUf *fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)))
Foam::fvc::domainIntegrate
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcVolumeIntegrate.C:86
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::MULES::interpolate
tmp< surfaceScalarField > interpolate(const RhoType &rho)
Definition: IMULESTemplates.C:40
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
rAU
volScalarField rAU(1.0/UEqn().A())
Foam::fvc::div
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
HbyA
HbyA
Definition: pcEqn.H:9
continuityErrs.H
Calculates and prints the continuity errors.
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:261
A
simpleMatrix< scalar > A(Nc)
simple
Simple relative velocity model.
closedVolume
bool closedVolume
Definition: pcEqn.H:9
Foam::fvc::laplacian
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
rhoMin
PtrList< dimensionedScalar > rhoMin(fluidRegions.size())
phiHbyA
phiHbyA
Definition: pcEqn.H:74
Foam::fvScalarMatrix
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
Foam::Info
messageStream Info
rho
rho
Definition: pcEqn.H:1
UEqn
tmp< fvVectorMatrix > UEqn(fvm::div(phi, U)+MRF.DDt(U)+turbulence->divDevReff(U)==fvOptions(U))
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
U
U
Definition: pcEqn.H:105
MRF
IOMRFZoneList & MRF
Definition: setRegionFluidFields.H:15
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
phic
phic
Definition: alphaEqnsSubCycle.H:5
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
psi
const volScalarField & psi
Definition: setRegionFluidFields.H:13
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:52
rhorAtU
volScalarField rhorAtU("rhorAtU", rho *rAtU)
initialMass
dimensionedScalar initialMass
Definition: createFields.H:83
rhoMax
PtrList< dimensionedScalar > rhoMax(fluidRegions.size())
rAtU
volScalarField rAtU(1.0/(1.0/rAU - UEqn().H1()))
pRefValue
const scalar pRefValue
Definition: setRegionFluidFields.H:28
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
fvOptions
fv::options & fvOptions
Definition: setRegionFluidFields.H:16