forces.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 "forces.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_;
47 }
48 
49 
51 {
52  writeHeaderValue(file, "CofR", CofR());
53 }
54 
55 
57 {}
58 
59 
61 {}
62 
63 
64 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
65 
67 (
68  const word& name,
69  const Time& runTime,
70  const dictionary& dict
71 )
72 :
73  forcesBase(name, runTime, dict),
74  CofR_(vector::zero)
75 {
76  read(dict);
77 }
78 
79 
81 (
82  const word& name,
83  const objectRegistry& obr,
84  const dictionary& dict
85 )
86 :
87  forcesBase(name, obr, dict),
88  CofR_(vector::zero)
89 {
90  read(dict);
91 }
92 
93 
94 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
95 
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
103 {
105 
106  // Centre of rotation for moment calculations
107  CofR_ = dict.lookup("CofR");
108 
109  return true;
110 }
111 
112 
113 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
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
Abstract base-class for Time/database functionObjects.
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: forces.H:188
virtual ~forces()
Destructor.
Definition: forces.C:96
virtual void writeCoRHeader(Ostream &file)
Do not write the constant centre of rotation.
Definition: forces.C:56
forces(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: forces.C:67
virtual void writeCoRValueHeader(Ostream &file)
Write the constant centre of rotation value in the header.
Definition: forces.C:50
vector CofR_
Centre of rotation.
Definition: forces.H:195
virtual vector CofR() const
Return the current centre of the rigid body.
Definition: forces.C:44
virtual void writeCofR(Ostream &file)
Do not write the constant centre of rotation.
Definition: forces.C:60
virtual bool read(const dictionary &)
Read the forces data.
Definition: forces.C:102
Registry of regIOobjects.
A class for handling words, derived from string.
Definition: word.H:62
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:50
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
dictionary dict