FreeFOAM The Cross-Platform CFD Toolkit
pEqn.H
Go to the documentation of this file.
1 {
2  rho = thermo.rho();
3  rho.relax();
4 
5  volScalarField rUA = 1.0/UEqn().A();
6  surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
7 
8  U = rUA*UEqn().H();
9  UEqn.clear();
10 
12  bool closedVolume = adjustPhi(phi, U, p_rgh);
13 
14  surfaceScalarField buoyancyPhi = rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf();
15  phi -= buoyancyPhi;
16 
17  for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
18  {
19  fvScalarMatrix p_rghEqn
20  (
22  );
23 
24  p_rghEqn.setReference
25  (
27  );
28 
29  eqnResidual = p_rghEqn.solve().initialResidual();
30 
31  // Retain the residual from the first iteration
32  if (nonOrth == 0)
33  {
35  }
36 
37  if (nonOrth == nNonOrthCorr)
38  {
39  // Calculate the conservative fluxes
40  phi -= p_rghEqn.flux();
41 
42  // Explicitly relax pressure for momentum corrector
43  p_rgh.relax();
44 
45  // Correct the momentum source with the pressure gradient flux
46  // calculated from the relaxed pressure
47  U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorUAf);
48  U.correctBoundaryConditions();
49  }
50  }
51 
53 
54  p = p_rgh + rho*gh;
55 
56  // For closed-volume cases adjust the pressure level
57  // to obey overall mass continuity
58  if (closedVolume)
59  {
62  p_rgh = p - rho*gh;
63  }
64 
65  rho = thermo.rho();
66  rho.relax();
67  Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value()
68  << endl;
69 }