CollidingParcel.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-2015 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 "CollidingParcel.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class ParcelType>
32 (
33  const CollidingParcel<ParcelType>& p
34 )
35 :
36  ParcelType(p),
37  f_(p.f_),
38  angularMomentum_(p.angularMomentum_),
39  torque_(p.torque_),
40  collisionRecords_(p.collisionRecords_)
41 {}
42 
43 
44 template<class ParcelType>
46 (
47  const CollidingParcel<ParcelType>& p,
48  const polyMesh& mesh
49 )
50 :
51  ParcelType(p, mesh),
52  f_(p.f_),
54  torque_(p.torque_),
56 {}
57 
58 
59 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
60 
61 template<class ParcelType>
62 template<class TrackData>
64 (
65  TrackData& td,
66  const scalar trackTime
67 )
68 {
69  typename TrackData::cloudType::parcelType& p =
70  static_cast<typename TrackData::cloudType::parcelType&>(*this);
71 
72  switch (td.part())
73  {
74  case TrackData::tpVelocityHalfStep:
75  {
76  // First and last leapfrog velocity adjust part, required
77  // before and after tracking and force calculation
78 
79  p.U() += 0.5*trackTime*p.f()/p.mass();
80 
81  p.angularMomentum() += 0.5*trackTime*p.torque();
82 
83  td.keepParticle = true;
84 
85  break;
86  }
87 
88  case TrackData::tpLinearTrack:
89  {
90  ParcelType::move(td, trackTime);
91 
92  break;
93  }
94 
95  case TrackData::tpRotationalTrack:
96  {
98 
99  break;
100  }
101 
102  default:
103  {
105  << td.part() << " is an invalid part of the tracking method."
106  << abort(FatalError);
107  }
108  }
109 
110  return td.keepParticle;
111 }
112 
113 
114 template<class ParcelType>
116 {
117  ParcelType::transformProperties(T);
118 
119  f_ = transform(T, f_);
120 
122 
123  torque_ = transform(T, torque_);
124 }
125 
126 
127 template<class ParcelType>
129 (
130  const vector& separation
131 )
132 {
133  ParcelType::transformProperties(separation);
134 }
135 
136 
137 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
138 
139 #include "CollidingParcelIO.C"
140 
141 // ************************************************************************* //
vector f_
Force on particle due to collisions [N].
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
collisionRecordList collisionRecords_
Particle collision records.
dynamicFvMesh & mesh
errorManip< error > abort(error &err)
Definition: errorManip.H:131
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
vector angularMomentum_
Angular momentum of Parcel in global reference frame [kg m2/s].
vector torque_
Torque on particle due to collisions in global.
CollidingParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from mesh, coordinates and topology.
bool move(TrackData &td, const scalar trackTime)
Move the parcel.
volScalarField & p
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:477