CollidingParcel.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-2018 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 TrackCloudType>
64 (
65  TrackCloudType& cloud,
66  trackingData& td,
67  const scalar trackTime
68 )
69 {
70  typename TrackCloudType::parcelType& p =
71  static_cast<typename TrackCloudType::parcelType&>(*this);
72 
73  switch (td.part())
74  {
75  case trackingData::tpVelocityHalfStep:
76  {
77  // First and last leapfrog velocity adjust part, required
78  // before and after tracking and force calculation
79 
80  p.U() += 0.5*trackTime*p.f()/p.mass();
81 
82  p.angularMomentum() += 0.5*trackTime*p.torque();
83 
84  td.keepParticle = true;
85  td.switchProcessor = false;
86 
87  break;
88  }
89 
90  case trackingData::tpLinearTrack:
91  {
92  ParcelType::move(cloud, td, trackTime);
93 
94  break;
95  }
96 
97  case trackingData::tpRotationalTrack:
98  {
100 
101  break;
102  }
103 
104  default:
105  {
107  << td.part() << " is an invalid part of the tracking method."
108  << abort(FatalError);
109  }
110  }
111 
112  return td.keepParticle;
113 }
114 
115 
116 template<class ParcelType>
118 {
119  ParcelType::transformProperties(T);
120 
121  f_ = transform(T, f_);
122 
124 
125  torque_ = transform(T, torque_);
126 }
127 
128 
129 template<class ParcelType>
131 (
132  const vector& separation
133 )
134 {
135  ParcelType::transformProperties(separation);
136 }
137 
138 
139 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
140 
141 #include "CollidingParcelIO.C"
142 
143 // ************************************************************************* //
ParcelType::trackingData trackingData
Use base tracking data.
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
bool move(TrackCloudType &cloud, trackingData &td, const scalar trackTime)
Move the parcel.
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.
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