All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
motionSolverList.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "motionSolverList.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33  defineTypeNameAndDebug(motionSolverList, 0);
35  (
36  motionSolver,
37  motionSolverList,
38  dictionary
39  );
40 }
41 
42 
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 
46 (
47  const polyMesh& mesh,
48  const dictionary& dict
49 )
50 :
51  motionSolver(mesh, dict, typeName),
52  motionSolvers_
53  (
54  dict.lookup("solvers"),
55  motionSolver::iNew(mesh)
56  )
57 {}
58 
59 
60 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
61 
63 {}
64 
65 
66 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
67 
69 {
70  if (motionSolvers_.size())
71  {
72  // Accumulated displacement
73  pointField disp(motionSolvers_[0].curPoints() - mesh().points());
74 
75  for (label i = 1; i < motionSolvers_.size(); i++)
76  {
77  disp += motionSolvers_[i].curPoints() - mesh().points();
78  }
79 
80  return mesh().points() + disp;
81  }
82  else
83  {
84  return mesh().points();
85  }
86 }
87 
88 
90 {
91  forAll(motionSolvers_, i)
92  {
93  motionSolvers_[i].solve();
94  }
95 }
96 
97 
99 {
100  forAll(motionSolvers_, i)
101  {
102  motionSolvers_[i].movePoints(points);
103  }
104 }
105 
106 
108 {
109  forAll(motionSolvers_, i)
110  {
111  motionSolvers_[i].updateMesh(mpm);
112  }
113 }
114 
115 
116 // ************************************************************************* //
Class used for the construction of PtrLists of motionSolvers.
Definition: motionSolver.H:90
virtual ~motionSolverList()
Destructor.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
virtual void solve()
Solve for motion.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Virtual base class for mesh motion solver.
Definition: motionSolver.H:55
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Macros for easy insertion into run-time selection tables.
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1131
dynamicFvMesh & mesh
const pointField & points
motionSolverList(const polyMesh &, const dictionary &)
Construct from mesh and dictionary.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
virtual tmp< pointField > curPoints() const
Provide current points for motion. Uses current motion field.
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:844