cloudAge.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 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 "HashTable.H"
27 #include "cloudAge.H"
28 #include "cloud.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 namespace functionObjects
39 {
42 }
43 }
44 
45 
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 
49 (
50  const word& name,
51  const Time& runTime,
52  const dictionary& dict
53 )
54 :
56  age_
57  (
58  IOobject
59  (
60  "age",
61  runTime.name(),
62  mesh(),
63  IOobject::READ_IF_PRESENT,
64  IOobject::AUTO_WRITE
65  ),
66  mesh(),
67  dimensionedScalar(dimTime, scalar(0)),
68  wordList
69  (
70  mesh().boundary().size(),
71  calculatedLagrangianPatchScalarField::typeName
72  ),
73  wordList::null(),
74  cloud().LagrangianModels().modelTypeFieldSourceTypes
75  <
77  zeroLagrangianScalarFieldSource,
79  internalLagrangianScalarFieldSource
80  >()
81  )
82 {}
83 
84 
85 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
86 
88 {}
89 
90 
91 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
92 
94 {
95  return wordList::null();
96 }
97 
98 
100 {
101  return true;
102 }
103 
104 
106 (
107  const LagrangianSubScalarField& deltaT,
108  const bool final
109 )
110 {
111  if (!final) return;
112 
113  const LagrangianSubMesh& subMesh = deltaT.mesh();
114 
115  LagrangianSubScalarSubField age(subMesh.sub(age_));
116 
117  age = age + deltaT;
118 }
119 
120 
122 {
123  return true;
124 }
125 
126 
128 {
129  return true;
130 }
131 
132 
133 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const Mesh & mesh() const
Return mesh.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
List of Lagrangian models, constructed as a (Lagrangian) mesh object. Provides similar functions to t...
Base class for Lagrangian sources. Minimal wrapper over LagrangianModel that provides an interface to...
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
SubList< Type > sub(const List< Type > &list) const
Return a sub-list corresponding to this sub-mesh.
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 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.
Calculates and writes out the time taken for a particle to travel from an inlet to the location....
Definition: age.H:132
Function to compute and write an age field for a cloud.
Definition: cloudAge.H:80
virtual wordList fields() const
Return the list of fields required.
Definition: cloudAge.C:93
virtual ~cloudAge()
Destructor.
Definition: cloudAge.C:87
virtual bool clear()
Clear the volumes.
Definition: cloudAge.C:127
cloudAge(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: cloudAge.C:49
virtual bool execute()
Calculate and store the volumes.
Definition: cloudAge.C:99
virtual bool write()
Write the volumes.
Definition: cloudAge.C:121
virtual void calculate(const LagrangianSubScalarField &deltaT, const bool final)
Update the ages.
Definition: cloudAge.C:106
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...
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)
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
Namespace for OpenFOAM.
const dimensionSet dimTime
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
faceListList boundary(nPatches)
dictionary dict