Forward compatibility: flex
[foam-extend-3.2.git] / src / dbns / include / updateFields.H
blobdda3b0b23aafecebd9d5724e0d58457316b01583
2     // Compute U
3     U = rhoU/rho;
4     U.correctBoundaryConditions();
6     // Calculate enthalpy from rhoE
7     const volScalarField Cp = thermo->Cp();
8     const volScalarField Cv = thermo->Cv();
10 //     h = rhoE/rho - 0.5*magSqr(U) + p/rho;
11     // Alternative formulation, Felipe Alves Portela TU Delft
12     h = Cp/Cv*(rhoE/rho - 0.5*magSqr(U));
13     h.correctBoundaryConditions();
15     // Bound enthalpy
16     dimensionedScalar CpMin = min(Cp);
17     dimensionedScalar CpMax = max(Cp);
19     dimensionedScalar hMin = CpMin*TMin;
20     dimensionedScalar hMax = CpMax*TMax;
22     boundMinMax(h, hMin, hMax);
24     // Correct thermodynamics
25     thermo->correct();
27     // Bound density
28     boundMinMax(rho, rhoMin, rhoMax);
30     // Compute p from rho
31     p = rho*(thermo->Cp() - thermo->Cv())*T;
32     p.correctBoundaryConditions();
34     // Bound pressure
35     boundMinMax(p, pMin, pMax);