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-2022 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  {
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.sendToProc = -1;
86 
87  break;
88  }
89 
91  {
92  ParcelType::move(cloud, td, trackTime);
93 
94  break;
95  }
96 
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  const transformer& transform
120 )
121 {
122  ParcelType::transformProperties(transform);
123  f_ = transform.transform(f_);
125  torque_ = transform.transform(torque_);
126 }
127 
128 
129 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
130 
131 #include "CollidingParcelIO.C"
132 
133 // ************************************************************************* //
trackPart part() const
Return the part of the tracking operation taking place.
vector f_
Force on particle due to collisions [N].
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
Class to hold temporary data during tracking.
virtual void transformProperties(const transformer &)
Transform the physical properties of the particle.
collisionRecordList collisionRecords_
Particle collision records.
fvMesh & mesh
errorManip< error > abort(error &err)
Definition: errorManip.H:131
bool move(TrackCloudType &cloud, trackingData &td, const scalar trackTime)
Move the parcel.
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.
Type transform(const Type &) const
Transform the given type.
volScalarField & p
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353