dynamicMotionSolverFvMesh.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) 2011-2012 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
31 #include "motionSolver.H"
32 #include "volFields.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38  defineTypeNameAndDebug(dynamicMotionSolverFvMesh, 0);
40  (
41  dynamicFvMesh,
42  dynamicMotionSolverFvMesh,
43  IOobject
44  );
46  (
47  dynamicFvMesh,
48  dynamicMotionSolverFvMesh,
49  doInit
50  );
51 }
52 
53 
54 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
55 
56 Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh
57 (
58  const IOobject& io,
59  const bool doInit
60 )
61 :
62  dynamicFvMesh(io, doInit),
63  motionPtr_(nullptr)
64 {
65  if (doInit)
66  {
67  init(false); // do not initialise lower levels
68  }
69 }
70 
71 
72 bool Foam::dynamicMotionSolverFvMesh::init(const bool doInit)
73 {
74  if (doInit)
75  {
76  dynamicFvMesh::init(doInit);
77  }
78 
79  motionPtr_ = motionSolver::New(*this);
80  return true;
81 }
82 
83 
84 Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh
85 (
86  const IOobject& io,
88  faceList&& faces,
89  labelList&& allOwner,
90  labelList&& allNeighbour,
91  const bool syncPar
92 )
93 :
95  (
96  io,
97  std::move(points),
98  std::move(faces),
99  std::move(allOwner),
100  std::move(allNeighbour),
101  syncPar
102  ),
103  motionPtr_(motionSolver::New(*this))
104 {}
105 
106 
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
110 {
111  return *motionPtr_;
112 }
113 
114 
116 {
117  fvMesh::movePoints(motionPtr_->newPoints());
118 
119  volVectorField* Uptr = getObjectPtr<volVectorField>("U");
120 
121  if (Uptr)
122  {
124  }
125 
126  return true;
127 }
128 
129 
130 // ************************************************************************* //
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
virtual bool update()
Update the mesh for both mesh motion and topology change.
virtual bool movePoints()
Do what is necessary if the mesh has moved.
Virtual base class for mesh motion solver.
Definition: motionSolver.H:54
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
Definition: dynamicFvMesh.C:84
static autoPtr< motionSolver > New(const polyMesh &)
Select constructed from polyMesh.
Definition: motionSolver.C:143
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Macros for easy insertion into run-time selection tables.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
const pointField & points
defineTypeNameAndDebug(combustionModel, 0)
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Abstract base class for geometry and/or topology changing fvMesh.
Definition: dynamicFvMesh.H:74
const motionSolver & motion() const
Return the motionSolver.
void correctBoundaryConditions()
Correct boundary field.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:166
Namespace for OpenFOAM.