Initial commit of NavalHydro package from Wikki to the ShipHydroSIG
[ShipHydroSIG.git] / src / navalFoam / createFields.H
blob2cd193092b320b58894b3ddfb6ea5371fc13614b
1     Info<< "Reading field pd\n" << endl;
2     volScalarField pd
3     (
4         IOobject
5         (
6             "pd",
7             runTime.timeName(),
8             mesh,
9             IOobject::MUST_READ,
10             IOobject::AUTO_WRITE
11         ),
12         mesh
13     );
15     Info<< "Reading field alpha1\n" << endl;
16     volScalarField alpha1
17     (
18         IOobject
19         (
20             "alpha1",
21             runTime.timeName(),
22             mesh,
23             IOobject::MUST_READ,
24             IOobject::AUTO_WRITE
25         ),
26         mesh
27     );
29     Info<< "Reading 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 "createPhi.H"
45     Info<< "Reading transportProperties\n" << endl;
46     twoPhaseMixture twoPhaseProperties(U, phi, "alpha1");
48     const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
49     //const dimensionedScalar& rho2 = twoPhaseProperties.rho2();
52     // Need to store rho for ddt(rho, U)
53     volScalarField rho
54     (
55         IOobject
56         (
57             "rho",
58             runTime.timeName(),
59             mesh,
60             IOobject::READ_IF_PRESENT
61         ),
62         twoPhaseProperties.rho()
63     );
64     rho.oldTime();
67     // Mass flux
68     surfaceScalarField rhoPhi
69     (
70         IOobject
71         (
72             "rho*phi",
73             runTime.timeName(),
74             mesh,
75             IOobject::NO_READ,
76             IOobject::NO_WRITE
77         ),
78         fvc::interpolate(rho)*phi
79     );
81     volScalarField p
82     (
83         IOobject
84         (
85             "p",
86             runTime.timeName(),
87             mesh,
88             IOobject::READ_IF_PRESENT,
89             IOobject::AUTO_WRITE
90         ),
91         pd + rho*(g & mesh.C()),
92         pd.boundaryField().types()
93     );
96     label pRefCell = 0;
97     scalar pRefValue = 0.0;
98     setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue);
99     dimensionedScalar one("one", dimless, 1.0);
101     Info<< "Calculating field g.h\n" << endl;
102     volScalarField gh("gh", g & mesh.C());
103     surfaceScalarField ghf("ghf", g & mesh.Cf());
107     // Construct interface from alpha1 distribution
108     interfaceProperties interface(alpha1, U, twoPhaseProperties);
110      // Construct incompressible turbulence model
111     autoPtr<incompressible::turbulenceModel> turbulence
112     (
113         incompressible::turbulenceModel::New(U, phi, twoPhaseProperties)
114     );
116     Info<< "Reading field rAU if present\n" << endl;
117     volScalarField rAU
118     (
119         IOobject
120         (
121             "rAU",
122             runTime.timeName(),
123             mesh,
124             IOobject::READ_IF_PRESENT,
125             IOobject::AUTO_WRITE
126         ),
127         mesh,
128         dimensionedScalar("dt", dimTime, 1.0)/rho1,
129 //         runTime.deltaT()/rho,
130         zeroGradientFvPatchScalarField::typeName
131     );
133     numericalBeach beach(U);