PairModel.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) 2011 OpenFOAM Foundation
9  Copyright (C) 2018-2022 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 "PairModel.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class CloudType>
35 (
36  CloudType& owner
37 )
38 :
39  dict_(dictionary::null),
40  owner_(owner),
41  coeffDict_(dictionary::null),
42  forceRampTime_(-1)
43 {}
44 
45 
46 template<class CloudType>
48 (
49  const dictionary& dict,
50  CloudType& owner,
51  const word& type
52 )
53 :
54  dict_(dict),
55  owner_(owner),
56  coeffDict_(dict.subDict(type + "Coeffs")),
57  forceRampTime_
58  (
59  this->coeffDict().template getOrDefault<scalar>("forceRampTime", -1)
60  )
61 {}
62 
63 
64 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65 
66 template<class CloudType>
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 
73 template<class CloudType>
74 const CloudType&
76 {
77  return owner_;
78 }
79 
80 
81 template<class CloudType>
83 {
84  return dict_;
85 }
86 
87 
88 template<class CloudType>
90 {
91  return coeffDict_;
92 }
93 
94 
95 template<class CloudType>
97 (
98  typename CloudType::parcelType& pA,
99  typename CloudType::parcelType& pB
100 ) const
101 {
102  if (forceRampTime_ < 0)
103  {
104  return 1;
105  }
106 
107  return min(min(pA.age(), pB.age())/forceRampTime_, 1);
108 }
109 
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 #include "PairModelNew.C"
114 
115 // ************************************************************************* //
dictionary dict
type
Types of root.
Definition: Roots.H:52
const dictionary & dict() const
Return the dictionary.
Definition: PairModel.C:75
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
PairModel(CloudType &owner)
Construct null from cloud owner.
Definition: PairModel.C:28
A class for handling words, derived from Foam::string.
Definition: word.H:63
const CloudType & owner() const
Return the owner cloud object.
Definition: PairModel.C:68
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:26
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:290
const dictionary & coeffDict() const
Return the coefficients dictionary.
Definition: PairModel.C:82
virtual ~PairModel()
Destructor.
Definition: PairModel.C:60
scalar forceCoeff(typename CloudType::parcelType &pA, typename CloudType::parcelType &pB) const
Return the force coefficient based on the forceRampTime_.
Definition: PairModel.C:90
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67