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 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 "coupled.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class Type>
34 (
35  const regIOobject& iIo,
36  const dictionary& dict
37 )
38 :
39  LagrangianFieldSource<Type>(iIo, dict),
40  CloudLagrangianFieldSource<Type>(*this),
41  fieldcName_(dict.lookupOrDefault<word>("fieldc", iIo.name()))
42 {}
43 
44 
45 template<class Type>
47 (
48  const carrierLagrangianFieldSource& field,
49  const regIOobject& iIo
50 )
51 :
52  LagrangianFieldSource<Type>(field, iIo),
53  CloudLagrangianFieldSource<Type>(*this),
54  fieldcName_(field.fieldcName_)
55 {}
56 
57 
58 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
59 
60 template<class Type>
62 {}
63 
64 
65 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
66 
67 template<class Type>
70 (
71  const LagrangianInjection& injection,
72  const LagrangianSubMesh& subMesh
73 ) const
74 {
75  return
76  this->template cloud<clouds::coupled>(injection, subMesh).carrierField
77  (
78  subMesh.mesh().mesh().lookupObject<VolField<Type>>(fieldcName_)
79  )(subMesh);
80 }
81 
82 
83 template<class Type>
85 (
86  Ostream& os
87 ) const
88 {
90 
91  writeEntryIfDifferent<word>
92  (
93  os,
94  "fieldc",
95  this->internalField().name(),
96  fieldcName_
97  );
98 }
99 
100 
101 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Templated base class for source conditions that refer to a cloud. Not a source condition in itself....
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 & mesh() const
Access the 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.
carrierLagrangianFieldSource(const regIOobject &, const dictionary &dict)
Construct from internal field and dictionary.
virtual tmp< LagrangianSubField< Type > > value(const LagrangianInjection &, const LagrangianSubMesh &) const
Return the value for an instantaneous injection.
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
Definition: cloud.H:63
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:62
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dictionary dict