OpenLB 1.8.1
Loading...
Searching...
No Matches
isotherm.h
Go to the documentation of this file.
1/* Lattice Boltzmann sample, written in C++, using the OpenLB
2 * library
3 *
4 * Copyright (C) 2022 Florian Raichle
5 * E-mail contact: info@openlb.net
6 * The most recent release of OpenLB can be downloaded at
7 * <http://www.openlb.net/>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 */
24
25
26#ifndef OLB_APPS_FLORIAN_ADSORPTION3D_PHOSPHATEREACTION_H_
27#define OLB_APPS_FLORIAN_ADSORPTION3D_PHOSPHATEREACTION_H_
28
29#include <vector>
30#include <cmath>
31#include <iostream>
32
33namespace olb {
34
44namespace Isotherm {
45
46// Linear Isotherm
48
49 struct ISO_KONST_A : public descriptors::FIELD_BASE<1> { };
50 struct ISO_KONST_B : public descriptors::FIELD_BASE<1> { };
51
53
54 template <typename V, typename COUPLING>
55 static void setParameters(V isoKonstA, V isoKonstB, COUPLING& coupling) any_platform {
56 coupling.template setParameter<Isotherm::LinearIsotherm::ISO_KONST_A>(isoKonstA);
57 coupling.template setParameter<Isotherm::LinearIsotherm::ISO_KONST_B>(isoKonstB);
58 return;
59 }
60
61 template <typename V, typename COUPLING>
62 static V getLoadingFromCoupling(V c, COUPLING& coupling) any_platform {
63 auto isoKonstA = coupling.template getParameter<Isotherm::LinearIsotherm::ISO_KONST_A>();
64 return isoKonstA[0] * c;
65 }
66
67 template <typename V, typename PARAMETERS>
68 V getLoading(V c, PARAMETERS& params) any_platform {
69 V isoKonstA = params.template get<ISO_KONST_A>();
70 return isoKonstA * c;
71 }
72
73 template <typename V, typename COUPLING>
74 static void print(std::ostream& clout, COUPLING& coupling) {
75 auto isoKonstA = coupling.template getParameter<Isotherm::LinearIsotherm::ISO_KONST_A>();
76 auto isoKonstB = coupling.template getParameter<Isotherm::LinearIsotherm::ISO_KONST_B>();
77 clout << "----------------- Isotherm information -----------------" << std::endl;
78 clout << "Isotherm exponent n = " << isoKonstB << std::endl;
79 clout << "Isotherm factor K = " << isoKonstA << std::endl;
80 clout << "-------------------------------------------------------------" << std::endl;
81 }
82
83};
84
85// LangmuirIsotherm
87
88 struct ISO_KONST_A : public descriptors::FIELD_BASE<1> { };
89 struct ISO_KONST_B : public descriptors::FIELD_BASE<1> { };
90
92
93 template <typename V, typename COUPLING>
94 static void setParameters(V isoKonstA, V isoKonstB, COUPLING& coupling) any_platform {
95 coupling.template setParameter<Isotherm::LangmuirIsotherm::ISO_KONST_A>(isoKonstA);
96 coupling.template setParameter<Isotherm::LangmuirIsotherm::ISO_KONST_B>(isoKonstB);
97 return;
98 }
99
100 template <typename V, typename COUPLING>
101 static V getLoadingFromCoupling(V c, COUPLING& coupling) any_platform {
102 auto isoKonstA = coupling.template getParameter<Isotherm::LangmuirIsotherm::ISO_KONST_A>();
103 auto isoKonstB = coupling.template getParameter<Isotherm::LangmuirIsotherm::ISO_KONST_B>();
104 return V(isoKonstA[0]) * V(isoKonstB[0]) * c / ( 1 + V(isoKonstB[0]) * c );
105 }
106
107 template <typename V, typename PARAMETERS>
108 V getLoading(V c, PARAMETERS& params) any_platform {
109 V isoKonstA = params.template get<ISO_KONST_A>();
110 V isoKonstB = params.template get<ISO_KONST_B>();
111 return isoKonstA * isoKonstB * c / ( 1 + isoKonstB * c );
112 }
113
114 template <typename V, typename COUPLING>
115 static void print(std::ostream& clout, COUPLING& coupling) {
116 auto isoKonstA = coupling.template getParameter<Isotherm::LangmuirIsotherm::ISO_KONST_A>();
117 auto isoKonstB = coupling.template getParameter<Isotherm::LangmuirIsotherm::ISO_KONST_B>();
118 clout << "----------------- Isotherm information -----------------" << std::endl;
119 clout << "Isotherm exponent n = " << isoKonstB << std::endl;
120 clout << "Isotherm factor K = " << isoKonstA << std::endl;
121 clout << "-------------------------------------------------------------" << std::endl;
122 }
123
124};
125
126// FreundlichIsotherm
128
129 struct ISO_KONST_A : public descriptors::FIELD_BASE<1> { };
130 struct ISO_KONST_B : public descriptors::FIELD_BASE<1> { };
131
133
134 template <typename V, typename PARAMETERS>
135 V getLoading(V c, PARAMETERS& params) any_platform {
136 V isoKonstA = params.template get<ISO_KONST_A>();
137 V isoKonstB = params.template get<ISO_KONST_B>();
138 return isoKonstA * std::pow(c, isoKonstB);
139 }
140
141};
142
143}
144
145}
146#endif
Top level namespace for all of OpenLB.
#define any_platform
Define preprocessor macros for device-side functions, constant storage.
Definition platform.h:77
V getLoading(V c, PARAMETERS &params) any_platform
Definition isotherm.h:135
static void print(std::ostream &clout, COUPLING &coupling)
Definition isotherm.h:115
static void setParameters(V isoKonstA, V isoKonstB, COUPLING &coupling) any_platform
Definition isotherm.h:94
V getLoading(V c, PARAMETERS &params) any_platform
Definition isotherm.h:108
static V getLoadingFromCoupling(V c, COUPLING &coupling) any_platform
Definition isotherm.h:101
static void setParameters(V isoKonstA, V isoKonstB, COUPLING &coupling) any_platform
Definition isotherm.h:55
V getLoading(V c, PARAMETERS &params) any_platform
Definition isotherm.h:68
static void print(std::ostream &clout, COUPLING &coupling)
Definition isotherm.h:74
static V getLoadingFromCoupling(V c, COUPLING &coupling) any_platform
Definition isotherm.h:62
Base of a field whose size is defined by [C_0,C_1,C_2]^T * [1,D,Q].
Definition fields.h:52
Plain wrapper for list of types.
Definition meta.h:276