Forward compatibility: flex
[foam-extend-3.2.git] / applications / solvers / compressible / steadyCompressibleMRFFoam / createFields.H
blob00073568ed8d55cc62a1e62e50a17d8e5b5e1d56
1     Info<< "Reading thermophysical properties\n" << endl;
3     autoPtr<basicPsiThermo> pThermo
4     (
5         basicPsiThermo::New(mesh)
6     );
7     basicPsiThermo& thermo = pThermo();
9     volScalarField& p = thermo.p();
10     volScalarField& h = thermo.h();
11     const volScalarField& T = thermo.T();
12     volScalarField psis("psi", thermo.psi()/thermo.Cp()*thermo.Cv());
13     psis.oldTime();
15     volScalarField rho
16     (
17         IOobject
18         (
19             "rho",
20             runTime.timeName(),
21             mesh,
22             IOobject::NO_READ,
23             IOobject::AUTO_WRITE
24         ),
25         thermo.rho()
26     );
27     rho.oldTime();
29     Info<< "\nReading field U\n" << endl;
30     volVectorField U
31     (
32         IOobject
33         (
34             "U",
35             runTime.timeName(),
36             mesh,
37             IOobject::MUST_READ,
38             IOobject::AUTO_WRITE
39         ),
40         mesh
41     );
43 #   include "compressibleCreatePhi.H"
45     Info<< "Creating turbulence model\n" << endl;
46     autoPtr<compressible::RASModel> turbulence
47     (
48         compressible::RASModel::New
49         (
50             rho,
51             U,
52             phi,
53             thermo
54         )
55     );
57     // Create MRF zones
58     MRFZones mrfZones(mesh);
59     mrfZones.correctBoundaryVelocity(U);
61     // Create relative velocity
62     volVectorField Urel
63     (
64         IOobject
65         (
66             "Urel",
67             runTime.timeName(),
68             mesh,
69             IOobject::NO_READ,
70             IOobject::AUTO_WRITE
71         ),
72         U
73     );
74     mrfZones.relativeVelocity(Urel);
76     // Create rotational velocity (= omega x r)
77     volVectorField Urot
78     (
79         "Urot",
80         U - Urel
81     );
83     // Create rothalpy, in two steps to preserve boundary conditions
84     volScalarField i
85     (
86         IOobject
87         (
88             "i",
89             runTime.timeName(),
90             mesh,
91             IOobject::NO_READ,
92             IOobject::AUTO_WRITE
93         ),
94         h
95     );
96     i -= 0.5*magSqr(Urot);