Skip to content

Commit

Permalink
Write documentation notebook for SepOS
Browse files Browse the repository at this point in the history
  • Loading branch information
tbody-cfs committed Nov 29, 2023
1 parent dfc13b9 commit 2df6c67
Show file tree
Hide file tree
Showing 4 changed files with 1,314 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import xarray as xr
from scipy.interpolate import RectBivariateSpline # type:ignore[import]

from cfspopcon.unit_handling import Unitfull, convert_units, ureg
from cfspopcon.unit_handling import Unitfull, convert_units, ureg, magnitude


def extract_LH_contour_points(LH_transition_condition: xr.DataArray) -> tuple[xr.DataArray, xr.DataArray]:
Expand All @@ -26,7 +26,7 @@ def interpolate_field_to_LH_curve(
) -> xr.DataArray:
"""Interpolate a 2D field to the points defined by the LH transition curve."""
interpolator = RectBivariateSpline(
field.dim_separatrix_density, field.dim_separatrix_temp, field.transpose("dim_separatrix_density", "dim_separatrix_temp")
field.dim_separatrix_electron_density, field.dim_separatrix_electron_temp, magnitude(field.transpose("dim_separatrix_electron_density", "dim_separatrix_electron_temp"))
)

interpolated_curve = xr.DataArray(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""
import numpy as np

from ...unit_handling import Quantity, Unitfull, ureg
from ...unit_handling import Quantity, Unitfull, ureg, convert_units


def calc_power_crossing_separatrix(
Expand All @@ -27,4 +27,4 @@ def calc_power_crossing_separatrix(

A_SOL = 2.0 * np.pi * (major_radius + minor_radius) * lambda_q * B_pol_omp / B_tor_omp

return 2.0 / 7.0 * kappa_0e * A_SOL / (L_parallel * f_share) * (separatrix_temp**3.5 - target_temp**3.5)
return convert_units(2.0 / 7.0 * kappa_0e * A_SOL / (L_parallel * f_share) * (separatrix_temp**3.5 - target_temp**3.5), ureg.MW)
Loading

0 comments on commit 2df6c67

Please sign in to comment.