Skip to content

Commit

Permalink
Auxiliary spelling correction (#102)
Browse files Browse the repository at this point in the history
* auxillary --> auxiliary replace all

* Save __init__.py

* Regression results

* Update docs/doc_sources/api.rst

Co-authored-by: Tom Body <[email protected]>

---------

Co-authored-by: Tom Body <[email protected]>
  • Loading branch information
AudreySaltzman and tbody-cfs authored Sep 11, 2024
1 parent 9c83c38 commit ecbc626
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 57 deletions.
4 changes: 2 additions & 2 deletions cfspopcon/formulas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from . import (
atomic_data,
auxillary_power,
auxiliary_power,
energy_confinement,
fusion_power,
geometry,
Expand All @@ -26,7 +26,7 @@
"radiated_power",
"scrape_off_layer",
"plasma_pressure",
"auxillary_power",
"auxiliary_power",
"separatrix_conditions",
"impurities",
"atomic_data",
Expand Down
5 changes: 5 additions & 0 deletions cfspopcon/formulas/auxiliary_power/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Routines to calculate the auxiliary (non-Ohmic, non-fusion) power."""

from .auxiliary_power import calc_auxiliary_power

__all__ = ["calc_auxiliary_power"]
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Routines to calculate the auxillary (non-Ohmic, non-fusion) power."""
"""Routines to calculate the auxiliary (non-Ohmic, non-fusion) power."""

from ...algorithm_class import Algorithm
from ...unit_handling import Unitfull, ureg


@Algorithm.register_algorithm(return_keys=["P_external", "P_auxillary_absorbed", "P_auxillary_launched"])
def calc_auxillary_power(P_in: Unitfull, P_alpha: Unitfull, P_ohmic: Unitfull, fraction_of_external_power_coupled: Unitfull) -> Unitfull:
"""Calculate the required auxillary power.
@Algorithm.register_algorithm(return_keys=["P_external", "P_auxiliary_absorbed", "P_auxiliary_launched"])
def calc_auxiliary_power(P_in: Unitfull, P_alpha: Unitfull, P_ohmic: Unitfull, fraction_of_external_power_coupled: Unitfull) -> Unitfull:
"""Calculate the required auxiliary power.
Args:
P_in: [MW] :term:`glossary link<P_in>`
Expand All @@ -15,10 +15,10 @@ def calc_auxillary_power(P_in: Unitfull, P_alpha: Unitfull, P_ohmic: Unitfull, f
fraction_of_external_power_coupled: [~]: :term:`glossary link<fraction_of_external_power_coupled>`
Returns:
:term:`P_external` [MW], :term:`P_auxillary_absorbed` [MW], :term:`P_auxillary_launched` [MW]
:term:`P_external` [MW], :term:`P_auxiliary_absorbed` [MW], :term:`P_auxiliary_launched` [MW]
"""
P_external = (P_in - P_alpha).clip(min=0.0 * ureg.MW)
P_auxillary_absorbed = (P_external - P_ohmic).clip(min=0.0 * ureg.MW)
P_auxillary_launched = P_auxillary_absorbed / fraction_of_external_power_coupled
P_auxiliary_absorbed = (P_external - P_ohmic).clip(min=0.0 * ureg.MW)
P_auxiliary_launched = P_auxiliary_absorbed / fraction_of_external_power_coupled

return P_external, P_auxillary_absorbed, P_auxillary_launched
return P_external, P_auxiliary_absorbed, P_auxiliary_launched
5 changes: 0 additions & 5 deletions cfspopcon/formulas/auxillary_power/__init__.py

This file was deleted.

6 changes: 3 additions & 3 deletions cfspopcon/formulas/fusion_power/fusion_gain.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


@Algorithm.register_algorithm(return_keys=["Q"])
def calc_fusion_gain(P_fusion: Unitfull, P_ohmic: Unitfull, P_auxillary_launched: Unitfull) -> Unitfull:
def calc_fusion_gain(P_fusion: Unitfull, P_ohmic: Unitfull, P_auxiliary_launched: Unitfull) -> Unitfull:
"""Calculate the fusion gain, using the launched power in the denominator.
This is the thermal gain using the launched power.
Expand All @@ -17,12 +17,12 @@ def calc_fusion_gain(P_fusion: Unitfull, P_ohmic: Unitfull, P_auxillary_launched
Args:
P_fusion: [MW] :term:`glossary link<P_fusion>`
P_ohmic: [MW] :term:`glossary link<P_ohmic>`
P_auxillary_launched: [MW] :term:`glossary link<P_auxillary_launched>`
P_auxiliary_launched: [MW] :term:`glossary link<P_auxiliary_launched>`
Returns:
:term:`Q` [~]
"""
Q = P_fusion / (P_ohmic + P_auxillary_launched).clip(min=1.0 * ureg.W)
Q = P_fusion / (P_ohmic + P_auxiliary_launched).clip(min=1.0 * ureg.W)

return Q

Expand Down
24 changes: 12 additions & 12 deletions cfspopcon/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ fraction_of_external_power_coupled:
/ P_{launched}`.'
set_by: []
used_by:
- calc_auxillary_power
- calc_auxiliary_power
fraction_of_P_SOL_to_divertor:
default_units: dimensionless
description:
Expand Down Expand Up @@ -1095,30 +1095,30 @@ P_alpha:
set_by:
- calc_fusion_power
used_by:
- calc_auxillary_power
P_auxillary_absorbed:
- calc_auxiliary_power
P_auxiliary_absorbed:
default_units: megawatt
description:
- Auxillary heating absorbed by the plasma integrated over the plasma volume.
- auxiliary heating absorbed by the plasma integrated over the plasma volume.
set_by:
- calc_auxillary_power
- calc_auxiliary_power
used_by: []
P_auxillary_launched:
P_auxiliary_launched:
default_units: megawatt
description:
- External heating supplied to the plasma (entering the volume, but not necessarily
absorbed by the plasma) integrated over the plasma volume.
set_by:
- calc_auxillary_power
- calc_auxiliary_power
used_by:
- calc_fusion_gain
P_external:
default_units: megawatt
description:
- External heating absorbed by the plasma (ohmic plus auxillary) integrated over
- External heating absorbed by the plasma (ohmic plus auxiliary) integrated over
the plasma volume.
set_by:
- calc_auxillary_power
- calc_auxiliary_power
used_by: []
P_fusion:
default_units: megawatt
Expand All @@ -1132,13 +1132,13 @@ P_fusion:
P_in:
default_units: megawatt
description:
- Total input power to the plasma. Sum of ohmic, auxillary and alpha power.
- Total input power to the plasma. Sum of ohmic, auxiliary and alpha power.
set_by:
- solve_energy_confinement_scaling_for_input_power
- switch_to_linearised_ohmic_confinement_below_threshold
- switch_to_L_mode_confinement_below_threshold
used_by:
- calc_auxillary_power
- calc_auxiliary_power
- switch_to_linearised_ohmic_confinement_below_threshold
- switch_to_L_mode_confinement_below_threshold
- calc_f_rad_core
Expand Down Expand Up @@ -1178,7 +1178,7 @@ P_ohmic:
set_by:
- calc_ohmic_power
used_by:
- calc_auxillary_power
- calc_auxiliary_power
- calc_fusion_gain
P_rad_bremsstrahlung:
default_units: megawatt
Expand Down
4 changes: 2 additions & 2 deletions docs/doc_sources/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Configuration Enums
Formulas
========================

Auxillary Power
Auxiliary Power
----------------
.. automodule:: cfspopcon.formulas.auxillary_power
.. automodule:: cfspopcon.formulas.auxiliary_power

Energy Confinement
----------------------
Expand Down
12 changes: 6 additions & 6 deletions docs/doc_sources/getting_started.ipynb

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/doc_sources/physics_glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -314,20 +314,20 @@ Physics Glossary
P_alpha
Fusion power released as alpha particles integrated over the plasma volume.

P_auxillary_absorbed
Auxillary heating absorbed by the plasma integrated over the plasma volume.
P_auxiliary_absorbed
auxiliary heating absorbed by the plasma integrated over the plasma volume.

P_auxillary_launched
P_auxiliary_launched
External heating supplied to the plasma (entering the volume, but not necessarily absorbed by the plasma) integrated over the plasma volume.

P_external
External heating absorbed by the plasma (ohmic plus auxillary) integrated over the plasma volume.
External heating absorbed by the plasma (ohmic plus auxiliary) integrated over the plasma volume.

P_fusion
Total power generated by fusion integrated over the plasma volume. For DT fusion, this is the sum of the power going to the alpha particles and to the neutrons.

P_in
Total input power to the plasma. Sum of ohmic, auxillary and alpha power.
Total input power to the plasma. Sum of ohmic, auxiliary and alpha power.

P_LH_thresh
Power required to cross the L-H transition.
Expand Down
2 changes: 1 addition & 1 deletion docs/doc_sources/understanding_algorithms.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@
" Algorithm: calc_neoclassical_loop_resistivity,\n",
" Algorithm: calc_loop_voltage,\n",
" Algorithm: calc_ohmic_power,\n",
" Algorithm: calc_auxillary_power,\n",
" Algorithm: calc_auxiliary_power,\n",
" Algorithm: calc_elongation_at_psi95_from_areal_elongation,\n",
" Algorithm: calc_cylindrical_edge_safety_factor,\n",
" Algorithm: calc_internal_inductivity,\n",
Expand Down
6 changes: 3 additions & 3 deletions example_cases/SPARC_PRD/input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ algorithms:
- calc_zeff_and_dilution_due_to_impurities
- calc_peaked_profiles
# We compute the ohmic heating power from the inductive current and
# loop voltage, and then set P_auxillary_absorbed = P_in - P_ohmic
# loop voltage, and then set P_auxiliary_absorbed = P_in - P_ohmic
- calc_bootstrap_fraction
- calc_inductive_plasma_current
- calc_Spitzer_loop_resistivity
Expand All @@ -56,7 +56,7 @@ algorithms:
# Calculate the fusion power and gain.
- calc_fusion_power
- calc_neutron_flux_to_walls
- calc_auxillary_power
- calc_auxiliary_power
- calc_fusion_gain
# We compute the inductances and then flux to get the max_flux_for_flattop
- calc_elongation_at_psi95_from_areal_elongation
Expand Down Expand Up @@ -130,7 +130,7 @@ points:
PRD:
maximize: Q
where:
P_auxillary_launched:
P_auxiliary_launched:
min: 0.0
max: 25.0
units: MW
Expand Down
4 changes: 2 additions & 2 deletions example_cases/SPARC_PRD/plot_popcon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fill:
where:
Q:
min: 1.0
P_auxillary_launched:
P_auxiliary_launched:
min: 0.0
max: 25.0
units: MW
Expand Down Expand Up @@ -53,7 +53,7 @@ contour:
levels: [1.0]
format: "1.2g"

P_auxillary_launched:
P_auxiliary_launched:
label: "$P_{aux,launched}$"
levels: [1.0, 5.0, 10.0, 25.0, 50.0]
color: "tab:gray"
Expand Down
6 changes: 3 additions & 3 deletions example_cases/SPARC_PRD/plot_remapped.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ show_dpi: 150

new_coords:
x:
dimension: P_auxillary_launched
dimension: P_auxiliary_launched
label: "$P_{RF}$ [$MW$]"
units: MW
max: 25.0
Expand All @@ -19,7 +19,7 @@ fill:
where:
Q:
min: 1.0
P_auxillary_launched:
P_auxiliary_launched:
min: 0.0
max: 25.0
units: MW
Expand Down Expand Up @@ -51,7 +51,7 @@ contour:
levels: [1.0]
format: "1.2g"

P_auxillary_launched:
P_auxiliary_launched:
label: "$P_{aux}$"
levels: [1.0, 5.0, 10.0, 25.0, 50.0]
color: "tab:gray"
Expand Down
Binary file modified tests/regression_results/AUG_SepOS_result.nc
Binary file not shown.
10 changes: 5 additions & 5 deletions tests/regression_results/PRD.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@
"data": 22.55867182,
"dims": []
},
"P_auxillary_absorbed": {
"P_auxiliary_absorbed": {
"attrs": {
"units": "megawatt"
},
"data": 7.702542635,
"dims": []
},
"P_auxillary_launched": {
"P_auxiliary_launched": {
"attrs": {
"units": "megawatt"
},
Expand Down Expand Up @@ -320,14 +320,14 @@
"attrs": {
"units": "dimensionless"
},
"data": 0.08439527531,
"data": 0.08439528049,
"dims": []
},
"edge_impurity_concentration_in_core": {
"attrs": {
"units": "dimensionless"
},
"data": 0.01687905506,
"data": 0.01687905610,
"dims": []
},
"edge_impurity_enrichment": {
Expand Down Expand Up @@ -687,7 +687,7 @@
"data": [
0.06000000000,
0.003100000000,
0.01687905506,
0.01687905610,
0.000000000,
1.500000000e-05
],
Expand Down
Binary file modified tests/regression_results/SPARC_PRD_result.nc
Binary file not shown.

0 comments on commit ecbc626

Please sign in to comment.