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-------------------------------------------------------------------------------
11License
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
33namespace Foam
34{
37}
38
39
40// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41
43(
44 const polyMesh& mesh,
45 const IOdictionary& dict,
46 const word& type
47)
48:
50 pointDisplacement_
51 (
53 (
54 "pointDisplacement",
55 time().timeName(),
56 mesh,
57 IOobject::MUST_READ,
58 IOobject::AUTO_WRITE
59 ),
61 )
62{}
63
64
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,
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// ************************************************************************* //
A primitive field of type <T> with automated input and output.
Definition: IOField.H:58
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
dlLibraryTable & libs() const
Mutable access to the loaded dynamic libraries.
Definition: Time.H:510
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Virtual base class for displacement motion solver.
bool open(bool verbose=true)
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:290
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:55
Virtual base class for displacement motion solvers, where the point motion is relative to a set of fi...
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
dynamicFvMesh & mesh
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
word timeName
Definition: getTimeIndex.H:3
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
IOerror FatalIOError
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false)))