26#include <pybind11/pybind11.h>
27#include <pybind11/stl.h>
28#include <pybind11/numpy.h>
37namespace py = pybind11;
44 const py::array_t<double>& values)
47 auto t = T.unchecked<1>();
48 auto v = values.unchecked<1>();
50 std::vector<double> tv(
static_cast<std::size_t
>(t.shape(0)));
51 std::vector<double> vv(
static_cast<std::size_t
>(v.shape(0)));
53 for (py::ssize_t i = 0; i < t.shape(0); i++) {
54 tv[
static_cast<std::size_t
>(i)] = t(i);
56 for (py::ssize_t i = 0; i < v.shape(0); i++) {
57 vv[
static_cast<std::size_t
>(i)] = v(i);
67 m.doc() =
"rizer Cantera 1D plasma extension (ThermalPlasmaColumn1D)";
70 "Version string of the linked libcantera.");
77 double electric_field,
79 py::array_t<double> sigma_T,
80 py::array_t<double> sigma_v,
81 py::array_t<double> kappa_T,
82 py::array_t<double> kappa_v,
86 double T_center_guess,
105 (prad_T.is_none() || prad_v.is_none())
107 : makeTable(prad_T.cast<py::array_t<double>>(),
108 prad_v.cast<py::array_t<double>>());
123 if (!init_r.is_none() && !init_T.is_none()) {
124 auto ir = init_r.cast<py::array_t<double>>();
125 auto it = init_T.cast<py::array_t<double>>();
126 auto ira = ir.unchecked<1>();
127 auto ita = it.unchecked<1>();
128 opts.
init_r.resize(
static_cast<std::size_t
>(ira.shape(0)));
129 opts.
init_T.resize(
static_cast<std::size_t
>(ita.shape(0)));
130 for (py::ssize_t i = 0; i < ira.shape(0); i++) {
131 opts.
init_r[
static_cast<std::size_t
>(i)] = ira(i);
133 for (py::ssize_t i = 0; i < ita.shape(0); i++) {
134 opts.
init_T[
static_cast<std::size_t
>(i)] = ita(i);
142 py::gil_scoped_release release;
144 sigma, kappa, prad, opts);
149 out[
"r"] = py::array_t<double>(res.
r.size(), res.
r.data());
150 out[
"T"] = py::array_t<double>(res.
T.size(), res.
T.data());
151 out[
"sigma"] = py::array_t<double>(res.
sigma.size(), res.
sigma.data());
152 out[
"kappa"] = py::array_t<double>(res.
kappa.size(), res.
kappa.data());
158 py::arg(
"R"), py::arg(
"electric_field"), py::arg(
"T_wall"),
159 py::arg(
"sigma_T"), py::arg(
"sigma_v"),
160 py::arg(
"kappa_T"), py::arg(
"kappa_v"),
161 py::arg(
"prad_T") = py::none(), py::arg(
"prad_v") = py::none(),
162 py::arg(
"n_points") = 41, py::arg(
"T_center_guess") = 10000.0,
163 py::arg(
"rho_cp") = 1.0e3, py::arg(
"loglevel") = 0,
164 py::arg(
"refine_grid") =
true, py::arg(
"refine_ratio") = 4.0,
165 py::arg(
"refine_slope") = 0.05, py::arg(
"refine_curve") = 0.10,
166 py::arg(
"refine_prune") = 0.0,
167 py::arg(
"init_r") = py::none(), py::arg(
"init_T") = py::none(),
168 "Solve the steady radial Elenbaas-Heller column.\n\n"
169 "Assembles [Empty1D | ThermalPlasmaColumn1D | Empty1D] in a Cantera\n"
170 "Sim1D, solves with Newton + pseudo-transient fallback, and optionally\n"
171 "refines the radial grid adaptively.\n\n"
174 "R : outer wall radius [m]\n"
175 "electric_field: axial E field [V/m]\n"
176 "T_wall : wall temperature [K]\n"
177 "sigma_T/v : tabulated sigma(T) [S/m] — 1-D arrays of equal length\n"
178 "kappa_T/v : tabulated kappa(T) [W/m/K]\n"
179 "prad_T/v : tabulated P_rad(T) [W/m^3], or None for no radiation\n"
180 "n_points : initial uniform grid count\n"
181 "T_center_guess: parabolic-seed centerline temperature [K]\n"
182 "rho_cp : rho*cp [J/m^3/K] for pseudo-transient scaling\n"
183 "loglevel : Sim1D verbosity (0 = silent)\n"
184 "refine_grid : enable adaptive grid refinement\n"
185 "refine_ratio/slope/curve/prune: Refiner parameters\n"
186 "init_r/T : optional seed profile T(r); overrides the parabola\n\n"
189 "dict with keys r, T, sigma, kappa (numpy arrays) and\n"
190 "current [A], electric_field [V/m], n_points (scalars).");
PYBIND11_MODULE(_plasma1d, m)
static PropertyTable constant(double value)
A two-point constant table returning value for any T.
ColumnResult solveColumn(double R, double electric_field, double T_wall, const PropertyTable &sigma, const PropertyTable &kappa, const PropertyTable &p_rad, const ColumnOptions &opts)
Build, solve, and extract the radial Elenbaas-Heller column.
Solver configuration. All fields have defaults matching a typical H2 arc.
std::vector< double > init_r
Optional seed profile for the initial guess.
int loglevel
Sim1D verbosity (0 = silent, 1 = progress)
double refine_ratio
Refiner: max ratio of adjacent cell widths.
double refine_curve
Refiner: max fractional curvature per cell.
double rho_cp
rho*cp [J/m³/K] — scales the pseudo-transient term
double refine_slope
Refiner: max fractional slope change per cell.
double T_center_guess
parabolic-seed centerline temperature [K]
double refine_prune
Refiner: remove points below this threshold.
std::vector< double > init_T
seed temperatures [K] at init_r
std::size_t n_points
initial uniform grid count (refined during solve)
bool refine_grid
enable Cantera adaptive grid refinement
Output of a completed column solve.
double electric_field
E [V/m] used for this solve.
std::size_t n_points
number of grid points after adaptive refinement
std::vector< double > T
converged temperature [K] at each grid point
double current
I = 2π·E·∫sigma(T)·r dr [A], trapezoidal.
std::vector< double > sigma
electrical conductivity [S/m] evaluated at T
std::vector< double > kappa
thermal conductivity [W/m/K] evaluated at T
std::vector< double > r
radial grid [m] after refinement, r[0]=0, r[N-1]=R