OGS
Adsorption.h
Go to the documentation of this file.
1
10#pragma once
11
12#include <array>
13#include <cmath>
14
15#include "Reaction.h"
16
17namespace Adsorption
18{
19
21{
22public:
23 // TODO [CL] move those three methods to water properties class
24 static double getEvaporationEnthalpy(const double T_Ads);
25 static double getEquilibriumVapourPressure(const double T_Ads);
26
27 static double getMolarFraction(double xm, double M_this, double M_other);
28 static double dMolarFraction(double xm, double M_this, double M_other);
29
30 static double getLoading(const double rho_curr, const double rho_dry);
31
32 double getEquilibriumLoading(const double p_Ads, const double T_Ads, const double M_Ads)
33 const override;
34
35 double getEnthalpy(const double p_Ads, const double T_Ads,
36 const double M_Ads) const override;
37 double getReactionRate(const double p_Ads, const double T_Ads,
38 const double M_Ads,
39 const double loading) const override;
40
41protected:
42 virtual double getAdsorbateDensity(const double T_Ads) const = 0;
43 virtual double getAlphaT(const double T_Ads) const = 0;
44 virtual double characteristicCurve(const double A) const = 0;
45 virtual double dCharacteristicCurve(const double A) const = 0;
46
47private:
48 double getEntropy(const double T_Ads, const double A) const;
49};
50
51
52inline double curvePolyfrac(const double* coeffs, const double x)
53{
54 // TODO use Horner scheme
55 return (coeffs[0] + coeffs[2] * x + coeffs[4] * std::pow(x, 2) +
56 coeffs[6] * std::pow(x, 3)) /
57 (1.0 + coeffs[1] * x + coeffs[3] * std::pow(x, 2) +
58 coeffs[5] * std::pow(x, 3));
59}
60
61inline double dCurvePolyfrac(const double* coeffs, const double x)
62{
63 const double x2 = x*x;
64 const double x3 = x2*x;
65 const double u = coeffs[0] + coeffs[2] * x + coeffs[4] * x2 + coeffs[6] * x3;
66 const double du = coeffs[2] + 2.0*coeffs[4] * x + 3.0*coeffs[6] * x2;
67 const double v = 1.0 + coeffs[1] * x + coeffs[3] * x2 + coeffs[5] * x3;
68 const double dv = coeffs[1] + 2.0*coeffs[3] * x + 3.0*coeffs[5] * x2;
69
70 return (du*v - u*dv) / v / v;
71}
72
73} // namespace Adsorption
static double getMolarFraction(double xm, double M_this, double M_other)
static double dMolarFraction(double xm, double M_this, double M_other)
virtual double getAlphaT(const double T_Ads) const =0
virtual double dCharacteristicCurve(const double A) const =0
double getEntropy(const double T_Ads, const double A) const
static double getEquilibriumVapourPressure(const double T_Ads)
double getEnthalpy(const double p_Ads, const double T_Ads, const double M_Ads) const override
static double getEvaporationEnthalpy(const double T_Ads)
static double getLoading(const double rho_curr, const double rho_dry)
virtual double characteristicCurve(const double A) const =0
double getReactionRate(const double p_Ads, const double T_Ads, const double M_Ads, const double loading) const override
virtual double getAdsorbateDensity(const double T_Ads) const =0
double getEquilibriumLoading(const double p_Ads, const double T_Ads, const double M_Ads) const override
double curvePolyfrac(const double *coeffs, const double x)
Definition Adsorption.h:52
double dCurvePolyfrac(const double *coeffs, const double x)
Definition Adsorption.h:61