SuppressionCollision.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) 2013-2017 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "SuppressionCollision.H"
30 #include "kinematicCloud.H"
31 
32 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
33 
34 template<class CloudType>
36 (
37  typename CloudType::parcelType::trackingData& td,
38  const scalar dt
39 )
40 {
41  const kinematicCloud& sc =
42  this->owner().mesh().template
43  lookupObject<kinematicCloud>(suppressionCloud_);
44 
45  volScalarField vDotSweep(sc.vDotSweep());
46 
47  dimensionedScalar Dt("dt", dimTime, dt);
48  volScalarField P(type() + ":p", 1.0 - exp(-vDotSweep*Dt));
49 
50  for (typename CloudType::parcelType& p : this->owner())
51  {
52  const label celli = p.cell();
53 
54  scalar xx = this->owner().rndGen().template sample01<scalar>();
55 
56  if (xx < P[celli])
57  {
58  p.canCombust() = -1;
59  p.typeId() = max(p.typeId(), suppressedParcelType_);
60  }
61  }
62 }
63 
64 
65 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
66 
67 template<class CloudType>
69 (
70  const dictionary& dict,
71  CloudType& owner
72 )
73 :
74  StochasticCollisionModel<CloudType>(dict, owner, typeName),
75  suppressionCloud_(this->coeffDict().lookup("suppressionCloud")),
76  suppressedParcelType_
77  (
78  this->coeffDict().getOrDefault("suppressedParcelType", -1)
79  )
80 {}
81 
82 
83 template<class CloudType>
85 (
87 )
88 :
90  suppressionCloud_(cm.suppressionCloud_),
91  suppressedParcelType_(cm.suppressedParcelType_)
92 {}
93 
94 
95 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
96 
97 template<class CloudType>
99 {}
100 
101 
102 // ************************************************************************* //
Foam::SuppressionCollision::suppressionCloud_
const word suppressionCloud_
Name of cloud used for suppression.
Definition: SuppressionCollision.H:60
p
volScalarField & p
Definition: createFieldRefs.H:8
kinematicCloud.H
Foam::SuppressionCollision
Inter-cloud collision model, whereby the canReact flag can be used to inhibit devolatilisation and su...
Definition: SuppressionCollision.H:51
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:261
Foam::DSMCCloud::rndGen
Random & rndGen()
Return reference to the random object.
Definition: DSMCCloudI.H:124
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:53
Foam::SuppressionCollision::collide
virtual void collide(typename CloudType::parcelType::trackingData &td, const scalar dt)
Update the model.
Definition: SuppressionCollision.C:36
Foam::kinematicCloud
Virtual abstract base class for templated KinematicCloud.
Definition: kinematicCloud.H:52
Foam::StochasticCollisionModel
Templated stochastic collision model class.
Definition: KinematicCloud.H:95
Foam::SuppressionCollision::SuppressionCollision
SuppressionCollision(const dictionary &dict, CloudType &owner)
Construct from dictionary.
Definition: SuppressionCollision.C:69
Foam::SuppressionCollision::suppressedParcelType_
const label suppressedParcelType_
Suppressed parcel type - optional.
Definition: SuppressionCollision.H:63
Foam::DSMCCloud::mesh
const fvMesh & mesh() const
Return reference to the mesh.
Definition: DSMCCloudI.H:44
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::radiation::lookup
Lookup type of boundary radiation properties.
Definition: lookup.H:63
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::dimensioned< scalar >
Foam::kinematicCloud::vDotSweep
virtual const tmp< volScalarField > vDotSweep() const =0
Volume swept rate of parcels per cell.
Foam::SuppressionCollision::~SuppressionCollision
virtual ~SuppressionCollision()
Destructor.
Definition: SuppressionCollision.C:98
Foam::roots::type
type
Types of root.
Definition: Roots.H:54
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::GeometricField< scalar, fvPatchField, volMesh >
SuppressionCollision.H