47 if (!maxAllowedDisplacement_)
50 <<
"maxAllowedDisplacement requested but not set" <<
nl 54 return maxAllowedDisplacement_();
60 Foam::optMeshMovement::optMeshMovement
67 maxAllowedDisplacement_(nullptr),
74 writeMeshQualityMetrics_
76 dict.getOrDefault(
"writeMeshQualityMetrics", false)
80 if (
dict.found(
"maxAllowedDisplacement"))
82 maxAllowedDisplacement_.
reset 84 new scalar(
dict.get<scalar>(
"maxAllowedDisplacement"))
95 const dictionary&
dict,
99 const word modelType(
dict.
get<word>(
"type"));
101 Info<<
"optMeshMovement type : " << modelType <<
endl;
103 auto* ctorPtr = dictionaryConstructorTable(modelType);
112 *dictionaryConstructorTablePtr_
131 displMethodPtr_->update();
134 mesh_.checkMesh(
true);
137 writeMeshQualityMetrics();
144 return displMethodPtr_;
156 if (writeMeshQualityMetrics_)
161 Info<<
"Average, Max cell non - orthogonality " 163 <<
" " <<
gMax(cellNonOrtho()) <<
endl;
164 Info<<
"Average, Max cell skewness " <<
gAverage(cellSkewness())
165 <<
" " <<
gMax(cellSkewness()) <<
endl;
168 createZeroFieldPtr<scalar>(mesh_,
"nonOrtho",
dimless)
172 createZeroFieldPtr<scalar>(mesh_,
"skewness",
dimless)
174 nonOrthoPtr().primitiveFieldRef() = cellNonOrtho();
175 skewnessPtr().primitiveFieldRef() = cellSkewness();
176 nonOrthoPtr().write();
177 skewnessPtr().write();
184 pointsInit_ = mesh_.points();
190 Info<<
"optMeshMovement:: resetting mesh points" <<
endl;
191 mesh_.movePoints(pointsInit_);
197 return maxAllowedDisplacement_.valid();
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
const labelList patchIDs(pbm.patchSet(polyPatchNames, false, true).sortedToc())
Class calculates cell quality measures.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool maxAllowedDisplacementSet() const
Whether maxAllowedDisplacement has been set.
Abstract base class for translating an update of the design variables into mesh movement.
constexpr char nl
The newline '\n' character (0x0a)
virtual void resetDesignVariables()
Reset to starting point of line search.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
virtual labelList getActiveDesignVariables() const
Return active design variables.
const dimensionSet dimless
Dimensionless.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
virtual void storeDesignVariables()
Store design variables and mesh, to act as the starting point of line search.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
static autoPtr< optMeshMovement > New(fvMesh &mesh, const dictionary &dict, const labelList &patchIDs)
autoPtr< displacementMethod > & returnDisplacementMethod()
Return displacementMethod.
Abstract base class for displacement methods, which are a set or wrapper classes allowing to change t...
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Type gMax(const FieldField< Field, Type > &f)
defineTypeNameAndDebug(combustionModel, 0)
Type gAverage(const FieldField< Field, Type > &f)
Mesh data needed to do the Finite Volume discretisation.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual void moveMesh()
Calculates mesh movemnt based on the correction of the design variables.
List< label > labelList
A List of labels.
A class for managing temporary objects.
const labelList & getPatchIDs()
Return patchIDs.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
void setCorrection(const scalarField &correction)
Set design variable correction.
scalar getMaxAllowedDisplacement() const
Get maxAllowedDisplacement, is set.
void writeMeshQualityMetrics()
Write mesh quality metrics.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...