Skip to content

Commit

Permalink
Add rotation powers in checker
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkitBarik committed Oct 14, 2024
1 parent 29479c6 commit cc7401c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python/magic/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,20 @@ def MagicCheck(tstart=None):
# Not super accurate if n_log_step changed but better that nothing
n_steps = len(ts.time[mask]) * ts.n_log_step

dEdt = ts.buoPower+ts.buoPower_chem+ts.ohmDiss+ts.viscDiss
dEdt = ts.buoPower+ts.buoPower_chem+ts.ohmDiss+ts.viscDiss+ts.icrotPower+ts.marotPower

# Power balance:
buoPower_avg = avgField(ts.time[mask], ts.buoPower[mask])
buoPower_chem_avg = avgField(ts.time[mask], ts.buoPower_chem[mask])
ohmDiss_avg = avgField(ts.time[mask], ts.ohmDiss[mask])
viscDiss_avg = avgField(ts.time[mask], ts.viscDiss[mask])
ratio = 100*abs(buoPower_avg+buoPower_chem_avg+ohmDiss_avg+viscDiss_avg) / \
(buoPower_avg+buoPower_chem_avg)

icrotPower_avg = avgField(ts.time[mask], ts.icrotPower[mask])
marotPower_avg = avgField(ts.time[mask], ts.marotPower[mask])
ratio = 100*(
abs(buoPower_avg+buoPower_chem_avg+icrotPower_avg+marotPower_avg
+ohmDiss_avg+viscDiss_avg) /
(buoPower_avg+buoPower_chem_avg+icrotPower_avg+marotPower_avg)
)
print(bcolors.BOLD + bcolors.UNDERLINE + 'Power balance:' + bcolors.ENDC)
print('Power injected : {:.5e}'.format(buoPower_avg+buoPower_chem_avg))
print('Power dissipated : {:.5e}'.format(-ohmDiss_avg-viscDiss_avg))
Expand Down

0 comments on commit cc7401c

Please sign in to comment.