FreeFOAM The Cross-Platform CFD Toolkit
partialSlipFvPatchField.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) 1991-2010 OpenCFD Ltd.
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 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
36 template<class Type>
38 (
39  const fvPatch& p,
41 )
42 :
44  valueFraction_(p.size(), 1.0)
45 {}
46 
47 
48 template<class Type>
50 (
52  const fvPatch& p,
54  const fvPatchFieldMapper& mapper
55 )
56 :
57  transformFvPatchField<Type>(ptf, p, iF, mapper),
58  valueFraction_(ptf.valueFraction_, mapper)
59 {}
60 
61 
62 template<class Type>
64 (
65  const fvPatch& p,
67  const dictionary& dict
68 )
69 :
71  valueFraction_("valueFraction", dict, p.size())
72 {
73  evaluate();
74 }
75 
76 
77 template<class Type>
79 (
81 )
82 :
84  valueFraction_(ptf.valueFraction_)
85 {}
86 
87 
88 template<class Type>
90 (
93 )
94 :
96  valueFraction_(ptf.valueFraction_)
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
102 template<class Type>
104 (
105  const fvPatchFieldMapper& m
106 )
107 {
109  valueFraction_.autoMap(m);
110 }
111 
112 
113 template<class Type>
115 (
116  const fvPatchField<Type>& ptf,
117  const labelList& addr
118 )
119 {
121 
122  const partialSlipFvPatchField<Type>& dmptf =
123  refCast<const partialSlipFvPatchField<Type> >(ptf);
124 
125  valueFraction_.rmap(dmptf.valueFraction_, addr);
126 }
127 
128 
129 template<class Type>
131 {
132  vectorField nHat = this->patch().nf();
133  Field<Type> pif = this->patchInternalField();
134 
135  return
136  (
137  (1.0 - valueFraction_)*transform(I - sqr(nHat), pif) - pif
138  )*this->patch().deltaCoeffs();
139 }
140 
141 
142 template<class Type>
144 {
145  if (!this->updated())
146  {
147  this->updateCoeffs();
148  }
149 
150  vectorField nHat = this->patch().nf();
151 
153  (
154  (1.0 - valueFraction_)
155  *transform(I - sqr(nHat), this->patchInternalField())
156  );
157 
159 }
160 
161 
162 template<class Type>
164 {
165  vectorField nHat = this->patch().nf();
166  vectorField diag(nHat.size());
167 
168  diag.replace(vector::X, mag(nHat.component(vector::X)));
169  diag.replace(vector::Y, mag(nHat.component(vector::Y)));
170  diag.replace(vector::Z, mag(nHat.component(vector::Z)));
171 
172  return
173  valueFraction_*pTraits<Type>::one
174  + (1.0 - valueFraction_)
175  *transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
176 }
177 
178 
179 template<class Type>
181 {
183  valueFraction_.writeEntry("valueFraction", os);
184 }
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace Foam
190 
191 // ************************ vim: set sw=4 sts=4 et: ************************ //