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 
17 Info<< "Reading field U\n" << endl;
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 
31 Info<< "Reading field p\n" << endl;
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 
46 Info<< "Reading/calculating continuous-phase face flux field phic\n"
47  << endl;
48 
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 
62 label pRefCell = 0;
63 scalar pRefValue = 0.0;
65 mesh.setFluxRequired(p.name());
66 
67 Info<< "Creating turbulence model\n" << endl;
68 
69 singlePhaseTransportModel continuousPhaseTransport(Uc, phic);
70 
71 dimensionedScalar rhocValue
72 (
73  IOobject::groupName("rho", continuousPhaseName),
74  dimDensity,
75  continuousPhaseTransport
76 );
77 
78 volScalarField 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 
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 
105 Info << "Creating field alphac\n" << endl;
106 // alphac must be constructed before the cloud
107 // so that the drag-models can find it
108 volScalarField 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,
120 );
121 
122 const word kinematicCloudName
123 (
124  args.getOrDefault<word>("cloud", "kinematicCloud")
125 );
126 
127 Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
128 basicKinematicTypeCloud kinematicCloud
129 (
131  rhoc,
132  Uc,
133  muc,
134  g
135 );
136 
137 // Particle fraction upper limit
138 scalar 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
148 alphac = max(1.0 - kinematicCloud.theta(), alphacMin);
149 alphac.correctBoundaryConditions();
150 
151 surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac));
152 
153 surfaceScalarField alphaPhic
154 (
155  IOobject::groupName
156  (
157  "alphaPhi",
159  ),
160  alphacf*phic
161 );
162 
163 
164 autoPtr<DPMIncompressibleTurbulenceModel<singlePhaseTransportModel>>
166 (
168  (
169  alphac,
170  Uc,
171  alphaPhic,
172  phic,
173  continuousPhaseTransport
174  )
175 );
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::argList::getOrDefault
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
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::dimDensity
const dimensionSet dimDensity
continuousPhaseTurbulence
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))
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
setRefCell
setRefCell(p, pimple.dict(), pRefCell, pRefValue)
phic
surfaceScalarField phic(mixture.cAlpha() *mag(alphaPhic/mesh.magSf()))
pimple
pimpleControl & pimple
Definition: setRegionFluidFields.H:56
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
p
volScalarField & p
Definition: createFields.H:23
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
g
const uniformDimensionedVectorField & g
Definition: createFluidFields.H:26
continuousPhaseName
word continuousPhaseName(IOdictionary(IOobject("transportProperties", runTime.constant(), mesh, IOobject::MUST_READ)).get< word >("continuousPhase"))
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:62
Foam::linearInterpolate
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > linearInterpolate(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: linear.H:112
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
kinematicCloudName
const word kinematicCloudName(args.getOrDefault< word >("cloud", "kinematicCloud"))
pRefCell
label pRefCell
Definition: createFields.H:75
pRefValue
scalar pRefValue
Definition: createFields.H:76
args
Foam::argList args(argc, argv)
Foam::fac::interpolate
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &tvf, const edgeScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189