Loading...
Searching...
No Matches
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\*---------------------------------------------------------------------------*/
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,
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// ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ MUST_READ
Reading required.
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const Time & time() const noexcept
Return Time associated with the objectRegistry.
Definition IOobject.C:456
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Virtual base class for displacement motion solver.
pointVectorField & pointDisplacement() noexcept
Return reference to the point motion displacement field.
displacementMotionSolver(const displacementMotionSolver &)=delete
No copy construct.
pointVectorField pointDisplacement_
Point motion field.
static autoPtr< displacementMotionSolver > New(const word &solverTypeName, const polyMesh &, const IOdictionary &, const pointVectorField &pointDisplacement, const pointIOField &points0)
Select constructed from polyMesh, dictionary and components.
const polyMesh & mesh() const
Return reference to mesh.
Mesh representing a set of points created from polyMesh.
Definition pointMesh.H:49
Virtual base class for displacement motion solvers, where the point motion is relative to a set of fi...
points0MotionSolver(const points0MotionSolver &)=delete
No copy construct.
pointField & points0() noexcept
Return reference to the reference ('0') pointField.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
dynamicFvMesh & mesh
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition error.H:637
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
word timeName
Definition getTimeIndex.H:3
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere).
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
vectorIOField pointIOField
pointIOField is a vectorIOField.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
#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, IOobject::NO_REGISTER)))