FreeFOAM The Cross-Platform CFD Toolkit
pEqn.H
Go to the documentation of this file.
1 {
2  rho = thermo.rho();
3 
4  volScalarField rUA = 1.0/UEqn.A();
5  surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
6 
7  U = rUA*UEqn.H();
8 
10  (
11  (fvc::interpolate(U) & mesh.Sf())
12  + fvc::ddtPhiCorr(rUA, rho, U, phi)
13  );
14 
15  surfaceScalarField buoyancyPhi = -rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf();
16  phi += buoyancyPhi;
17 
18  {
19  fvScalarMatrix p_rghDDtEqn
20  (
22  + fvc::div(phi)
23  );
24 
25  // Thermodynamic density needs to be updated by psi*d(p) after the
26  // pressure solution - done in 2 parts. Part 1:
27  thermo.rho() -= psi*p_rgh;
28 
29  for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
30  {
31  fvScalarMatrix p_rghEqn
32  (
33  p_rghDDtEqn - fvm::laplacian(rhorUAf, p_rgh)
34  );
35 
36  p_rghEqn.solve
37  (
38  mesh.solver
39  (
40  p_rgh.select
41  (
42  (
43  finalIter
44  && corr == nCorr-1
45  && nonOrth == nNonOrthCorr
46  )
47  )
48  )
49  );
50 
51  if (nonOrth == nNonOrthCorr)
52  {
53  // Second part of thermodynamic density update
54  thermo.rho() += psi*p_rgh;
55 
56  // Calculate the conservative fluxes
57  phi += p_rghEqn.flux();
58 
59  // Explicitly relax pressure for momentum corrector
60  p_rgh.relax();
61 
62  // Correct the momentum source with the pressure gradient flux
63  // calculated from the relaxed pressure
64  U += rUA*fvc::reconstruct
65  (
66  (buoyancyPhi + p_rghEqn.flux())/rhorUAf
67  );
68 
69  U.correctBoundaryConditions();
70  }
71  }
72  }
73 
74  p = p_rgh + rho*gh;
75 
77 
78  #include <finiteVolume/rhoEqn.H>
80 }