timeVaryingMappedFixedValueFvPatchField.C
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) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2015-2018 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
27\*---------------------------------------------------------------------------*/
28
30#include "Time.H"
31
32// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33
34template<class Type>
37(
38 const fvPatch& p,
40)
41:
42 fixedValueFvPatchField<Type>(p, iF),
43 uniformValue_()
44{}
45
46
47template<class Type>
50(
51 const fvPatch& p,
53 const dictionary& dict
54)
55:
56 fixedValueFvPatchField<Type>(p, iF, dict, false),
57 uniformValue_
58 (
59 new PatchFunction1Types::MappedFile<Type>
60 (
61 p.patch(),
62 "uniformValue",
63 dict,
64 iF.name(), // field table name
65 true // face values
66 )
67 )
68{
69 if (dict.found("value"))
70 {
72 }
73 else
74 {
75 // Note: we use evaluate() here to trigger updateCoeffs followed
76 // by re-setting of fvatchfield::updated_ flag. This is
77 // so if first use is in the next time step it retriggers
78 // a new update.
80 }
81}
82
83
84template<class Type>
87(
89 const fvPatch& p,
91 const fvPatchFieldMapper& mapper
92)
93:
94 fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
95 uniformValue_
96 (
97 new PatchFunction1Types::MappedFile<Type>
98 (
99 ptf.uniformValue_(),
100 p.patch()
101 )
102 )
103{}
104
105
106template<class Type>
109(
111)
112:
113 fixedValueFvPatchField<Type>(ptf),
114 uniformValue_
115 (
116 new PatchFunction1Types::MappedFile<Type>
117 (
118 ptf.uniformValue_(),
119 this->patch().patch()
120 )
121 )
122{}
123
124
125template<class Type>
128(
131)
132:
133 fixedValueFvPatchField<Type>(ptf, iF),
134 uniformValue_
135 (
136 new PatchFunction1Types::MappedFile<Type>
137 (
138 ptf.uniformValue_(),
139 this->patch().patch()
140 )
141 )
142{}
143
144
145// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
146
147template<class Type>
149(
150 const fvPatchFieldMapper& m
151)
152{
154 uniformValue_().autoMap(m);
155}
156
157
158template<class Type>
160(
161 const fvPatchField<Type>& ptf,
162 const labelList& addr
163)
164{
166
168 refCast<const timeVaryingMappedFixedValueFvPatchField<Type>>(ptf);
169
170 uniformValue_().rmap(tiptf.uniformValue_(), addr);
171}
172
173
174template<class Type>
176{
177 if (this->updated())
178 {
179 return;
180 }
181
182
183 const scalar t = this->db().time().timeOutputValue();
184 fvPatchField<Type>::operator==(uniformValue_->value(t));
185
186 if (debug)
187 {
188 Pout<< "updateCoeffs : set fixedValue to min:" << gMin(*this)
189 << " max:" << gMax(*this)
190 << " avg:" << gAverage(*this) << endl;
191 }
192
194}
195
196
197template<class Type>
199(
200 Ostream& os
201) const
202{
204 uniformValue_->writeData(os);
205 this->writeEntry("value", os);
206}
207
208
209// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type.
Definition: Field.H:82
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
void rmap(const atmBoundaryLayer &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Definition: dictionaryI.H:87
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
virtual bool write()
Write the output fields.
A FieldMapper for finite-volume patch fields.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:82
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field, sets Updated to false.
Definition: fvPatchField.C:345
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
friend bool operator==(const refineCell &rc1, const refineCell &rc2)
Definition: refineCell.H:97
This boundary conditions interpolates the values from a set of supplied points in space and time.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
Type gAverage(const FieldField< Field, Type > &f)
Type gMin(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Type gMax(const FieldField< Field, Type > &f)
dictionary dict