rigidBodyPropellerDisk.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "rigidBodyPropellerDisk.H"
28 #include "motionSolver.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace fv
36 {
39  (
40  fvModel,
43  );
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
49 
51 {
53 
54  if (!dict.found("centre"))
55  {
57  << "Required entry 'centre' not found"
58  << exit(FatalIOError);
59  }
60 
61  dict.lookup("body") >> body_;
62  bodyID_ = motion_.bodyIndex(body_);
63 }
64 
65 
67 {
68  return motion_.p(bodyID_, centre_);
69 }
70 
71 
73 {
74  return motion_.d(bodyID_, normal_);
75 }
76 
77 
78 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
79 
81 (
82  const word& name,
83  const word& modelType,
84  const fvMesh& mesh,
85  const dictionary& dict
86 )
87 :
88  propellerDisk(name, modelType, mesh, dict),
89  motion_
90  (
91  refCast<const RBD::rigidBodyMotion>
92  (
93  refCast<const fvMeshMovers::motionSolver>(mesh.mover()).motion()
94  )
95  )
96 {
98 }
99 
100 
101 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
label bodyIndex(const word &name) const
Return the ID of the body with the given name.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
Finite volume model abstract base class.
Definition: fvModel.H:60
static const dictionary & coeffs(const word &modelType, const dictionary &)
Return the coefficients sub-dictionary for a given model type.
Definition: fvModelI.H:31
Disk momentum source which approximates a propeller based on a given propeller curve.
virtual void readCoeffs(const dictionary &dict)
Read the model coefficients.
Definition: propellerDisk.C:48
Disk momentum source derived from Foam::fv::propellerDisk with support for motion of the body the pro...
virtual void readCoeffs(const dictionary &dict)
Read the model coefficients.
virtual vector centre() const
Return the current propeller centre.
virtual vector normal() const
Return the current propeller normal.
rigidBodyPropellerDisk(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
Virtual base class for mesh motion solver.
Definition: motionSolver.H:57
A class for handling words, derived from string.
Definition: word.H:62
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:346
addToRunTimeSelectionTable(fvConstraint, bound, dictionary)
defineTypeNameAndDebug(bound, 0)
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:134
IOerror FatalIOError
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
labelList fv(nPoints)
dictionary dict