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  interface.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  // Make the fluxes relative to the mesh motion
37 
38  tmp<fvScalarMatrix> p_rghEqnComp1;
39  tmp<fvScalarMatrix> p_rghEqnComp2;
40 
41  if (pimple.transonic())
42  {
45 
48  + correction
49  (
51  + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
52  );
53  deleteDemandDrivenData(p_rghEqnComp1().faceFluxCorrectionPtr());
54  p_rghEqnComp1().relax();
55 
58  + correction
59  (
61  + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
62  );
63  deleteDemandDrivenData(p_rghEqnComp2().faceFluxCorrectionPtr());
64  p_rghEqnComp2().relax();
65  }
66  else
67  {
71 
75  }
76 
77  // Cache p_rgh prior to solve for density update
79 
80  while (pimple.correctNonOrthogonal())
81  {
82  fvScalarMatrix p_rghEqnIncomp
83  (
86  );
87 
88  solve
89  (
90  (
91  (max(alpha1, scalar(0))/rho1)*p_rghEqnComp1()
92  + (max(alpha2, scalar(0))/rho2)*p_rghEqnComp2()
93  )
94  + p_rghEqnIncomp,
95  mesh.solver(p_rgh.select(pimple.finalInnerIter()))
96  );
97 
98  if (pimple.finalNonOrthogonalIter())
99  {
100  p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
101  p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
102 
103  dgdt =
104  (
107  );
108 
109  phi = phiHbyA + p_rghEqnIncomp.flux();
110 
111  U = HbyA
112  + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
113  U.correctBoundaryConditions();
114  }
115  }
116 
117  {
118  Uf = fvc::interpolate(U);
119  surfaceVectorField n(mesh.Sf()/mesh.magSf());
120  Uf += n*(fvc::absolute(phi, U)/mesh.magSf() - (n & Uf));
121  }
122 
123  // Update densities from change in p_rgh
126 
128 
129  K = 0.5*magSqr(U);
130 
131  Info<< "max(U) " << max(mag(U)).value() << endl;
132  Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
133 }
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_rghEqnComp1
tmp< fvScalarMatrix > p_rghEqnComp1
Definition: pEqn.H:38
p
p
Definition: pEqn.H:62
ghf
const surfaceScalarField & ghf
Definition: setRegionFluidFields.H:35
phig
surfaceScalarField phig(-rAUf *ghf *fvc::snGrad(rhok) *mesh.magSf())
psi1
psi1
Definition: TEqns.H:34
pMin
dimensionedScalar pMin("pMin", dimPressure, fluid)
Foam::MULES::interpolate
tmp< surfaceScalarField > interpolate(const RhoType &rho)
Definition: IMULESTemplates.C:40
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
U
U
Definition: pEqn.H:46
K
CGAL::Exact_predicates_exact_constructions_kernel K
Definition: CGALTriangulation3DKernel.H:56
interface
interfaceProperties interface(alpha1, U, mixture())
Foam::fvc::laplacian
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:40
solve
rhoEqn solve()
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
psi2
psi2
Definition: TEqns.H:35
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
rho2
rho2
Definition: pEqn.H:125
n
surfaceVectorField n(mesh.Sf()/mesh.magSf())
alpha2
alpha2
Definition: alphaEqn.H:112
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
gh
const volScalarField & gh
Definition: setRegionFluidFields.H:34
rho1
rho1
Definition: pEqn.H:124
p_rgh_0
volScalarField p_rgh_0(p_rgh)
alpha1
volScalarField & alpha1
Definition: createFields.H:15
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
makeRelative
MRF makeRelative(phiHbyA)
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
Foam::fvc::Sp
tmp< GeometricField< Type, fvPatchField, volMesh > > Sp(const volScalarField &sp, const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcSup.C:67
Foam::surfaceVectorField
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
Definition: surfaceFieldsFwd.H:55
Uf
Uf
Definition: pEqn.H:78
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
p_rgh
volScalarField & p_rgh
Definition: setRegionFluidFields.H:31
p_rghEqnComp2
tmp< fvScalarMatrix > p_rghEqnComp2
Definition: pEqn.H:39
Foam::magSqr
dimensioned< scalar > magSqr(const dimensioned< Type > &)
Foam::fvc::absolute
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
Definition: fvcMeshPhi.C:187
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:190
rAUf
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU))