Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
ConvertUtils.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright © 2014-2024 Allan Leal
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 namespace Reaktoro {
21 
23 template<typename Scalar> auto convertCelsiusToKelvin(Scalar T) -> decltype(T + 273.15) { return T + 273.15; }
24 
26 template<typename Scalar> auto convertKelvinToCelsius(Scalar T) -> decltype(T - 273.15) { return T - 273.15; }
27 
29 template<typename Scalar> auto convertPascalToKiloPascal(Scalar P) -> decltype(P * 1.0e-3) { return P * 1.0e-3; }
30 
32 template<typename Scalar> auto convertPascalToMegaPascal(Scalar P) -> decltype(P * 1.0e-6) { return P * 1.0e-6; }
33 
35 template<typename Scalar> auto convertPascalToBar(Scalar P) -> decltype(P * 1.0e-5) { return P * 1.0e-5; }
36 
38 template<typename Scalar> auto convertKiloPascalToPascal(Scalar P) -> decltype(P * 1.0e+3) { return P * 1.0e+3; }
39 
41 template<typename Scalar> auto convertKiloPascalToMegaPascal(Scalar P) -> decltype(P * 1.0e-3) { return P * 1.0e-3; }
42 
44 template<typename Scalar> auto convertKiloPascalToBar(Scalar P) -> decltype(P * 1.0e-2) { return P * 1.0e-2; }
45 
47 template<typename Scalar> auto convertMegaPascalToPascal(Scalar P) -> decltype(P * 1.0e+6) { return P * 1.0e+6; }
48 
50 template<typename Scalar> auto convertMegaPascalToKiloPascal(Scalar P) -> decltype(P * 1.0e+3) { return P * 1.0e+3; }
51 
53 template<typename Scalar> auto convertMegaPascalToBar(Scalar P) -> decltype(P * 1.0e+1) { return P * 1.0e+1; }
54 
56 template<typename Scalar> auto convertBarToPascal(Scalar P) -> decltype(P * 1.0e+5) { return P * 1.0e+5; }
57 
59 template<typename Scalar> auto convertBarToKiloPascal(Scalar P) -> decltype(P * 1.0e+2) { return P * 1.0e+2; }
60 
62 template<typename Scalar> auto convertBarToMegaPascal(Scalar P) -> decltype(P * 1.0e-1) { return P * 1.0e-1; }
63 
65 template<typename Scalar> auto convertBarToAtm(Scalar P) -> decltype(P * 0.986923267) { return P * 0.986923267; }
66 
68 template<typename Scalar> auto convertCubicCentimeterToCubicMeter(Scalar V) -> decltype(V * 1.0e-6) { return V * 1.0e-6; }
69 
71 template<typename Scalar> auto convertCubicMeterToCubicCentimeter(Scalar V) -> decltype(V * 1.0e+6) { return V * 1.0e+6; }
72 
74 template<typename Scalar> auto convertCubicMeterToLiter(Scalar V) -> decltype(V * 1.0e+3) { return V * 1.0e+3; }
75 
77 template<typename Scalar> auto convertLiterToCubicMeter(Scalar V) -> decltype(V * 1.0e-3) { return V * 1.0e-3; }
78 
79 } // namespace Reaktoro
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
auto convertKelvinToCelsius(Scalar T) -> decltype(T - 273.15)
Converts temperature from kelvin to celsius.
Definition: ConvertUtils.hpp:26
auto convertCubicCentimeterToCubicMeter(Scalar V) -> decltype(V *1.0e-6)
Converts volume from cm3 to m3.
Definition: ConvertUtils.hpp:68
auto convertCubicMeterToLiter(Scalar V) -> decltype(V *1.0e+3)
Converts volume from m3 to liter.
Definition: ConvertUtils.hpp:74
auto convertKiloPascalToBar(Scalar P) -> decltype(P *1.0e-2)
Converts pressure from kilo pascal to bar.
Definition: ConvertUtils.hpp:44
auto convertMegaPascalToPascal(Scalar P) -> decltype(P *1.0e+6)
Converts pressure from mega pascal to pascal.
Definition: ConvertUtils.hpp:47
auto convertPascalToKiloPascal(Scalar P) -> decltype(P *1.0e-3)
Converts pressure from pascal to kilo pascal.
Definition: ConvertUtils.hpp:29
auto convertPascalToBar(Scalar P) -> decltype(P *1.0e-5)
Converts pressure from pascal to bar.
Definition: ConvertUtils.hpp:35
auto convertBarToAtm(Scalar P) -> decltype(P *0.986923267)
Convert pressure from bar to atm.
Definition: ConvertUtils.hpp:65
auto convertBarToPascal(Scalar P) -> decltype(P *1.0e+5)
Converts pressure from bar to pascal.
Definition: ConvertUtils.hpp:56
auto convertPascalToMegaPascal(Scalar P) -> decltype(P *1.0e-6)
Converts pressure from pascal to mega pascal.
Definition: ConvertUtils.hpp:32
auto convertLiterToCubicMeter(Scalar V) -> decltype(V *1.0e-3)
Converts volume from liter to m3.
Definition: ConvertUtils.hpp:77
auto convertBarToKiloPascal(Scalar P) -> decltype(P *1.0e+2)
Converts pressure from bar to kilo pascal.
Definition: ConvertUtils.hpp:59
auto convertMegaPascalToKiloPascal(Scalar P) -> decltype(P *1.0e+3)
Converts pressure from mega pascal to kilo pascal.
Definition: ConvertUtils.hpp:50
auto convertKiloPascalToPascal(Scalar P) -> decltype(P *1.0e+3)
Converts pressure from kilo pascal to pascal.
Definition: ConvertUtils.hpp:38
auto convertBarToMegaPascal(Scalar P) -> decltype(P *1.0e-1)
Converts pressure from bar to mega pascal.
Definition: ConvertUtils.hpp:62
auto convertKiloPascalToMegaPascal(Scalar P) -> decltype(P *1.0e-3)
Converts pressure from kilo pascal to mega pascal.
Definition: ConvertUtils.hpp:41
auto convertCelsiusToKelvin(Scalar T) -> decltype(T+273.15)
Converts temperature from celsius to kelvin.
Definition: ConvertUtils.hpp:23
auto convertCubicMeterToCubicCentimeter(Scalar V) -> decltype(V *1.0e+6)
Converts volume from m3 to cm3.
Definition: ConvertUtils.hpp:71
auto convertMegaPascalToBar(Scalar P) -> decltype(P *1.0e+1)
Converts pressure from mega pascal to bar.
Definition: ConvertUtils.hpp:53