OpenLB 1.7
Loading...
Searching...
No Matches
rate.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2020 Davide Dapelo
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
28#ifndef RATE_HH
29#define RATE_HH
30
31namespace olb {
32
34template<typename T>
35Rate<T>::Rate(std::vector<T> params)
36 : _params(params)
37{}
38
39
41template<typename T>
43 : Rate<T>(std::vector<T>{})
44{}
45
46template<typename T>
47T ConstantRate<T>::compute(std::vector<T> localFieldValues)
48{
49 return 1.0;
50}
51
52
54template<typename T>
56 : Rate<T>(std::vector<T>{(T)(t0)})
57{}
58
59template<typename T>
60T ExpOn1stSpecieRate<T>::compute(std::vector<T> localFieldValues)
61{
62 return localFieldValues[0] / this->_params[0];
63}
64
65
67template<typename T>
69 : Rate<T>(std::vector<T>{muMax, Ks})
70{}
71
72template<typename T>
73T MonodRate<T>::compute(std::vector<T> localFieldValues)
74{
75 // _params[0] = muMax
76 // _params[1] = Ks
77 // localFieldValues[0] = [S]
78 // localFieldValues[1] = [X]
79 return this->_params[0] * localFieldValues[0] * localFieldValues[1] / (localFieldValues[0] + this->_params[1]);
80}
81
82
84template<typename T>
85HaldaneRate<T>::HaldaneRate(T muMax, T Ks, T KI)
86 : Rate<T>(std::vector<T>{muMax, Ks, KI})
87{}
88
89template<typename T>
90T HaldaneRate<T>::compute(std::vector<T> localFieldValues)
91{
92 // _params[0] = muMax
93 // _params[1] = Ks
94 // _params[2] = KI
95 // localFieldValues[0] = [S]
96 // localFieldValues[1] = [X]
97 return this->_params[0] * localFieldValues[0] * localFieldValues[1]
98 / (localFieldValues[0] + this->_params[1] + localFieldValues[0]*localFieldValues[0]/this->_params[2]) ;
99}
100
101
102} // namespace olb
103
104#endif
virtual T compute(std::vector< T > localFieldValues) override
Definition rate.hh:47
ExpOn1stSpecieRate(int t0)
Definition rate.hh:55
T compute(std::vector< T > localFieldValues) override
Definition rate.hh:60
HaldaneRate(T muMax, T Ks, T KI)
Definition rate.hh:85
T compute(std::vector< T > localFieldValues) override
Definition rate.hh:90
T compute(std::vector< T > localFieldValues) override
Definition rate.hh:73
MonodRate(T muMax, T Ks)
Definition rate.hh:68
Rate(std::vector< T > params)
Definition rate.hh:35
Top level namespace for all of OpenLB.