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 | 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 "CollidingParcel.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class ParcelType>
34 (
35  const CollidingParcel<ParcelType>& p
36 )
37 :
38  ParcelType(p),
39  f_(p.f_),
40  angularMomentum_(p.angularMomentum_),
41  torque_(p.torque_),
42  collisionRecords_(p.collisionRecords_)
43 {}
44 
45 
46 template<class ParcelType>
48 (
49  const CollidingParcel<ParcelType>& p,
50  const polyMesh& mesh
51 )
52 :
53  ParcelType(p, mesh),
54  f_(p.f_),
55  angularMomentum_(p.angularMomentum_),
56  torque_(p.torque_),
57  collisionRecords_(p.collisionRecords_)
58 {}
59 
60 
61 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
62 
63 template<class ParcelType>
64 template<class TrackCloudType>
66 (
67  TrackCloudType& cloud,
68  trackingData& td,
69  const scalar trackTime
70 )
71 {
72  typename TrackCloudType::parcelType& p =
73  static_cast<typename TrackCloudType::parcelType&>(*this);
74 
75  td.keepParticle = true;
76  td.switchProcessor = false;
77 
78  switch (td.part())
79  {
80  case trackingData::tpVelocityHalfStep:
81  {
82  // First and last leapfrog velocity adjust part, required
83  // before and after tracking and force calculation
84 
85  p.U() += 0.5*trackTime*p.f()/p.mass();
86 
87  p.angularMomentum() += 0.5*trackTime*p.torque();
88 
89  td.keepParticle = true;
90  td.switchProcessor = false;
91 
92  break;
93  }
94 
95  case trackingData::tpLinearTrack:
96  {
97  ParcelType::move(cloud, td, trackTime);
98 
99  break;
100  }
101 
102  case trackingData::tpRotationalTrack:
103  {
105 
106  break;
107  }
108 
109  default:
110  {
112  << td.part() << " is an invalid part of the tracking method."
113  << abort(FatalError);
114  }
115  }
116 
117  return td.keepParticle;
118 }
119 
120 
121 template<class ParcelType>
123 {
124  ParcelType::transformProperties(T);
125 
126  f_ = transform(T, f_);
127 
128  angularMomentum_ = transform(T, angularMomentum_);
129 
130  torque_ = transform(T, torque_);
131 }
132 
133 
134 template<class ParcelType>
136 (
137  const vector& separation
138 )
139 {
140  ParcelType::transformProperties(separation);
141 }
142 
143 
144 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
145 
146 #include "CollidingParcelIO.C"
147 
148 // ************************************************************************* //
Foam::Tensor< scalar >
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::transform
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
CollidingParcel.H
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::FatalError
error FatalError
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
T
const volScalarField & T
Definition: createFieldRefs.H:2
Foam::CollidingParcel::transformProperties
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: CollidingParcel.C:122
Foam::cloud
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:57
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::Vector< scalar >
Foam::CollidingParcel::trackingData
ParcelType::trackingData trackingData
Use base tracking data.
Definition: CollidingParcel.H:127
Foam::CollidingParcel::move
bool move(TrackCloudType &cloud, trackingData &td, const scalar trackTime)
Move the parcel.
Definition: CollidingParcel.C:66
CollidingParcelIO.C
Foam::CollidingParcel::CollidingParcel
CollidingParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from mesh, coordinates and topology.
Definition: CollidingParcelI.H:66