OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

ORourkeCollisionModel.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "error.H"
00028 
00029 #include "ORourkeCollisionModel.H"
00030 #include "addToRunTimeSelectionTable.H"
00031 
00032 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036 
00037 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00038 
00039 defineTypeNameAndDebug(ORourkeCollisionModel, 0);
00040 
00041 addToRunTimeSelectionTable
00042 (
00043     collisionModel,
00044     ORourkeCollisionModel,
00045     dictionary
00046 );
00047 
00048 
00049 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00050 
00051 // Construct from components
00052 ORourkeCollisionModel::ORourkeCollisionModel
00053 (
00054     const dictionary& dict,
00055     spray& sm,
00056     Random& rndGen
00057 )
00058 :
00059     collisionModel(dict, sm, rndGen),
00060     vols_(sm.mesh().V()),
00061     coeffsDict_(dict.subDict(typeName + "Coeffs")),
00062     coalescence_(coeffsDict_.lookup("coalescence"))
00063 {}
00064 
00065 
00066 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00067 
00068 ORourkeCollisionModel::~ORourkeCollisionModel()
00069 {}
00070 
00071 
00072 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00073 
00074 void ORourkeCollisionModel::collideParcels(const scalar dt) const
00075 {
00076 
00077     if (spray_.size() < 2)
00078     {
00079         return;
00080     }
00081 
00082     spray::iterator secondParcel = spray_.begin();
00083     ++secondParcel;
00084     spray::iterator p1 = secondParcel;
00085 
00086     while (p1 != spray_.end())
00087     {
00088         label cell1 = p1().cell();
00089 
00090         spray::iterator p2 = spray_.begin();
00091 
00092         while (p2 != p1)
00093         {
00094             label cell2 = p2().cell();
00095 
00096             // No collision if parcels are not in the same cell
00097             if (cell1 == cell2)
00098             {
00099 #               include "sameCell.H"
00100             } // if - parcels in same cell
00101 
00102             // remove coalesced droplet
00103             if (p2().m() < VSMALL) 
00104             {
00105                 spray::iterator tmpElmnt = p2;
00106                 ++tmpElmnt;
00107                 spray_.deleteParticle(p2());
00108                 p2 = tmpElmnt;
00109             }
00110             else 
00111             {
00112                 ++p2;
00113             }
00114 
00115         } // inner loop
00116 
00117         // remove coalesced droplet
00118         if (p1().m() < VSMALL) 
00119         {
00120             spray::iterator tmpElmnt = p1;
00121             ++tmpElmnt;
00122             spray_.deleteParticle(p1());
00123             p1 = tmpElmnt;
00124         }
00125         else 
00126         {
00127             ++p1;
00128         }
00129     } // outer loop
00130 
00131 } // end
00132 
00133 
00134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00135 
00136 } // End namespace Foam
00137 
00138 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd