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 
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 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
108 
110 {}
111 
112 
113 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114 
116 {
117  return *motionPtr_;
118 }
119 
120 
122 {
123  // Scan through AMI patches and update
124 
125 
126  fvMesh::movePoints(motionPtr_->newPoints());
127 
128  volVectorField* Uptr = getObjectPtr<volVectorField>("U");
129 
130  if (Uptr)
131  {
132  Uptr->correctBoundaryConditions();
133  }
134 
135  return true;
136 }
137 
138 
139 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::motionSolver::New
static autoPtr< motionSolver > New(const polyMesh &)
Select constructed from polyMesh.
Definition: motionSolver.C:150
volFields.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
motionSolver.H
Foam::dynamicMotionSolverFvMesh::update
virtual bool update()
Update the mesh for both mesh motion and topology change.
Definition: dynamicMotionSolverFvMesh.C:121
Foam::dynamicMotionSolverFvMesh::init
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
Definition: dynamicMotionSolverFvMesh.C:72
Foam::dynamicFvMesh::init
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
Definition: dynamicFvMesh.C:90
Foam::dynamicFvMesh
Abstract base class for geometry and/or topology changing fvMesh.
Definition: dynamicFvMesh.H:78
Foam::dynamicMotionSolverFvMesh::motion
const motionSolver & motion() const
Return the motionSolver.
Definition: dynamicMotionSolverFvMesh.C:115
Foam::Field< vector >
init
mesh init(true)
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::surfaceInterpolation::movePoints
virtual bool movePoints()
Do what is necessary if the mesh has moved.
Definition: surfaceInterpolation.C:151
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::motionSolver
Virtual base class for mesh motion solver.
Definition: motionSolver.H:58
dynamicMotionSolverFvMesh.H
Foam::List< face >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::dynamicMotionSolverFvMesh::~dynamicMotionSolverFvMesh
~dynamicMotionSolverFvMesh()
Destructor.
Definition: dynamicMotionSolverFvMesh.C:109