Loading...
Searching...
No Matches
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\*---------------------------------------------------------------------------*/
30#include "Time.H"
31
32// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33
34template<class Type>
37(
38 const fvPatch& p,
40)
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, IOobjectOption::NO_READ),
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 (!this->readValueEntry(dict))
70 {
71 // Note: we use evaluate() here to trigger updateCoeffs followed
72 // by re-setting of fvatchfield::updated_ flag. This is
73 // so if first use is in the next time step it retriggers
74 // a new update.
76 }
77}
78
79
80template<class Type>
83(
84 const timeVaryingMappedFixedValueFvPatchField<Type>& ptf,
85 const fvPatch& p,
86 const DimensionedField<Type, volMesh>& iF,
87 const fvPatchFieldMapper& mapper
88)
89:
90 fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
91 uniformValue_
92 (
93 new PatchFunction1Types::MappedFile<Type>
94 (
95 ptf.uniformValue_(),
97 )
98 )
99{}
100
101
102template<class Type>
105(
107)
108:
109 fixedValueFvPatchField<Type>(ptf),
110 uniformValue_
111 (
112 new PatchFunction1Types::MappedFile<Type>
113 (
114 ptf.uniformValue_(),
115 this->patch().patch()
116 )
117 )
118{}
119
120
121template<class Type>
124(
127)
128:
129 fixedValueFvPatchField<Type>(ptf, iF),
130 uniformValue_
131 (
132 new PatchFunction1Types::MappedFile<Type>
133 (
134 ptf.uniformValue_(),
135 this->patch().patch()
136 )
138{}
139
140
141// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
142
143template<class Type>
145(
146 const fvPatchFieldMapper& m
147)
150 uniformValue_().autoMap(m);
151}
152
153
154template<class Type>
156(
157 const fvPatchField<Type>& ptf,
158 const labelList& addr
159)
160{
162
165
166 uniformValue_().rmap(tiptf.uniformValue_(), addr);
167}
168
169
170template<class Type>
172{
173 if (this->updated())
174 {
175 return;
176 }
177
178
179 const scalar t = this->db().time().timeOutputValue();
180 fvPatchField<Type>::operator==(uniformValue_->value(t));
181
182 if (debug)
183 {
184 auto limits = gMinMax(*this);
185 auto avg = gAverage(*this);
186
187 Pout<< "updateCoeffs : set fixedValue to min:" << limits.min()
188 << " max:" << limits.max()
189 << " avg:" << avg << endl;
199 Ostream& os
200) const
201{
203 uniformValue_->writeData(os);
205}
206
207
208// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
@ buffered
"buffered" : (MPI_Bsend, MPI_Recv)
Definition UPstream.H:82
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
fixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
const objectRegistry & db() const
The associated objectRegistry.
const fvPatch & patch() const noexcept
Return the patch.
bool updated() const noexcept
True if the boundary condition has already been updated.
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...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void write(Ostream &) const
Write.
virtual void operator==(const fvPatchField< Type > &)
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
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.
bool readValueEntry(const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::LAZY_READ)
Read the "value" entry into *this.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field, sets updated() to false.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition fvPatch.H:71
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.
timeVaryingMappedFixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
volScalarField & p
auto limits
Definition setRDeltaT.H:186
OBJstream os(runTime.globalPath()/outputName)
Namespace for handling debugging switches.
Definition debug.C:45
Type gAverage(const FieldField< Field, Type > &f, const label comm)
The global arithmetic average of a FieldField.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Definition typeInfo.H:172
List< label > labelList
A List of labels.
Definition List.H:62
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
dictionary dict