surfaceNormalFixedValueFvPatchVectorField.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-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2021 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 
31 #include "volFields.H"
32 #include "fvPatchFieldMapper.H"
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
38 (
39  const fvPatch& p,
41 )
42 :
43  fixedValueFvPatchVectorField(p, iF),
44  refValue_(p.size()),
45  ramp_(nullptr)
46 {}
47 
48 
51 (
52  const fvPatch& p,
54  const dictionary& dict
55 )
56 :
57  fixedValueFvPatchVectorField(p, iF, dict, false),
58  refValue_("refValue", dict, p.size()),
59  ramp_(Function1<scalar>::NewIfPresent("ramp", dict, word::null, &db()))
60 {
61  tmp<vectorField> tvalues(refValue_*patch().nf());
62 
63  if (ramp_)
64  {
65  tvalues.ref() *= ramp_->value(this->db().time().timeOutputValue());
66  }
67 
69 }
70 
71 
74 (
76  const fvPatch& p,
78  const fvPatchFieldMapper& mapper
79 )
80 :
81  fixedValueFvPatchVectorField(p, iF),
82  refValue_(ptf.refValue_, mapper, pTraits<scalar>::zero),
83  ramp_(ptf.ramp_.clone())
84 {
85  // Note: refValue_ will have default value of 0 for unmapped faces. This
86  // can temporarily happen during e.g. redistributePar. We should not
87  // access ptf.patch() instead since redistributePar has destroyed this
88  // at the time of mapping.
89 
90  tmp<vectorField> tvalues(refValue_*patch().nf());
91 
92  if (ramp_)
93  {
94  tvalues.ref() *= ramp_->value(this->db().time().timeOutputValue());
95  }
96 
98 }
99 
100 
103 (
105 )
106 :
107  fixedValueFvPatchVectorField(ptf),
108  refValue_(ptf.refValue_),
109  ramp_(ptf.ramp_.clone())
110 {}
111 
112 
115 (
118 )
119 :
120  fixedValueFvPatchVectorField(ptf, iF),
121  refValue_(ptf.refValue_),
122  ramp_(ptf.ramp_.clone())
123 {}
124 
125 
126 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
127 
129 (
130  const fvPatchFieldMapper& mapper
131 )
132 {
133  fixedValueFvPatchVectorField::autoMap(mapper);
134  refValue_.autoMap(mapper);
135 }
136 
137 
139 (
140  const fvPatchVectorField& ptf,
141  const labelList& addr
142 )
143 {
144  fixedValueFvPatchVectorField::rmap(ptf, addr);
145 
147  refCast<const surfaceNormalFixedValueFvPatchVectorField>(ptf);
148 
149  refValue_.rmap(tiptf.refValue_, addr);
150 }
151 
152 
154 {
155  if (updated())
156  {
157  return;
158  }
159 
160  tmp<vectorField> tvalues(refValue_*patch().nf());
161 
162  if (ramp_)
163  {
164  tvalues.ref() *= ramp_->value(this->db().time().timeOutputValue());
165  }
166 
169 }
170 
171 
173 {
175  refValue_.writeEntry("refValue", os);
176  if (ramp_)
177  {
178  ramp_->writeData(os);
179  }
180 }
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 namespace Foam
186 {
188  (
190  surfaceNormalFixedValueFvPatchVectorField
191  );
192 }
193 
194 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:47
volFields.H
Foam::fvPatchField::write
virtual void write(Ostream &) const
Definition: fvPatchField.C:377
Foam::fvPatchField::operator=
virtual void operator=(const UList< Type > &)
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:63
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:57
Foam::surfaceNormalFixedValueFvPatchVectorField::write
virtual void write(Ostream &) const
Definition: surfaceNormalFixedValueFvPatchVectorField.C:165
fvPatchFieldMapper.H
Foam::surfaceNormalFixedValueFvPatchVectorField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Definition: surfaceNormalFixedValueFvPatchVectorField.C:122
Foam::Function1
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: propellerInfo.H:287
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:220
Foam::surfaceNormalFixedValueFvPatchVectorField::surfaceNormalFixedValueFvPatchVectorField
surfaceNormalFixedValueFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Definition: surfaceNormalFixedValueFvPatchVectorField.C:31
surfaceNormalFixedValueFvPatchVectorField.H
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
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:119
os
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Definition: atmBoundaryLayer.C:26
Foam::fvPatchField::updateCoeffs
virtual void updateCoeffs()
Definition: fvPatchField.C:314
Foam::fvPatchVectorField
fvPatchField< vector > fvPatchVectorField
Definition: fvPatchFieldsFwd.H:36
Foam::foamVersion::patch
const std::string patch
Foam::surfaceNormalFixedValueFvPatchVectorField
This boundary condition provides a surface-normal vector boundary condition by its magnitude.
Definition: surfaceNormalFixedValueFvPatchVectorField.H:91
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:58
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition: pTraits.H:50
Foam::surfaceNormalFixedValueFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Definition: surfaceNormalFixedValueFvPatchVectorField.C:146
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:41
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:52
Foam::makePatchTypeField
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Foam::surfaceNormalFixedValueFvPatchVectorField::rmap
virtual void rmap(const fvPatchVectorField &, const labelList &)
Definition: surfaceNormalFixedValueFvPatchVectorField.C:132
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:50
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:58