correctPhi.H
Go to the documentation of this file.
1 if (mesh.changing())
2 {
3  volVectorField::Boundary& bfld = U.boundaryFieldRef();
4  forAll(bfld, patchi)
5  {
6  if (bfld[patchi].fixesValue())
7  {
8  bfld[patchi].initEvaluate();
9  }
10  }
11 
12  surfaceScalarField::Boundary& phiBfld = phi.boundaryFieldRef();
13  forAll(bfld, patchi)
14  {
15  if (bfld[patchi].fixesValue())
16  {
17  bfld[patchi].evaluate();
18 
19  phiBfld[patchi] =
20  rho.boundaryField()[patchi]
21  * (
22  bfld[patchi]
23  & mesh.Sf().boundaryField()[patchi]
24  );
25  }
26  }
27 }
28  // Initialize BCs list for pcorr to zero-gradient
30  (
31  p.boundaryField().size(),
32  zeroGradientFvPatchScalarField::typeName
33  );
34 
35  // Set BCs of pcorr to fixed-value for patches at which p is fixed
36  forAll(p.boundaryField(), patchi)
37  {
38  if (p.boundaryField()[patchi].fixesValue())
39  {
40  pcorrTypes[patchi] = fixedValueFvPatchScalarField::typeName;
41  }
42  }
43 
45  (
46  IOobject
47  (
48  "pcorr",
49  runTime.timeName(),
50  mesh,
51  IOobject::NO_READ,
52  IOobject::NO_WRITE
53  ),
54  mesh,
55  dimensionedScalar(p.dimensions(), Zero),
57  );
58 
59  mesh.setFluxRequired(pcorr.name());
60 
61 {
62  dimensionedScalar rAUf("rAUf", dimTime, 1.0);
63 
64  while (pimple.correctNonOrthogonal())
65  {
66  fvScalarMatrix pcorrEqn
67  (
69  + fvc::div(phi)
71  ==
72  divrhoU()
73  );
74 
75  pcorrEqn.solve(mesh.solver(pcorr.select(pimple.finalInnerIter())));
76  //Bypass virtual layer
77  //mesh.fvMesh::solve(pcorrEqn, d);
78 
79  if (pimple.finalNonOrthogonalIter())
80  {
81  phi += pcorrEqn.flux();
82  }
83  }
84 }
rAUf
dimensionedScalar rAUf("rAUf", dimTime, 1.0)
runTime
engineTime & runTime
Definition: createEngineTime.H:13
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::fac::div
tmp< GeometricField< Type, faPatchField, areaMesh > > div(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facDiv.C:50
rho
rho
Definition: readInitialConditions.H:88
pcorr
volScalarField pcorr(IOobject("pcorr", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mesh, dimensionedScalar(p.dimensions(), Zero), pcorrTypes)
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:62
pimple
pimpleControl & pimple
Definition: setRegionFluidFields.H:56
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:53
Foam::fvScalarMatrix
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:44
pcorrTypes
wordList pcorrTypes(p.boundaryField().size(), zeroGradientFvPatchScalarField::typeName)
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
U
U
Definition: pEqn.H:72
Foam::fac::ddt
tmp< GeometricField< Type, faPatchField, areaMesh > > ddt(const dimensioned< Type > dt, const faMesh &mesh)
Definition: facDdt.C:47
Foam::fac::laplacian
tmp< GeometricField< Type, faPatchField, areaMesh > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Definition: facLaplacian.C:47
psi
const volScalarField & psi
Definition: createFieldRefs.H:1
forAll
forAll(p.boundaryField(), patchi)
Definition: correctPhi.H:36