internalFvFieldSource.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) 2023-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 "internalFvFieldSource.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Type>
32 (
34  const dictionary& dict
35 )
36 :
37  fvFieldSource<Type>(iF, dict)
38 {}
39 
40 
41 template<class Type>
43 (
44  const internalFvFieldSource<Type>& field,
46 )
47 :
48  fvFieldSource<Type>(field, iF)
49 {}
50 
51 
52 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
53 
54 template<class Type>
56 {}
57 
58 
59 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
60 
61 template<class Type>
64 (
65  const fvSource& model,
67 ) const
68 {
69  // This value doesn't matter in principle, as this condition takes 100% of
70  // its value from the internal field. However, this value does, at least,
71  // need to be physical to prevent things like thermo evaluations from
72  // failing. So, just take the internal values.
73  return this->internalField();
74 }
75 
76 
77 template<class Type>
80 (
81  const fvSource& model,
82  const scalarField& source,
83  const labelUList& cells
84 ) const
85 {
86  // This value doesn't matter in principle, as this condition takes 100% of
87  // its value from the internal field. However, this value does, at least,
88  // need to be physical to prevent things like thermo evaluations from
89  // failing. So, just take the internal values.
90  return tmp<Field<Type>>(new Field<Type>(this->internalField(), cells));
91 }
92 
93 
94 template<class Type>
97 (
98  const fvSource& model,
100 ) const
101 {
102  return
104  (
105  model.name() + ":" + this->internalField().name() + "InternalCoeff",
106  this->internalField().mesh(),
107  dimensionedScalar(dimless, scalar(1))
108  );
109 }
110 
111 
112 template<class Type>
115 (
116  const fvSource& model,
117  const scalarField& source,
118  const labelUList& cells
119 ) const
120 {
121  return tmp<scalarField>(new scalarField(source.size(), scalar(1)));
122 }
123 
124 
125 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Mesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Base class for finite-volume field sources.
Definition: fvFieldSource.H:62
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:57
Base class for finite volume sources.
Definition: fvSource.H:52
This source condition provides the internal value.
virtual ~internalFvFieldSource()
Destructor.
internalFvFieldSource(const DimensionedField< Type, volMesh > &, const dictionary &dict)
Construct from internal field and dictionary.
virtual tmp< DimensionedField< Type, volMesh > > sourceValue(const fvSource &model, const DimensionedField< scalar, volMesh > &source) const
Return the source value.
virtual tmp< DimensionedField< scalar, volMesh > > internalCoeff(const fvSource &model, const DimensionedField< scalar, volMesh > &source) const
Return the source value.
A class for managing temporary objects.
Definition: tmp.H:55
const cellShapeList & cells
const dimensionSet dimless
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dictionary dict