BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / lagrangian / dieselSpray / spraySubModels / collisionModel / ORourke / ORourkeCollisionModel.C
blob8e965a7063117186851105b1d5d61e5ae321a421
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "ORourkeCollisionModel.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "mathematicalConstants.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 namespace Foam
34     defineTypeNameAndDebug(ORourkeCollisionModel, 0);
36     addToRunTimeSelectionTable
37     (
38         collisionModel,
39         ORourkeCollisionModel,
40         dictionary
41     );
45 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
47 Foam::ORourkeCollisionModel::ORourkeCollisionModel
49     const dictionary& dict,
50     spray& sm,
51     cachedRandom& rndGen
54     collisionModel(dict, sm, rndGen),
55     vols_(sm.mesh().V()),
56     coeffsDict_(dict.subDict(typeName + "Coeffs")),
57     coalescence_(coeffsDict_.lookup("coalescence"))
61 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
63 Foam::ORourkeCollisionModel::~ORourkeCollisionModel()
67 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
69 void Foam::ORourkeCollisionModel::collideParcels(const scalar dt) const
71     if (spray_.size() < 2)
72     {
73         return;
74     }
76     spray::iterator secondParcel = spray_.begin();
77     ++secondParcel;
78     spray::iterator p1 = secondParcel;
80     while (p1 != spray_.end())
81     {
82         label cell1 = p1().cell();
84         spray::iterator p2 = spray_.begin();
86         while (p2 != p1)
87         {
88             label cell2 = p2().cell();
90             // No collision if parcels are not in the same cell
91             if (cell1 == cell2)
92             {
93                 #include "sameCell.H"
94             }
96             // remove coalesced droplet
97             if (p2().m() < VSMALL)
98             {
99                 spray::iterator tmpElmnt = p2;
100                 ++tmpElmnt;
101                 spray_.deleteParticle(p2());
102                 p2 = tmpElmnt;
103             }
104             else
105             {
106                 ++p2;
107             }
108         }
110         // remove coalesced droplet
111         if (p1().m() < VSMALL)
112         {
113             spray::iterator tmpElmnt = p1;
114             ++tmpElmnt;
115             spray_.deleteParticle(p1());
116             p1 = tmpElmnt;
117         }
118         else
119         {
120             ++p1;
121         }
122     }
126 // ************************************************************************* //