FreeFOAM The Cross-Platform CFD Toolkit
correctPhi.H
Go to the documentation of this file.
1 {
3 
5  (
6  p_rgh.boundaryField().size(),
7  zeroGradientFvPatchScalarField::typeName
8  );
9 
10  for (label i=0; i<p_rgh.boundaryField().size(); i++)
11  {
12  if (p_rgh.boundaryField()[i].fixesValue())
13  {
14  pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
15  }
16  }
17 
18  volScalarField pcorr
19  (
20  IOobject
21  (
22  "pcorr",
23  runTime.timeName(),
24  mesh,
25  IOobject::NO_READ,
26  IOobject::NO_WRITE
27  ),
28  mesh,
29  dimensionedScalar("pcorr", p_rgh.dimensions(), 0.0),
31  );
32 
33  dimensionedScalar rAUf("(1|A(U))", dimTime/rho.dimensions(), 1.0);
34 
35  adjustPhi(phi, U, pcorr);
36 
37  for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
38  {
39  fvScalarMatrix pcorrEqn
40  (
41  fvm::laplacian(rAUf, pcorr) == fvc::div(phi)
42  );
43 
44  pcorrEqn.setReference(pRefCell, pRefValue);
45  pcorrEqn.solve();
46 
47  if (nonOrth == nNonOrthCorr)
48  {
49  phi -= pcorrEqn.flux();
50  }
51  }
52 
54 }