NonInertialFrameForce.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-2022 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 :
85  ParticleForce<CloudType>(niff),
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  const 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  const 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  const uniformDimensionedVectorField& omegaDot =
153  this->mesh().template
154  lookupObject<uniformDimensionedVectorField>(omegaDotName_);
155 
156  omegaDot_ = omegaDot.value();
157  }
158 
159  if
160  (
161  this->mesh().template foundObject<uniformDimensionedVectorField>
162  (
163  centreOfRotationName_
164  )
165  )
166  {
167  const uniformDimensionedVectorField& centreOfRotation =
168  this->mesh().template
169  lookupObject<uniformDimensionedVectorField>
170  (
171  centreOfRotationName_
172  );
173 
174  centreOfRotation_ = centreOfRotation.value();
175  }
176  }
177 }
178 
179 
180 template<class CloudType>
182 (
183  const typename CloudType::parcelType& p,
184  const typename CloudType::parcelType::trackingData& td,
185  const scalar dt,
186  const scalar mass,
187  const scalar Re,
188  const scalar muc
189 ) const
190 {
191  forceSuSp value(Zero, 0.0);
192 
193  const vector r = p.position(td.mesh) - centreOfRotation_;
194 
195  value.Su() =
196  mass
197  *(
198  -W_
199  + (r ^ omegaDot_)
200  + 2.0*(p.U() ^ omega_)
201  + (omega_ ^ (r ^ omega_))
202  );
203 
204  return value;
205 }
206 
207 
208 // ************************************************************************* //
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:80
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:225
Calculates particle non-inertial reference frame force. Variable names as from Landau and Lifshitz,...
virtual forceSuSp calcNonCoupled(const typename CloudType::parcelType &p, const typename CloudType::parcelType::trackingData &td, const scalar dt, const scalar mass, const scalar Re, const scalar muc) const
Calculate the non-coupled force.
virtual ~NonInertialFrameForce()
Destructor.
virtual void cacheFields(const bool store)
Cache fields.
NonInertialFrameForce(CloudType &owner, const fvMesh &mesh, const dictionary &dict)
Construct from mesh.
Abstract base class for particle forces.
Definition: ParticleForce.H:54
Type & value()
Return a reference to the value.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
const Type & value() const
Return const reference to value.
Helper container for force Su and Sp terms.
Definition: forceSuSp.H:64
const vector & Su() const
Return const access to the explicit contribution [kg m/s^2].
Definition: forceSuSpI.H:56
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Convenience class to handle the input of constant rotational speed. Reads an omega entry with default...
Definition: omega.H:54
A class for handling words, derived from string.
Definition: word.H:62
static const zero Zero
Definition: zero.H:97
scalarList W(const fluidMulticomponentThermo &thermo)
scalarField Re(const UList< complex > &cf)
Definition: complexFields.C:97
dictionary dict
volScalarField & p