surfaceNormalFixedValueFvPatchVectorField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 #include "volFields.H"
29 #include "fvPatchFieldMapper.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
35 (
36  const fvPatch& p,
38 )
39 :
40  fixedValueFvPatchVectorField(p, iF),
41  refValue_(p.size())
42 {}
43 
44 
47 (
48  const fvPatch& p,
50  const dictionary& dict
51 )
52 :
53  fixedValueFvPatchVectorField(p, iF, dict, false),
54  refValue_("refValue", dict, p.size())
55 {
56  fvPatchVectorField::operator=(refValue_*patch().nf());
57 }
58 
59 
62 (
64  const fvPatch& p,
66  const fvPatchFieldMapper& mapper
67 )
68 :
69  fixedValueFvPatchVectorField(p, iF),
70  refValue_(mapper(ptf.refValue_))
71 {
72  // Note: calculate product only on ptf to avoid multiplication on
73  // unset values in reconstructPar.
74  fvPatchVectorField::operator=
75  (
76  mapper(ptf.refValue_*ptf.patch().nf())
77  );
78 }
79 
80 
83 (
86 )
87 :
88  fixedValueFvPatchVectorField(pivpvf, iF),
89  refValue_(pivpvf.refValue_)
90 {}
91 
92 
93 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
94 
96 (
97  const fvPatchFieldMapper& m
98 )
99 {
100  fixedValueFvPatchVectorField::autoMap(m);
101  m(refValue_, refValue_);
102 }
103 
104 
106 (
107  const fvPatchVectorField& ptf,
108  const labelList& addr
109 )
110 {
111  fixedValueFvPatchVectorField::rmap(ptf, addr);
112 
114  refCast<const surfaceNormalFixedValueFvPatchVectorField>(ptf);
115 
116  refValue_.rmap(tiptf.refValue_, addr);
117 }
118 
119 
121 (
122  const fvPatchVectorField& ptf
123 )
124 {
125  fixedValueFvPatchVectorField::reset(ptf);
126 
128  refCast<const surfaceNormalFixedValueFvPatchVectorField>(ptf);
129 
130  refValue_.reset(tiptf.refValue_);
131 }
132 
133 
135 {
136  if (updated())
137  {
138  return;
139  }
140 
141  fvPatchVectorField::operator=(refValue_*patch().nf());
143 }
144 
145 
147 {
149  writeEntry(os, "refValue", refValue_);
150 }
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 namespace Foam
156 {
158  (
161  );
162 }
163 
164 // ************************************************************************* //
surfaceNormalFixedValueFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:243
Macros for easy insertion into run-time selection tables.
Surface-normal fixed value vector boundary condition.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Foam::fvPatchFieldMapper.
virtual label size() const
Return size.
Definition: fvPatch.H:157
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:216
virtual void operator=(const UList< Type > &)
Definition: fvPatchField.C:258
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Namespace for OpenFOAM.