Skip to content

Commit

Permalink
✅ Add test for core_electron_density_temperature_profile() (Fusion-Po…
Browse files Browse the repository at this point in the history
…wer-Plant-Framework#3362)

Co-authored-by: Athoy Nilima <athoy.nilima@ukaea.uk>
  • Loading branch information
athoynilimanew and Athoy Nilima authored Jun 12, 2024
1 parent 8af8df4 commit 1acb6ec
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/radiation_transport/test_radiation_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,26 @@ def test_rho_core(self):
assert rho_core[0] > 0
assert rho_core[-1] < 1

def test_core_electron_density_temperature_profile(self):
rho_core = self.profiles.collect_rho_core_values()
ne_core, te_core, psi_n = (
self.profiles.core_electron_density_temperature_profile(rho_core)
)

assert len(ne_core) == len(rho_core)
assert len(te_core) == len(rho_core)
assert len(psi_n) == len(rho_core)

# Ensure values are within expected ranges
assert np.all(ne_core >= self.params["n_e_sep"]["value"])
assert np.all(te_core >= self.params["T_e_sep"]["value"])
assert np.all(ne_core <= self.params["n_e_0"]["value"])
assert np.all(te_core <= self.params["T_e_0"]["value"])

# Ensure the density and temperature are decreasing towards the edge
assert ne_core[0] > ne_core[-1]
assert te_core[0] > te_core[-1]

def test_calculate_mp_radiation_profile(self):
self.source.core_rad.calculate_mp_radiation_profile()
rad_tot = np.sum(np.array(self.source.core_rad.rad_mp, dtype=object), axis=0)
Expand Down

0 comments on commit 1acb6ec

Please sign in to comment.