FreeFOAM The Cross-Platform CFD Toolkit
pEqn.H
Go to the documentation of this file.
1 {
2  rho = thermo.rho();
3  rho = max(rho, rhoMin[i]);
4  rho = min(rho, rhoMax[i]);
5  rho.relax();
6 
7  volScalarField rUA = 1.0/UEqn().A();
8  surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
9 
10  U = rUA*UEqn().H();
11  UEqn.clear();
12 
14  bool closedVolume = adjustPhi(phi, U, p_rgh);
15  dimensionedScalar compressibility = fvc::domainIntegrate(psi);
16  bool compressible = (compressibility.value() > SMALL);
17 
18  surfaceScalarField buoyancyPhi = rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf();
19  phi -= buoyancyPhi;
20 
21  // Solve pressure
22  for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
23  {
24  fvScalarMatrix p_rghEqn
25  (
27  );
28 
29  p_rghEqn.setReference
30  (
31  pRefCell,
32  compressible ? getRefCellValue(p_rgh, pRefCell) : pRefValue
33  );
34 
35  eqnResidual = p_rghEqn.solve().initialResidual();
36 
37  // Retain the residual from the first iteration
38  if (nonOrth == 0)
39  {
41  }
42 
43  if (nonOrth == nNonOrthCorr)
44  {
45  // Calculate the conservative fluxes
46  phi -= p_rghEqn.flux();
47 
48  // Explicitly relax pressure for momentum corrector
49  p_rgh.relax();
50 
51  // Correct the momentum source with the pressure gradient flux
52  // calculated from the relaxed pressure
53  U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorUAf);
54  U.correctBoundaryConditions();
55  }
56  }
57 
58  p = p_rgh + rho*gh;
59 
61 
62  // For closed-volume cases adjust the pressure level
63  // to obey overall mass continuity
64  if (closedVolume && compressible)
65  {
67  /compressibility;
68  p_rgh = p - rho*gh;
69  }
70 
71  rho = thermo.rho();
72  rho = max(rho, rhoMin[i]);
73  rho = min(rho, rhoMax[i]);
74  rho.relax();
75 
76  Info<< "Min/max rho:" << min(rho).value() << ' '
77  << max(rho).value() << endl;
78 
79  // Update thermal conductivity
80  K = thermo.Cp()*turb.alphaEff();
81 }