fixedNormalSlipFvPatchField.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 | Copyright (C) 2011 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 :
40  fixedValue_(p.size(), pTraits<Type>::zero)
41 {}
42 
43 
44 template<class Type>
46 (
48  const fvPatch& p,
50  const fvPatchFieldMapper& mapper
51 )
52 :
53  transformFvPatchField<Type>(ptf, p, iF, mapper),
54  fixedValue_(ptf.fixedValue_, mapper)
55 {}
56 
57 
58 template<class Type>
60 (
61  const fvPatch& p,
63  const dictionary& dict
64 )
65 :
67  fixedValue_("fixedValue", dict, p.size())
68 {
69  evaluate();
70 }
71 
72 
73 template<class Type>
75 (
77 )
78 :
80  fixedValue_(ptf.fixedValue_)
81 {}
82 
83 
84 template<class Type>
86 (
89 )
90 :
92  fixedValue_(ptf.fixedValue_)
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 
98 template<class Type>
100 (
101  const fvPatchFieldMapper& m
102 )
103 {
105  fixedValue_.autoMap(m);
106 }
107 
108 
109 template<class Type>
111 (
112  const fvPatchField<Type>& ptf,
113  const labelList& addr
114 )
115 {
117 
118  const fixedNormalSlipFvPatchField<Type>& dmptf =
119  refCast<const fixedNormalSlipFvPatchField<Type> >(ptf);
120 
121  fixedValue_.rmap(dmptf.fixedValue_, addr);
122 }
123 
124 
125 template<class Type>
128 {
129  const vectorField nHat(this->patch().nf());
130  const Field<Type> pif(this->patchInternalField());
131 
132  return
133  (
134  (nHat*(nHat & fixedValue_) + transform(I - sqr(nHat), pif)) - pif
135  )*this->patch().deltaCoeffs();
136 }
137 
138 
139 template<class Type>
141 (
142  const Pstream::commsTypes
143 )
144 {
145  if (!this->updated())
146  {
147  this->updateCoeffs();
148  }
149 
150  const vectorField nHat(this->patch().nf());
151 
153  (
154  nHat*(nHat & fixedValue_)
155  + transform(I - sqr(nHat), this->patchInternalField())
156  );
157 
159 }
160 
161 
162 template<class Type>
165 {
166  const vectorField nHat(this->patch().nf());
167  vectorField diag(nHat.size());
168 
169  diag.replace(vector::X, mag(nHat.component(vector::X)));
170  diag.replace(vector::Y, mag(nHat.component(vector::Y)));
171  diag.replace(vector::Z, mag(nHat.component(vector::Z)));
172 
173  return transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
174 }
175 
176 
177 template<class Type>
179 {
181  fixedValue_.writeEntry("fixedValue", os);
182 }
183 
184 
185 // ************************************************************************* //
Foam::fvPatchField< Type >
Foam::fixedNormalSlipFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: fixedNormalSlipFvPatchField.C:178
symmTransformField.H
p
p
Definition: pEqn.H:62
Foam::fixedNormalSlipFvPatchField::rmap
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: fixedNormalSlipFvPatchField.C:111
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::fixedNormalSlipFvPatchField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: fixedNormalSlipFvPatchField.C:100
Foam::fixedNormalSlipFvPatchField::evaluate
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::blocking)
Evaluate the patch field.
Definition: fixedNormalSlipFvPatchField.C:141
Foam::diag
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
Definition: pointPatchFieldFunctions.H:262
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::transform
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:465
fixedNormalSlipFvPatchField.H
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fixedNormalSlipFvPatchField::fixedNormalSlipFvPatchField
fixedNormalSlipFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: fixedNormalSlipFvPatchField.C:34
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:73
Foam::I
static const sphericalTensor I(1)
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::fixedNormalSlipFvPatchField
This boundary condition sets the patch-normal component to a fixed value.
Definition: fixedNormalSlipFvPatchField.H:81
Foam::Field::component
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
Definition: Field.C:644
Foam::fixedNormalSlipFvPatchField::snGradTransformDiag
virtual tmp< Field< Type > > snGradTransformDiag() const
Return face-gradient transform diagonal.
Definition: fixedNormalSlipFvPatchField.C:164
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:64
Foam::fixedNormalSlipFvPatchField::fixedValue_
Field< Type > fixedValue_
Value the normal component of which the boundary is set to.
Definition: fixedNormalSlipFvPatchField.H:88
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:49
Foam::fixedNormalSlipFvPatchField::snGrad
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
Definition: fixedNormalSlipFvPatchField.C:127
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:50
Foam::transformFvPatchField
Foam::transformFvPatchField.
Definition: transformFvPatchField.H:52
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
write
Tcoeff write()
Y
PtrList< volScalarField > & Y
Definition: createFields.H:36
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51