teqp
0.23.1
Toggle main menu visibility
Loading...
Searching...
No Matches
interface
CPP
test
test_teqpcpp.cpp
Go to the documentation of this file.
1
10
11
#include <iostream>
12
#include "
teqp/cpp/teqpcpp.hpp
"
13
#include "
teqp/cpp/derivs.hpp
"
14
15
int
main
() {
16
nlohmann::json j = {
17
{
"kind"
,
"multifluid"
},
18
{
"model"
, {
19
{
"components"
, {
"../mycp/dev/fluids/Methane.json"
,
"../mycp/dev/fluids/Ethane.json"
}},
20
{
"BIP"
,
"../mycp/dev/mixtures/mixture_binary_pairs.json"
},
21
{
"departure"
,
"../mycp/dev/mixtures/mixture_departure_functions.json"
}
22
}
23
}};
24
//std::cout << j.dump(2);
25
auto
am =
teqp::cppinterface::make_model
(j);
26
27
auto
z = (Eigen::ArrayXd(2) << 0.5, 0.5).finished();
28
double
Ar01 = am->get_Arxy(0, 1, 300, 3, z);
29
std::cout << Ar01 << std::endl;
30
31
auto
fugcoeff = am->get_fugacity_coefficients(300.0, z*300.0);
32
std::cout << fugcoeff << std::endl;
33
34
auto
vhat = am->get_partial_molar_volumes(300.0, z*300.0);
35
std::cout << vhat << std::endl;
36
37
auto
mat = am->get_deriv_mat2(300.0, 300.0, z);
38
std::cout << mat << std::endl;
39
40
const
std::vector<char> vars = {
'T'
,
'D'
,
'P'
,
'S'
};
41
auto
im =
teqp::cppinterface::build_iteration_Jv
(vars, mat, mat, 8.3144, 300.0, 300.0, z);
42
std::cout << im.J << std::endl;
43
44
const
auto
& p = std::get<teqp::multifluid_t>(am->get_model());
45
std::cout << p.get_meta() << std::endl;
46
47
}
derivs.hpp
teqp::cppinterface::make_model
std::unique_ptr< AbstractModel > make_model(const nlohmann::json &, bool validate=true)
Definition
teqp_impl_factory.cpp:136
teqp::cppinterface::build_iteration_Jv
auto build_iteration_Jv(const std::vector< char > &vars, const Eigen::Array< double, 3, 3 > &A, const double R, const double T, const double rho, const Array &z)
A convenience function for calculation of Jacobian terms of the form and where is one of the therm...
Definition
derivs.hpp:26
teqpcpp.hpp
main
int main()
Definition
test_teqpcpp.cpp:15
Generated by
1.17.0