25 const word objFuncName,
26 const word objFuncPart,
27 const dictionary& objFuncDict)
62 const labelList& objFuncFaceSources,
63 const labelList& objFuncCellSources,
64 scalarList& objFuncFaceValues,
65 scalarList& objFuncCellValues,
92 forAll(objFuncCellValues, idxI)
94 objFuncCellValues[idxI] = 0.0;
97 const objectRegistry& db =
mesh_.thisDb();
99 scalar totalVol = 1.0;
105 totalVol +=
mesh_.V()[cellI];
107 reduce(totalVol, sumOp<scalar>());
112 const volScalarField& var = db.lookupObject<volScalarField>(
varName_);
114 forAll(objFuncCellSources, idxI)
116 const label& cellI = objFuncCellSources[idxI];
117 scalar volume =
mesh_.V()[cellI];
120 objFuncCellValues[idxI] =
scale_ * volume * var[cellI] * var[cellI];
124 objFuncCellValues[idxI] =
scale_ * volume * var[cellI];
126 objFuncValue += objFuncCellValues[idxI];
131 const volVectorField& var = db.lookupObject<volVectorField>(
varName_);
133 forAll(objFuncCellSources, idxI)
135 const label& cellI = objFuncCellSources[idxI];
136 scalar volume =
mesh_.V()[cellI];
145 objFuncValue += objFuncCellValues[idxI];
150 FatalErrorIn(
"") <<
"varType " <<
varType_ <<
" not supported!"
151 <<
"Options are: scalar or vector"
152 << abort(FatalError);
156 reduce(objFuncValue, sumOp<scalar>());
158 objFuncValue /= totalVol;