NonInertialFrameForce.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-2016 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 
26 #include "NonInertialFrameForce.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class CloudType>
33 (
34  CloudType& owner,
35  const fvMesh& mesh,
36  const dictionary& dict
37 )
38 :
39  ParticleForce<CloudType>(owner, mesh, dict, typeName, true),
40  WName_
41  (
42  this->coeffs().template lookupOrDefault<word>
43  (
44  "linearAccelerationName",
45  "linearAcceleration"
46  )
47  ),
48  W_(Zero),
49  omegaName_
50  (
51  this->coeffs().template lookupOrDefault<word>
52  (
53  "angularVelocityName",
54  "angularVelocity"
55  )
56  ),
57  omega_(Zero),
58  omegaDotName_
59  (
60  this->coeffs().template lookupOrDefault<word>
61  (
62  "angularAccelerationName",
63  "angularAcceleration"
64  )
65  ),
66  omegaDot_(Zero),
67  centreOfRotationName_
68  (
69  this->coeffs().template lookupOrDefault<word>
70  (
71  "centreOfRotationName",
72  "centreOfRotation"
73  )
74  ),
75  centreOfRotation_(Zero)
76 {}
77 
78 
79 template<class CloudType>
81 (
82  const NonInertialFrameForce& niff
83 )
84 :
86  WName_(niff.WName_),
87  W_(niff.W_),
88  omegaName_(niff.omegaName_),
89  omega_(niff.omega_),
90  omegaDotName_(niff.omegaDotName_),
91  omegaDot_(niff.omegaDot_),
92  centreOfRotationName_(niff.centreOfRotationName_),
93  centreOfRotation_(niff.centreOfRotation_)
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
98 
99 template<class CloudType>
101 {}
102 
103 
104 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
105 
106 template<class CloudType>
108 {
109  W_ = Zero;
110  omega_ = Zero;
111  omegaDot_ = Zero;
112  centreOfRotation_ = Zero;
113 
114  if (store)
115  {
116  if
117  (
118  this->mesh().template foundObject<uniformDimensionedVectorField>
119  (
120  WName_
121  )
122  )
123  {
124  uniformDimensionedVectorField W = this->mesh().template
125  lookupObject<uniformDimensionedVectorField>(WName_);
126 
127  W_ = W.value();
128  }
129 
130  if
131  (
132  this->mesh().template foundObject<uniformDimensionedVectorField>
133  (
134  omegaName_
135  )
136  )
137  {
138  uniformDimensionedVectorField omega = this->mesh().template
139  lookupObject<uniformDimensionedVectorField>(omegaName_);
140 
141  omega_ = omega.value();
142  }
143 
144  if
145  (
146  this->mesh().template foundObject<uniformDimensionedVectorField>
147  (
148  omegaDotName_
149  )
150  )
151  {
152  uniformDimensionedVectorField omegaDot = this->mesh().template
153  lookupObject<uniformDimensionedVectorField>(omegaDotName_);
154 
155  omegaDot_ = omegaDot.value();
156  }
157 
158  if
159  (
160  this->mesh().template foundObject<uniformDimensionedVectorField>
161  (
162  centreOfRotationName_
163  )
164  )
165  {
166  uniformDimensionedVectorField centreOfRotation =
167  this->mesh().template
168  lookupObject<uniformDimensionedVectorField>
169  (
170  centreOfRotationName_
171  );
172 
173  centreOfRotation_ = centreOfRotation.value();
174  }
175  }
176 }
177 
178 
179 template<class CloudType>
181 (
182  const typename CloudType::parcelType& p,
183  const scalar dt,
184  const scalar mass,
185  const scalar Re,
186  const scalar muc
187 ) const
188 {
189  forceSuSp value(Zero, 0.0);
190 
191  const vector r = p.position() - centreOfRotation_;
192 
193  value.Su() =
194  mass
195  *(
196  -W_
197  + (r ^ omegaDot_)
198  + 2.0*(p.U() ^ omega_)
199  + (omega_ ^ (r ^ omega_))
200  );
201 
202  return value;
203 }
204 
205 
206 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void cacheFields(const bool store)
Cache fields.
Abstract base class for particle forces.
Definition: ParticleForce.H:53
const vector & Su() const
Return const access to the explicit contribution [kg.m/s2].
Definition: forceSuSpI.H:56
const Type & value() const
Return const reference to value.
virtual ~NonInertialFrameForce()
Destructor.
Helper container for force Su and Sp terms.
Definition: forceSuSp.H:61
dynamicFvMesh & mesh
Calculates particle non-inertial reference frame force. Variable names as from Landau and Lifshitz...
NonInertialFrameForce(CloudType &owner, const fvMesh &mesh, const dictionary &dict)
Construct from mesh.
static const zero Zero
Definition: zero.H:91
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
virtual forceSuSp calcNonCoupled(const typename CloudType::parcelType &p, const scalar dt, const scalar mass, const scalar Re, const scalar muc) const
Calculate the non-coupled force.