Skip to content

Commit 66e3c74

Browse files
committed
Added scaling in equilibrium.py to the total Ip_profile such that is consistent with global_quantities.ip from input IDS
1 parent aaf6cba commit 66e3c74

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

torax/torax_imastools/equilibrium.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,12 @@ def geometry_from_IMAS(
150150
rhon = IMAS_data.profiles_1d.rho_tor_norm
151151
vpr = 4 * np.pi * Phi[-1] * rhon / (F * flux_surf_avg_1_over_R2)
152152
spr = vpr / (2 * np.pi * R_major)
153-
Ip_profile = scipy.integrate.cumulative_trapezoid(y=spr * jtor, x=rhon, initial=0.0)
153+
Ip_profile_unscaled = scipy.integrate.cumulative_trapezoid(y=spr * jtor, x=rhon, initial=0.0) # this Ip_profile by integration results in a discrepancy between this term and the total ip from IDS
154154

155+
# Because of the discrepancy between Ip_profile[-1] (computed by integration) and global_quantities.ip, here we will scale Ip_profile such that the total plasma current is equal
156+
Ip_total = -1 * IMAS_data.global_quantities.ip
157+
Ip_profile = Ip_profile_unscaled * (Ip_total / Ip_profile_unscaled[-1]) # scaled Ip profile such that the total plasma current is consistent
158+
155159
# To check
156160
z_magnetic_axis = np.asarray(IMAS_data.global_quantities.magnetic_axis.z)
157161

0 commit comments

Comments
 (0)