coupledTemplates.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 "coupled.H"
27 #include "CarrierField.H"
28 #include "CarrierEqn.H"
29 
30 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
31 
32 template<class Type>
34 (
35  const VolField<Type>& psi
36 ) const
37 {
38  return carrierField<Type, VolField<Type>>(psi);
39 }
40 
41 
42 template<class Type, class ... Args>
44 (
45  const Args& ... args
46 ) const
47 {
48  const CarrierField<Type>* lookupPtr =
49  carrierFields<Type>().lookupPtr(CarrierField<Type>(args ...).name());
50 
51  if (lookupPtr) return *lookupPtr;
52 
54  carrierFields<Type>().insert(ptr->name(), ptr);
55  return *ptr;
56 }
57 
58 
59 template<class Type>
61 (
62  const VolField<Type>& psi
63 )
64 {
65  CarrierEqn<Type>* lookupPtr =
66  carrierEqns<Type>().lookupPtr(psi.name());
67 
68  if (lookupPtr) return *lookupPtr;
69 
71  carrierEqns<Type>().insert(psi.name(), ptr);
72  return *ptr;
73 }
74 
75 
76 template<class Type>
78 (
79  const VolField<Type>& psi
80 ) const
81 {
82  return carrierEqns<Type>()[psi.name()];
83 }
84 
85 
86 template<class Type>
88 (
89  const CarrierField<Type>& psic
90 )
91 {
92  return carrierEqn(psic.psi());
93 }
94 
95 
96 template<class Type>
98 (
99  const CarrierField<Type>& psic
100 ) const
101 {
102  return carrierEqn(psic.psi());
103 }
104 
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Class to store the coefficients of a term in a carrier equation.
Definition: CarrierEqn.H:52
A field interpolated from the carrier to the cloud. Uses CloudDerivedField to provide flexible access...
Definition: CarrierField.H:57
const VolField< Type > & psi() const
Access the carrier field.
Definition: CarrierField.C:243
const word & name() const
Carrier field name.
Definition: CarrierField.C:255
Generic GeometricField class.
CarrierEqn< Type > & carrierEqn(const VolField< Type > &)
Add/get a carrier equation to/from the cache.
const CarrierField< Type > & carrierField(const VolField< Type > &) const
Add/get a carrier field to/from the cache.
const volScalarField & psi
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
Foam::argList args(argc, argv)