SuppressionCollision.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "SuppressionCollision.H"
27 #include "kinematicCloud.H"
28 
29 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
30 
31 template<class CloudType>
33 (
34  typename CloudType::parcelType::trackingData& td,
35  const scalar dt
36 )
37 {
38  const kinematicCloud& sc =
39  this->owner().mesh().template
40  lookupObject<kinematicCloud>(suppressionCloud_);
41 
42  volScalarField vDotSweep(sc.vDotSweep());
43 
44  dimensionedScalar Dt("dt", dimTime, dt);
45  volScalarField P(type() + ":p", 1.0 - exp(-vDotSweep*Dt));
46 
47  forAllIter(typename CloudType, this->owner(), iter)
48  {
49  typename CloudType::parcelType& p = iter();
50  label celli = p.cell();
51 
52  scalar xx = this->owner().rndGen().template sample01<scalar>();
53 
54  if (xx < P[celli])
55  {
56  p.canCombust() = -1;
57  p.typeId() = max(p.typeId(), suppressedParcelType_);
58  }
59  }
60 }
61 
62 
63 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
64 
65 template<class CloudType>
67 (
68  const dictionary& dict,
69  CloudType& owner
70 )
71 :
72  StochasticCollisionModel<CloudType>(dict, owner, typeName),
73  suppressionCloud_(this->coeffDict().lookup("suppressionCloud")),
74  suppressedParcelType_
75  (
76  this->coeffDict().lookupOrDefault("suppressedParcelType", -1)
77  )
78 {}
79 
80 
81 template<class CloudType>
83 (
85 )
86 :
88  suppressionCloud_(cm.suppressionCloud_),
89  suppressedParcelType_(cm.suppressedParcelType_)
90 {}
91 
92 
93 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
94 
95 template<class CloudType>
97 {}
98 
99 
100 // ************************************************************************* //
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const word suppressionCloud_
Name of cloud used for suppression.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Inter-cloud collision model, whereby the canReact flag can be used to inhibit devolatilisation and su...
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:459
const label suppressedParcelType_
Suppressed parcel type - optional.
dimensionedScalar exp(const dimensionedScalar &ds)
virtual const tmp< volScalarField > vDotSweep() const =0
Volume swept rate of parcels per cell.
virtual void collide(typename CloudType::parcelType::trackingData &td, const scalar dt)
Update the model.
SuppressionCollision(const dictionary &dict, CloudType &owner)
Construct from dictionary.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:215
virtual ~SuppressionCollision()
Destructor.
Virtual abstract base class for templated KinematicCloud.
Templated stochastic collision model class.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
volScalarField & p
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69