ENH: Time: access to libs
[OpenFOAM-2.0.x.git] / applications / solvers / heatTransfer / buoyantBoussinesqSimpleFoam / createFields.H
blob477a3228331f2f98218d1f764ed8e84f1a72133f
1     Info<< "Reading thermophysical properties\n" << endl;
3     Info<< "Reading field T\n" << endl;
4     volScalarField T
5     (
6         IOobject
7         (
8             "T",
9             runTime.timeName(),
10             mesh,
11             IOobject::MUST_READ,
12             IOobject::AUTO_WRITE
13         ),
14         mesh
15     );
17     Info<< "Reading field p_rgh\n" << endl;
18     volScalarField p_rgh
19     (
20         IOobject
21         (
22             "p_rgh",
23             runTime.timeName(),
24             mesh,
25             IOobject::MUST_READ,
26             IOobject::AUTO_WRITE
27         ),
28         mesh
29     );
31     Info<< "Reading field U\n" << endl;
32     volVectorField U
33     (
34         IOobject
35         (
36             "U",
37             runTime.timeName(),
38             mesh,
39             IOobject::MUST_READ,
40             IOobject::AUTO_WRITE
41         ),
42         mesh
43     );
45     #include "createPhi.H"
47     #include "readTransportProperties.H"
49     Info<< "Creating turbulence model\n" << endl;
50     autoPtr<incompressible::RASModel> turbulence
51     (
52         incompressible::RASModel::New(U, phi, laminarTransport)
53     );
55     // Kinematic density for buoyancy force
56     volScalarField rhok
57     (
58         IOobject
59         (
60             "rhok",
61             runTime.timeName(),
62             mesh
63         ),
64         1.0 - beta*(T - TRef)
65     );
67     // kinematic turbulent thermal thermal conductivity m2/s
68     Info<< "Reading field kappat\n" << endl;
69     volScalarField kappat
70     (
71         IOobject
72         (
73             "kappat",
74             runTime.timeName(),
75             mesh,
76             IOobject::MUST_READ,
77             IOobject::AUTO_WRITE
78         ),
79         mesh
80     );
82     Info<< "Calculating field g.h\n" << endl;
83     volScalarField gh("gh", g & mesh.C());
84     surfaceScalarField ghf("ghf", g & mesh.Cf());
86     volScalarField p
87     (
88         IOobject
89         (
90             "p",
91             runTime.timeName(),
92             mesh,
93             IOobject::NO_READ,
94             IOobject::AUTO_WRITE
95         ),
96         p_rgh + rhok*gh
97     );
99     label pRefCell = 0;
100     scalar pRefValue = 0.0;
101     setRefCell
102     (
103         p,
104         p_rgh,
105         mesh.solutionDict().subDict("SIMPLE"),
106         pRefCell,
107         pRefValue
108     );
110     if (p_rgh.needReference())
111     {
112         p += dimensionedScalar
113         (
114             "p",
115             p.dimensions(),
116             pRefValue - getRefCellValue(p, pRefCell)
117         );
118     }