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 :
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  (
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.
79  this->evaluate(Pstream::commsTypes::blocking);
80  }
81 }
82 
83 
84 template<class Type>
87 (
89  const fvPatch& p,
91  const fvPatchFieldMapper& mapper
92 )
93 :
94  fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
95  uniformValue_
96  (
98  (
99  ptf.uniformValue_(),
100  p.patch()
101  )
102  )
103 {}
104 
105 
106 template<class Type>
109 (
111 )
112 :
114  uniformValue_
115  (
117  (
118  ptf.uniformValue_(),
119  this->patch().patch()
120  )
121  )
122 {}
123 
124 
125 template<class Type>
128 (
131 )
132 :
134  uniformValue_
135  (
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  }
192 
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 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::timeVaryingMappedFixedValueFvPatchField::rmap
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: timeVaryingMappedFixedValueFvPatchField.C:160
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::gAverage
Type gAverage(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:604
Foam::timeVaryingMappedFixedValueFvPatchField
This boundary conditions interpolates the values from a set of supplied points in space and time.
Definition: timeVaryingMappedFixedValueFvPatchField.H:127
Foam::timeVaryingMappedFixedValueFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: timeVaryingMappedFixedValueFvPatchField.C:199
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::Pout
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Foam::fixedValueFvPatchField
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Definition: fixedValueFvPatchField.H:80
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::timeVaryingMappedFixedValueFvPatchField::timeVaryingMappedFixedValueFvPatchField
timeVaryingMappedFixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: timeVaryingMappedFixedValueFvPatchField.C:37
Foam::timeVaryingMappedFixedValueFvPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: timeVaryingMappedFixedValueFvPatchField.C:175
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
timeVaryingMappedFixedValueFvPatchField.H
Foam::PatchFunction1Types::MappedFile
Patch value mapping from a set of values stored in a file and a set of unstructured points using the ...
Definition: MappedFile.H:129
Time.H
Foam::timeVaryingMappedFixedValueFvPatchField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: timeVaryingMappedFixedValueFvPatchField.C:149
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::List< label >
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:36
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::gMin
Type gMin(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:593
Foam::gMax
Type gMax(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:592
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::stringOps::evaluate
string evaluate(label fieldWidth, const std::string &s, size_t pos=0, size_t len=std::string::npos)
String evaluation with specified (positive, non-zero) field width.
Definition: stringOpsEvaluate.C:37