cloudGravitationalPotentialEnergy.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) 2025-2026 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 
28 #include "shaped.H"
29 #include "massive.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace functionObjects
37 {
40  (
44  );
45 }
46 }
47 
48 
49 const Foam::word
51 
52 
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54 
57 (
58  const word& name,
59  const Time& runTime,
60  const dictionary& dict
61 )
62 :
64  g
65  (
67  (
68  mesh().time(),
69  "g",
71  )
72  )
73 {}
74 
75 
76 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
77 
80 {}
81 
82 
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
84 
87 {
88  return wordList::null();
89 }
90 
91 
93 {
95 }
96 
97 
99 {
100  const Foam::cloud& c = cloud();
101 
103  (
104  GPEName_,
105  isCloud<clouds::massive>()
106  ? cloud<clouds::massive>().m(c.mesh())*(-g & c.mesh().position())
107  : cloud<clouds::shaped>().v(c.mesh())*(-g & c.mesh().position())
108  );
109 
110  return true;
111 }
112 
113 
115 {
117 }
118 
119 
121 {
123 }
124 
125 
126 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A cloud is a collection of lagrangian particles.
Definition: cloud.H:61
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base-class for Time/database functionObjects.
Function to compute and write the gravitational potential energy field for a cloud.
cloudGravitationalPotentialEnergy(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual wordList fields() const
Return the list of fields required.
static const word GPEName_
The name of the gravitational potential energy field.
virtual bool clear()
Clear the gravitational potential energy.
virtual bool execute()
Calculate and store the gravitational potential energy.
virtual bool write()
Write the gravitational potential energy.
Base class for function objects that refer to a LagrangianMesh and a cloud. Used, for example,...
Function object that solves for the evolution of a cloud. Only provides one-way coupling with a finit...
ObjectType & store(const tmp< ObjectType > &tfield)
Store the given field in the objectRegistry.
bool writeObject(const word &fieldName)
Write field if present in objectRegistry.
bool clearObject(const word &fieldName)
Clear field from the objectRegistry if present.
Writes run time, CPU time and clock time and optionally the CPU and clock times per time step.
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const dimensionedScalar c
Speed of light in a vacuum.
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
addToRunTimeSelectionTable(functionObject, fvModel, dictionary)
Namespace for OpenFOAM.
const dimensionSet & dimAcceleration
Definition: dimensions.C:287
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
const UniformDimensionedField< Type > & lookupUniformDimensionedField(const objectRegistry &db, const word &name, const dimensionSet dims)
dictionary dict