Skip to content

Commit 7c5b36f

Browse files
committed
Respond to Jonathan's review
1 parent 271e18b commit 7c5b36f

File tree

2 files changed

+33
-34
lines changed

2 files changed

+33
-34
lines changed

torax/_src/output_tools/post_processing.py

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,14 @@ class PostProcessedOutputs:
138138
j_parallel_external: Parallel current density from external psi sources
139139
(i.e., excluding bootstrap) [A m^-2]
140140
j_parallel_ohmic: Parallel ohmic current density [Am^-2]
141-
j_toroidal_total: Total toroidal current density [Am^-2]
142-
j_toroidal_bootstrap: Toroidal bootstrap current density [Am^-2]
143-
j_toroidal_ohmic: Toroidal ohmic current density [Am^-2]
144-
j_toroidal_external: Toroidal current density from external psi sources
141+
j_total: Total toroidal current density [Am^-2]
142+
j_bootstrap: Toroidal bootstrap current density [Am^-2]
143+
j_ohmic: Toroidal ohmic current density [Am^-2]
144+
j_external: Toroidal current density from external psi sources
145145
(i.e., excluding bootstrap) [A m^-2]
146-
j_toroidal_generic_current: Toroidal current density from generic current source
146+
j_generic_current: Toroidal current density from generic current source
147147
[Am^-2]
148-
j_toroidal_ecrh: Toroidal current density from electron cyclotron heating
148+
j_ecrh: Toroidal current density from electron cyclotron heating
149149
and current source [Am^-2]
150150
S_gas_puff: Integrated gas puff source [s^-1]
151151
S_pellet: Integrated pellet source [s^-1]
@@ -228,12 +228,12 @@ class PostProcessedOutputs:
228228
I_bootstrap: array_typing.FloatScalar
229229
j_parallel_external: array_typing.FloatVector
230230
j_parallel_ohmic: array_typing.FloatVector
231-
j_toroidal_total: array_typing.FloatVector
232-
j_toroidal_bootstrap: array_typing.FloatVector
233-
j_toroidal_ohmic: array_typing.FloatVector
234-
j_toroidal_external: array_typing.FloatVector
235-
j_toroidal_generic_current: array_typing.FloatVector
236-
j_toroidal_ecrh: array_typing.FloatVector
231+
j_total: array_typing.FloatVector
232+
j_bootstrap: array_typing.FloatVector
233+
j_ohmic: array_typing.FloatVector
234+
j_external: array_typing.FloatVector
235+
j_generic_current: array_typing.FloatVector
236+
j_ecrh: array_typing.FloatVector
237237
S_gas_puff: array_typing.FloatScalar
238238
S_pellet: array_typing.FloatScalar
239239
S_generic_particle: array_typing.FloatScalar
@@ -330,14 +330,15 @@ def zeros(cls, geo: geometry.Geometry) -> typing_extensions.Self:
330330
rho_q_2_1_second=jnp.array(0.0, dtype=jax_utils.get_dtype()),
331331
rho_q_3_1_second=jnp.array(0.0, dtype=jax_utils.get_dtype()),
332332
I_bootstrap=jnp.array(0.0, dtype=jax_utils.get_dtype()),
333+
# TODO (v2): rename j_* to j_toroidal_* for clarity
333334
j_parallel_external=jnp.zeros(geo.rho_face.shape),
334335
j_parallel_ohmic=jnp.zeros(geo.rho_face.shape),
335-
j_toroidal_total=jnp.zeros(geo.rho_face.shape),
336-
j_toroidal_bootstrap=jnp.zeros(geo.rho_face.shape),
337-
j_toroidal_ohmic=jnp.zeros(geo.rho_face.shape),
338-
j_toroidal_external=jnp.zeros(geo.rho_face.shape),
339-
j_toroidal_generic_current=jnp.zeros(geo.rho_face.shape),
340-
j_toroidal_ecrh=jnp.zeros(geo.rho_face.shape),
336+
j_total=jnp.zeros(geo.rho_face.shape),
337+
j_bootstrap=jnp.zeros(geo.rho_face.shape),
338+
j_ohmic=jnp.zeros(geo.rho_face.shape),
339+
j_external=jnp.zeros(geo.rho_face.shape),
340+
j_generic_current=jnp.zeros(geo.rho_face.shape),
341+
j_ecrh=jnp.zeros(geo.rho_face.shape),
341342
S_gas_puff=jnp.array(0.0, dtype=jax_utils.get_dtype()),
342343
S_pellet=jnp.array(0.0, dtype=jax_utils.get_dtype()),
343344
S_generic_particle=jnp.array(0.0, dtype=jax_utils.get_dtype()),
@@ -735,28 +736,26 @@ def make_post_processed_outputs(
735736

736737
# Toroidal current densities
737738
# TODO: check whether j_total is parallel or toroidal
738-
j_toroidal_total = psi_calculations.j_parallel_to_j_tor(
739+
j_total = psi_calculations.j_parallel_to_j_tor(
739740
sim_state.core_profiles.j_total, sim_state.geometry
740741
)
741-
j_toroidal_bootstrap = psi_calculations.j_parallel_to_j_tor(
742+
j_bootstrap = psi_calculations.j_parallel_to_j_tor(
742743
sim_state.core_sources.bootstrap_current.j_bootstrap, sim_state.geometry
743744
)
744-
j_toroidal_ohmic = psi_calculations.j_parallel_to_j_tor(
745+
j_ohmic = psi_calculations.j_parallel_to_j_tor(
745746
j_parallel_ohmic, sim_state.geometry
746747
)
747-
j_toroidal_external = psi_calculations.j_parallel_to_j_tor(
748+
j_external = psi_calculations.j_parallel_to_j_tor(
748749
j_parallel_external, sim_state.geometry
749750
)
750-
j_toroidal_sources = {}
751+
j_sources = {}
751752
for source_name in ['ecrh', 'generic_current']:
752753
if source_name in sim_state.core_sources.psi.keys():
753-
j_toroidal_sources[f'j_toroidal_{source_name}'] = (
754-
psi_calculations.j_parallel_to_j_tor(
755-
sim_state.core_sources.psi[source_name], sim_state.geometry
756-
)
754+
j_sources[f'j_{source_name}'] = psi_calculations.j_parallel_to_j_tor(
755+
sim_state.core_sources.psi[source_name], sim_state.geometry
757756
)
758757
else:
759-
j_toroidal_sources[f'j_toroidal_{source_name}'] = jnp.array(
758+
j_sources[f'j_{source_name}'] = jnp.array(
760759
0.0, dtype=jax_utils.get_dtype()
761760
)
762761

@@ -810,11 +809,11 @@ def make_post_processed_outputs(
810809
I_bootstrap=I_bootstrap,
811810
j_parallel_external=j_parallel_external,
812811
j_parallel_ohmic=j_parallel_ohmic,
813-
j_toroidal_total=j_toroidal_total,
814-
j_toroidal_bootstrap=j_toroidal_bootstrap,
815-
j_toroidal_ohmic=j_toroidal_ohmic,
816-
j_toroidal_external=j_toroidal_external,
817-
**j_toroidal_sources,
812+
j_total=j_total,
813+
j_bootstrap=j_bootstrap,
814+
j_ohmic=j_ohmic,
815+
j_external=j_external,
816+
**j_sources,
818817
beta_tor=beta_tor,
819818
beta_pol=beta_pol,
820819
beta_N=beta_N,

torax/_src/sources/generic_current_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def calculate_generic_current(
5858
unused_state: state.CoreProfiles,
5959
unused_calculated_source_profiles: source_profiles.SourceProfiles | None,
6060
unused_conductivity: conductivity_base.Conductivity | None,
61-
) -> tuple[chex.Array, ...]:
61+
) -> tuple[array_typing.FloatVectorCell, ...]:
6262
"""Calculates the external parallel current density profile on the cell
6363
grid."""
6464
source_params = runtime_params.sources[source_name]

0 commit comments

Comments
 (0)