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 -------------------------------------------------------------------------------
11 License
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 
34 template<class Type>
37 (
38  const fvPatch& p,
40 )
41 :
42  fixedValueFvPatchField<Type>(p, iF),
43  uniformValue_()
44 {}
45 
46 
47 template<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 
84 template<class Type>
87 (
88  const timeVaryingMappedFixedValueFvPatchField<Type>& ptf,
89  const fvPatch& p,
90  const DimensionedField<Type, volMesh>& iF,
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 
106 template<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 
125 template<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 
147 template<class Type>
149 (
150  const fvPatchFieldMapper& m
151 )
152 {
154  uniformValue_().autoMap(m);
155 }
156 
157 
158 template<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 
174 template<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  }
194 }
195 
196 
197 template<class Type>
199 (
200  Ostream& os
201 ) const
202 {
204  uniformValue_->writeData(os);
205  this->writeEntry("value", os);
206 }
207 
208 
209 // ************************************************************************* //
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
dictionary dict
"blocking" : (MPI_Bsend, MPI_Recv)
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: fvPatchField.C:197
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
Type gMin(const FieldField< Field, Type > &f)
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:487
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:68
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:333
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void operator==(const fvPatchField< Type > &)
Definition: fvPatchField.C:507
This boundary conditions interpolates the values from a set of supplied points in space and time...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:52
Generic templated field type.
Definition: Field.H:61
A FieldMapper for finite-volume patch fields.
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: fvPatchField.C:260
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
OBJstream os(runTime.globalPath()/outputName)
timeVaryingMappedFixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field, sets Updated to false.
Definition: fvPatchField.C:290
Type gAverage(const FieldField< Field, Type > &f)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:270
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
const std::string patch
OpenFOAM patch number as a std::string.
volScalarField & p
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.