codedFixedValueFvPatchField.H
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) 2011-2026 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 Class
25  Foam::codedFixedValueFvPatchField
26 
27 Description
28  Fixed value boundary condition evaluated from the code provided
29 
30  which is compiled, linked and executed automatically at run-time.
31 
32  The optional \c name entry specifies the name of the code generated from the
33  template, if not provided the it constructed as
34  <field name>_<patch name> for single region cases or
35  <region name>_<field name>_<patch name> for multi-region cases.
36 
37 Usage
38  Example:
39  \verbatim
40  <patchName>
41  {
42  type codedFixedValue;
43 
44  value uniform 0;
45 
46  name rampedFixedValue; // Optional name of generated code
47 
48  code
49  #{
50  operator==(min(10, 0.1*this->time().value()));
51  #};
52 
53  // codeInclude
54  //#{
55  // #include ".H"
56  //#};
57 
58  // codeOptions
59  //#{
60  // -I$(LIB_SRC)/finiteVolume/lnInclude
61  //#};
62  }
63  \endverbatim
64 
65 See also
66  Foam::codedBase
67  Foam::dynamicCode
68 
69 SourceFiles
70  codedFixedValueFvPatchField.C
71 
72 \*---------------------------------------------------------------------------*/
73 
74 #ifndef codedFixedValueFvPatchField_H
75 #define codedFixedValueFvPatchField_H
76 
78 #include "codedBase.H"
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 namespace Foam
83 {
84 
85 /*---------------------------------------------------------------------------*\
86  Class codedFixedValueFvPatchField Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 template<class Type>
91 :
92  public fixedValueFvPatchField<Type>,
93  public codedBase
94 {
95  // Private Data
96 
97  //- Keywords associated with source code
98  static const wordList codeKeys;
99 
100  //- Name of the dictionary variables in the source code
101  static const wordList codeDictVars;
102 
103  // Name of the code options template file
104  static const word codeOptions;
105 
106  // Names of the source files to compile
107  static const wordList compileFiles;
108 
109  // Names of the source files to copy (header files)
110  static const wordList copyFiles;
111 
112  mutable autoPtr<fvPatchField<Type>> redirectPatchFieldPtr_;
113 
114 
115 public:
116 
117  //- Runtime type information
118  TypeName("codedFixedValue");
119 
120 
121  // Constructors
122 
123  //- Construct from patch, internal field and dictionary
125  (
126  const fvPatch&,
128  const dictionary&
129  );
130 
131  //- Construct by mapping given codedFixedValueFvPatchField
132  // onto a new patch
134  (
136  const fvPatch&,
138  const fieldMapper&
139  );
140 
141 
142  //- Disallow copy without setting internal field reference
144  (
146  ) = delete;
147 
148  //- Copy constructor setting internal field reference
150  (
153  );
154 
155  //- Construct and return a clone setting internal field reference
157  (
159  ) const
160  {
161  return tmp<fvPatchField<Type>>
162  (
163  new codedFixedValueFvPatchField<Type>(*this, iF)
164  );
165  }
166 
167 
168  // Member Functions
169 
170  //- Get reference to the underlying patch
171  const fvPatchField<Type>& redirectPatchField() const;
172 
173  //- Update the coefficients associated with the patch field
174  virtual void updateCoeffs();
175 
176  //- Evaluate the patch field, sets Updated to false
177  virtual void evaluate
178  (
180  );
181 
182  //- Write
183  virtual void write(Ostream&) const;
184 
185 
186  // Member Operators
187 
188  //- Inherit assignment
190 };
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #ifdef NoRepository
201 #endif
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
commsTypes
Types of communications.
Definition: UPstream.H:65
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base class for coded functionObjects, fvModels, Function1, Function2.
Definition: codedBase.H:53
Fixed value boundary condition evaluated from the code provided.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field, sets Updated to false.
TypeName("codedFixedValue")
Runtime type information.
virtual void write(Ostream &) const
Write.
codedFixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, fvMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
const fvPatchField< Type > & redirectPatchField() const
Get reference to the underlying patch.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:90
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:215
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:58
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.