fixedNormalSlipFvPatchField.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-2023 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 
27 #include "symmTransformField.H"
28 
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class Type>
34 (
35  const fvPatch& p,
37 )
38 :
39  transformFvPatchField<Type>(p, iF),
40  fixedValue_(p.size(), Zero)
41 {}
42 
43 
44 template<class Type>
46 (
47  const fvPatch& p,
49  const dictionary& dict
50 )
51 :
52  transformFvPatchField<Type>(p, iF),
53  fixedValue_("fixedValue", dict, p.size())
54 {
55  evaluate();
56 }
57 
58 
59 template<class Type>
61 (
63  const fvPatch& p,
65  const fvPatchFieldMapper& mapper
66 )
67 :
68  transformFvPatchField<Type>(ptf, p, iF, mapper),
69  fixedValue_(mapper(ptf.fixedValue_))
70 {}
71 
72 
73 template<class Type>
75 (
78 )
79 :
80  transformFvPatchField<Type>(ptf, iF),
81  fixedValue_(ptf.fixedValue_)
82 {}
83 
84 
85 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
86 
87 template<class Type>
89 (
90  const fvPatchField<Type>& ptf,
91  const fvPatchFieldMapper& mapper
92 )
93 {
95 
97  refCast<const fixedNormalSlipFvPatchField<Type>>(ptf);
98 
99  mapper(fixedValue_, dmptf.fixedValue_);
100 }
101 
102 
103 template<class Type>
105 (
106  const fvPatchField<Type>& ptf
107 )
108 {
110 
111  const fixedNormalSlipFvPatchField<Type>& dmptf =
112  refCast<const fixedNormalSlipFvPatchField<Type>>(ptf);
113 
114  fixedValue_.reset(dmptf.fixedValue_);
115 }
116 
117 
118 template<class Type>
121 {
122  const vectorField nHat(this->patch().nf());
123  const Field<Type> pif(this->patchInternalField());
124 
125  return
126  (
127  (nHat*(nHat & fixedValue_) + transform(I - sqr(nHat), pif)) - pif
128  )*this->patch().deltaCoeffs();
129 }
130 
131 
132 template<class Type>
134 (
135  const Pstream::commsTypes
136 )
137 {
138  if (!this->updated())
139  {
140  this->updateCoeffs();
141  }
142 
143  const vectorField nHat(this->patch().nf());
144 
146  (
147  nHat*(nHat & fixedValue_)
148  + transform(I - sqr(nHat), this->patchInternalField())
149  );
150 
152 }
153 
154 
155 template<class Type>
158 {
159  const vectorField nHat(this->patch().nf());
160  vectorField diag(nHat.size());
161 
162  diag.replace(vector::X, mag(nHat.component(vector::X)));
163  diag.replace(vector::Y, mag(nHat.component(vector::Y)));
164  diag.replace(vector::Z, mag(nHat.component(vector::Z)));
165 
166  return transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
167 }
168 
169 
170 template<class Type>
172 {
174  writeEntry(os, "fixedValue", fixedValue_);
175 }
176 
177 
178 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
Definition: Field.C:455
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
commsTypes
Types of communications.
Definition: UPstream.H:65
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
This boundary condition sets the patch-normal component to a fixed value.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
virtual void write(Ostream &) const
Write.
fixedNormalSlipFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
virtual void map(const fvPatchField< Type > &, const fvPatchFieldMapper &)
Map the given fvPatchField onto this fvPatchField.
virtual tmp< Field< Type > > snGradTransformDiag() const
Return face-gradient transform diagonal.
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field, sets Updated to false.
Definition: fvPatchField.C:211
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:231
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
Definition: fvPatchField.C:197
virtual void map(const fvPatchField< Type > &, const fvPatchFieldMapper &)
Map the given fvPatchField onto this fvPatchField.
Definition: fvPatchField.C:187
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Traits class for primitives.
Definition: pTraits.H:53
A class for managing temporary objects.
Definition: tmp.H:55
Foam::transformFvPatchField.
static const zero Zero
Definition: zero.H:97
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static const Identity< scalar > I
Definition: Identity.H:93
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:483
dimensioned< scalar > mag(const dimensioned< Type > &)
dictionary dict
volScalarField & p