25 const word objFuncName,
26 const word objFuncPart,
27 const dictionary& objFuncDict)
37 daTurb_(
daModel.getDATurbulenceModel())
63 alphaSubDict.readEntry<wordList>(
"patches", patches);
65 HashTable<label> axisIndices;
66 axisIndices.set(
"x", 0);
67 axisIndices.set(
"y", 1);
68 axisIndices.set(
"z", 2);
69 word flowAxis = alphaSubDict.getWord(
"flowAxis");
70 word normalAxis = alphaSubDict.getWord(
"normalAxis");
76 FatalErrorIn(
" ") <<
"directionMode for "
77 << objFuncName <<
" " << objFuncPart <<
" not valid!"
78 <<
"Options: fixedDirection, parallelToFlow, normalToFlow."
84 FatalErrorIn(
" ") <<
"the magnitude of the direction parameter in "
85 << objFuncName <<
" " << objFuncPart <<
" is not 1.0!"
95 if (
mesh_.thisDb().foundObject<volScalarField>(
"p_rgh"))
99 #ifdef IncompressibleFlow
107 #ifdef CompressibleFlow
111 {
"U",
"nut",
"T", pName},
121 const labelList& objFuncFaceSources,
122 const labelList& objFuncCellSources,
123 scalarList& objFuncFaceValues,
124 scalarList& objFuncCellValues,
125 scalar& objFuncValue)
157 forAll(objFuncFaceValues, idxI)
159 objFuncFaceValues[idxI] = 0.0;
164 const objectRegistry& db =
mesh_.thisDb();
165 const volScalarField&
p = db.lookupObject<volScalarField>(
"p");
167 const surfaceVectorField::Boundary& Sfb =
mesh_.Sf().boundaryField();
170 const volSymmTensorField::Boundary& devRhoReffb = tdevRhoReff().boundaryField();
173 forAll(objFuncFaceSources, idxI)
175 const label& objFuncFaceI = objFuncFaceSources[idxI];
181 vector fN(Sfb[patchI][faceI] *
p.boundaryField()[patchI][faceI]);
183 vector fT(Sfb[patchI][faceI] & devRhoReffb[patchI][faceI]);
187 objFuncValue += objFuncFaceValues[idxI];
191 reduce(objFuncValue, sumOp<scalar>());
225 else if (
dirMode_ ==
"normalToFlow")
232 FatalErrorIn(
" ") <<
"directionMode not valid!"
233 <<
"Options: parallelToFlow, normalToFlow."
234 << abort(FatalError);
244 const_cast<volVectorField&
>(
mesh_.thisDb().lookupObject<volVectorField>(
"U"));
246 vector flowDir = {-1e16, -1e16, -1e16};
249 if (
mesh_.boundaryMesh()[patchI].size() > 0)
251 if (
U.boundaryField()[patchI].type() ==
"fixedValue")
253 flowDir =
U.boundaryField()[patchI][0];
254 flowDir = flowDir / mag(flowDir);
256 else if (
U.boundaryField()[patchI].type() ==
"inletOutlet")
259 mixedFvPatchField<vector>& inletOutletPatch =
260 refCast<mixedFvPatchField<vector>>(
U.boundaryFieldRef()[patchI]);
261 flowDir = inletOutletPatch.refValue()[0];
262 flowDir = flowDir / mag(flowDir);
266 FatalErrorIn(
"") <<
"boundaryType: " <<
U.boundaryField()[patchI].type()
268 <<
"Available options are: fixedValue, inletOutlet"
269 << abort(FatalError);
277 reduce(flowDir[0], maxOp<scalar>());
278 reduce(flowDir[1], maxOp<scalar>());
279 reduce(flowDir[2], maxOp<scalar>());
285 else if (
dirMode_ ==
"normalToFlow")
292 FatalErrorIn(
" ") <<
"directionMode not valid!"
293 <<
"Options: parallelToFlow, normalToFlow."
294 << abort(FatalError);