fvMeshMoversMotionSolver.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) 2021-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 
27 #include "motionSolver.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace fvMeshMovers
35 {
36  defineTypeNameAndDebug(motionSolver, 0);
37  addToRunTimeSelectionTable(fvMeshMover, motionSolver, fvMesh);
38 }
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
45 :
46  fvMeshMover(mesh),
47  motionPtr_(Foam::motionSolver::New("motionSolver", mesh, dict())),
48  velocityMotionCorrection_(mesh, dict())
49 {}
50 
51 
52 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
53 
55 {}
56 
57 
58 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
59 
61 {
62  return motionPtr_();
63 }
64 
65 
67 {
68  mesh().movePoints(motionPtr_->newPoints());
69  velocityMotionCorrection_.update();
70 
71  return true;
72 }
73 
74 
76 {
77  motionPtr_->topoChange(map);
78 }
79 
80 
82 {
83  motionPtr_->mapMesh(map);
84 }
85 
86 
88 (
89  const polyDistributionMap& map
90 )
91 {
92  motionPtr_->distribute(map);
93 }
94 
95 
97 {
98  if (write)
99  {
100  return motionPtr_->write();
101  }
102  else
103  {
104  return true;
105  }
106 }
107 
108 
109 // ************************************************************************* //
dictionary dict
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
virtual tmp< pointField > newPoints()
Provide new points for motion. Solves for motion.
Definition: motionSolver.C:115
motionSolver(fvMesh &mesh)
Construct from fvMesh.
Abstract base class for fvMesh movers.
Definition: fvMeshMover.H:52
virtual bool write() const
Optionally write motion state information for restart.
Definition: motionSolver.C:128
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
Virtual base class for mesh motion solver.
Definition: motionSolver.H:56
fvMesh & mesh
Macros for easy insertion into run-time selection tables.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
virtual void topoChange(const polyTopoChangeMap &)=0
Update local data for topology changes.
defineTypeNameAndDebug(none, 0)
virtual void mapMesh(const polyMeshMap &)=0
Update from another mesh using the given map.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
virtual bool update()
Update the mesh for both mesh motion and topology change.
virtual void distribute(const polyDistributionMap &)=0
Update corresponding to the given distribution map.
virtual bool write(const bool write=true) const
Write the motion solver state.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Definition: fvMesh.C:1065
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
fvMesh & mesh()
Return the fvMesh.
Definition: fvMeshMover.H:132
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
const Foam::motionSolver & motion() const
Return the motionSolver.
addToRunTimeSelectionTable(fvMeshMover, none, fvMesh)
Namespace for OpenFOAM.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.