createFields.H
Go to the documentation of this file.
1#include "readGravitationalAcceleration.H"
2
4(
5 IOdictionary
6 (
7 IOobject
8 (
9 "transportProperties",
10 runTime.constant(),
11 mesh,
12 IOobject::MUST_READ
13 )
14 ).get<word>("continuousPhase")
15);
16
17Info<< "Reading field U\n" << endl;
18volVectorField Uc
19(
20 IOobject
21 (
22 IOobject::groupName("U", continuousPhaseName),
23 runTime.timeName(),
24 mesh,
25 IOobject::MUST_READ,
26 IOobject::AUTO_WRITE
27 ),
28 mesh
29);
30
31Info<< "Reading field p\n" << endl;
32volScalarField p
33(
34 IOobject
35 (
36 "p",
37 runTime.timeName(),
38 mesh,
39 IOobject::MUST_READ,
40 IOobject::AUTO_WRITE
41 ),
42 mesh
43);
44
45
46Info<< "Reading/calculating continuous-phase face flux field phic\n"
47 << endl;
48
49surfaceScalarField phic
50(
51 IOobject
52 (
53 IOobject::groupName("phi", continuousPhaseName),
54 runTime.timeName(),
55 mesh,
56 IOobject::READ_IF_PRESENT,
57 IOobject::AUTO_WRITE
58 ),
59 linearInterpolate(Uc) & mesh.Sf()
60);
61
62label pRefCell = 0;
63scalar pRefValue = 0.0;
65mesh.setFluxRequired(p.name());
66
67Info<< "Creating turbulence model\n" << endl;
68
69singlePhaseTransportModel continuousPhaseTransport(Uc, phic);
70
71dimensionedScalar rhocValue
72(
73 IOobject::groupName("rho", continuousPhaseName),
74 dimDensity,
75 continuousPhaseTransport
76);
77
78volScalarField rhoc
79(
80 IOobject
81 (
82 rhocValue.name(),
83 runTime.timeName(),
84 mesh,
85 IOobject::NO_READ,
86 IOobject::AUTO_WRITE
87 ),
88 mesh,
89 rhocValue
90);
91
92volScalarField muc
93(
94 IOobject
95 (
96 IOobject::groupName("mu", continuousPhaseName),
97 runTime.timeName(),
98 mesh,
99 IOobject::NO_READ,
100 IOobject::AUTO_WRITE
101 ),
102 rhoc*continuousPhaseTransport.nu()
103);
104
105Info << "Creating field alphac\n" << endl;
106// alphac must be constructed before the cloud
107// so that the drag-models can find it
108volScalarField alphac
109(
110 IOobject
111 (
112 IOobject::groupName("alpha", continuousPhaseName),
113 runTime.timeName(),
114 mesh,
115 IOobject::READ_IF_PRESENT,
116 IOobject::AUTO_WRITE
117 ),
118 mesh,
119 dimensionedScalar(dimless, Zero)
120);
121
122const word kinematicCloudName
123(
124 args.getOrDefault<word>("cloud", "kinematicCloud")
125);
126
127Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
128basicKinematicTypeCloud kinematicCloud
129(
131 rhoc,
132 Uc,
133 muc,
134 g
135);
136
137// Particle fraction upper limit
138scalar alphacMin
139(
140 1.0
141 - (
142 kinematicCloud.particleProperties().subDict("constantProperties")
143 .get<scalar>("alphaMax")
144 )
145);
146
147// Update alphac from the particle locations
148alphac = max(1.0 - kinematicCloud.theta(), alphacMin);
149alphac.correctBoundaryConditions();
150
151surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac));
152
153surfaceScalarField alphaPhic
154(
155 IOobject::groupName
156 (
157 "alphaPhi",
159 ),
160 alphacf*phic
161);
162
163
164autoPtr<DPMIncompressibleTurbulenceModel<singlePhaseTransportModel>>
166(
167 DPMIncompressibleTurbulenceModel<singlePhaseTransportModel>::New
168 (
169 alphac,
170 Uc,
171 alphaPhic,
172 phic,
173 continuousPhaseTransport
174 )
175);
surfaceScalarField phic(mixture.cAlpha() *mag(alphaPhic/mesh.magSf()))
Y[inertIndex] max(0.0)
const uniformDimensionedVectorField & g
const scalar pRefValue
const label pRefCell
pimpleControl & pimple
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
Definition: argListI.H:307
volScalarField & p
dynamicFvMesh & mesh
engineTime & runTime
Foam::argList args(argc, argv)
Info<< "Reading field U\n"<< endl;volVectorField Uc(IOobject(IOobject::groupName("U", continuousPhaseName), runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field p\n"<< endl;volScalarField p(IOobject("p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading/calculating continuous-phase face flux field phic\n"<< endl;surfaceScalarField phic(IOobject(IOobject::groupName("phi", continuousPhaseName), runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), linearInterpolate(Uc) &mesh.Sf());label pRefCell=0;scalar pRefValue=0.0;setRefCell(p, pimple.dict(), pRefCell, pRefValue);mesh.setFluxRequired(p.name());Info<< "Creating turbulence model\n"<< endl;singlePhaseTransportModel continuousPhaseTransport(Uc, phic);dimensionedScalar rhocValue(IOobject::groupName("rho", continuousPhaseName), dimDensity, continuousPhaseTransport);volScalarField rhoc(IOobject(rhocValue.name(), runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), mesh, rhocValue);volScalarField muc(IOobject(IOobject::groupName("mu", continuousPhaseName), runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), rhoc *continuousPhaseTransport.nu());Info<< "Creating field alphac\n"<< endl;volScalarField alphac(IOobject(IOobject::groupName("alpha", continuousPhaseName), runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), mesh, dimensionedScalar(dimless, Zero));const word kinematicCloudName(args.getOrDefault< word >("cloud", "kinematicCloud"));Info<< "Constructing kinematicCloud "<< kinematicCloudName<< endl;basicKinematicTypeCloud kinematicCloud(kinematicCloudName, rhoc, Uc, muc, g);scalar alphacMin(1.0 -(kinematicCloud.particleProperties().subDict("constantProperties") .get< scalar >("alphaMax")));alphac=max(1.0 - kinematicCloud.theta(), alphacMin);alphac.correctBoundaryConditions();surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac));surfaceScalarField alphaPhic(IOobject::groupName("alphaPhi", continuousPhaseName), alphacf *phic);autoPtr< DPMIncompressibleTurbulenceModel< singlePhaseTransportModel > continuousPhaseTurbulence(DPMIncompressibleTurbulenceModel< singlePhaseTransportModel >::New(alphac, Uc, alphaPhic, phic, continuousPhaseTransport))
word continuousPhaseName(IOdictionary(IOobject("transportProperties", runTime.constant(), mesh, IOobject::MUST_READ)).get< word >("continuousPhase"))
const word kinematicCloudName(args.getOrDefault< word >("cloud", "kinematicCloud"))
setRefCell(p, pimple.dict(), pRefCell, pRefValue)