feat(pythonInterface/eos): added working python eos interface
confirmed that this produces the same results as the underlying C code would predict
This commit is contained in:
@@ -91,6 +91,56 @@ void register_eos_bindings(pybind11::module &eos_submodule) {
|
||||
);
|
||||
}, py::return_value_policy::reference_internal); // Keep parent 'table' alive
|
||||
|
||||
py::class_<serif::eos::helmholtz::EOS>(eos_submodule, "EOS")
|
||||
.def(py::init<>())
|
||||
.def_readonly("ye", &serif::eos::helmholtz::EOS::ye)
|
||||
.def_readonly("etaele", &serif::eos::helmholtz::EOS::etaele)
|
||||
.def_readonly("xnefer", &serif::eos::helmholtz::EOS::xnefer)
|
||||
|
||||
.def_readonly("ptot", &serif::eos::helmholtz::EOS::ptot)
|
||||
.def_readonly("pgas", &serif::eos::helmholtz::EOS::pgas)
|
||||
.def_readonly("prad", &serif::eos::helmholtz::EOS::prad)
|
||||
|
||||
.def_readonly("etot", &serif::eos::helmholtz::EOS::etot)
|
||||
.def_readonly("egas", &serif::eos::helmholtz::EOS::egas)
|
||||
.def_readonly("erad", &serif::eos::helmholtz::EOS::erad)
|
||||
|
||||
.def_readonly("stot", &serif::eos::helmholtz::EOS::stot)
|
||||
.def_readonly("sgas", &serif::eos::helmholtz::EOS::sgas)
|
||||
.def_readonly("srad", &serif::eos::helmholtz::EOS::srad)
|
||||
|
||||
.def_readonly("dpresdd", &serif::eos::helmholtz::EOS::dpresdd)
|
||||
.def_readonly("dpresdt", &serif::eos::helmholtz::EOS::dpresdt)
|
||||
.def_readonly("dpresda", &serif::eos::helmholtz::EOS::dpresda)
|
||||
.def_readonly("dpresdz", &serif::eos::helmholtz::EOS::dpresdz)
|
||||
// TODO: Finish adding all the derivatives to the bound class
|
||||
.def_readonly("dentrdd", &serif::eos::helmholtz::EOS::dentrdd)
|
||||
.def_readonly("dentrdt", &serif::eos::helmholtz::EOS::dentrdt)
|
||||
.def_readonly("dentrda", &serif::eos::helmholtz::EOS::dentrda)
|
||||
.def_readonly("dentrdz", &serif::eos::helmholtz::EOS::dentrdz)
|
||||
|
||||
.def_readonly("denerdd", &serif::eos::helmholtz::EOS::denerdd)
|
||||
.def_readonly("denerdt", &serif::eos::helmholtz::EOS::denerdt)
|
||||
.def_readonly("denerda", &serif::eos::helmholtz::EOS::denerda)
|
||||
.def_readonly("denerdz", &serif::eos::helmholtz::EOS::denerdz)
|
||||
|
||||
.def_readonly("chiT", &serif::eos::helmholtz::EOS::chiT)
|
||||
.def_readonly("chiRho", &serif::eos::helmholtz::EOS::chiRho)
|
||||
.def_readonly("csound", &serif::eos::helmholtz::EOS::csound)
|
||||
.def_readonly("grad_ad", &serif::eos::helmholtz::EOS::grad_ad)
|
||||
.def_readonly("gamma1", &serif::eos::helmholtz::EOS::gamma1)
|
||||
.def_readonly("gamma2", &serif::eos::helmholtz::EOS::gamma2)
|
||||
.def_readonly("gamma3", &serif::eos::helmholtz::EOS::gamma3)
|
||||
.def_readonly("cV", &serif::eos::helmholtz::EOS::cV)
|
||||
.def_readonly("cP", &serif::eos::helmholtz::EOS::cP)
|
||||
.def_readonly("dse", &serif::eos::helmholtz::EOS::dse)
|
||||
.def_readonly("dpe", &serif::eos::helmholtz::EOS::dpe)
|
||||
.def_readonly("dsp", &serif::eos::helmholtz::EOS::dsp)
|
||||
|
||||
.def("__repr__", [](const serif::eos::helmholtz::EOS &eos) {
|
||||
return "<EOS (output from helmholtz eos)>";
|
||||
});
|
||||
|
||||
py::class_<serif::eos::helmholtz::EOSInput>(eos_submodule, "EOSInput")
|
||||
.def(py::init<>())
|
||||
.def_readwrite("T", &serif::eos::helmholtz::EOSInput::T)
|
||||
@@ -103,4 +153,10 @@ void register_eos_bindings(pybind11::module &eos_submodule) {
|
||||
", abar=" + std::to_string(input.abar) +
|
||||
", zbar=" + std::to_string(input.zbar) + ")>";
|
||||
});
|
||||
|
||||
eos_submodule.def("get_helm_eos",
|
||||
&serif::eos::helmholtz::get_helm_EOS,
|
||||
py::arg("q"), py::arg("table"),
|
||||
"Calculate the Helmholtz EOS components based on input parameters and table data.");
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user