initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / lagrangian / dieselSpray / spraySubModels / collisionModel / ORourke / ORourkeCollisionModel.C
blob092fdc87ac822c0f6befb31c451c494f3e5eb186
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "error.H"
29 #include "ORourkeCollisionModel.H"
30 #include "addToRunTimeSelectionTable.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace Foam
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 defineTypeNameAndDebug(ORourkeCollisionModel, 0);
41 addToRunTimeSelectionTable
43     collisionModel,
44     ORourkeCollisionModel,
45     dictionary
49 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
51 // Construct from components
52 ORourkeCollisionModel::ORourkeCollisionModel
54     const dictionary& dict,
55     spray& sm,
56     Random& rndGen
59     collisionModel(dict, sm, rndGen),
60     vols_(sm.mesh().V()),
61     coeffsDict_(dict.subDict(typeName + "Coeffs")),
62     coalescence_(coeffsDict_.lookup("coalescence"))
66 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
68 ORourkeCollisionModel::~ORourkeCollisionModel()
72 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
74 void ORourkeCollisionModel::collideParcels(const scalar dt) const
77     if (spray_.size() < 2)
78     {
79         return;
80     }
82     spray::iterator secondParcel = spray_.begin();
83     ++secondParcel;
84     spray::iterator p1 = secondParcel;
86     while (p1 != spray_.end())
87     {
88         label cell1 = p1().cell();
90         spray::iterator p2 = spray_.begin();
92         while (p2 != p1)
93         {
94             label cell2 = p2().cell();
96             // No collision if parcels are not in the same cell
97             if (cell1 == cell2)
98             {
99 #               include "sameCell.H"
100             } // if - parcels in same cell
102             // remove coalesced droplet
103             if (p2().m() < VSMALL) 
104             {
105                 spray::iterator tmpElmnt = p2;
106                 ++tmpElmnt;
107                 spray_.deleteParticle(p2());
108                 p2 = tmpElmnt;
109             }
110             else 
111             {
112                 ++p2;
113             }
115         } // inner loop
117         // remove coalesced droplet
118         if (p1().m() < VSMALL) 
119         {
120             spray::iterator tmpElmnt = p1;
121             ++tmpElmnt;
122             spray_.deleteParticle(p1());
123             p1 = tmpElmnt;
124         }
125         else 
126         {
127             ++p1;
128         }
129     } // outer loop
131 } // end
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 } // End namespace Foam
138 // ************************************************************************* //