initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / lagrangian / dieselSpray / spraySubModels / collisionModel / trajectoryModel / trajectoryModel.C
blobc3b80068afb7c9d4789fa42b070edef764b9bde4
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 "trajectoryModel.H"
28 #include "addToRunTimeSelectionTable.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(trajectoryCollisionModel, 0);
39 addToRunTimeSelectionTable
41     collisionModel,
42     trajectoryCollisionModel,
43     dictionary
47 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
49 // Construct from components
50 trajectoryCollisionModel::trajectoryCollisionModel
52     const dictionary& dict,
53     spray& sm,
54     Random& rndGen
57     collisionModel(dict, sm, rndGen),
58     coeffsDict_(dict.subDict(typeName + "Coeffs")),
59     cSpace_(readScalar(coeffsDict_.lookup("cSpace"))),
60     cTime_(readScalar(coeffsDict_.lookup("cTime"))),
61     coalescence_(coeffsDict_.lookup("coalescence"))
66 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
68 trajectoryCollisionModel::~trajectoryCollisionModel()
72 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
74 void trajectoryCollisionModel::collideParcels(const scalar dt) const
76     if (spray_.size() < 2)
77     {
78         return;
79     }
81     spray::iterator secondParcel = spray_.begin();
82     ++secondParcel;
83     spray::iterator p1 = secondParcel;
85     while (p1 != spray_.end())
86     {
87         spray::iterator p2 = spray_.begin();
89         while (p2 != p1)
90         {
91 #           include "trajectoryCM.H"
93             // remove coalesced droplets
94             if (p2().m() < VSMALL) 
95             {
96                 spray::iterator tmpElmnt = p2;
97                 ++tmpElmnt;
98                 spray_.deleteParticle(p2());
99                 p2 = tmpElmnt;
100             }
101             else 
102             {
103                 ++p2;
104             }
106         } // end - inner loop
108         // remove coalesced droplets
109         if (p1().m() < VSMALL)
110         {
111             spray::iterator tmpElmnt = p1;
112             ++tmpElmnt;
113             spray_.deleteParticle(p1());
114             p1 = tmpElmnt;
115         }
116         else
117         {
118             ++p1;
119         }
120     } // end - outer loop
122 } // end
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 } // End namespace Foam
129 // ************************************************************************* //