NaNFvFieldSource.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 "DimensionedField.H"
27 #include "NaNFvFieldSource.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class Type>
33 (
35  const dictionary& dict
36 )
37 :
38  fvFieldSource<Type>(iF, dict)
39 {}
40 
41 
42 template<class Type>
44 (
45  const NaNFvFieldSource<Type>& field,
47 )
48 :
49  fvFieldSource<Type>(field, iF)
50 {}
51 
52 
53 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
54 
55 template<class Type>
57 {}
58 
59 
60 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
61 
62 template<class Type>
65 (
66  const fvSource& model,
68 ) const
69 {
70  return
72  (
73  model.name() + ":" + this->internalField().name() + "SourceValue",
74  this->internalField().mesh(),
76  (
77  "NaN",
78  this->internalField().dimensions(),
80  )
81  );
82 }
83 
84 
85 template<class Type>
88 (
89  const fvSource& model,
90  const scalarField& source,
91  const labelUList& cells
92 ) const
93 {
94  return tmp<Field<Type>>(new Field<Type>(source.size(), pTraits<Type>::nan));
95 }
96 
97 
98 template<class Type>
101 (
102  const fvSource& model,
104 ) const
105 {
106  return
108  (
109  model.name() + ":" + this->internalField().name() + "InternalCoeff",
110  this->internalField().mesh(),
111  dimensionedScalar("NaN", dimless, NaN)
112  );
113 }
114 
115 
116 template<class Type>
119 (
120  const fvSource& model,
121  const scalarField& source,
122  const labelUList& cells
123 ) const
124 {
125  return tmp<scalarField>(new scalarField(source.size(), NaN));
126 }
127 
128 
129 // ************************************************************************* //
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
This source condition provides a NaN value.
virtual ~NaNFvFieldSource()
Destructor.
NaNFvFieldSource(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 list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Generic dimensioned Type class.
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
Traits class for primitives.
Definition: pTraits.H:53
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