FreeFOAM The Cross-Platform CFD Toolkit
ORourkeCollisionModel.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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 <OpenFOAM/error.H>
27 
28 #include "ORourkeCollisionModel.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 defineTypeNameAndDebug(ORourkeCollisionModel, 0);
39 
41 (
42  collisionModel,
43  ORourkeCollisionModel,
44  dictionary
45 );
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
50 // Construct from components
52 (
53  const dictionary& dict,
54  spray& sm,
55  Random& rndGen
56 )
57 :
58  collisionModel(dict, sm, rndGen),
59  vols_(sm.mesh().V()),
60  coeffsDict_(dict.subDict(typeName + "Coeffs")),
61  coalescence_(coeffsDict_.lookup("coalescence"))
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
66 
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 
73 void ORourkeCollisionModel::collideParcels(const scalar dt) const
74 {
75 
76  if (spray_.size() < 2)
77  {
78  return;
79  }
80 
81  spray::iterator secondParcel = spray_.begin();
82  ++secondParcel;
83  spray::iterator p1 = secondParcel;
84 
85  while (p1 != spray_.end())
86  {
87  label cell1 = p1().cell();
88 
90 
91  while (p2 != p1)
92  {
93  label cell2 = p2().cell();
94 
95  // No collision if parcels are not in the same cell
96  if (cell1 == cell2)
97  {
98 # include "sameCell.H"
99  } // if - parcels in same cell
100 
101  // remove coalesced droplet
102  if (p2().m() < VSMALL)
103  {
104  spray::iterator tmpElmnt = p2;
105  ++tmpElmnt;
106  spray_.deleteParticle(p2());
107  p2 = tmpElmnt;
108  }
109  else
110  {
111  ++p2;
112  }
113 
114  } // inner loop
115 
116  // remove coalesced droplet
117  if (p1().m() < VSMALL)
118  {
119  spray::iterator tmpElmnt = p1;
120  ++tmpElmnt;
121  spray_.deleteParticle(p1());
122  p1 = tmpElmnt;
123  }
124  else
125  {
126  ++p1;
127  }
128  } // outer loop
129 
130 } // end
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace Foam
136 
137 // ************************ vim: set sw=4 sts=4 et: ************************ //