MPPICParcel.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) 2013-2020 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 "MPPICParcel.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class ParcelType>
32 (
33  const MPPICParcel<ParcelType>& p
34 )
35 :
36  ParcelType(p),
37  UCorrect_(p.UCorrect_)
38 {}
39 
40 
41 template<class ParcelType>
43 (
44  const MPPICParcel<ParcelType>& p,
45  const polyMesh& mesh
46 )
47 :
48  ParcelType(p, mesh),
50 {}
51 
52 
53 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
54 
55 template<class ParcelType>
56 template<class TrackCloudType>
58 (
59  TrackCloudType& cloud,
60  trackingData& td,
61  const scalar trackTime
62 )
63 {
64  typename TrackCloudType::parcelType& p =
65  static_cast<typename TrackCloudType::parcelType&>(*this);
66 
67  switch (td.part())
68  {
70  {
71  ParcelType::move(cloud, td, trackTime);
72 
73  break;
74  }
76  {
77  p.UCorrect() =
78  cloud.dampingModel().velocityCorrection(p, trackTime);
79 
80  td.keepParticle = true;
81  td.switchProcessor = false;
82 
83  break;
84  }
86  {
87  p.UCorrect() =
88  cloud.packingModel().velocityCorrection(p, trackTime);
89 
90  td.keepParticle = true;
91  td.switchProcessor = false;
92 
93  break;
94  }
96  {
97  const scalar f = p.stepFraction();
98  const scalar a = p.age();
99 
100  Swap(p.U(), p.UCorrect());
101 
102  ParcelType::move(cloud, td, trackTime);
103 
104  Swap(p.U(), p.UCorrect());
105 
106  p.U() += (p.stepFraction() - f)*p.UCorrect();
107 
108  p.age() = a;
109 
110  break;
111  }
112  }
113 
114  return td.keepParticle;
115 }
116 
117 
118 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
119 
120 #include "MPPICParcelIO.C"
121 
122 // ************************************************************************* //
bool move(TrackCloudType &cloud, trackingData &td, const scalar trackTime)
Move the parcel.
Definition: MPPICParcel.C:58
dynamicFvMesh & mesh
void Swap(T &a, T &b)
Definition: Swap.H:43
labelList f(nPoints)
vector UCorrect_
Velocity correction due to collisions [m/s].
Definition: MPPICParcel.H:168
MPPICParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from mesh, coordinates and topology.
Definition: MPPICParcelI.H:30
volScalarField & p