uniformInletOutletFvFieldSource.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 "DimensionedField.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class Type>
33 (
35  const dictionary& dict
36 )
37 :
38  fvFieldSource<Type>(iF, dict),
39  uniformInletValue_
40  (
41  Function1<Type>::New
42  (
43  "uniformInletValue",
44  this->db().time().userUnits(),
45  iF.dimensions(),
46  dict
47  )
48  )
49 {}
50 
51 
52 template<class Type>
54 (
57 )
58 :
59  fvFieldSource<Type>(field, iF),
60  uniformInletValue_(field.uniformInletValue_, false)
61 {}
62 
63 
64 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65 
66 template<class Type>
68 {}
69 
70 
71 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
72 
73 template<class Type>
76 (
77  const fvSource& model,
79 ) const
80 {
81  return
83  (
84  model.name() + ":" + this->internalField().name() + "SourceValue",
85  this->internalField().mesh(),
87  (
88  this->internalField().dimensions(),
89  uniformInletValue_->value(this->db().time().value())
90  )
91  );
92 }
93 
94 
95 template<class Type>
98 (
99  const fvSource& model,
100  const scalarField& source,
101  const labelUList& cells
102 ) const
103 {
104  return
106  (
107  new Field<Type>
108  (
109  source.size(),
110  uniformInletValue_->value(this->db().time().value())
111  )
112  );
113 }
114 
115 
116 template<class Type>
119 (
120  const fvSource& model,
122 ) const
123 {
124  return neg0(source);
125 }
126 
127 
128 template<class Type>
131 (
132  const fvSource& model,
133  const scalarField& source,
134  const labelUList& cells
135 ) const
136 {
137  return neg0(source);
138 }
139 
140 
141 template<class Type>
143 {
145  writeEntry
146  (
147  os,
148  this->db().time().userUnits(),
149  this->internalField().dimensions(),
150  uniformInletValue_()
151  );
152 }
153 
154 
155 // ************************************************************************* //
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,.
Run-time selectable general function of one variable.
Definition: Function1.H:125
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
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
virtual void write(Ostream &) const
Write.
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
A class for managing temporary objects.
Definition: tmp.H:55
This source condition provides a uniform fixed value when the source is positive, and the internal va...
uniformInletOutletFvFieldSource(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.
const cellShapeList & cells
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
Definition: dimensionSets.C:96
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
dimensionedScalar neg0(const dimensionedScalar &ds)
dictionary dict