FreeFOAM The Cross-Platform CFD Toolkit
correctPhi.H
Go to the documentation of this file.
1 {
2  if (mesh.changing())
3  {
4  forAll(U.boundaryField(), patchi)
5  {
6  if (U.boundaryField()[patchi].fixesValue())
7  {
8  U.boundaryField()[patchi].initEvaluate();
9  }
10  }
11 
12  forAll(U.boundaryField(), patchi)
13  {
14  if (U.boundaryField()[patchi].fixesValue())
15  {
16  U.boundaryField()[patchi].evaluate();
17 
18  phi.boundaryField()[patchi] =
19  U.boundaryField()[patchi] & mesh.Sf().boundaryField()[patchi];
20  }
21  }
22  }
23 
25 
26  volScalarField pcorr
27  (
28  IOobject
29  (
30  "pcorr",
31  runTime.timeName(),
32  mesh,
33  IOobject::NO_READ,
34  IOobject::NO_WRITE
35  ),
36  mesh,
37  dimensionedScalar("pcorr", p.dimensions(), 0.0),
39  );
40 
41  dimensionedScalar rAUf("(1|A(U))", dimTime/rho.dimensions(), 1.0);
42 
43  adjustPhi(phi, U, pcorr);
44 
45  for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
46  {
47  fvScalarMatrix pcorrEqn
48  (
49  fvm::laplacian(rAUf, pcorr) == fvc::div(phi) - divU
50  );
51 
52  pcorrEqn.solve();
53 
54  if (nonOrth == nNonOrthCorr)
55  {
56  phi -= pcorrEqn.flux();
57  }
58  }
59 
61 }