initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / applications / solvers / compressible / rhoPorousSimpleFoam / createFields.H
blobeee3959a4e0850702aa4ef1a47052aece69971fb
1     Info<< "Reading thermophysical properties\n" << endl;
3     autoPtr<basicThermo> thermo
4     (
5         basicThermo::New(mesh)
6     );
8     volScalarField rho
9     (
10         IOobject
11         (
12             "rho",
13             runTime.timeName(),
14             mesh,
15             IOobject::READ_IF_PRESENT,
16             IOobject::AUTO_WRITE
17         ),
18         thermo->rho()
19     );
21     volScalarField& p = thermo->p();
22     volScalarField& h = thermo->h();
25     Info<< "Reading field U\n" << endl;
26     volVectorField U
27     (
28         IOobject
29         (
30             "U",
31             runTime.timeName(),
32             mesh,
33             IOobject::MUST_READ,
34             IOobject::AUTO_WRITE
35         ),
36         mesh
37     );
39 #   include "compressibleCreatePhi.H"
42     label pRefCell = 0;
43     scalar pRefValue = 0.0;
44     setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
46     dimensionedScalar pMin
47     (
48         mesh.solutionDict().subDict("SIMPLE").lookup("pMin")
49     );
51     Info<< "Creating turbulence model\n" << endl;
52     autoPtr<compressible::RASModel> turbulence
53     (
54         compressible::RASModel::New
55         (
56             rho,
57             U,
58             phi,
59             thermo()
60         )
61     );
63     dimensionedScalar initialMass = fvc::domainIntegrate(rho);
65     porousZones pZones(mesh);
66     Switch pressureImplicitPorosity(false);
68     int nUCorr = 0;
69     if (pZones.size())
70     {
71         // nUCorrectors for pressureImplicitPorosity
72         if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors"))
73         {
74             nUCorr = readInt
75             (
76                 mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors")
77             );
78         }
80         if (nUCorr > 0)
81         {
82             pressureImplicitPorosity = true;
83         }
84     }