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-2022 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"
27 #include "polyMesh.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(motionSolverList, 0);
36  (
37  motionSolver,
38  motionSolverList,
39  dictionary
40  );
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
47 (
48  const word& name,
49  const polyMesh& mesh,
50  const dictionary& dict
51 )
52 :
53  motionSolver(name, mesh, dict, typeName)
54 {
55  const dictionary& solversDict = dict.subDict("solvers");
56 
57  forAllConstIter(dictionary, solversDict, iter)
58  {
59  if (iter().isDict())
60  {
61  const word& name = iter().keyword();
62  const dictionary& dict = iter().dict();
63 
64  motionSolvers_.insert
65  (
66  name,
67  motionSolver::New(name, mesh, dict).ptr()
68  );
69  }
70  }
71 }
72 
73 
74 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
75 
77 {}
78 
79 
80 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 
83 {
84  if (motionSolvers_.size())
85  {
86  // Accumulated displacement
87  pointField disp(mesh().nPoints(), Zero);
88 
89  forAllConstIter(PtrDictionary<motionSolver>, motionSolvers_, iter)
90  {
91  disp += iter().curPoints() - mesh().points();
92  }
93 
94  return mesh().points() + disp;
95  }
96  else
97  {
98  return mesh().points();
99  }
100 }
101 
102 
104 {
105  forAllIter(PtrDictionary<motionSolver>, motionSolvers_, iter)
106  {
107  iter().solve();
108  }
109 }
110 
111 
113 {
114  forAllIter(PtrDictionary<motionSolver>, motionSolvers_, iter)
115  {
116  iter().topoChange(map);
117  }
118 }
119 
120 
122 {
123  forAllIter(PtrDictionary<motionSolver>, motionSolvers_, iter)
124  {
125  iter().mapMesh(map);
126  }
127 }
128 
129 
131 (
132  const polyDistributionMap& map
133 )
134 {
135  forAllIter(PtrDictionary<motionSolver>, motionSolvers_, iter)
136  {
137  iter().distribute(map);
138  }
139 }
140 
141 
143 {
144  forAllIter(PtrDictionary<motionSolver>, motionSolvers_, iter)
145  {
146  iter().movePoints(points);
147  }
148 }
149 
150 
151 // ************************************************************************* //
Template dictionary class which manages the storage associated with it.
Definition: PtrDictionary.H:53
virtual ~motionSolverList()
Destructor.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
virtual void solve()
Solve for motion.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:477
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:459
Virtual base class for mesh motion solver.
Definition: motionSolver.H:56
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
fvMesh & mesh
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Macros for easy insertion into run-time selection tables.
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1211
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:1002
motionSolverList(const word &name, const polyMesh &, const dictionary &)
Construct from mesh and dictionary.
const pointField & points
A class for handling words, derived from string.
Definition: word.H:59
label nPoints
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
static const zero Zero
Definition: zero.H:97
virtual void topoChange(const polyTopoChangeMap &)
Update local data for topology changes.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
virtual tmp< pointField > curPoints() const
Provide current points for motion. Uses current motion field.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
A class for managing temporary objects.
Definition: PtrList.H:53
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
static autoPtr< motionSolver > New(const word &name, const polyMesh &, const dictionary &)
Select constructed from polyMesh and dictionary.
Definition: motionSolver.C:66
Namespace for OpenFOAM.