carrierLagrangianFieldSource.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 
27 #include "carried.H"
28 #include "volFields.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class Type>
35 (
36  const regIOobject& iIo
37 )
38 :
39  LagrangianFieldSource<Type>(iIo),
41  fieldcName_(iIo.name())
42 {}
43 
44 
45 template<class Type>
47 (
48  const regIOobject& iIo,
49  const dictionary& dict
50 )
51 :
52  LagrangianFieldSource<Type>(iIo, dict),
54  fieldcName_(dict.lookupOrDefault<word>("fieldc", iIo.name()))
55 {}
56 
57 
58 template<class Type>
60 (
61  const carrierLagrangianFieldSource& field,
62  const regIOobject& iIo
63 )
64 :
65  LagrangianFieldSource<Type>(field, iIo),
67  fieldcName_(field.fieldcName_)
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
72 
73 template<class Type>
75 {}
76 
77 
78 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
79 
80 template<class Type>
83 (
84  const LagrangianInjection& injection,
85  const LagrangianSubMesh& subMesh
86 ) const
87 {
88  return value(subMesh);
89 }
90 
91 
92 template<class Type>
95 (
96  const LagrangianSubMesh& subMesh
97 ) const
98 {
99  return
100  this->template cloud<clouds::carried>().carrierField
101  (
102  subMesh.mesh().poly().lookupObject<VolField<Type>>(fieldcName_)
103  )(subMesh);
104 }
105 
106 
107 template<class Type>
109 (
110  Ostream& os
111 ) const
112 {
114 
115  writeEntryIfDifferent<word>
116  (
117  os,
118  "fieldc",
119  this->internalName(),
120  fieldcName_
121  );
122 }
123 
124 
125 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
Base class for Lagrangian source conditions.
virtual void write(Ostream &) const
Write.
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
const polyMesh & poly() const
Access the poly mesh.
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
const LagrangianMesh & mesh() const
Return the mesh.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
This source condition creates a Lagrangian value interpolated from a given carrier field....
virtual void write(Ostream &) const
Write.
virtual tmp< LagrangianSubField< Type > > value(const LagrangianInjection &, const LagrangianSubMesh &) const
Return the value for an instantaneous injection.
carrierLagrangianFieldSource(const regIOobject &)
Construct from internal field.
Mix-in for source conditions that refer to a cloud.
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
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
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dictionary dict