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-------------------------------------------------------------------------------
10License
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
32template<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
46template<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
63template<class ParcelType>
64template<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
121template<class ParcelType>
123{
125
126 f_ = transform(T, f_);
127
128 angularMomentum_ = transform(T, angularMomentum_);
129
130 torque_ = transform(T, torque_);
131}
132
133
134template<class ParcelType>
136(
137 const vector& separation
138)
139{
141}
142
143
144// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
145
146#include "CollidingParcelIO.C"
147
148// ************************************************************************* //
Wrapper around kinematic parcel types to add collision modelling.
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:60
virtual void move()=0
Class used to pass data into container.
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
Definition: particle.C:1072
volScalarField & p
const volScalarField & T
dynamicFvMesh & mesh
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
errorManip< error > abort(error &err)
Definition: errorManip.H:144
error FatalError