FreeFOAM The Cross-Platform CFD Toolkit
StandardWallInteraction.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) 2008-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 
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template <class CloudType>
32 (
33  const dictionary& dict,
34  CloudType& cloud
35 )
36 :
37  PatchInteractionModel<CloudType>(dict, cloud, typeName),
38  interactionType_
39  (
40  this->wordToInteractionType(this->coeffDict().lookup("type"))
41  ),
42  e_(0.0),
43  mu_(0.0)
44 {
45  switch (interactionType_)
46  {
48  {
49  word interactionTypeName(this->coeffDict().lookup("type"));
50 
52  (
53  "StandardWallInteraction<CloudType>::StandardWallInteraction"
54  "("
55  "const dictionary&, "
56  "CloudType& cloud"
57  ")"
58  ) << "Unknown interaction result type "
59  << interactionTypeName
60  << ". Valid selections are:" << this->interactionTypeNames_
61  << endl << exit(FatalError);
62 
63  break;
64  }
66  {
67  e_ = this->coeffDict().lookupOrDefault("e", 1.0);
68  mu_ = this->coeffDict().lookupOrDefault("mu", 0.0);
69  break;
70  }
71  default:
72  {
73  // do nothing
74  }
75  }
76 }
77 
78 
79 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
80 
81 template <class CloudType>
83 {}
84 
85 
86 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87 
88 template<class CloudType>
90 {
91  return true;
92 }
93 
94 
95 template <class CloudType>
97 (
98  const polyPatch& pp,
99  const label faceId,
100  bool& keepParticle,
101  bool& active,
102  vector& U
103 ) const
104 {
105  if (isA<wallPolyPatch>(pp))
106  {
107  switch (interactionType_)
108  {
110  {
111  keepParticle = false;
112  active = false;
113  U = vector::zero;
114  break;
115  }
117  {
118  keepParticle = true;
119  active = false;
120  U = vector::zero;
121  break;
122  }
124  {
125  keepParticle = true;
126  active = true;
127 
128  vector nw = pp.faceAreas()[pp.whichFace(faceId)];
129  nw /= mag(nw);
130 
131  scalar Un = U & nw;
132  vector Ut = U - Un*nw;
133 
134  if (Un > 0)
135  {
136  U -= (1.0 + e_)*Un*nw;
137  }
138 
139  U -= mu_*Ut;
140 
141  break;
142  }
143  default:
144  {
146  (
147  "bool StandardWallInteraction<CloudType>::correct"
148  "("
149  "const polyPatch&, "
150  "const label, "
151  "bool&, "
152  "vector&"
153  ") const"
154  ) << "Unknown interaction type "
155  << this->interactionTypeToWord(interactionType_)
156  << "(" << interactionType_ << ")" << endl
157  << abort(FatalError);
158  }
159  }
160 
161  return true;
162  }
163 
164  return false;
165 }
166 
167 
168 // ************************ vim: set sw=4 sts=4 et: ************************ //