diff --git a/include/teqp/models/multifluid.hpp b/include/teqp/models/multifluid.hpp index 4bec7c7b254ee208be8036be7348101bd67444c6..331368a931a2975c677e1438fd9f4b53b1774cde 100644 --- a/include/teqp/models/multifluid.hpp +++ b/include/teqp/models/multifluid.hpp @@ -15,6 +15,7 @@ #include "teqp/constants.hpp" #include "teqp/filesystem.hpp" #include "teqp/json_tools.hpp" +#include "teqp/exceptions.hpp" #include "MultiComplex/MultiComplex.hpp" @@ -108,6 +109,19 @@ public: } return forceeval(alphar); } + + /// Call a single departure term at i,j + template<typename TauType, typename DeltaType> + auto get_alpharij(const int i, const int j, const TauType& tau, const DeltaType& delta) const { + int N = funcs.size(); + if (i < 0 || j < 0){ + throw teqp::InvalidArgument("i or j is negative"); + } + if (i >= N || j >= N){ + throw teqp::InvalidArgument("i or j is invalid; size is " + std::to_string(N)); + } + return forceeval(funcs[i][j].alphar(tau, delta)); + } }; template<typename CorrespondingTerm, typename DepartureTerm> diff --git a/interface/multifluid.cpp b/interface/multifluid.cpp index 594e955198541163d599ee7934873d70ef9ec36a..4f09fa49ad56a74514ed0c4f29be0b081c5bd3be 100644 --- a/interface/multifluid.cpp +++ b/interface/multifluid.cpp @@ -14,6 +14,7 @@ void add_multifluid(py::module& m) { auto wMF = py::class_<MultiFluid>(m, "MultiFluid"); add_derivatives<MultiFluid>(m, wMF); add_multifluid_methods<MultiFluid>(wMF); + wMF.def("get_alpharij", [](const MultiFluid& c, const int i, const int j, const double &tau, const double &delta) { return c.dep.get_alpharij(i, j, tau, delta); }); // Expose some additional functions for working with the JSON data structures and resolving aliases m.def("get_BIPdep", &reducing::get_BIPdep, py::arg("BIPcollection"), py::arg("identifiers"), py::arg("flags") = nlohmann::json{}); diff --git a/interface/multifluid_mutant.cpp b/interface/multifluid_mutant.cpp index f0cd365a5d2d1004defaf2694ab08854e1cd7eb5..bae14c8ce5b09daee6e93ddc284a0400d33bf452 100644 --- a/interface/multifluid_mutant.cpp +++ b/interface/multifluid_mutant.cpp @@ -28,6 +28,7 @@ void add_multifluid_mutant(py::module& m) { add_derivatives<BIPmod>(m, wMFBIP); add_multifluid_methods<BIPmod>(wMFBIP); + wMFBIP.def("get_alpharij", [](const BIPmod& c, const int i, const int j, const double &tau, const double &delta) { return c.depfunc.get_alpharij(i, j, tau, delta); }); // Wrap the deprecated function for generating a multifluid mutant called an invariant m.def("build_multifluid_mutant_invariant", &build_multifluid_mutant<MultiFluid>);