NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing support for different coordinate systems. More...
Public Member Functions | |
TypeName ("NURBS3DVolume") | |
Runtime type information. More... | |
declareRunTimeSelectionTable (autoPtr, NURBS3DVolume, dictionary,(const dictionary &dict, const fvMesh &mesh, bool computeParamCoors),(dict, mesh, computeParamCoors)) | |
NURBS3DVolume (const dictionary &dict, const fvMesh &mesh, bool computeParamCoors=true) | |
Construct from dictionary. More... | |
NURBS3DVolume (const NURBS3DVolume &) | |
Construct as copy. More... | |
virtual | ~NURBS3DVolume ()=default |
Destructor. More... | |
vector | volumeDerivativeU (const scalar u, const scalar v, const scalar w) const |
Volume point derivative wrt u at point u,v,w. More... | |
vector | volumeDerivativeV (const scalar u, const scalar v, const scalar w) const |
Volume point derivative wrt v at point u,v,w. More... | |
vector | volumeDerivativeW (const scalar u, const scalar v, const scalar w) const |
Volume point derivative wrt w at point u,v,w. More... | |
tensor | JacobianUVW (const vector &u) const |
Jacobian matrix wrt to the volume parametric coordinates. More... | |
scalar | volumeDerivativeCP (const vector &u, const label cpI) const |
Volume point derivative wrt to control point cpI at point u,v,w. More... | |
vectorField | computeControlPointSensitivities (const pointVectorField &pointSens, const labelList &sensitivityPatchIDs) |
vectorField | computeControlPointSensitivities (const volVectorField &faceSens, const labelList &sensitivityPatchIDs) |
vectorField | computeControlPointSensitivities (const boundaryVectorField &faceSens, const labelList &sensitivityPatchIDs) |
vector | computeControlPointSensitivities (const vectorField &faceSens, const label patchI, const label cpI) |
tmp< tensorField > | dndbBasedSensitivities (const label patchI, const label cpI, bool DimensionedNormalSens=true) |
tmp< tensorField > | patchDxDb (const label patchI, const label cpI) |
Get patch dx/db. More... | |
tmp< tensorField > | patchDxDbFace (const label patchI, const label cpI) |
Get patch dx/db. More... | |
tmp< vectorField > | coordinates (const vectorField &uVector) const |
vector | coordinates (const vector &uVector) const |
The same, for a specific point. More... | |
tmp< vectorField > | computeNewPoints (const vectorField &controlPointsMovement) |
Mesh movement based on given control point movement. More... | |
tmp< vectorField > | computeNewBoundaryPoints (const vectorField &controlPointsMovement, const labelList &patchesToBeMoved) |
Boundary mesh movement based on given control point movement. More... | |
void | setControlPoints (const vectorField &newCps) |
Set new control points. More... | |
void | boundControlPointMovement (vectorField &controlPointsMovement) |
scalar | computeMaxBoundaryDisplacement (const vectorField &controlPointsMovement, const labelList &patchesToBeMoved) |
Compute max. displacement at the boundary. More... | |
tmp< vectorField > | getPointsInBox () |
const labelList & | getMap () |
Get map of points in box to mesh points. More... | |
const labelList & | getReverseMap () |
const pointVectorField & | getParametricCoordinates () |
Get parametric coordinates. More... | |
tmp< pointTensorField > | getDxDb (const label cpI) |
Get dxCartesiandb for a certain control point. More... | |
tmp< volTensorField > | getDxCellsDb (const label cpI) |
Get dxCartesiandb for a certain control point on cells. More... | |
label | nUSymmetry () const |
Get number of variables if CPs are moved symmetrically in U. More... | |
label | nVSymmetry () const |
Get number of variables if CPs are moved symmetrically in V. More... | |
label | nWSymmetry () const |
Get number of variables if CPs are moved symmetrically in W. More... | |
const word & | name () const |
Get box name. More... | |
const boolList & | getActiveCPs () const |
Which control points are active? More... | |
const boolList & | getActiveDesignVariables () const |
Which design variables are active? More... | |
const vectorField & | getControlPoints () const |
Get control points. More... | |
bool | confineX1movement () const |
Get confine movements. More... | |
bool | confineX2movement () const |
bool | confineX3movement () const |
const NURBSbasis & | basisU () const |
Get basis functions. More... | |
const NURBSbasis & | basisV () const |
const NURBSbasis & | basisW () const |
void | writeCps (const string="cpsFile") const |
void | writeCpsInDict () const |
Write control points on the local coordinate system. More... | |
void | write () const |
Write parametric coordinates. More... | |
Static Public Member Functions | |
static autoPtr< NURBS3DVolume > | New (const dictionary &dict, const fvMesh &mesh, bool computeParamCoors=true) |
Return a reference to the selected NURBS model. More... | |
Protected Types | |
typedef List< FixedList< bool, 3 > > | boolListList3 |
Protected Member Functions | |
label | getCPID (const label i, const label j, const label k) const |
Get control point ID from its I-J-K coordinates. More... | |
void | findPointsInBox (const vectorField &meshPoints) |
Find points within control points box. More... | |
void | computeParametricCoordinates (const vectorField &points) |
void | computeParametricCoordinates (tmp< vectorField > tPoints) |
bool | bound (vector &vec, scalar minValue=1e-7, scalar maxValue=0.999999) |
Bound components to certain limits. More... | |
void | determineActiveDesignVariablesAndPoints () |
Create lists with active design variables and control points. More... | |
void | confineBoundaryControlPoints () |
Confine movement in boundary control points if necessary. More... | |
void | continuityRealatedConfinement () |
Confine control point movement to maintain user-defined continuity. More... | |
void | confineControlPointsDirections () |
Confine movement in all control points for user-defined directions. More... | |
void | confineControlPoint (const label cpI) |
Confine all three movements for a prescribed control point. More... | |
void | confineControlPoint (const label cpI, const FixedList< bool, 3 > &) |
Confine specific movements for a prescribed control point. More... | |
void | makeFolders () |
Create folders to store cps and derivatives. More... | |
virtual vector | transformPointToCartesian (const vector &localCoordinates) const =0 |
Transform a point from its coordinate system to a cartesian system. More... | |
virtual tensor | transformationTensorDxDb (label globalPointIndex)=0 |
virtual void | updateLocalCoordinateSystem (const vectorField &cartesianPoints)=0 |
Update coordinates in the local system based on the cartesian points. More... | |
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing support for different coordinate systems.
For a short introduction to a volumetric B-Splines morpher and its use in shape optimisation Papoutsis-Kiachagias, E., Magoulas, N., Mueller, J., Othmer, C., & Giannakoglou, K. (2015). Noise reduction in car aerodynamics using a surrogate objective function and the continuous adjoint method with wall functions. Computers & Fluids, 122, 223-232. http://doi.org/10.1016/j.compfluid.2015.09.002
Definition at line 71 of file NURBS3DVolume.H.
|
protected |
Definition at line 77 of file NURBS3DVolume.H.
NURBS3DVolume | ( | const dictionary & | dict, |
const fvMesh & | mesh, | ||
bool | computeParamCoors = true |
||
) |
Construct from dictionary.
Definition at line 641 of file NURBS3DVolume.C.
References dict, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, dictionary::get(), Foam::Info, IOobject::MUST_READ, IOobject::NO_WRITE, dictionary::readEntry(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
NURBS3DVolume | ( | const NURBS3DVolume & | ) |
Construct as copy.
|
virtualdefault |
Destructor.
|
protected |
Get control point ID from its I-J-K coordinates.
Definition at line 50 of file NURBS3DVolume.C.
References k.
|
protected |
Find points within control points box.
Definition at line 63 of file NURBS3DVolume.C.
References Field< Type >::component(), Foam::BitOps::count(), NURBS3DVolume::cps_, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::Info, NURBS3DVolume::mapPtr_, Foam::max(), Foam::min(), Foam::reduce(), NURBS3DVolume::reverseMapPtr_, List< T >::setSize(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
|
protected |
Compute parametric coordinates in order to match a given set of coordinates, based on the cps of the class
Uses a Newton-Raphson loop. Argument is the points residing in the box
Definition at line 118 of file NURBS3DVolume.C.
References IOobject::AUTO_WRITE, Foam::bound(), Foam::cmptMag(), VectorSpace< Form, Cmpt, Ncmpts >::component(), coordinates(), Foam::diff(), Foam::dimless, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::Info, Foam::inv(), Foam::mag(), Foam::max(), Foam::min(), MeshObject< polyMesh, UpdateableMeshObject, pointMesh >::New(), IOobject::NO_READ, points, Foam::reduce(), tmp< T >::ref(), List< T >::setSize(), WarningInFunction, VectorSpace< Vector< scalar >, scalar, 3 >::zero, and Foam::Zero.
|
protected |
Definition at line 352 of file NURBS3DVolume.C.
References points.
Bound components to certain limits.
Definition at line 362 of file NURBS3DVolume.C.
References maxValue, minValue, Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
|
protected |
Create lists with active design variables and control points.
Definition at line 414 of file NURBS3DVolume.C.
References forAll.
|
protected |
Confine movement in boundary control points if necessary.
Definition at line 446 of file NURBS3DVolume.C.
|
protected |
Confine control point movement to maintain user-defined continuity.
Definition at line 492 of file NURBS3DVolume.C.
References forAll.
|
protected |
Confine movement in all control points for user-defined directions.
Definition at line 587 of file NURBS3DVolume.C.
|
protected |
Confine all three movements for a prescribed control point.
Definition at line 598 of file NURBS3DVolume.C.
References Foam::exit(), Foam::FatalError, and FatalErrorInFunction.
|
protected |
Confine specific movements for a prescribed control point.
Definition at line 617 of file NURBS3DVolume.C.
References Foam::exit(), Foam::FatalError, and FatalErrorInFunction.
|
protected |
Create folders to store cps and derivatives.
Definition at line 405 of file NURBS3DVolume.C.
References UPstream::master(), and Foam::mkDir().
|
protectedpure virtual |
Transform a point from its coordinate system to a cartesian system.
Implemented in NURBS3DVolumeCylindrical, and NURBS3DVolumeCartesian.
Transformation tensor for dxdb, from local coordinate system to cartesian
Implemented in NURBS3DVolumeCylindrical, and NURBS3DVolumeCartesian.
|
protectedpure virtual |
Update coordinates in the local system based on the cartesian points.
Implemented in NURBS3DVolumeCylindrical, and NURBS3DVolumeCartesian.
TypeName | ( | "NURBS3DVolume" | ) |
Runtime type information.
declareRunTimeSelectionTable | ( | autoPtr | , |
NURBS3DVolume | , | ||
dictionary | , | ||
(const dictionary &dict, const fvMesh &mesh, bool computeParamCoors) | , | ||
(dict, mesh, computeParamCoors) | |||
) |
|
static |
Return a reference to the selected NURBS model.
Definition at line 802 of file NURBS3DVolume.C.
References dict, Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInLookup, dictionary::get(), Foam::Info, and mesh.
Referenced by volBSplinesBase::volBSplinesBase().
Foam::vector volumeDerivativeU | ( | const scalar | u, |
const scalar | v, | ||
const scalar | w | ||
) | const |
Volume point derivative wrt u at point u,v,w.
Definition at line 832 of file NURBS3DVolume.C.
References Foam::Zero.
Foam::vector volumeDerivativeV | ( | const scalar | u, |
const scalar | v, | ||
const scalar | w | ||
) | const |
Volume point derivative wrt v at point u,v,w.
Definition at line 868 of file NURBS3DVolume.C.
References Foam::Zero.
Foam::vector volumeDerivativeW | ( | const scalar | u, |
const scalar | v, | ||
const scalar | w | ||
) | const |
Volume point derivative wrt w at point u,v,w.
Definition at line 904 of file NURBS3DVolume.C.
References Foam::Zero.
Foam::tensor JacobianUVW | ( | const vector & | u | ) | const |
Jacobian matrix wrt to the volume parametric coordinates.
Definition at line 940 of file NURBS3DVolume.C.
References VectorSpace< Form, Cmpt, Ncmpts >::component(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), Vector< Cmpt >::z(), and Foam::Zero.
Volume point derivative wrt to control point cpI at point u,v,w.
Scalar since in the local system!
Definition at line 969 of file NURBS3DVolume.C.
References Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().
Foam::vectorField computeControlPointSensitivities | ( | const pointVectorField & | pointSens, |
const labelList & | sensitivityPatchIDs | ||
) |
Control point sensitivities computed using point-based surface sensitivities
Definition at line 1002 of file NURBS3DVolume.C.
References forAll, Pstream::listCombineGather(), Pstream::listCombineScatter(), Foam::foamVersion::patch, and Foam::Zero.
Foam::vectorField computeControlPointSensitivities | ( | const volVectorField & | faceSens, |
const labelList & | sensitivityPatchIDs | ||
) |
Control point sensitivities computed using face-based surface sensitivities
Definition at line 1053 of file NURBS3DVolume.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryField().
Foam::vectorField computeControlPointSensitivities | ( | const boundaryVectorField & | faceSens, |
const labelList & | sensitivityPatchIDs | ||
) |
Control point sensitivities computed using face-based surface sensitivities
Definition at line 1068 of file NURBS3DVolume.C.
References forAll, Pstream::listCombineGather(), Pstream::listCombineScatter(), deltaBoundary::makeFaceCentresAndAreas_d(), Foam::foamVersion::patch, face::points(), and Foam::Zero.
Foam::vector computeControlPointSensitivities | ( | const vectorField & | faceSens, |
const label | patchI, | ||
const label | cpI | ||
) |
Control point sensitivities computed using face-based surface sensitivities
Definition at line 1139 of file NURBS3DVolume.C.
References forAll, deltaBoundary::makeFaceCentresAndAreas_d(), Foam::foamVersion::patch, face::points(), Foam::reduce(), and Foam::Zero.
Foam::tmp< Foam::tensorField > dndbBasedSensitivities | ( | const label | patchI, |
const label | cpI, | ||
bool | DimensionedNormalSens = true |
||
) |
Part of control point sensitivities related to the face normal variations
Definition at line 1199 of file NURBS3DVolume.C.
References forAll, deltaBoundary::makeFaceCentresAndAreas_d(), Foam::foamVersion::patch, face::points(), tmp< T >::ref(), polyPatch::start(), and Foam::Zero.
Foam::tmp< Foam::tensorField > patchDxDb | ( | const label | patchI, |
const label | cpI | ||
) |
Get patch dx/db.
Definition at line 1268 of file NURBS3DVolume.C.
References forAll, tmp< T >::New(), Foam::foamVersion::patch, and Foam::Zero.
Foam::tmp< Foam::tensorField > patchDxDbFace | ( | const label | patchI, |
const label | cpI | ||
) |
Get patch dx/db.
Definition at line 1307 of file NURBS3DVolume.C.
References forAll, deltaBoundary::makeFaceCentresAndAreas_d(), tmp< T >::New(), Foam::foamVersion::patch, face::points(), and Foam::Zero.
Foam::tmp< Foam::vectorField > coordinates | ( | const vectorField & | uVector | ) | const |
Compute cartesian coordinates based on control points and parametric coordinates
Definition at line 1365 of file NURBS3DVolume.C.
References forAll, tmp< T >::New(), nPoints, points, and Foam::Zero.
Foam::vector coordinates | ( | const vector & | uVector | ) | const |
The same, for a specific point.
Definition at line 1408 of file NURBS3DVolume.C.
References Vector< Cmpt >::x(), Vector< Cmpt >::y(), Vector< Cmpt >::z(), and Foam::Zero.
Foam::tmp< Foam::vectorField > computeNewPoints | ( | const vectorField & | controlPointsMovement | ) |
Mesh movement based on given control point movement.
Definition at line 1445 of file NURBS3DVolume.C.
References coordinates(), DebugInfo, Foam::endl(), forAll, Foam::gMax(), Foam::mag(), and tmp< T >::ref().
Foam::tmp< Foam::vectorField > computeNewBoundaryPoints | ( | const vectorField & | controlPointsMovement, |
const labelList & | patchesToBeMoved | ||
) |
Boundary mesh movement based on given control point movement.
Definition at line 1483 of file NURBS3DVolume.C.
References coordinates(), DebugInfo, Foam::endl(), Foam::gMax(), Foam::mag(), Foam::foamVersion::patch, and tmp< T >::ref().
void setControlPoints | ( | const vectorField & | newCps | ) |
Set new control points.
New values should be on the coordinates system original CPs were defined
Definition at line 1536 of file NURBS3DVolume.C.
References Foam::exit(), Foam::FatalError, and FatalErrorInFunction.
void boundControlPointMovement | ( | vectorField & | controlPointsMovement | ) |
Bound control points movement in the boundary control points and in certain directions if needed
Definition at line 1550 of file NURBS3DVolume.C.
References forAll, and Foam::Zero.
Foam::scalar computeMaxBoundaryDisplacement | ( | const vectorField & | controlPointsMovement, |
const labelList & | patchesToBeMoved | ||
) |
Compute max. displacement at the boundary.
Definition at line 1573 of file NURBS3DVolume.C.
References coordinates(), Foam::mag(), Foam::max(), Foam::foamVersion::patch, Foam::reduce(), and Foam::Zero.
Foam::tmp< Foam::vectorField > getPointsInBox | ( | ) |
Get points of mesh which recide within the control points box
Definition at line 1622 of file NURBS3DVolume.C.
const Foam::labelList & getMap | ( | ) |
Get map of points in box to mesh points.
Definition at line 1637 of file NURBS3DVolume.C.
const Foam::labelList & getReverseMap | ( | ) |
Get map of mesh points to points in box. Return -1 if point is outside the box
Definition at line 1648 of file NURBS3DVolume.C.
const Foam::pointVectorField & getParametricCoordinates | ( | ) |
Get parametric coordinates.
Definition at line 1659 of file NURBS3DVolume.C.
Foam::tmp< Foam::pointTensorField > getDxDb | ( | const label | cpI | ) |
Get dxCartesiandb for a certain control point.
Definition at line 1677 of file NURBS3DVolume.C.
References Foam::dimless, MeshObject< polyMesh, UpdateableMeshObject, pointMesh >::New(), IOobject::NO_READ, IOobject::NO_WRITE, tmp< T >::ref(), and Foam::Zero.
Foam::tmp< Foam::volTensorField > getDxCellsDb | ( | const label | cpI | ) |
Get dxCartesiandb for a certain control point on cells.
Definition at line 1721 of file NURBS3DVolume.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryFieldRef(), deltaBoundary::cellCenters_d(), GeometricField< Type, PatchField, GeoMesh >::correctBoundaryConditions(), Foam::dimless, forAll, IOobject::NO_READ, IOobject::NO_WRITE, Foam::foamVersion::patch, tmp< T >::ref(), and Foam::Zero.
Foam::label nUSymmetry | ( | ) | const |
Get number of variables if CPs are moved symmetrically in U.
Definition at line 1789 of file NURBS3DVolume.C.
Foam::label nVSymmetry | ( | ) | const |
Get number of variables if CPs are moved symmetrically in V.
Definition at line 1804 of file NURBS3DVolume.C.
Foam::label nWSymmetry | ( | ) | const |
Get number of variables if CPs are moved symmetrically in W.
Definition at line 1819 of file NURBS3DVolume.C.
|
inline |
|
inline |
Which control points are active?
A control point is active if at least one component can move
Definition at line 40 of file NURBS3DVolumeI.H.
|
inline |
Which design variables are active?
Numbering is (X1,Y1,Z1), (X2,Y2,Z2) ...
Definition at line 47 of file NURBS3DVolumeI.H.
|
inline |
Get control points.
Definition at line 53 of file NURBS3DVolumeI.H.
|
inline |
Get confine movements.
Definition at line 59 of file NURBS3DVolumeI.H.
|
inline |
Definition at line 65 of file NURBS3DVolumeI.H.
|
inline |
Definition at line 71 of file NURBS3DVolumeI.H.
|
inline |
Get basis functions.
Definition at line 77 of file NURBS3DVolumeI.H.
|
inline |
Definition at line 83 of file NURBS3DVolumeI.H.
|
inline |
Definition at line 89 of file NURBS3DVolumeI.H.
void writeCps | ( | const string | fileName = "cpsFile" | ) | const |
Write control points on a cartesian coordinates system for visualization
Definition at line 1834 of file NURBS3DVolume.C.
References Foam::endl(), forAll, Foam::Info, UPstream::master(), and Foam::Zero.
void writeCpsInDict | ( | ) | const |
Write control points on the local coordinate system.
For continuation
Definition at line 1876 of file NURBS3DVolume.C.
References dictionary::add(), IOstreamOption::ASCII, IOstreamOption::currentVersion, UPstream::master(), IOobject::NO_READ, and IOobject::NO_WRITE.
void write | ( | ) | const |
Write parametric coordinates.
Definition at line 1911 of file NURBS3DVolume.C.
|
protected |
NURBS basis functions.
Definition at line 80 of file NURBS3DVolume.H.
|
protected |
Definition at line 81 of file NURBS3DVolume.H.
Referenced by NURBS3DVolume::name().
|
protected |
Definition at line 82 of file NURBS3DVolume.H.
|
protected |
Definition at line 83 of file NURBS3DVolume.H.
|
protected |
Definition at line 84 of file NURBS3DVolume.H.
|
protected |
Max iterations for Newton-Raphson.
Definition at line 87 of file NURBS3DVolume.H.
|
protected |
Tolerance for Newton-Raphson.
Definition at line 90 of file NURBS3DVolume.H.
|
protected |
How many times to bound parametric coordinates until deciding it is outside the box
Definition at line 94 of file NURBS3DVolume.H.
|
protected |
The volumetric B-Splines control points.
Definition at line 97 of file NURBS3DVolume.H.
Referenced by NURBS3DVolume::findPointsInBox().
Map of points-in-box to mesh points.
Definition at line 100 of file NURBS3DVolume.H.
Referenced by NURBS3DVolume::findPointsInBox().
Map of mesh points to points-in-box.
Return -1 if point not whithin the box
Definition at line 104 of file NURBS3DVolume.H.
Referenced by NURBS3DVolume::findPointsInBox().
|
protected |
Parametric coordinates of pointsInBox.
Definition at line 107 of file NURBS3DVolume.H.
|
protected |
Coordinates in the local system for which CPs are defined.
Definition at line 110 of file NURBS3DVolume.H.
|
protected |
Confine movement in certain directions and control points. Refers to the local system
Definition at line 114 of file NURBS3DVolume.H.
|
protected |
Definition at line 116 of file NURBS3DVolume.H.
|
protected |
Definition at line 118 of file NURBS3DVolume.H.
|
protected |
Definition at line 120 of file NURBS3DVolume.H.
|
protected |
Which movement components to freeze in each plane.
Definition at line 123 of file NURBS3DVolume.H.
|
protected |
Definition at line 125 of file NURBS3DVolume.H.
|
protected |
Definition at line 127 of file NURBS3DVolume.H.
|
protected |
Definition at line 129 of file NURBS3DVolume.H.
|
protected |
Definition at line 131 of file NURBS3DVolume.H.
|
protected |
Definition at line 133 of file NURBS3DVolume.H.
|
protected |
Which of the cps are moved in an optimisation.
Definition at line 136 of file NURBS3DVolume.H.
|
protected |
Which design variables are changed in an optimisation.
Definition at line 139 of file NURBS3DVolume.H.
|
protected |
Folder to store control points.
Definition at line 142 of file NURBS3DVolume.H.
|
protected |
Read parametric coordinates from file if present in the folder.
Definition at line 145 of file NURBS3DVolume.H.