22 DAFunction::DAFunction(
27 const word functionName)
32 functionName_(functionName)
59 const word functionName)
63 dictionary functionDict = daOption.
getAllOptions().subDict(
"function").subDict(functionName);
67 functionDict.readEntry<word>(
"type", modelType);
69 if (daOption.
getAllOptions().lookupOrDefault<label>(
"debug", 0))
71 Info <<
"Selecting type: " << modelType <<
" for DAFunction. Name: " << functionName << endl;
74 dictionaryConstructorTable::iterator cstrIter =
75 dictionaryConstructorTablePtr_->find(modelType);
78 if (cstrIter == dictionaryConstructorTablePtr_->end())
89 <<
"Unknown DAFunction type "
90 << modelType << nl << nl
91 <<
"Valid DAFunction types:" << endl
92 << dictionaryConstructorTablePtr_->sortedToc()
97 return autoPtr<DAFunction>(
136 if (functionSource ==
"patchToFace")
139 autoPtr<topoSet> currentSet(
146 autoPtr<topoSetSource> sourceSet(
150 sourceSet().applyToSet(topoSetSource::NEW, currentSet());
153 for (
const label i : currentSet())
158 else if (functionSource ==
"boxToCell")
161 autoPtr<topoSet> currentSet(
178 boxMin1[0] = boxMin[0];
179 boxMin1[1] = boxMin[1];
180 boxMin1[2] = boxMin[2];
181 boxMax1[0] = boxMax[0];
182 boxMax1[1] = boxMax[1];
183 boxMax1[2] = boxMax[2];
185 functionTmp.set(
"min", boxMin1);
186 functionTmp.set(
"max", boxMax1);
189 autoPtr<topoSetSource> sourceSet(
190 topoSetSource::New(functionSource,
mesh_, functionTmp));
193 sourceSet().applyToSet(topoSetSource::NEW, currentSet());
196 for (
const label i : currentSet())
201 else if (functionSource ==
"allCells")
210 FatalErrorIn(
"calcFunctionSources") <<
"source: " << functionSource <<
" not supported!"
211 <<
"Options are: allCells, patchToFace, or boxToCell!"
212 << abort(FatalError);
226 if (
ref_.size() == 1)
228 functionValue = (functionValue -
ref_[0]) * (functionValue -
ref_[0]);
232 label idxI =
mesh_.time().timeIndex() - 1;
233 functionValue = (functionValue -
ref_[idxI]) * (functionValue -
ref_[idxI]);