Loading...
Searching...
No Matches
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(
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 }
116
117 return td.keepParticle;
118}
119
120
121template<class ParcelType>
123{
124 ParcelType::transformProperties(T);
125
126 f_ = transform(T, f_);
127
129
131}
132
133
134template<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// ************************************************************************* //
Wrapper around kinematic parcel types to add collision modelling.
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
vector f_
Force on particle due to collisions [N].
ParcelType::trackingData trackingData
Use base tracking data.
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.
A cloud is a registry collection of lagrangian particles.
Definition cloud.H:56
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Tensor of scalars, i.e. Tensor<scalar>.
volScalarField & p
const volScalarField & T
dynamicFvMesh & mesh
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
Tensor< scalar > tensor
Definition symmTensor.H:57
errorManip< error > abort(error &err)
Definition errorManip.H:139
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
Vector< scalar > vector
Definition vector.H:57
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)