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-2024 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 "fieldMapper.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
35 (
36  const fvPatch& p,
38  const dictionary& dict
39 )
40 :
41  fixedValueFvPatchVectorField(p, iF, dict, false),
42  refValue_("refValue", iF.dimensions(), dict, p.size())
43 {
44  fvPatchVectorField::operator=(refValue_*patch().nf());
45 }
46 
47 
50 (
52  const fvPatch& p,
54  const fieldMapper& mapper
55 )
56 :
57  fixedValueFvPatchVectorField(p, iF),
58  refValue_(mapper(ptf.refValue_))
59 {
60  // Note: calculate product only on ptf to avoid multiplication on
61  // unset values in reconstructPar.
63  (
64  mapper(ptf.refValue_*ptf.patch().nf())
65  );
66 }
67 
68 
71 (
74 )
75 :
76  fixedValueFvPatchVectorField(pivpvf, iF),
77  refValue_(pivpvf.refValue_)
78 {}
79 
80 
81 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82 
84 (
85  const fvPatchVectorField& ptf,
86  const fieldMapper& mapper
87 )
88 {
89  fixedValueFvPatchVectorField::map(ptf, mapper);
90 
92  refCast<const surfaceNormalFixedValueFvPatchVectorField>(ptf);
93 
94  mapper(refValue_, tiptf.refValue_);
95 }
96 
97 
99 (
100  const fvPatchVectorField& ptf
101 )
102 {
103  fixedValueFvPatchVectorField::reset(ptf);
104 
106  refCast<const surfaceNormalFixedValueFvPatchVectorField>(ptf);
107 
108  refValue_.reset(tiptf.refValue_);
109 }
110 
111 
113 {
114  if (updated())
115  {
116  return;
117  }
118 
119  fvPatchVectorField::operator=(refValue_*patch().nf());
121 }
122 
123 
125 {
127  writeEntry(os, "refValue", refValue_);
128 }
129 
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 namespace Foam
134 {
136  (
139  );
140 }
141 
142 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:229
friend Ostream & operator(Ostream &, const fvPatchField< Type > &)
virtual void operator=(const UList< Type > &)
Definition: fvPatchField.C:249
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:202
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Surface-normal fixed value vector boundary condition.
surfaceNormalFixedValueFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
virtual void map(const fvPatchVectorField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
Namespace for OpenFOAM.
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
Definition: dimensionSets.C:96
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
dictionary dict
volScalarField & p