volumetricBSplinesMotionSolver.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2007-2020 PCOpt/NTUA
9  Copyright (C) 2013-2020 FOSS GP
10  Copyright (C) 2019 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 \*---------------------------------------------------------------------------*/
29 
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37  defineTypeNameAndDebug(volumetricBSplinesMotionSolver, 0);
38 
40  (
41  motionSolver,
42  volumetricBSplinesMotionSolver,
43  dictionary
44  );
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
50 Foam::volumetricBSplinesMotionSolver::volumetricBSplinesMotionSolver
51 (
52  const polyMesh& mesh,
53  const IOdictionary& dict
54 )
55 :
56  motionSolver(mesh, dict, typeName),
57  volBSplinesBase_
58  (
59  const_cast<volBSplinesBase&>
60  (
61  volBSplinesBase::New(refCast<fvMesh>(const_cast<polyMesh&>(mesh)))
62  )
63  ),
64  controlPointsMovement_
65  (
66  volBSplinesBase_.getTotalControlPointsNumber(),
67  Zero
68  )
69 {}
70 
71 
72 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
73 
76 {
77  tmp<vectorField> tPointMovement(new vectorField(mesh().points()));
78  vectorField& pointMovement = tPointMovement.ref();
79 
80  label pastControlPoints(0);
82  forAll(boxes, iNURB)
83  {
84  const label nb = boxes[iNURB].getControlPoints().size();
85  vectorField localControlPointsMovement(nb, Zero);
86 
87  forAll(localControlPointsMovement, iCP)
88  {
89  localControlPointsMovement[iCP] =
90  controlPointsMovement_[pastControlPoints + iCP];
91  }
92 
94  partialMovement
95  (
96  boxes[iNURB].computeNewPoints
97  (
98  localControlPointsMovement
99  )
100  );
101 
102  pointMovement += partialMovement() - mesh().points();
103 
104  pastControlPoints += nb;
105  }
106 
107  return tPointMovement;
108 }
109 
110 
112 {
113  // Do nothing
114 }
115 
116 
118 {
119  // Do nothing
120 }
121 
122 
124 {
125  // Do nothing
126 }
127 
128 
130 (
131  const vectorField& controlPointsMovement
132 )
133 {
134  if (controlPointsMovement_.size() != controlPointsMovement.size())
135  {
137  << "Attempting to replace controlPointsMovement with a set of "
138  << "different size"
139  << exit(FatalError);
140  }
141  controlPointsMovement_ = controlPointsMovement;
142 }
143 
144 
146 (
147  vectorField& controlPointsMovement
148 )
149 {
150  volBSplinesBase_.boundControlPointMovement(controlPointsMovement);
151 }
152 
153 
154 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::volumetricBSplinesMotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update the mesh corresponding to given map.
Definition: volumetricBSplinesMotionSolver.C:123
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::polyMesh::points
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1069
volumetricBSplinesMotionSolver.H
Foam::volumetricBSplinesMotionSolver::curPoints
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
Definition: volumetricBSplinesMotionSolver.C:75
Foam::volumetricBSplinesMotionSolver::controlPointsMovement_
vectorField controlPointsMovement_
Movement of the control points.
Definition: volumetricBSplinesMotionSolver.H:68
Foam::volBSplinesBase
Class constructing a number of volumetric B-Splines boxes, read from dynamicMeshDict....
Definition: volBSplinesBase.H:59
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::volumetricBSplinesMotionSolver::movePoints
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Definition: volumetricBSplinesMotionSolver.C:117
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:227
Foam::Field< vector >
Foam::volumetricBSplinesMotionSolver::setControlPointsMovement
void setControlPointsMovement(const vectorField &controlPointsMovement)
Set control points movement.
Definition: volumetricBSplinesMotionSolver.C:130
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::volBSplinesBase::boxesRef
PtrList< NURBS3DVolume > & boxesRef()
Get non-const reference to the vol. B-splines boxes.
Definition: volBSplinesBase.C:121
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::volumetricBSplinesMotionSolver::solve
virtual void solve()
Solve for motion/ Does nothing.
Definition: volumetricBSplinesMotionSolver.C:111
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::motionSolver
Virtual base class for mesh motion solver.
Definition: motionSolver.H:58
Foam::volumetricBSplinesMotionSolver::volBSplinesBase_
volBSplinesBase & volBSplinesBase_
Reference to the underlaying volumetric B-Splines base.
Definition: volumetricBSplinesMotionSolver.H:65
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::motionSolver::mesh
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:144
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::volumetricBSplinesMotionSolver::boundControlPointMovement
void boundControlPointMovement(vectorField &controlPointsMovement)
Bound control points movement.
Definition: volumetricBSplinesMotionSolver.C:146
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)