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 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
45 
46 template<class ParcelType>
47 template<class TrackCloudType>
49 (
50  TrackCloudType& cloud,
51  trackingData& td
52 )
53 {
54  typename TrackCloudType::parcelType& p =
55  static_cast<typename TrackCloudType::parcelType&>(*this);
56 
57  switch (td.part())
58  {
59  case trackingData::tpVelocityHalfStep:
60  {
61  // First and last leapfrog velocity adjust part, required
62  // before and after tracking and force calculation
63 
64  const Pair<scalar>& sfr = td.stepFractionRange();
65  const scalar dt = (sfr.second() - sfr.first())*td.trackTime()/2;
66 
67  p.U() += dt*p.f()/p.mass();
68  p.angularMomentum() += dt*p.torque();
69 
70  td.keepParticle = true;
71  td.sendToProc = -1;
72 
73  break;
74  }
75 
76  case trackingData::tpLinearTrack:
77  {
78  ParcelType::move(cloud, td);
79 
80  break;
81  }
82 
83  case trackingData::tpRotationalTrack:
84  {
86 
87  break;
88  }
89  }
90 
91  return td.keepParticle;
92 }
93 
94 
95 template<class ParcelType>
97 (
98  const transformer& transform
99 )
100 {
101  ParcelType::transformProperties(transform);
102  f_ = transform.transform(f_);
103  angularMomentum_ = transform.transform(angularMomentum_);
104  torque_ = transform.transform(torque_);
105 }
106 
107 
108 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
109 
110 #include "CollidingParcelIO.C"
111 
112 // ************************************************************************* //
Class to hold temporary data during tracking.
trackPart part() const
Return the part of the tracking operation taking place.
bool move(TrackCloudType &cloud, trackingData &td)
Move the parcel.
CollidingParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti, const label facei)
Construct from mesh, coordinates and topology.
virtual void transformProperties(const transformer &)
Transform the physical properties of the particle.
const Type & second() const
Return second.
Definition: Pair.H:110
const Type & first() const
Return first.
Definition: Pair.H:98
A cloud is a collection of lagrangian particles.
Definition: cloud.H:55
friend dimensionSet transform(const dimensionSet &)
Return the argument; transformations do not change the dimensions.
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:483
volScalarField & p