49 const word& solverName
59 <<
setw(width) <<
"#varID" <<
" "
60 <<
setw(width) <<
"adjointSensitivity"
66 const label activeVarI = activeVars[varI];
68 <<
setw(width) << activeVarI <<
" "
69 <<
setw(width) << sens[activeVarI] <<
endl;
77Foam::morphingBoxConstraint::morphingBoxConstraint
88 initialCPs_(3*volBSplinesBase_.getTotalControlPointsNumber()),
89 initialiseVars_(true),
90 derivativesFolder_(
"optimisation"/
type() +
"Derivatives")
95 for (
const NURBS3DVolume& boxI : boxes)
98 for (
const vector& cpI : cps)
120 const word modelType(
dict.getOrDefault<
word>(
"constraintType",
"none"));
122 Info<<
"morphingBoxConstraint type : " << modelType <<
endl;
124 auto* ctorPtr = dictionaryConstructorTable(modelType);
132 *dictionaryConstructorTablePtr_
136 return autoPtr<morphingBoxConstraint>
151 if (lowerBounds || upperBounds)
160 autoPtr<scalarField>& lowerBounds,
161 autoPtr<scalarField>& upperBounds
174 const word& adjointSolverName
191 const scalar maxInitChange
195 const scalar maxDisplacement
197 volBSplinesBase_.computeMaxBoundaryDisplacement
200 designVariables_.getPatches().toc()
204 Info<<
"maxAllowedDisplacement/maxDisplacement of boundary\t"
205 << maxInitChange <<
"/" << maxDisplacement <<
endl;
206 const scalar eta(maxInitChange/ maxDisplacement);
Istream and Ostream manipulators taking arguments.
Macros for easy insertion into run-time selection tables.
static unsigned int defaultPrecision() noexcept
Return the default precision.
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Abstract base class for defining design variables.
const labelList & activeDesignVariables() const
Return list of active design variables.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
Abstract base class for defining constraints for the control points of volumetric B-Splines morphing ...
virtual tmp< scalarField > postProcessSens(const scalarField &controlPointSens, const word &adjointSolverName)
Chain rule from control points to design variables.
volumetricBSplinesDesignVariables & designVariables_
Reference to underlaying volumetric B-Splines morpher.
virtual void computeDVsSensitivities(scalarField &dvSens, const scalarField &cpSens)=0
Compute sensitivities wrt the design variables (chain rule).
const fvMesh & mesh_
Mesh reference.
virtual scalar computeEta(scalarField &correction, const scalar maxInitChange)
Compute eta if not set in the first step.
virtual void computeBounds(autoPtr< scalarField > &lowerBounds, autoPtr< scalarField > &upperBounds)
Transform bounds from control points to design variables.
static autoPtr< morphingBoxConstraint > New(const fvMesh &mesh, const dictionary &dict, volumetricBSplinesDesignVariables &designVariables)
Construct and return the selected morphingBoxConstraint.
virtual bool writeData(Ostream &os) const
Append useful information to the design variables IOdictionary.
fileName derivativesFolder_
Folder holding the twist sensitivities.
scalarField initialCPs_
Initial CPs stored in scalarField.
virtual void updateBounds(autoPtr< scalarField > &lowerBounds, autoPtr< scalarField > &upperBounds)
Update the bounds of the design variables.
bool initialiseVars_
Initialise the design variables.
const dictionary dict_
Volumetric B-Splines variables dict.
virtual void writeDVSensitivities(const scalarField &sens, const word &name)
Write sensitivities w.r.t. the design variables.
volBSplinesBase & volBSplinesBase_
Easy access to the volBSplinesBase resting in the designVariables_.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Volumetric B-Splines design variables for shape optimisation.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
OBJstream os(runTime.globalPath()/outputName)
List< label > labelList
A List of labels.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Omanip< int > setw(const int i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
#define forAll(list, i)
Loop across all elements in list.