cloudPosition.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 "cloudPosition.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace functionObjects
37 {
40 }
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
47 (
48  const word& name,
49  const Time& runTime,
50  const dictionary& dict
51 )
52 :
54  position_
55  (
56  IOobject
57  (
58  "position",
59  runTime.name(),
60  mesh(),
61  IOobject::NO_READ,
62  IOobject::AUTO_WRITE
63  ),
64  mesh().position()(),
65  wordList
66  (
67  mesh().boundary().size(),
68  calculatedLagrangianPatchVectorField::typeName
69  ),
70  wordList::null(),
71  cloud().LagrangianModels().modelTypeFieldSourceTypes
72  <
76  zeroLagrangianScalarFieldSource
77  >()
78  )
79 {}
80 
81 
82 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
83 
85 {}
86 
87 
88 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
89 
91 {
92  return wordList::null();
93 }
94 
95 
97 {
98  return true;
99 }
100 
101 
103 (
104  const LagrangianSubScalarField& deltaT,
105  const bool final
106 )
107 {
108  if (!final) return;
109 
110  const LagrangianSubMesh& subMesh = deltaT.mesh();
111 
112  LagrangianSubVectorSubField position(subMesh.sub(position_));
113 
114  position = mesh().position(subMesh);
115 }
116 
117 
119 (
121 )
122 {
123  const LagrangianSubMesh& subMesh = fraction.mesh();
124 
125  LagrangianSubVectorSubField position(subMesh.sub(position_));
126 
127  position = mesh().position(subMesh);
128 }
129 
130 
132 {
133  return true;
134 }
135 
136 
138 {
139  return true;
140 }
141 
142 
143 // ************************************************************************* //
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 GeoMesh & 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...
word sub(const word &fieldName) const
Return the name of a field 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.
Base class for function objects that refer to a LagrangianMesh and a cloud. Used, for example,...
Function to compute and write a position field for a cloud.
Definition: cloudPosition.H:80
virtual ~cloudPosition()
Destructor.
Definition: cloudPosition.C:84
virtual wordList fields() const
Return the list of fields required.
Definition: cloudPosition.C:90
virtual void postCrossFaces(const LagrangianSubScalarSubField &fraction)
Hook following face crossings of a specific sub-mesh.
virtual bool clear()
Clear the volumes.
cloudPosition(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: cloudPosition.C:47
virtual bool execute()
Calculate and store the volumes.
Definition: cloudPosition.C:96
virtual bool write()
Write the volumes.
virtual void calculate(const LagrangianSubScalarField &deltaT, const bool final)
Update the positions.
Function object that solves for the evolution of a cloud. Only provides one-way coupling with a finit...
This source condition provides a vector corresponding to the position.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
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)
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
addToRunTimeSelectionTable(functionObject, fvModel, dictionary)
point position(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label facei, const label faceTrii, const scalar stepFraction)
Return the position given the coordinates and tet topology.
Definition: trackingI.H:224
const unitSet fraction
Namespace for OpenFOAM.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
faceListList boundary(nPatches)
dictionary dict