Skip to content

Commit

Permalink
Add the Arn0 methods like the Ar0n ones
Browse files Browse the repository at this point in the history
Closes #122
  • Loading branch information
ianhbell committed Apr 24, 2024
1 parent d7e134c commit f17543c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/teqp/cpp/deriv_adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ class DerivativeAdapter : public teqp::cppinterface::AbstractModel{
#define X(i) virtual EArrayd get_Ar0 ## i ## n(const double T, const double rho, const REArrayd& molefrac) const override { auto vals = TDXDerivatives<decltype(mp.get_cref()), double, EArrayd>::template get_Ar0n<i>(mp.get_cref(), T, rho, molefrac); return Eigen::Map<Eigen::ArrayXd>(&(vals[0]), vals.size()); };
AR0N_args
#undef X
// And like get_Ar10n, get_Ar20n, ....
#define X(i) virtual EArrayd get_Ar ## i ## 0n(const double T, const double rho, const REArrayd& molefrac) const override { auto vals = TDXDerivatives<decltype(mp.get_cref()), double, EArrayd>::template get_Arn0<i>(mp.get_cref(), T, rho, molefrac); return Eigen::Map<Eigen::ArrayXd>(&(vals[0]), vals.size()); };
ARN0_args
#undef X

// Virial derivatives
virtual double get_B2vir(const double T, const EArrayd& z) const override {
Expand Down
12 changes: 12 additions & 0 deletions include/teqp/cpp/teqpcpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ using REMatrixd = Eigen::Ref<const Eigen::Array<double, Eigen::Dynamic, Eigen::D
X(5) \
X(6)

// Note: the 0 index is not included because it is already present in the AR0N_args array
// otherwise you would have two copies of the 00
#define ARN0_args \
X(1) \
X(2) \
X(3) \
X(4)

// Functions that return a double, take T and rhovec as arguments
#define ISOCHORIC_double_args \
X(get_pr) \
Expand Down Expand Up @@ -104,6 +112,10 @@ namespace teqp {
#define X(i) virtual EArrayd get_Ar0 ## i ## n(const double T, const double rho, const REArrayd& molefrac) const = 0;
AR0N_args
#undef X
// And like get_Ar10n, get_Ar20n, ....
#define X(i) virtual EArrayd get_Ar ## i ## 0n(const double T, const double rho, const REArrayd& molefrac) const = 0;
ARN0_args
#undef X


// Virial derivatives
Expand Down
4 changes: 4 additions & 0 deletions interface/pybind11_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@ void init_teqp(py::module& m) {
#define X(i) .def(stringify(get_Ar0 ## i ## n), &am::get_Ar0 ## i ## n, "T"_a, "rho"_a, "molefrac"_a.noconvert())
AR0N_args
#undef X
// And like get_Ar10n, get_Ar20n, ....
#define X(i) .def(stringify(get_Ar ## i ## 0n), &am::get_Ar ## i ## 0n, "T"_a, "rho"_a, "molefrac"_a.noconvert())
ARN0_args
#undef X
.def("get_neff", &am::get_neff, "T"_a, "rho"_a, "molefrac"_a.noconvert())

// Methods that come from the isochoric derivatives formalism
Expand Down

0 comments on commit f17543c

Please sign in to comment.