1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
25 Foam::codedFixedValueFvPatchField
28 Constructs on-the-fly a new boundary condition (derived from
29 fixedValueFvPatchField) which is then used to evaluate.
37 redirectType rampedFixedValue; // name of generated bc
41 operator==(min(10, 0.1*this->db().time().value()));
51 // -I$(LIB_SRC)/finiteVolume/lnInclude
56 A special form is if the 'code' section is not supplied. In this case
57 the code gets read from a (runTimeModifiable!) dictionary system/codeDict
58 which would have a corresponding entry
65 operator==(min(10, 0.1*this->db().time().value()));
71 Foam::dynamicCode and Foam::functionEntries::codeStream
74 codedFixedValueFvPatchField.C
76 \*---------------------------------------------------------------------------*/
78 #ifndef codedFixedValueFvPatchField_H
79 #define codedFixedValueFvPatchField_H
81 #include "fixedValueFvPatchFields.H"
82 #include "codedBase.H"
84 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89 // Forward declaration of classes
91 class dynamicCodeContext;
94 /*---------------------------------------------------------------------------*\
95 Class codedFixedValueFvPatch Declaration
96 \*---------------------------------------------------------------------------*/
99 class codedFixedValueFvPatchField
101 public fixedValueFvPatchField<Type>,
106 //- Dictionary contents for the boundary condition
107 mutable dictionary dict_;
109 const word redirectType_;
111 mutable autoPtr<fvPatchField<Type> > redirectPatchFieldPtr_;
113 // Private Member Functions
115 const IOdictionary& dict() const;
117 //- Set the rewrite vars controlling the Type
118 static void setFieldTemplates(dynamicCode& dynCode);
120 //- get the loaded dynamic libraries
121 virtual dlLibraryTable& libs() const;
123 //- adapt the context for the current object
124 virtual void prepare(dynamicCode&, const dynamicCodeContext&) const;
126 // Return a description (type + name) for the output
127 virtual string description() const;
129 // Clear the ptr to the redirected object
130 virtual void clearRedirect() const;
132 // Get the dictionary to initialize the codeContext
133 virtual const dictionary& codeDict() const;
137 // Static data members
139 //- Name of the C code template to be used
140 static const word codeTemplateC;
142 //- Name of the H code template to be used
143 static const word codeTemplateH;
146 //- Runtime type information
147 TypeName("codedFixedValue");
152 //- Construct from patch and internal field
153 codedFixedValueFvPatchField
156 const DimensionedField<Type, volMesh>&
159 //- Construct from patch, internal field and dictionary
160 codedFixedValueFvPatchField
163 const DimensionedField<Type, volMesh>&,
167 //- Construct by mapping given codedFixedValueFvPatchField
169 codedFixedValueFvPatchField
171 const codedFixedValueFvPatchField<Type>&,
173 const DimensionedField<Type, volMesh>&,
174 const fvPatchFieldMapper&
177 //- Construct as copy
178 codedFixedValueFvPatchField
180 const codedFixedValueFvPatchField<Type>&
183 //- Construct and return a clone
184 virtual tmp<fvPatchField<Type> > clone() const
186 return tmp<fvPatchField<Type> >
188 new codedFixedValueFvPatchField<Type>(*this)
192 //- Construct as copy setting internal field reference
193 codedFixedValueFvPatchField
195 const codedFixedValueFvPatchField<Type>&,
196 const DimensionedField<Type, volMesh>&
199 //- Construct and return a clone setting internal field reference
200 virtual tmp<fvPatchField<Type> > clone
202 const DimensionedField<Type, volMesh>& iF
205 return tmp<fvPatchField<Type> >
207 new codedFixedValueFvPatchField<Type>(*this, iF)
216 //- Get reference to the underlying patch
217 const fvPatchField<Type>& redirectPatchField() const;
219 //- Update the coefficients associated with the patch field
220 virtual void updateCoeffs();
222 //- Evaluate the patch field, sets Updated to false
223 virtual void evaluate
225 const Pstream::commsTypes commsType=Pstream::blocking
229 virtual void write(Ostream&) const;
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 } // End namespace Foam
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 # include "codedFixedValueFvPatchField.C"
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 // ************************************************************************* //