4233 global power imbalance output#4417
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4417 +/- ##
==========================================
- Coverage 48.84% 48.72% -0.13%
==========================================
Files 151 151
Lines 29406 29480 +74
==========================================
Hits 14363 14363
- Misses 15043 15117 +74 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
timothy-nunn
left a comment
There was a problem hiding this comment.
Just some suggestions from a quick code review. Will check the calculations in another review.
| if self.data.physics.i_plasma_ignited == 1: | ||
| po.ocmmnt(self.outfile, " (Injected power only used for start-up phase)") | ||
|
|
||
| # Global power imbalance output #4233 ######################################## |
There was a problem hiding this comment.
| # Global power imbalance output #4233 ######################################## |
There was a problem hiding this comment.
Row of # removed. Comment unchanged
| po.ovarre( | ||
| self.outfile, | ||
| "Plasma power imbalance (MW)", | ||
| "(p_plasma_out - p_plasma_in)", |
There was a problem hiding this comment.
| "(p_plasma_out - p_plasma_in)", | |
| "(p_plasma_out_subtract_p_plasma_in)", |
I don't think this will be able to be indexed from the MFILE properly
There was a problem hiding this comment.
All these have been replaced by new variables:
"(p_plasma_imbalance_mw)",
etc
| if abs(p_plasma_out - p_plasma_in) > 0.1: | ||
| logger.error("Plasma power imbalance > 0.1 MW") | ||
|
|
||
| #################################################### |
There was a problem hiding this comment.
| #################################################### |
I know these still exist in the code but I try and keep them at a minimum
| po.ovarre( | ||
| self.outfile, | ||
| "Electric power imbalance (MW)", | ||
| "()", |
There was a problem hiding this comment.
Can you assign this an output name otherwise I suspect it will cause issues in the MFILE parsing at some point
| po.ovarre( | ||
| self.outfile, | ||
| "Power plant overall imbalance (MW)", | ||
| "(p_plant_in_mw - p_plant_out_mw)", |
There was a problem hiding this comment.
| "(p_plant_in_mw - p_plant_out_mw)", | |
| "(p_plant_in_mw_subtract_p_plant_out_mw)", |
timothy-nunn
left a comment
There was a problem hiding this comment.
A lot of these variables are already being output in the same routine/in other models. I don't see a reason to do this twice?
| po.ovarre( | ||
| self.outfile, | ||
| "Net power transported by electrons (MW)", | ||
| "(p_electron_transport_loss_mw)", | ||
| self.data.physics.p_electron_transport_loss_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Net power transported by ions (MW)", | ||
| "(p_ion_transport_loss_mw)", | ||
| self.data.physics.p_ion_transport_loss_mw, | ||
| "OP ", | ||
| ) |
There was a problem hiding this comment.
These variables are already output above
| po.ovarre( | |
| self.outfile, | |
| "Net power transported by electrons (MW)", | |
| "(p_electron_transport_loss_mw)", | |
| self.data.physics.p_electron_transport_loss_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Net power transported by ions (MW)", | |
| "(p_ion_transport_loss_mw)", | |
| self.data.physics.p_ion_transport_loss_mw, | |
| "OP ", | |
| ) |
There was a problem hiding this comment.
Indeed. Nevertheless, we need to check that the powers balance, and there is no easy way to check that from the existing outputs. A certain amount of redundancy is not a big deal. It may be possible to slim down the rest of the output file - I can look at that, but that would be another issue.
In theory one could hide the output if it balances, and display it only if there is a discrepancy, but I don't really see the benefit.
| po.ovarre( | ||
| self.outfile, | ||
| "Net loss by synchrotron radiation (MW)", | ||
| "(p_plasma_sync_mw)", | ||
| self.data.physics.p_plasma_sync_mw, | ||
| "OP ", | ||
| ) |
There was a problem hiding this comment.
Already output above
| po.ovarre( | |
| self.outfile, | |
| "Net loss by synchrotron radiation (MW)", | |
| "(p_plasma_sync_mw)", | |
| self.data.physics.p_plasma_sync_mw, | |
| "OP ", | |
| ) |
| po.ovarre( | ||
| self.outfile, | ||
| "Alpha power (MW)", | ||
| "(p_alpha_total_mw)", | ||
| self.data.physics.p_alpha_total_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Power from p, 3He, T products of DD and/or D-He3 fusion (MW)", | ||
| "(p_non_alpha_charged_mw)", | ||
| self.data.physics.p_non_alpha_charged_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Injected power (MW)", | ||
| "(p_hcd_injected_total_mw)", | ||
| self.data.current_drive.p_hcd_injected_total_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Ohmic heating (MW)", | ||
| "(p_plasma_ohmic_mw)", | ||
| self.data.physics.p_plasma_ohmic_mw, | ||
| "OP ", | ||
| ) |
There was a problem hiding this comment.
| po.ovarre( | |
| self.outfile, | |
| "Alpha power (MW)", | |
| "(p_alpha_total_mw)", | |
| self.data.physics.p_alpha_total_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Power from p, 3He, T products of DD and/or D-He3 fusion (MW)", | |
| "(p_non_alpha_charged_mw)", | |
| self.data.physics.p_non_alpha_charged_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Injected power (MW)", | |
| "(p_hcd_injected_total_mw)", | |
| self.data.current_drive.p_hcd_injected_total_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Ohmic heating (MW)", | |
| "(p_plasma_ohmic_mw)", | |
| self.data.physics.p_plasma_ohmic_mw, | |
| "OP ", | |
| ) |
Already output above
| po.ovarre( | ||
| self.outfile, | ||
| "Fusion power (MW)", | ||
| "(p_fusion_total_mw)", | ||
| self.data.physics.p_fusion_total_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Energy multiplication in blanket and shield (MW)", | ||
| "(p_blkt_multiplication_mw)", | ||
| self.data.fwbs.p_blkt_multiplication_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Injected power (MW)", | ||
| "(p_hcd_injected_total_mw)", | ||
| self.data.current_drive.p_hcd_injected_total_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Ohmic heating (MW)", | ||
| "(p_plasma_ohmic_mw)", | ||
| self.data.physics.p_plasma_ohmic_mw, | ||
| "OP ", | ||
| ) |
There was a problem hiding this comment.
| po.ovarre( | |
| self.outfile, | |
| "Fusion power (MW)", | |
| "(p_fusion_total_mw)", | |
| self.data.physics.p_fusion_total_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Energy multiplication in blanket and shield (MW)", | |
| "(p_blkt_multiplication_mw)", | |
| self.data.fwbs.p_blkt_multiplication_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Injected power (MW)", | |
| "(p_hcd_injected_total_mw)", | |
| self.data.current_drive.p_hcd_injected_total_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Ohmic heating (MW)", | |
| "(p_plasma_ohmic_mw)", | |
| self.data.physics.p_plasma_ohmic_mw, | |
| "OP ", | |
| ) |
Already output above
| po.ovarre( | ||
| self.outfile, | ||
| "Power deposited by pump in coolant for FW and blanket circuit (MW)", | ||
| "(p_fw_blkt_coolant_pump_mw)", | ||
| self.data.primary_pumping.p_fw_blkt_coolant_pump_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Power deposited by pump in coolant for divertor circuit (MW)", | ||
| "(p_div_coolant_pump_mw)", | ||
| self.data.heat_transport.p_div_coolant_pump_mw, | ||
| "OP ", | ||
| ) |
There was a problem hiding this comment.
Already output in another module
| po.ovarre( | |
| self.outfile, | |
| "Power deposited by pump in coolant for FW and blanket circuit (MW)", | |
| "(p_fw_blkt_coolant_pump_mw)", | |
| self.data.primary_pumping.p_fw_blkt_coolant_pump_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Power deposited by pump in coolant for divertor circuit (MW)", | |
| "(p_div_coolant_pump_mw)", | |
| self.data.heat_transport.p_div_coolant_pump_mw, | |
| "OP ", | |
| ) |
| po.ovarre( | ||
| self.outfile, | ||
| "Net electric (MW)", | ||
| "(p_plant_electric_net_mw)", | ||
| self.data.heat_transport.p_plant_electric_net_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "TF coils electric power (MW)", | ||
| "(p_tf_electric_supplies_mw)", | ||
| self.data.heat_transport.p_tf_electric_supplies_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "PF coils electric power (MW)", | ||
| "(p_pf_electric_supplies_mw)", | ||
| self.data.pf_coil.p_pf_electric_supplies_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Heating and current drive electric power (MW)", | ||
| "(p_hcd_electric_total_mw)", | ||
| self.data.heat_transport.p_hcd_electric_total_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Primary coolant pump electric power (MW)", | ||
| "(p_coolant_pump_elec_total_mw)", | ||
| self.data.heat_transport.p_coolant_pump_elec_total_mw, | ||
| "OP ", | ||
| ) |
There was a problem hiding this comment.
Already being output in another model
| po.ovarre( | |
| self.outfile, | |
| "Net electric (MW)", | |
| "(p_plant_electric_net_mw)", | |
| self.data.heat_transport.p_plant_electric_net_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "TF coils electric power (MW)", | |
| "(p_tf_electric_supplies_mw)", | |
| self.data.heat_transport.p_tf_electric_supplies_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "PF coils electric power (MW)", | |
| "(p_pf_electric_supplies_mw)", | |
| self.data.pf_coil.p_pf_electric_supplies_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Heating and current drive electric power (MW)", | |
| "(p_hcd_electric_total_mw)", | |
| self.data.heat_transport.p_hcd_electric_total_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Primary coolant pump electric power (MW)", | |
| "(p_coolant_pump_elec_total_mw)", | |
| self.data.heat_transport.p_coolant_pump_elec_total_mw, | |
| "OP ", | |
| ) |
| po.ovarre( | ||
| self.outfile, | ||
| "Vacuum pumps electric power (MW)", | ||
| "(vachtmw)", | ||
| self.data.heat_transport.vachtmw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Cryoplant electric power (MW)", | ||
| "(p_cryo_plant_electric_mw)", | ||
| self.data.heat_transport.p_cryo_plant_electric_mw, | ||
| "OP ", | ||
| ) |
There was a problem hiding this comment.
| po.ovarre( | |
| self.outfile, | |
| "Vacuum pumps electric power (MW)", | |
| "(vachtmw)", | |
| self.data.heat_transport.vachtmw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Cryoplant electric power (MW)", | |
| "(p_cryo_plant_electric_mw)", | |
| self.data.heat_transport.p_cryo_plant_electric_mw, | |
| "OP ", | |
| ) |
Already being output
| po.ovarre( | ||
| self.outfile, | ||
| "Gross electric output (MW)", | ||
| "(p_plant_electric_gross_mw)", | ||
| self.data.heat_transport.p_plant_electric_gross_mw, | ||
| "OP ", | ||
| ) |
There was a problem hiding this comment.
| po.ovarre( | |
| self.outfile, | |
| "Gross electric output (MW)", | |
| "(p_plant_electric_gross_mw)", | |
| self.data.heat_transport.p_plant_electric_gross_mw, | |
| "OP ", | |
| ) |
Already being output
| po.ovarre( | ||
| self.outfile, | ||
| "Fusion power (MW)", | ||
| "(p_fusion_total_mw)", | ||
| self.data.physics.p_fusion_total_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Energy multiplication in blanket and shield (MW)", | ||
| "(p_blkt_multiplication_mw)", | ||
| self.data.fwbs.p_blkt_multiplication_mw, | ||
| "OP ", | ||
| ) |
There was a problem hiding this comment.
| po.ovarre( | |
| self.outfile, | |
| "Fusion power (MW)", | |
| "(p_fusion_total_mw)", | |
| self.data.physics.p_fusion_total_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Energy multiplication in blanket and shield (MW)", | |
| "(p_blkt_multiplication_mw)", | |
| self.data.fwbs.p_blkt_multiplication_mw, | |
| "OP ", | |
| ) |
Already being output
| po.ovarre( | ||
| self.outfile, | ||
| "Net electric (MW)", | ||
| "(p_plant_electric_net_mw)", | ||
| self.data.heat_transport.p_plant_electric_net_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Heat rejected by main power conversion circuit (MW)", | ||
| "(p_turbine_loss_mw)", | ||
| self.data.power.p_turbine_loss_mw, | ||
| "OP ", | ||
| ) | ||
| po.ovarre( | ||
| self.outfile, | ||
| "Heat rejected by other circuits (secondary heat) (MW)", | ||
| "(p_plant_secondary_heat_mw)", | ||
| self.data.heat_transport.p_plant_secondary_heat_mw, | ||
| "OP ", | ||
| ) |
There was a problem hiding this comment.
Already output in another model
| po.ovarre( | |
| self.outfile, | |
| "Net electric (MW)", | |
| "(p_plant_electric_net_mw)", | |
| self.data.heat_transport.p_plant_electric_net_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Heat rejected by main power conversion circuit (MW)", | |
| "(p_turbine_loss_mw)", | |
| self.data.power.p_turbine_loss_mw, | |
| "OP ", | |
| ) | |
| po.ovarre( | |
| self.outfile, | |
| "Heat rejected by other circuits (secondary heat) (MW)", | |
| "(p_plant_secondary_heat_mw)", | |
| self.data.heat_transport.p_plant_secondary_heat_mw, | |
| "OP ", | |
| ) |
This implements issue #4233. I have restored the power accounting section in the output files.
Note the powers do not balance - see issue for details.
The only changes are additional outputs.
I have merged main into this branch, but's a long time since I have made a merge request - let me know if there are any problems. I have no idea how to update the outputs of the regression tests, or if I need to do this.
I will create new issues to resolve the imbalances. Those will need to be looked at by Chris and others - for the moment I suggest any of the people on the maintainer list are sufficient.