41 BezierDesignVariables,
75 autoPtr<scalarField>& bounds,
80 const label nCPs(bezier_.nBezier());
81 for (label iCP = 0; iCP < nCPs; ++iCP)
83 bounds()[iCP] = cpBounds.x();
84 bounds()[nCPs + iCP] = cpBounds.y();
85 bounds()[2*nCPs + iCP] = cpBounds.z();
97 dx_.primitiveFieldRef() =
Zero;
101 const label nCPs(bezier_.nBezier());
104 const boolListList& confineMovement = bezier_.confineMovement();
108 if (!confineMovement[0][cpI])
112 if (!confineMovement[1][cpI])
116 if (!confineMovement[2][cpI])
118 cpMovement[cpI].z() =
correction[2*nCPs + cpI];
121 dx_ += (bezier_.dxidXj()[cpI] & cpMovement[cpI]);
135 const label nBezier = bezier_.nBezier();
143 Foam::BezierDesignVariables::BezierDesignVariables
158 mesh_.time().globalPath()/
"system",
199 displMethodPtr_->setMotionField(dx_);
214 const scalar maxDisplacement(
max(
mag(dx_)).value());
216 Info<<
"maxAllowedDisplacement/maxDisplacement at the boundary\t" 217 << maxInitChange_() <<
"/" << maxDisplacement <<
endl;
219 const scalar eta = maxInitChange_()/maxDisplacement;
239 label cpI(-1), dir(-1);
240 decomposeVarID(cpI, dir, varID);
241 return bezier_.dxdbFace(patchI, cpI, dir);
251 label cpI(-1), dir(-1);
252 decomposeVarID(cpI, dir, varID);
253 return bezier_.dndbBasedSensitivities(patchI, cpI, dir,
false);
263 label cpI(-1), dir(-1);
264 decomposeVarID(cpI, dir, varID);
265 return bezier_.dndbBasedSensitivities(patchI, cpI, dir,
true);
272 label cpI(-1), dir(-1);
273 decomposeVarID(cpI, dir, varID);
277 for (
const label pI : parametertisedPatches_)
280 if (
gSum(
mag(dxdbFace)) > SMALL)
285 return solveMeshMovementEqn(patchI, varID);
labelList activeDesignVariables_
Which of the design variables will be updated.
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
List< List< bool > > boolListList
List of boolList.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
virtual bool globalSum() const
Whether to use global sum when computing matrix-vector products.
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 scalar computeEta(scalarField &correction)
Compute eta if not set in the first step.
virtual tmp< vectorField > dxdbFace(const label patchI, const label varID) const
Get dxdb for given design variable and patch.
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.
const labelList & getActiveDesignVariables() const
Return active design variables.
Macros for easy insertion into run-time selection tables.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
void decomposeVarID(label &cpI, label &dir, const label varID) const
Decompose varID to cpID and direction.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Mesh representing a set of points created from polyMesh.
#define forAll(list, i)
Loop across all elements in list.
void setSize(const label n)
Alias for resize()
Type gSum(const FieldField< Field, Type > &f)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
label nBezier() const
Number of Bezier control points.
void readBounds(autoPtr< scalar > lowerBoundPtr=nullptr, autoPtr< scalar > upperBoundPtr=nullptr)
Read bounds for design variables, if present.
virtual const scalarField & getVars() const
Get the design variables.
void setBounds(autoPtr< scalarField > &bounds, const vector &cpBounds)
Set uniform bounds for all control points.
Istream and Ostream manipulators taking arguments.
tmp< vectorField > computeBoundaryDisplacement(const scalarField &correction)
Transform the correction of design variables to control points' movement.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
label size() const noexcept
The number of elements in the container.
defineTypeNameAndDebug(combustionModel, 0)
virtual tmp< volVectorField > dCdb(const label varID) const
Get dCdb for given design variable.
virtual void update(scalarField &correction)
Update design variables based on a given correction.
autoPtr< scalarField > lowerBounds_
Lower bounds of the design variables.
Abstract base class for defining design variables for shape optimisation.
Mesh data needed to do the Finite Volume discretisation.
autoPtr< scalarField > upperBounds_
Upper bounds of the design variables.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< vector > vectorField
Specialisation of Field<T> for vector.
void operator+=(const UList< scalar > &)
virtual tmp< vectorField > dndb(const label patchI, const label varID) const
Get dndb for given design variable and patch.
A class for managing temporary objects.
Bezier bezier_
The Bezier control points and auxiliary functions.
Defines the attributes of an object for which implicit objectRegistry management is supported...
void readBounds(autoPtr< scalar > lowerBoundPtr=nullptr, autoPtr< scalar > upperBoundPtr=nullptr)
Read bounds for design variables, if present.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
static constexpr const zero Zero
Global zero (0)
virtual tmp< vectorField > dSdb(const label patchI, const label varID) const
Get dSdb for given design variable and patch.