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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "NonInertialFrameForce.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class CloudType>
35 (
36  CloudType& owner,
37  const fvMesh& mesh,
38  const dictionary& dict
39 )
40 :
41  ParticleForce<CloudType>(owner, mesh, dict, typeName, true),
42  WName_
43  (
44  this->coeffs().template lookupOrDefault<word>
45  (
46  "linearAcceleration",
47  "linearAcceleration"
48  )
49  ),
50  W_(Zero),
51  omegaName_
52  (
53  this->coeffs().template lookupOrDefault<word>
54  (
55  "angularVelocity",
56  "angularVelocity"
57  )
58  ),
59  omega_(Zero),
60  omegaDotName_
61  (
62  this->coeffs().template lookupOrDefault<word>
63  (
64  "angularAcceleration",
65  "angularAcceleration"
66  )
67  ),
68  omegaDot_(Zero),
69  centreOfRotationName_
70  (
71  this->coeffs().template lookupOrDefault<word>
72  (
73  "centreOfRotation",
74  "centreOfRotation"
75  )
76  ),
77  centreOfRotation_(Zero)
78 {}
79 
80 
81 template<class CloudType>
83 (
84  const NonInertialFrameForce& niff
85 )
86 :
88  WName_(niff.WName_),
89  W_(niff.W_),
90  omegaName_(niff.omegaName_),
91  omega_(niff.omega_),
92  omegaDotName_(niff.omegaDotName_),
93  omegaDot_(niff.omegaDot_),
94  centreOfRotationName_(niff.centreOfRotationName_),
95  centreOfRotation_(niff.centreOfRotation_)
96 {}
97 
98 
99 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
100 
101 template<class CloudType>
103 {}
104 
105 
106 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
107 
108 template<class CloudType>
110 {
111  W_ = Zero;
112  omega_ = Zero;
113  omegaDot_ = Zero;
114  centreOfRotation_ = Zero;
115 
116  if (store)
117  {
118  if
119  (
120  this->mesh().template foundObject<uniformDimensionedVectorField>
121  (
122  WName_
123  )
124  )
125  {
126  const uniformDimensionedVectorField& W = this->mesh().template
127  lookupObject<uniformDimensionedVectorField>(WName_);
128 
129  W_ = W.value();
130  }
131 
132  if
133  (
134  this->mesh().template foundObject<uniformDimensionedVectorField>
135  (
136  omegaName_
137  )
138  )
139  {
140  const uniformDimensionedVectorField& omega = this->mesh().template
141  lookupObject<uniformDimensionedVectorField>(omegaName_);
142 
143  omega_ = omega.value();
144  }
145 
146  if
147  (
148  this->mesh().template foundObject<uniformDimensionedVectorField>
149  (
150  omegaDotName_
151  )
152  )
153  {
154  const uniformDimensionedVectorField& omegaDot =
155  this->mesh().template
156  lookupObject<uniformDimensionedVectorField>(omegaDotName_);
157 
158  omegaDot_ = omegaDot.value();
159  }
160 
161  if
162  (
163  this->mesh().template foundObject<uniformDimensionedVectorField>
164  (
165  centreOfRotationName_
166  )
167  )
168  {
169  const uniformDimensionedVectorField& centreOfRotation =
170  this->mesh().template
171  lookupObject<uniformDimensionedVectorField>
172  (
173  centreOfRotationName_
174  );
175 
176  centreOfRotation_ = centreOfRotation.value();
177  }
178  }
179 }
180 
181 
182 template<class CloudType>
184 (
185  const typename CloudType::parcelType& p,
186  const typename CloudType::parcelType::trackingData& td,
187  const scalar dt,
188  const scalar mass,
189  const scalar Re,
190  const scalar muc
191 ) const
192 {
193  forceSuSp value(Zero);
194 
195  const vector r = p.position() - centreOfRotation_;
196 
197  value.Su() =
198  mass
199  *(
200  -W_
201  + (r ^ omegaDot_)
202  + 2.0*(p.U() ^ omega_)
203  + (omega_ ^ (r ^ omega_))
204  );
205 
206  return value;
207 }
208 
209 
210 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::NonInertialFrameForce
Calculates particle non-inertial reference frame force. Variable names as from Landau and Lifshitz,...
Definition: NonInertialFrameForce.H:57
Foam::NonInertialFrameForce::cacheFields
virtual void cacheFields(const bool store)
Cache fields.
Definition: NonInertialFrameForce.C:109
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
NonInertialFrameForce.H
Foam::NonInertialFrameForce::~NonInertialFrameForce
virtual ~NonInertialFrameForce()
Destructor.
Definition: NonInertialFrameForce.C:102
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:404
Foam::forceSuSp::Su
const vector & Su() const
Return const access to the explicit contribution [kg.m/s2].
Definition: forceSuSpI.H:64
Foam::UniformDimensionedField< vector >
Foam::forceSuSp
Helper container for force Su and Sp terms.
Definition: forceSuSp.H:63
Foam::ParticleForce
Abstract base class for particle forces.
Definition: ParticleForce.H:59
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::NonInertialFrameForce::NonInertialFrameForce
NonInertialFrameForce(CloudType &owner, const fvMesh &mesh, const dictionary &dict)
Construct from mesh.
Definition: NonInertialFrameForce.C:35
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::NonInertialFrameForce::calcNonCoupled
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.
Definition: NonInertialFrameForce.C:184
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
uniformDimensionedFields.H
Foam::Vector< scalar >
Foam::Re
scalarField Re(const UList< complex > &cf)
Extract real component.
Definition: complexField.C:159
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220