|
10 | 10 | import typing |
11 | 11 |
|
12 | 12 | import numpy as np |
13 | | -from scipy import integrate |
| 13 | +from scipy.integrate import cumulative_trapezoid |
14 | 14 |
|
15 | 15 | from .datatypes import Field, Rprof, Tseries, Varf, Varr, Vart |
16 | 16 | from .error import NotAvailableError |
@@ -341,22 +341,22 @@ def stream_function(step: Step) -> Field: |
341 | 341 | vz0 = ((r_nw[1] - r_nc[0]) * v_z[:, 0] + (r_nc[0] - r_nw[0]) * v_z[:, 1]) / ( |
342 | 342 | r_nw[1] - r_nw[0] |
343 | 343 | ) |
344 | | - psi[1:, 0] = -integrate.cumtrapz(r_pc[0] ** 2 * vz0, x=x_coord) |
| 344 | + psi[1:, 0] = -cumulative_trapezoid(r_pc[0] ** 2 * vz0, x=x_coord) |
345 | 345 | # vx at center |
346 | 346 | vxc = (v_x + np.roll(v_x, -1, axis=0)) / 2 |
347 | 347 | for i_x in range(len(x_coord)): |
348 | | - psi[i_x, 1:] = psi[i_x, 0] + integrate.cumtrapz(r_pc * vxc[i_x], x=r_nc) |
| 348 | + psi[i_x, 1:] = psi[i_x, 0] + cumulative_trapezoid(r_pc * vxc[i_x], x=r_nc) |
349 | 349 | else: # assume cartesian geometry |
350 | 350 | z_nc = step.geom.r_centers |
351 | 351 | z_nw = step.rprofs.walls[:2] |
352 | 352 | vz0 = ((z_nw[1] - z_nc[0]) * v_z[:, 0] + (z_nc[0] - z_nw[0]) * v_z[:, 1]) / ( |
353 | 353 | z_nw[1] - z_nw[0] |
354 | 354 | ) |
355 | | - psi[1:, 0] = -integrate.cumtrapz(vz0, x=x_coord) |
| 355 | + psi[1:, 0] = -cumulative_trapezoid(vz0, x=x_coord) |
356 | 356 | # vx at center |
357 | 357 | vxc = (v_x + np.roll(v_x, -1, axis=0)) / 2 |
358 | 358 | for i_x in range(len(x_coord)): |
359 | | - psi[i_x, 1:] = psi[i_x, 0] + integrate.cumtrapz(vxc[i_x], x=z_nc) |
| 359 | + psi[i_x, 1:] = psi[i_x, 0] + cumulative_trapezoid(vxc[i_x], x=z_nc) |
360 | 360 | if step.geom.twod_xz: |
361 | 361 | psi = -psi |
362 | 362 | psi = np.reshape(psi, shape) |
|
0 commit comments