25 const word objFuncName,
26 const word objFuncPart,
27 const dictionary& objFuncDict)
52 const labelList& objFuncFaceSources,
53 const labelList& objFuncCellSources,
54 scalarList& objFuncFaceValues,
55 scalarList& objFuncCellValues,
82 if (
metric_ ==
"faceOrthogonality")
85 const scalarField faceOrthogonality(
86 polyMeshTools::faceOrthogonality(
89 mesh_.cellCentres()));
92 forAll(faceOrthogonality, cellI)
94 objFuncValue += exp(
coeffKS_ * faceOrthogonality[cellI]);
96 if (objFuncValue > 1e200)
98 FatalErrorIn(
" ") <<
"KS function summation term too large! "
99 <<
"Reduce coeffKS! " << abort(FatalError);
103 else if (
metric_ ==
"nonOrthoAngle")
105 const scalarField faceOrthogonality(
106 polyMeshTools::faceOrthogonality(
109 mesh_.cellCentres()));
112 scalarField nonOrthoAngle = faceOrthogonality;
113 forAll(faceOrthogonality, cellI)
115 scalar val = faceOrthogonality[cellI];
118 scalar boundV = 1.0 - 1e-6;
128 scalar angleRad = acos(val);
130 scalar pi = constant::mathematical::pi;
131 scalar angleDeg = angleRad * 180.0 / pi;
132 nonOrthoAngle[cellI] = angleDeg;
136 forAll(nonOrthoAngle, cellI)
139 objFuncValue += exp(
coeffKS_ * nonOrthoAngle[cellI]);
141 if (objFuncValue > 1e200)
143 FatalErrorIn(
" ") <<
"KS function summation term too large! "
144 <<
"Reduce coeffKS! " << abort(FatalError);
149 else if (
metric_ ==
"faceSkewness")
151 const scalarField faceSkewness(
152 polyMeshTools::faceSkewness(
157 mesh_.cellCentres()));
160 forAll(faceSkewness, cellI)
163 objFuncValue += exp(
coeffKS_ * faceSkewness[cellI]);
165 if (objFuncValue > 1e200)
167 FatalErrorIn(
" ") <<
"KS function summation term too large! "
168 <<
"Reduce coeffKS! " << abort(FatalError);
175 FatalErrorIn(
" ") <<
"metric not valid! "
176 <<
"Options: faceOrthogonality, nonOrthoAngle, or faceSkewness "
177 << abort(FatalError);
181 reduce(objFuncValue, sumOp<scalar>());
183 objFuncValue = log(objFuncValue) /
coeffKS_;