displacementMotionSolver.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) 2012-2016 OpenFOAM Foundation
9  Copyright (C) 2016-2021 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 
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(displacementMotionSolver, 0);
36  defineRunTimeSelectionTable(displacementMotionSolver, displacement);
37 }
38 
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
42 Foam::displacementMotionSolver::displacementMotionSolver
43 (
44  const polyMesh& mesh,
45  const IOdictionary& dict,
46  const word& type
47 )
48 :
50  pointDisplacement_
51  (
52  IOobject
53  (
54  "pointDisplacement",
55  time().timeName(),
56  mesh,
57  IOobject::MUST_READ,
58  IOobject::AUTO_WRITE
59  ),
61  )
62 {}
63 
64 
65 Foam::displacementMotionSolver::displacementMotionSolver
66 (
67  const polyMesh& mesh,
68  const IOdictionary& dict,
69  const pointVectorField& pointDisplacement,
70  const pointIOField& points0,
71  const word& type
72 )
73 :
75  pointDisplacement_
76  (
77  IOobject(pointDisplacement, "pointDisplacement"),
78  pointDisplacement
79  )
80 {}
81 
82 
83 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
84 
87 (
88  const word& solverTypeName,
89  const polyMesh& mesh,
90  const IOdictionary& solverDict,
91  const pointVectorField& pointDisplacement,
92  const pointIOField& points0
93 )
94 {
95  Info<< "Selecting motion solver: " << solverTypeName << endl;
96 
97  mesh.time().libs().open
98  (
99  solverDict,
100  "motionSolverLibs",
101  displacementConstructorTablePtr_
102  );
103 
104  if (!displacementConstructorTablePtr_)
105  {
107  << "solver table is empty"
108  << exit(FatalError);
109  }
110 
111  auto* ctorPtr = displacementConstructorTable(solverTypeName);
112 
113  if (!ctorPtr)
114  {
116  (
117  solverDict,
118  "solver",
119  solverTypeName,
120  *displacementConstructorTablePtr_
121  ) << exit(FatalIOError);
122  }
123 
125  (
126  ctorPtr
127  (
128  mesh,
129  solverDict,
130  pointDisplacement,
131  points0
132  )
133  );
134 }
135 
136 
137 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
138 
140 {}
141 
142 
143 // ************************************************************************* //
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::points0MotionSolver
Virtual base class for displacement motion solvers, where the point motion is relative to a set of fi...
Definition: points0MotionSolver.H:57
Foam::displacementMotionSolver::New
static autoPtr< displacementMotionSolver > New(const word &solverTypeName, const polyMesh &, const IOdictionary &, const pointVectorField &pointDisplacement, const pointIOField &points0)
Select constructed from polyMesh, dictionary and components.
Definition: displacementMotionSolver.C:87
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::IOField
A primitive field of type <T> with automated input and output.
Definition: foamVtkLagrangianWriter.H:61
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::displacementMotionSolver::~displacementMotionSolver
virtual ~displacementMotionSolver()
Destructor.
Definition: displacementMotionSolver.C:139
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
timeName
word timeName
Definition: getTimeIndex.H:3
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
displacementMotionSolver.H
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::autoPtr< Foam::displacementMotionSolver >
points0
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false)))
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::roots::type
type
Types of root.
Definition: Roots.H:54
Foam::GeometricField< vector, pointPatchField, pointMesh >
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)