Loading...
Searching...
No Matches
codedFixedValuePointPatchField.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2012-2017 OpenFOAM Foundation
9 Copyright (C) 2019-2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::codedFixedValuePointPatchField
29
30Description
31 Constructs on-the-fly a new boundary condition (derived from
32 fixedValuePointPatchField) which is then used to evaluate.
33
34 The \c value entry (optional) is used for the initial values.
35 Otherwise the code is executed.
36
37 The code entries:
38 \plaintable
39 codeInclude | include files
40 codeOptions | compiler line: added to EXE_INC (Make/options)
41 codeLibs | linker line: added to LIB_LIBS (Make/options)
42 localCode | c++; local static functions
43 code | c++; patch value assignment
44 codeContext | additional dictionary context for the code
45 \endplaintable
46
47 Example:
48 \verbatim
49 movingWall
50 {
51 type codedFixedValue;
52 value uniform 0;
53 name rampedFixedValue; // name of generated bc
54
55 code
56 #{
57 operator==
58 (
59 vector(0,0,1) * min(10, 0.1*this->db().time().value())
60 );
61 #};
62
63 codeContext
64 {
65 ...
66 }
67
68 //codeInclude
69 //#{
70 // #include "fvCFD.H"
71 //#};
72
73 //codeOptions
74 //#{
75 // -I$(LIB_SRC)/finiteVolume/lnInclude
76 //#};
77 }
78 \endverbatim
79
80 A special form is if the \c code section is not supplied. In this case
81 the code gets read from a (runTimeModifiable!) dictionary system/codeDict
82 which would have a corresponding entry
83
84 \verbatim
85 rampedFixedValue
86 {
87 code
88 #{
89 operator==(min(10, 0.1*this->db().time().value()));
90 #};
91 }
92 \endverbatim
93
94Note
95 The code context dictionary can be supplied separately as the
96 \c codeContext entry.
97
98See also
99 codedFixedValueFvPatchField
100
101SourceFiles
102 codedFixedValuePointPatchField.C
103
104\*---------------------------------------------------------------------------*/
105
106#ifndef Foam_codedFixedValuePointPatchField_H
107#define Foam_codedFixedValuePointPatchField_H
108
110#include "codedBase.H"
111
112// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113
114namespace Foam
115{
116
117/*---------------------------------------------------------------------------*\
118 Class codedFixedValuePointPatchField Declaration
119\*---------------------------------------------------------------------------*/
120
121template<class Type>
123:
124 public fixedValuePointPatchField<Type>,
125 protected codedBase
126{
127 //- The parent boundary condition type
128 typedef fixedValuePointPatchField<Type> parent_bctype;
129
130
131 // Private Data
132
133 //- Dictionary contents for the boundary condition
134 dictionary dict_;
135
136 const word name_;
137
138 mutable autoPtr<pointPatchField<Type>> redirectPatchFieldPtr_;
139
140
141 // Private Member Functions
142
143 //- Mutable access to the loaded dynamic libraries
144 virtual dlLibraryTable& libs() const;
145
146 //- Description (type + name) for the output
147 virtual string description() const;
148
149 //- Clear redirected object(s)
150 virtual void clearRedirect() const;
151
152 //- Additional 'codeContext' dictionary to pass through
153 virtual const dictionary& codeContext() const;
154
155 //- The code dictionary. Inline "code" or from system/codeDict
156 virtual const dictionary& codeDict() const;
157
158 //- Adapt the context for the current object
159 virtual void prepare(dynamicCode&, const dynamicCodeContext&) const;
160
161
162public:
163
164 // Static Data Members
165
166 //- Name of the C code template to be used
167 static constexpr const char* const codeTemplateC
168 = "fixedValuePointPatchFieldTemplate.C";
169
170 //- Name of the H code template to be used
171 static constexpr const char* const codeTemplateH
172 = "fixedValuePointPatchFieldTemplate.H";
173
174
175 //- Runtime type information
176 TypeName("codedFixedValue");
177
178
179 // Constructors
180
181 //- Construct from patch and internal field
183 (
184 const pointPatch&,
186 );
187
188 //- Construct from patch, internal field and dictionary
190 (
191 const pointPatch&,
193 const dictionary&
194 );
195
196 //- Construct by mapping given codedFixedValuePointPatchField
197 // onto a new patch
199 (
201 const pointPatch&,
204 );
205
206 //- Construct as copy
208 (
210 );
211
212 //- Construct as copy setting internal field reference
214 (
217 );
218
219 //- Return a clone
220 virtual autoPtr<pointPatchField<Type>> clone() const
221 {
222 return pointPatchField<Type>::Clone(*this);
223 }
224
225 //- Construct and return a clone setting internal field reference
227 (
229 ) const
230 {
231 return pointPatchField<Type>::Clone(*this, iF);
232 }
233
234
235 // Member functions
236
237 //- Get reference to the underlying patch
239
240 //- Update the coefficients associated with the patch field
241 virtual void updateCoeffs();
242
243 //- Evaluate the patch field, sets updated() to false
244 virtual void evaluate
245 (
247 );
248
249 //- Write
250 virtual void write(Ostream&) const;
251};
252
253
254// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255
256} // End namespace Foam
257
258// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259
260#ifdef NoRepository
262#endif
263
264// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265
266#endif
267
268// ************************************************************************* //
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:59
commsTypes
Communications types.
Definition UPstream.H:81
@ buffered
"buffered" : (MPI_Bsend, MPI_Recv)
Definition UPstream.H:82
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Base class for function objects and boundary conditions using dynamic code that provides methods for ...
Definition codedBase.H:63
virtual void clearRedirect() const =0
codedBase(const codedBase &)=delete
No copy construct.
virtual dlLibraryTable & libs() const =0
Mutable access to the loaded dynamic libraries.
virtual string description() const =0
virtual const dictionary & codeDict() const =0
dynamicCodeContext & codeContext()
Access to the dynamic code context.
Definition codedBase.H:131
Constructs on-the-fly a new boundary condition (derived from fixedValuePointPatchField) which is then...
TypeName("codedFixedValue")
Runtime type information.
const pointPatchField< Type > & redirectPatchField() const
Get reference to the underlying patch.
virtual autoPtr< pointPatchField< Type > > clone(const DimensionedField< Type, pointMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
codedFixedValuePointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
static constexpr const char *const codeTemplateC
Name of the C code template to be used.
virtual autoPtr< pointPatchField< Type > > clone() const
Return a clone.
static constexpr const char *const codeTemplateH
Name of the H code template to be used.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field, sets updated() to false.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A table of dynamically loaded libraries.
Encapsulation of dynamic code dictionaries.
Tools for handling dynamic code compilation.
Definition dynamicCode.H:57
A FixedValue boundary condition for pointField.
fixedValuePointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
Foam::pointPatchFieldMapper.
Abstract base class for point-mesh patch fields.
static autoPtr< pointPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
pointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
Basic pointPatch represents a set of points from the mesh.
Definition pointPatch.H:67
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68