pEqn.H
Go to the documentation of this file.
1 {
2  volScalarField rAU("rAU", 1.0/UEqn.A());
4 
5  volVectorField HbyA("HbyA", U);
6  HbyA = rAU*UEqn.H();
7 
9  (
10  "phiHbyA",
11  (fvc::interpolate(HbyA) & mesh.Sf())
13  );
14 
16  (
17  (
18  mixture.surfaceTensionForce()
20  )*rAUf*mesh.magSf()
21  );
22 
24 
25  // Update the fixedFluxPressure BCs to ensure flux consistency
27  (
28  p_rgh.boundaryField(),
29  (
30  phiHbyA.boundaryField()
31  - (mesh.Sf().boundaryField() & U.boundaryField())
32  )/(mesh.magSf().boundaryField()*rAUf.boundaryField())
33  );
34 
35  PtrList<fvScalarMatrix> p_rghEqnComps(mixture.phases().size());
36 
39  (
40  PtrDictionary<phaseModel>,
41  mixture.phases(),
42  phase
43  )
44  {
45  const rhoThermo& thermo = phase().thermo();
46  const volScalarField& rho = thermo.rho()();
47 
48  p_rghEqnComps.set
49  (
50  phasei,
51  (
54  ).ptr()
55  );
56 
57  phasei++;
58  }
59 
60  // Cache p_rgh prior to solve for density update
62 
63  while (pimple.correctNonOrthogonal())
64  {
65  fvScalarMatrix p_rghEqnIncomp
66  (
69  );
70 
71  tmp<fvScalarMatrix> p_rghEqnComp;
72 
73  phasei = 0;
75  (
76  PtrDictionary<phaseModel>,
77  mixture.phases(),
78  phase
79  )
80  {
81  tmp<fvScalarMatrix> hmm
82  (
83  (max(phase(), scalar(0))/phase().thermo().rho())
85  );
86 
87  if (phasei == 0)
88  {
89  p_rghEqnComp = hmm;
90  }
91  else
92  {
93  p_rghEqnComp() += hmm;
94  }
95 
96  phasei++;
97  }
98 
99  solve
100  (
101  p_rghEqnComp
102  + p_rghEqnIncomp,
103  mesh.solver(p_rgh.select(pimple.finalInnerIter()))
104  );
105 
106  if (pimple.finalNonOrthogonalIter())
107  {
108  // p = max(p_rgh + mixture.rho()*gh, pMin);
109  // p_rgh = p - mixture.rho()*gh;
110 
111  phasei = 0;
112  forAllIter
113  (
114  PtrDictionary<phaseModel>,
115  mixture.phases(),
116  phase
117  )
118  {
119  phase().dgdt() =
120  pos(phase())
121  *(p_rghEqnComps[phasei] & p_rgh)/phase().thermo().rho();
122  }
123 
124  phi = phiHbyA + p_rghEqnIncomp.flux();
125 
126  U = HbyA
127  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
128  U.correctBoundaryConditions();
129  }
130  }
131 
132  p = max(p_rgh + mixture.rho()*gh, pMin);
133 
134  // Update densities from change in p_rgh
135  mixture.correctRho(p_rgh - p_rgh_0);
136  rho = mixture.rho();
137 
138  K = 0.5*magSqr(U);
139 
140  Info<< "max(U) " << max(mag(U)).value() << endl;
141  Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
142 }
Foam::fvc::reconstruct
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcReconstruct.C:54
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
p_rghEqnComps
PtrList< fvScalarMatrix > p_rghEqnComps(mixture.phases().size())
p
p
Definition: pEqn.H:62
ghf
const surfaceScalarField & ghf
Definition: setRegionFluidFields.H:35
phig
surfaceScalarField phig(-rAUf *ghf *fvc::snGrad(rhok) *mesh.magSf())
pMin
dimensionedScalar pMin("pMin", dimPressure, fluid)
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...
Foam::fvc::div
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
setSnGrad< fixedFluxPressureFvPatchScalarField >
setSnGrad< fixedFluxPressureFvPatchScalarField >(p_rgh.boundaryField(),(phiHbyA.boundaryField() - MRF.relative(mesh.Sf().boundaryField() &U.boundaryField()))/(mesh.magSf().boundaryField() *rAUf.boundaryField()))
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::correction
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix.
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:261
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
phi
phi
Definition: pEqn.H:20
mixture
Info<< "Reading field p_rgh\n"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field U\n"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Creating phaseChangeTwoPhaseMixture\n"<< endl;autoPtr< phaseChangeTwoPhaseMixture > mixture
Definition: createFields.H:33
thermo
rhoThermo & thermo
Definition: setRegionFluidFields.H:3
U
U
Definition: pEqn.H:46
forAllConstIter
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
K
CGAL::Exact_predicates_exact_constructions_kernel K
Definition: CGALTriangulation3DKernel.H:56
Foam::fvc::laplacian
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
solve
rhoEqn solve()
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::fvScalarMatrix
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
Foam::Info
messageStream Info
Foam::fvc::ddtCorr
tmp< GeometricField< typename flux< Type >::type, fvsPatchField, surfaceMesh > > ddtCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const GeometricField< Type, fvsPatchField, surfaceMesh > &Uf)
Definition: fvcDdt.C:155
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
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
gh
const volScalarField & gh
Definition: setRegionFluidFields.H:34
p_rgh_0
volScalarField p_rgh_0(p_rgh)
rho
rho
Definition: pEqn.H:3
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
rAU
volScalarField rAU("rAU", 1.0/UEqn().A())
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
HbyA
HbyA
Definition: pEqn.H:4
phasei
label phasei
Definition: pEqn.H:37
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:52
pimple
const dictionary & pimple
Definition: readFluidMultiRegionPIMPLEControls.H:1
phiHbyA
phiHbyA
Definition: pEqn.H:21
Foam::fvc::ddt
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:45
forAllIter
forAllIter(PtrDictionary< phaseModel >, fluid.phases(), iter)
Definition: pEqn.H:34
Foam::fvc::Sp
tmp< GeometricField< Type, fvPatchField, volMesh > > Sp(const volScalarField &sp, const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcSup.C:67
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
p_rgh
volScalarField & p_rgh
Definition: setRegionFluidFields.H:31
Foam::magSqr
dimensioned< scalar > magSqr(const dimensioned< Type > &)
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:190
rAUf
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))