Skip to content

Commit

Permalink
🔄 Rename 'rjpfalw' to 'j_pf_wp_critical' across multiple files for co…
Browse files Browse the repository at this point in the history
…nsistency and clarity
  • Loading branch information
chris-ashe committed Feb 11, 2025
1 parent c8f250f commit 7b570e0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
12 changes: 7 additions & 5 deletions process/pfcoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ def pfcoil(self):
if pfv.i_pf_conductor == 0:
bmax = max(abs(pfv.bpf[i]), abs(pf.bpf2[i]))

pfv.rjpfalw[i], jstrand, jsc, tmarg = self.superconpf(
pfv.j_pf_wp_critical[i], jstrand, jsc, tmarg = self.superconpf(
bmax,
pfv.vf[i],
pfv.fcupfsu,
Expand Down Expand Up @@ -1299,8 +1299,10 @@ def ohcalc(self):
tfv.tcritsc,
)

pfv.rjpfalw[pfv.n_cs_pf_coils - 1] = jcritwp * pfv.awpoh / pfv.a_cs_poloidal
pfv.rjohc0 = pfv.rjpfalw[pfv.n_cs_pf_coils - 1]
pfv.j_pf_wp_critical[pfv.n_cs_pf_coils - 1] = (
jcritwp * pfv.awpoh / pfv.a_cs_poloidal
)
pfv.rjohc0 = pfv.j_pf_wp_critical[pfv.n_cs_pf_coils - 1]

pfv.temp_cs_margin = min(tmarg1, tmarg2)

Expand Down Expand Up @@ -2587,7 +2589,7 @@ def outpf(self):
if pfv.i_pf_conductor == 0:
op.write(
self.outfile,
f"PF {k}\t{pfv.ric[k]:.2e}\t{pfv.rjpfalw[k]:.2e}\t{pfv.rjconpf[k]:.2e}\t{pfv.rjconpf[k] / pfv.rjpfalw[k]:.2e}\t{pfv.m_pf_coil_conductor[k]:.2e}\t{pfv.m_pf_coil_structure[k]:.2e}\t{pfv.bpf[k]:.2e}",
f"PF {k}\t{pfv.ric[k]:.2e}\t{pfv.j_pf_wp_critical[k]:.2e}\t{pfv.rjconpf[k]:.2e}\t{pfv.rjconpf[k] / pfv.j_pf_wp_critical[k]:.2e}\t{pfv.m_pf_coil_conductor[k]:.2e}\t{pfv.m_pf_coil_structure[k]:.2e}\t{pfv.bpf[k]:.2e}",
)
else:
op.write(
Expand All @@ -2601,7 +2603,7 @@ def outpf(self):
# Issue #328
op.write(
self.outfile,
f"CS\t\t{pfv.ric[pfv.n_cs_pf_coils - 1]:.2e}\t{pfv.rjpfalw[pfv.n_cs_pf_coils - 1]:.2e}\t{max(abs(pfv.j_cs_pulse_start), abs(pfv.j_cs_flat_top_end)):.2e}\t{max(abs(pfv.j_cs_pulse_start), abs(pfv.j_cs_flat_top_end)) / pfv.rjpfalw[pfv.n_cs_pf_coils - 1]:.2e}\t{pfv.m_pf_coil_conductor[pfv.n_cs_pf_coils - 1]:.2e}\t{pfv.m_pf_coil_structure[pfv.n_cs_pf_coils - 1]:.2e}\t{pfv.bpf[pfv.n_cs_pf_coils - 1]:.2e}",
f"CS\t\t{pfv.ric[pfv.n_cs_pf_coils - 1]:.2e}\t{pfv.j_pf_wp_critical[pfv.n_cs_pf_coils - 1]:.2e}\t{max(abs(pfv.j_cs_pulse_start), abs(pfv.j_cs_flat_top_end)):.2e}\t{max(abs(pfv.j_cs_pulse_start), abs(pfv.j_cs_flat_top_end)) / pfv.j_pf_wp_critical[pfv.n_cs_pf_coils - 1]:.2e}\t{pfv.m_pf_coil_conductor[pfv.n_cs_pf_coils - 1]:.2e}\t{pfv.m_pf_coil_structure[pfv.n_cs_pf_coils - 1]:.2e}\t{pfv.bpf[pfv.n_cs_pf_coils - 1]:.2e}",
)
else:
op.write(
Expand Down
4 changes: 2 additions & 2 deletions source/fortran/pfcoil_variables.f90
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ module pfcoil_variables
real(dp) :: rjohc0
!! allowable central solenoid current density at beginning of pulse (A/m2)

real(dp), dimension(ngc2) :: rjpfalw
real(dp), dimension(ngc2) :: j_pf_wp_critical
!! allowable winding pack current density of PF coil i (A/m2)

real(dp) :: r_cs_middle
Expand Down Expand Up @@ -481,7 +481,7 @@ subroutine init_pfcoil_variables
3.0D7, 3.0D7, 3.0D7, 3.0D7, 3.0D7/)
rjohc = 0.0D0
rjohc0 = 0.0D0
rjpfalw = 0.0D0
j_pf_wp_critical = 0.0D0
r_cs_middle = 0.0D0
routr = 1.5D0
r_pf_coil_middle = 0.0D0
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/ref_dicts.json
Original file line number Diff line number Diff line change
Expand Up @@ -4230,7 +4230,7 @@
"rjconpf": 30000000.0,
"rjohc": 0.0,
"rjohc0": 0.0,
"rjpfalw": 0.0,
"j_pf_wp_critical": 0.0,
"rkind": "double",
"rlclolcn": 0.0,
"rlenmax": 0.5,
Expand Down Expand Up @@ -10538,7 +10538,7 @@
"rjconpf": "average winding pack current density of PF coil i (A/m2) at time of peak\n current in that coil (calculated for `i_pf_location=1` coils)",
"rjohc": "allowable central solenoid current density at end of flat-top (A/m2)",
"rjohc0": "allowable central solenoid current density at beginning of pulse (A/m2)",
"rjpfalw": "allowable winding pack current density of PF coil i (A/m2)",
"j_pf_wp_critical": "allowable winding pack current density of PF coil i (A/m2)",
"rkind": "",
"rlclolcn": "ratio of collision length / connection length",
"rlenmax": "maximum value for length ratio (rlclolcn) (`constraintg eqn 22`)",
Expand Down Expand Up @@ -18986,7 +18986,7 @@
"rjconpf",
"rjohc",
"rjohc0",
"rjpfalw",
"j_pf_wp_critical",
"r_cs_middle",
"routr",
"r_pf_coil_middle",
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_pfcoil_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_pfcoil(monkeypatch, pfcoil):
monkeypatch.setattr(pfv, "m_pf_coil_conductor_total", 0.0)
monkeypatch.setattr(pfv, "fcupfsu", 6.900e-1)
monkeypatch.setattr(pfv, "j_cs_pulse_start", 1.693e7)
monkeypatch.setattr(pfv, "rjpfalw", np.full(22, 0.0))
monkeypatch.setattr(pfv, "j_pf_wp_critical", np.full(22, 0.0))
monkeypatch.setattr(pfv, "i_sup_pf_shape", 0)
monkeypatch.setattr(pfv, "rref", np.full(10, 7.0))
monkeypatch.setattr(pfv, "i_pf_current", 1)
Expand Down Expand Up @@ -213,7 +213,7 @@ def test_ohcalc(monkeypatch, reinitialise_error_module, pfcoil):
monkeypatch.setattr(pfv, "rjohc", 4.070e7)
monkeypatch.setattr(pfv, "temp_cs_margin", 1.5)
monkeypatch.setattr(pfv, "i_pf_conductor", 0)
monkeypatch.setattr(pfv, "rjpfalw", np.full(22, 0.0))
monkeypatch.setattr(pfv, "j_pf_wp_critical", np.full(22, 0.0))
monkeypatch.setattr(pfv, "rho_pf_coil", 2.8e-8)
monkeypatch.setattr(pfv, "vf", np.full(22, 0.3))
monkeypatch.setattr(pfv, "ric", np.full(22, 0.0))
Expand Down

0 comments on commit 7b570e0

Please sign in to comment.