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