Repository navigation
Derive plasma beta explicitly from the current plasma state #4640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6c34f15
707589c
8e6cb33
8dc8e88
f01251e
ee85479
0b1a95b
6478096
c9362c1
59315f5
144fe7d
122540b
7cbaa0f
3368eb6
01d3e39
b90996c
a6bc5b0
d449469
ed7e2af
c82ac5c
cfea93e
caa8643
779034d
6a21140
da86937
b8b906a
be3e518
61bf24a
79917aa
55b1f4d
4508b31
af9fdce
7dcf9c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -430,12 +430,6 @@ def run(self): | |
|
|
||
| # ============================================ | ||
|
|
||
| # ----------------------------------------------------- | ||
| # Beta Components | ||
| # ----------------------------------------------------- | ||
|
|
||
| self.beta.run() | ||
|
|
||
| # Stored thermal energies in the plasma | ||
|
|
||
| ( | ||
|
|
@@ -680,19 +674,8 @@ def run(self): | |
| self.data.physics.f_p_alpha_plasma_deposited, | ||
| ) | ||
|
|
||
| self.data.physics.beta_fast_alpha = self.beta.fast_alpha_beta( | ||
| b_plasma_poloidal_average=self.data.physics.b_plasma_surface_poloidal_average, | ||
| b_plasma_toroidal_on_axis=self.data.physics.b_plasma_toroidal_on_axis, | ||
| nd_plasma_electrons_vol_avg=self.data.physics.nd_plasma_electrons_vol_avg, | ||
| nd_plasma_fuel_ions_vol_avg=self.data.physics.nd_plasma_fuel_ions_vol_avg, | ||
| nd_plasma_ions_total_vol_avg=self.data.physics.nd_plasma_ions_total_vol_avg, | ||
| temp_plasma_electron_density_weighted_kev=self.data.physics.temp_plasma_electron_density_weighted_kev, | ||
| temp_plasma_ion_density_weighted_kev=self.data.physics.temp_plasma_ion_density_weighted_kev, | ||
| pden_alpha_total_vol_avg_mw=self.data.physics.pden_alpha_total_vol_avg_mw, | ||
| pden_plasma_alpha_vol_avg_mw=self.data.physics.pden_plasma_alpha_vol_avg_mw, | ||
| i_beta_fast_alpha=self.data.physics.i_beta_fast_alpha, | ||
| f_plasma_fuel_deuterium=self.data.physics.f_plasma_fuel_deuterium, | ||
| ) | ||
| # Calculate beta quantities. | ||
| self.beta.run() | ||
|
|
||
| # Calculate ion/electron equilibration power | ||
|
|
||
|
|
@@ -3506,6 +3489,44 @@ def run(self): | |
| If an illegal value of i_beta_norm_max is provided. | ||
|
|
||
| """ | ||
| # Thermal beta is derived directly from the current plasma state. | ||
| self.data.physics.beta_thermal_vol_avg = self.calculate_plasma_beta( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wondering if we could do this all tidy and just put this in the run method of the beta class?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I've tidied this up in the latest commits
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cant see the thermal calc inside the beat run method its still showing as a random calc for me
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should have been resolved in the latest commits. |
||
| pres_plasma=( | ||
| constants.KILOELECTRON_VOLT | ||
| * ( | ||
| self.data.physics.nd_plasma_electrons_vol_avg | ||
| * self.data.physics.temp_plasma_electron_density_weighted_kev | ||
| + self.data.physics.nd_plasma_ions_total_vol_avg | ||
| * self.data.physics.temp_plasma_ion_density_weighted_kev | ||
| ) | ||
| ), | ||
| b_field=self.data.physics.b_plasma_total, | ||
| ) | ||
|
|
||
| # Fast-alpha beta is calculated here so all tokamak beta calculations are | ||
| # owned by PlasmaBeta.run(). Keep fast_alpha_beta() unchanged because it is | ||
| # also called directly by the stellarator physics model. | ||
| self.data.physics.beta_fast_alpha = self.fast_alpha_beta( | ||
| b_plasma_poloidal_average=self.data.physics.b_plasma_surface_poloidal_average, | ||
| b_plasma_toroidal_on_axis=self.data.physics.b_plasma_toroidal_on_axis, | ||
| nd_plasma_electrons_vol_avg=self.data.physics.nd_plasma_electrons_vol_avg, | ||
| nd_plasma_fuel_ions_vol_avg=self.data.physics.nd_plasma_fuel_ions_vol_avg, | ||
| nd_plasma_ions_total_vol_avg=self.data.physics.nd_plasma_ions_total_vol_avg, | ||
| temp_plasma_electron_density_weighted_kev=self.data.physics.temp_plasma_electron_density_weighted_kev, | ||
| temp_plasma_ion_density_weighted_kev=self.data.physics.temp_plasma_ion_density_weighted_kev, | ||
| pden_alpha_total_vol_avg_mw=self.data.physics.pden_alpha_total_vol_avg_mw, | ||
| pden_plasma_alpha_vol_avg_mw=self.data.physics.pden_plasma_alpha_vol_avg_mw, | ||
| i_beta_fast_alpha=self.data.physics.i_beta_fast_alpha, | ||
| f_plasma_fuel_deuterium=self.data.physics.f_plasma_fuel_deuterium, | ||
| ) | ||
|
|
||
| # Total beta is derived from the thermal and fast-particle components. | ||
| self.data.physics.beta_total_vol_avg = ( | ||
|
timothy-nunn marked this conversation as resolved.
|
||
| self.data.physics.beta_thermal_vol_avg | ||
| + self.data.physics.beta_fast_alpha | ||
| + self.data.physics.beta_beam | ||
| ) | ||
|
|
||
| # ----------------------------------------------------- | ||
| # Normalised Beta Limit | ||
| # ----------------------------------------------------- | ||
|
|
@@ -3570,6 +3591,10 @@ def run(self): | |
| rminor=self.data.physics.rminor, | ||
| ) | ||
|
|
||
| # ----------------------------------------------------- | ||
| # Derived beta components | ||
| # ----------------------------------------------------- | ||
|
|
||
| self.data.physics.beta_toroidal_vol_avg = ( | ||
| self.data.physics.beta_total_vol_avg | ||
| * self.data.physics.b_plasma_total**2 | ||
|
|
@@ -3583,12 +3608,6 @@ def run(self): | |
| beta=self.data.physics.beta_total_vol_avg, | ||
| ) | ||
|
|
||
| self.data.physics.beta_thermal_vol_avg = ( | ||
| self.data.physics.beta_total_vol_avg | ||
| - self.data.physics.beta_fast_alpha | ||
| - self.data.physics.beta_beam | ||
| ) | ||
|
|
||
| self.data.physics.beta_poloidal_eps = ( | ||
| self.data.physics.beta_poloidal_vol_avg * self.data.physics.eps | ||
| ) | ||
|
|
@@ -3601,6 +3620,7 @@ def run(self): | |
| ) | ||
| ** 2 | ||
| ) | ||
|
|
||
| self.data.physics.beta_thermal_toroidal_vol_avg = ( | ||
| self.data.physics.beta_thermal_vol_avg | ||
| * ( | ||
|
|
@@ -3643,6 +3663,7 @@ def run(self): | |
| ) | ||
| ** 2 | ||
| ) | ||
|
|
||
| self.data.physics.beta_norm_poloidal = ( | ||
| self.data.physics.beta_norm_total | ||
| * ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we removing it as an iteration variable in this case? How would a user constraint the beta value then. We can still have this as an iteration but now without the constraint
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that beta is calculated directly from the plasma state, I don't think it makes sense for it to remain an iteration variable.
If a user wants to restrict beta, that should be done by applying a constraint to the derived beta rather than allowing the optimiser to vary beta independently of the plasma state. We already have beta upper and lower-limit constraints for this purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would agree. Now that
beta_total_vol_avgis calculated in the code (here) having it as an iteration variable would be incorrect at best and dangerous at worse.The solver would set
beta_total_vol_avg = xand then the code would update it tobeta_total_vol_avg. = yand all of the gradients would be calculated wrtybut the solver would think they related tox, which would cause the solver to move in incorrect ways.