movingForces.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 "movingForces.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace functionObjects
34 {
36 
38 }
39 }
40 
41 
42 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
43 
45 {
46  return CofR_->value(time_.value());
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
53 (
54  const word& name,
55  const Time& runTime,
56  const dictionary& dict
57 )
58 :
59  forcesBase(name, runTime, dict)
60 {
61  read(dict);
62 }
63 
64 
66 (
67  const word& name,
68  const objectRegistry& obr,
69  const dictionary& dict
70 )
71 :
72  forcesBase(name, obr, dict)
73 {
74  read(dict);
75 }
76 
77 
78 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
79 
81 {}
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
87 {
89 
90  // Centre of rotation for moment calculations
91  CofR_ = Function1<vector>::New("CofR", time_.userUnits(), dimLength, dict);
92 
93  return true;
94 }
95 
96 
97 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
static autoPtr< Function1< Type > > New(const word &name, const Function1s::unitConversions &units, const dictionary &dict)
Select from dictionary.
Definition: Function1New.C:32
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
const Type & value() const
Return const reference to value.
Abstract base-class for Time/database functionObjects.
const Time & time_
Reference to time.
Calculates the forces and moments by integrating the pressure and skin-friction forces over a given l...
Definition: forcesBase.H:64
virtual bool read(const dictionary &)
Read the forces data.
Definition: forcesBase.C:653
Calculates the forces and moments by integrating the pressure and skin-friction forces over a given l...
Definition: movingForces.H:195
virtual ~movingForces()
Destructor.
Definition: movingForces.C:80
movingForces(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: movingForces.C:53
autoPtr< Function1< vector > > CofR_
Centre of rotation.
Definition: movingForces.H:202
virtual vector CofR() const
Return the current centre of the rigid body.
Definition: movingForces.C:44
virtual bool read(const dictionary &)
Read the forces data.
Definition: movingForces.C:86
Registry of regIOobjects.
A class for handling words, derived from string.
Definition: word.H:62
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
Namespace for OpenFOAM.
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
const dimensionSet dimLength
dictionary dict