Skip to content

Improve EAST physics methods#411

Merged
gtrevisan merged 31 commits intodevfrom
east
May 5, 2025
Merged

Improve EAST physics methods#411
gtrevisan merged 31 commits intodevfrom
east

Conversation

@yumouwei
Copy link
Copy Markdown
Contributor

@yumouwei yumouwei commented Mar 4, 2025

Improved physics methods:

  • get_mirnov_std
  • (get_prad_peaking) -- see note below
  • get_n_equal_1_data
  • get_n1rms_n2rms
  • get_efit_gaps

Newly added physics methods:

  • get_radiated_power

Remaining XFAILs:

  • EFIT signals: beta_n, beta_p, kappa, li, q0, qstar, q95, wmhd: Fresh EFIT signals don't match the stored SQL data for some disruptive shots on EAST #380
  • greenwald_fraction, p_oh, kappa_area: computations are dependent on EFIT signals.
  • rad_input_frac, rad_loss_frac, p_input: computations are dependent on p_oh which uses EFIT signals.
  • beta_p_rt, li_rt, wmhd_rt: fresh data are all NaN, but there are cached data in the disruption_warning table. I don't know where those data were obtained from.

Notes on improved/added methods

1. get_mirnov_std

  • Fix data address & std computation
  • Result is still slightly different from SQL table (and MATLAB). This is because for each time point the method computes the standard deviation within a time window; because of the high sampling rate of the mirnov sensor and the floating point bit error, sometimes this window may include one extra or one less data point (e.g. 101 or 99 instead of 100). This does not significantly affect the outputs (difference is <0.5%) but it does trigger test_against_cache. For this reason, I kept both mirnov_std and mirnov_std_normalized in the expected_failure_columns.
shot time fresh (disruption-py) fresh (matlab) stored (sql table)
55012 0.2 0.006171 0.006171 0.006171
55012 0.3 0.002339 0.002329 0.002339
55012 0.4 0.002952 0.002965 0.002965
55012 0.5 0.002942 0.002964 0.002964
55012 0.6 0.002022 0.002015 0.002022

Note that neither disruption-py, matlab, nor the sql table match another column completely. Technically I can change the time window to a fixed index-based window but the difference would be too minuscule to matter.

2. get_radiated_power (translated from prad_bulk_xuv2014_2016.m)

Both this method and get_prad_peaking use data from the AXUV array. However the ways these two methods deal with what's noted as "bad" channels (ch 12 and 16) are different.

  • For get_radiated_power, the orders are:
    1. Apply calibration factors Fac1 -- Fac4;
    2. Correct bad channels: ch12 = (ch11 + ch13)/2, ch36 = (ch35 + ch36)/2 -- WHY?
    3. Apply geometric calibrations and Fac5.
  • For get_prad_peaking, the orders are:
    1. Apply calibration factors Fac1 -- Fac4, and geometric calibrations.
    2. Correct bad channel: ch12 = (ch11+ch13)/2; correction for ch36 was commented out.

The ways these two methods define the non-divertor channels are also different.

  • For get_radiated_power, these channels are: 8-15, 21-32, 33-48, 54-59 (the MATLAB script had a line comment "subtract divertor measuring and overlap measuring")
  • For get_prad_peaking, the core channels are 30-35, and the non-divertor channels are 9-56.

For now I implemented these two methods to match exactly with their original MATLAB method, but in the future we need to sort out these discrepancies.

3. get_prad_peaking

In addition to the points in get_radiated_power, the original MATLAB script used Del_r(ichan) in calibrating the xuv channels, which was almost certainly a typo. I corrected it in the python translation and moved prad_peaking to XFAIL.

for iarray = 1:4;
for ichan = 1:16;

xuv(:, ichord) = xuv(:, ichord) * ...
Fac1(ichan) * Fac2(iarray, ichan) * Fac3(iarray) * Fac4 * ...
2*pi * Maj_R * Del_r(ichan); % from Duan Yanmin's program

4. get_n1rms_n2rms

  • Fixed data addresses & computation.
  • The original MATLAB script mistakenly stored the mirnov_std and mirnov_std_normalized data in the columns of n1rms, n2rms & the _normalized signals computed by this method. I removed these four signals from the test_columns.
    field_counter = field_counter + 1;
    fields(field_counter) = {'n1rms'};
    values(:,field_counter) = num2cell(Mirnov_std);
    field_counter = field_counter + 1;
    fields(field_counter) = {'n1rms_normalized'};
    values(:,field_counter) = num2cell(Mirnov_std_normalized);
    field_counter = field_counter + 1;
    fields(field_counter) = {'n2rms'};
    values(:,field_counter) = num2cell(Mirnov_std);
    field_counter = field_counter + 1;
    fields(field_counter) = {'n2rms_normalized'};
    values(:,field_counter) = num2cell(Mirnov_std_normalized);

5. get_efit_gaps

  • This method now returns both the upper and lower gaps calculated from the standard efit_east tree (upper_gap and lower_gap) and the P-EFIT tree (pupper_gap and plower_gap).
  • The columns pupper_gap and plower_gap do exist in the disruption_warning table, but all of the stored values are NULL. Therefore I removed these two signals from the test_columns

@yumouwei yumouwei added enhancement Improvements or proposed new features machine: EAST Related to the EAST tokamak and removed enhancement Improvements or proposed new features labels Mar 4, 2025
@yumouwei yumouwei marked this pull request as ready for review March 29, 2025 22:35
# phase = np.arctan2(np.imag(rmp_fft_output), np.real(rmp_fft_output))
rmp_fft_output = scipy.fft.fft(rmp_pickup, axis=1)
amplitude = abs(rmp_fft_output) / len(rmp_fft_output[0])
amplitude[:, 1:] *= 2 # TODO: Why?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cruft? or is this still mysterious?

@yumouwei yumouwei requested a review from gtrevisan May 5, 2025 19:16
@gtrevisan gtrevisan merged commit 1f955a6 into dev May 5, 2025
12 checks passed
@gtrevisan gtrevisan mentioned this pull request May 5, 2025
@gtrevisan gtrevisan deleted the east branch May 5, 2025 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

machine: EAST Related to the EAST tokamak

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants