Forward compatibility: flex
[foam-extend-3.2.git] / applications / solvers / compressible / dbnsTurbFoam / createFields.H
blob74df61ab9f8ec52a5b53c003ad94639461a81e05
1     Info<< "Reading thermophysical properties\n" << endl;
3     autoPtr<basicPsiThermo> thermo
4     (
5         basicPsiThermo::New(mesh)
6     );
8     // Primitive variables
10     volScalarField& h = thermo->h();
11     volScalarField& p = thermo->p();
12     const volScalarField& T = thermo->T();
14     Info<< "Reading field rho\n" << endl;
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     );
28     Info<< "Reading field U\n" << endl;
29     volVectorField U
30     (
31         IOobject
32         (
33             "U",
34             runTime.timeName(),
35             mesh,
36             IOobject::MUST_READ,
37             IOobject::AUTO_WRITE
38         ),
39         mesh
40     );
43     // Conservative variables
45     volVectorField rhoU
46     (
47         IOobject
48         (
49             "rhoU",
50             runTime.timeName(),
51             mesh,
52             IOobject::NO_READ,
53             IOobject::NO_WRITE
54         ),
55         rho*U
56     );
58     volScalarField rhoE
59     (
60         IOobject
61         (
62             "rhoE",
63             runTime.timeName(),
64             mesh,
65             IOobject::NO_READ,
66             IOobject::NO_WRITE
67         ),
68         rho*(h + 0.5*magSqr(U)) - p
69     );
72     // Create numeric flux
73     numericFlux<rusanovFlux, BarthJespersenLimiter> dbnsFlux
74     (
75         p,
76         U,
77         T,
78         thermo()
79     );
81     // Create mass flux alias for easier coupling with other code components
82     const surfaceScalarField& phi = dbnsFlux.rhoFlux();
84     Info<< "Creating turbulence model\n" << endl;
85     autoPtr<compressible::turbulenceModel> turbulence
86     (
87         compressible::turbulenceModel::New
88         (
89             rho,
90             U,
91             phi,
92             thermo
93         )
94     );