mappedFieldFvPatchField.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-2018 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "volFields.H"
30 #include "interpolationCell.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class Type>
36 (
37  const fvPatch& p,
39 )
40 :
42  mappedPatchBase(p.patch()),
43  mappedPatchFieldBase<Type>(*this, *this)
44 {}
45 
46 
47 template<class Type>
49 (
50  const fvPatch& p,
52  const dictionary& dict
53 )
54 :
56  mappedPatchBase(p.patch(), dict),
57  mappedPatchFieldBase<Type>(*this, *this, dict, *this)
58 {}
59 
60 
61 template<class Type>
63 (
65  const fvPatch& p,
67  const fvPatchFieldMapper& mapper
68 )
69 :
70  fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
71  mappedPatchBase(p.patch(), ptf),
72  mappedPatchFieldBase<Type>(*this, *this, ptf)
73 {}
74 
75 
76 template<class Type>
78 (
79  const fvPatch& p,
81 
82  // mappedPatchBase
83  const word& sampleRegion,
84  const sampleMode sampleMode,
85  const word& samplePatch,
86  const scalar distance,
87 
88  // My settings
89  const word& fieldName,
90  const bool setAverage,
91  const Type average,
92  const word& interpolationScheme
93 )
94 :
97  (
98  p.patch(),
99  sampleRegion,
100  sampleMode,
101  samplePatch,
102  distance
103  ),
105  (
106  *this,
107  *this,
108  fieldName,
109  setAverage,
110  average,
111  interpolationScheme
112  )
113 {}
114 
115 
116 template<class Type>
118 (
120 )
121 :
123  mappedPatchBase(ptf.patch().patch(), ptf),
125 {}
126 
127 
128 template<class Type>
130 (
133 )
134 :
136  mappedPatchBase(ptf.patch().patch(), ptf),
137  mappedPatchFieldBase<Type>(*this, *this, ptf)
138 {}
139 
140 
141 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
142 
143 template<class Type>
145 (
146  const fvPatchFieldMapper& m
147 )
148 {
150  mappedPatchBase::clearOut();
151 }
152 
153 
154 template<class Type>
156 (
157  const fvPatchField<Type>& ptf,
158  const labelList& addr
159 )
160 {
162  mappedPatchBase::clearOut();
163 }
164 
165 
166 template<class Type>
168 {
169  if (this->updated())
170  {
171  return;
172  }
173 
174  this->operator==(this->mappedField());
175 
176  if (debug)
177  {
178  Info<< "operating on field:" << this->internalField().name()
179  << " patch:" << this->patch().name()
180  << " avg:" << gAverage(*this)
181  << " min:" << gMin(*this)
182  << " max:" << gMax(*this)
183  << endl;
184  }
185 
187 }
188 
189 
190 template<class Type>
192 {
196  this->writeEntry("value", os);
197 }
198 
199 
200 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
volFields.H
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::mappedFieldFvPatchField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: mappedFieldFvPatchField.C:145
Foam::gAverage
Type gAverage(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:604
interpolationCell.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::mappedFieldFvPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: mappedFieldFvPatchField.C:167
Foam::mappedPatchBase
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
Definition: mappedPatchBase.H:112
Foam::fixedValueFvPatchField
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Definition: fixedValueFvPatchField.H:80
mappedFieldFvPatchField.H
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::fac::average
tmp< GeometricField< Type, faPatchField, areaMesh > > average(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Area-weighted average a edgeField creating a areaField.
Definition: facAverage.C:47
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::mappedPatchFieldBase
Functionality for sampling fields using mappedPatchBase. Every call to mappedField() returns a sample...
Definition: mappedPatchFieldBase.H:105
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)
Foam::distance
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
Foam::mappedFieldFvPatchField
This boundary condition provides a self-contained version of the mapped condition....
Definition: mappedFieldFvPatchField.H:114
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::mappedFieldFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: mappedFieldFvPatchField.C:191
Foam::fvPatchField::patch
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:357
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::mappedFieldFvPatchField::mappedFieldFvPatchField
mappedFieldFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: mappedFieldFvPatchField.C:36
Foam::mappedPatchBase::sampleMode
sampleMode
Mesh items to sample.
Definition: mappedPatchBase.H:119
Foam::gMax
Type gMax(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:592
Foam::mappedFieldFvPatchField::rmap
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: mappedFieldFvPatchField.C:156
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54