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_),
53  angularMomentum_(p.angularMomentum_),
54  torque_(p.torque_),
55  collisionRecords_(p.collisionRecords_)
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  td.keepParticle = true;
73 
74  switch (td.part())
75  {
76  case TrackData::tpVelocityHalfStep:
77  {
78  // First and last leapfrog velocity adjust part, required
79  // before and after tracking and force calculation
80 
81  p.U() += 0.5*trackTime*p.f()/p.mass();
82 
83  p.angularMomentum() += 0.5*trackTime*p.torque();
84 
85  td.keepParticle = true;
86 
87  break;
88  }
89 
90  case TrackData::tpLinearTrack:
91  {
92  ParcelType::move(td, trackTime);
93 
94  break;
95  }
96 
97  case TrackData::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 
123  angularMomentum_ = transform(T, angularMomentum_);
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 // ************************************************************************* //
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
p
p
Definition: pEqn.H:62
Foam::transform
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:465
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:365
CollidingParcel.H
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
Foam::FatalError
error FatalError
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::CollidingParcel::transformProperties
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: CollidingParcel.C:117
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
T
const volScalarField & T
Definition: createFields.H:25
Foam::Vector< scalar >
CollidingParcelIO.C
Foam::CollidingParcel::CollidingParcel
CollidingParcel(const polyMesh &mesh, const vector &position, const label cellI, const label tetFaceI, const label tetPtI)
Construct from owner, position, and cloud owner.
Foam::CollidingParcel::move
bool move(TrackData &td, const scalar trackTime)
Move the parcel.
Definition: CollidingParcel.C:64