eulerianParticleTemplates.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2015-2016 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 namespace Foam
29 {
30 namespace functionObjects
31 {
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 template<class VOFParticle>
37 {
38  public:
39  eulerianParticle operator()
40  (
41  const eulerianParticle& p0,
42  const eulerianParticle& p1
43  ) const
44  {
45  if ((p0.faceIHit != -1) && (p1.faceIHit == -1))
46  {
47  return p0;
48  }
49  else if ((p0.faceIHit == -1) && (p1.faceIHit != -1))
50  {
51  return p1;
52  }
53  else if ((p0.faceIHit != -1) && (p1.faceIHit != -1))
54  {
55  // Choose particle with the largest collected volume and
56  // accumulate total volume
57  if (p0.V > p1.V)
58  {
60  p.V = p0.V + p1.V;
61  p.VC = p0.VC + p1.VC;
62  p.VU = p0.VU + p1.VU;
63  return p;
64  }
65  else
66  {
67  eulerianParticle p = p1;
68  p.V = p0.V + p1.V;
69  p.VC = p0.VC + p1.VC;
70  p.VU = p0.VU + p1.VU;
71  return p;
72  }
73  }
74  else
75  {
77  return p;
78  }
79  }
80 };
81 
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 } // End namespace functionObjects
86 } // End namespace Foam
87 
88 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89 
90 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::functionObjects::eulerianParticle
Definition: eulerianParticle.H:71
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
p0
const volScalarField & p0
Definition: EEqn.H:36
Foam::functionObjects::sumParticleOp
Definition: eulerianParticleTemplates.C:36