From 2be3edfc7200b621ca448e83b9ed0680d29e4268 Mon Sep 17 00:00:00 2001 From: Jack Foster Date: Mon, 12 Feb 2024 13:41:33 +0000 Subject: [PATCH] Renamed theat to t_fusion_ramp --- process/pfcoil.py | 6 +++--- process/physics.py | 19 ++++++++++++------- process/power.py | 10 +++++----- process/pulse.py | 4 ++-- process/utilities/errorlist.json | 2 +- source/fortran/input.f90 | 6 +++--- source/fortran/stellarator.f90 | 6 +++--- source/fortran/times_variables.f90 | 16 ++++++++-------- tests/integration/ref_dicts.json | 14 +++++++------- tests/integration/test_pfcoil_int.py | 3 ++- tests/unit/test_physics.py | 9 +++++---- tests/unit/test_power.py | 12 ++++++------ tests/unit/test_pulse.py | 8 ++++---- 13 files changed, 61 insertions(+), 54 deletions(-) diff --git a/process/pfcoil.py b/process/pfcoil.py index a7edefee93..a31651891d 100644 --- a/process/pfcoil.py +++ b/process/pfcoil.py @@ -119,7 +119,7 @@ def pfcoil(self): tv.tim[0] = 0.0e0 tv.tim[1] = tv.tramp tv.tim[2] = tv.tim[1] + tv.tohs - tv.tim[3] = tv.tim[2] + tv.theat + tv.tim[3] = tv.tim[2] + tv.t_fusion_ramp tv.tim[4] = tv.tim[3] + tv.tburn tv.tim[5] = tv.tim[4] + tv.tqnch @@ -514,7 +514,7 @@ def pfcoil(self): pf.ccls[nng] - (pf.ccl0[nng] * pfv.fcohbof / pfv.fcohbop) ) - # End of flat-top: t = tv.tramp+tv.tohs+tv.theat+tv.tburn + # End of flat-top: t = tv.tramp+tv.tohs+tv.t_fusion_ramp+tv.tburn pfv.curpfb[ncl] = 1.0e-6 * ( pf.ccls[nng] - (pf.ccl0[nng] * (1.0e0 / pfv.fcohbop)) ) @@ -2697,7 +2697,7 @@ def waveform(self): ): pfv.ric[ic] = pfv.curpff[ic] - # End of flat-top, t = tramp + tohs + theat + tburn + # End of flat-top, t = tramp + tohs + t_fusion_ramp + tburn if (abs(pfv.curpfb[ic]) >= abs(pfv.curpfs[ic])) and ( abs(pfv.curpfb[ic]) >= abs(pfv.curpff[ic]) ): diff --git a/process/physics.py b/process/physics.py index 39d9564430..9cde0a55ff 100644 --- a/process/physics.py +++ b/process/physics.py @@ -158,7 +158,7 @@ def physics(self): # The pulse length is the duration of non-zero plasma current times_variables.tpulse = ( times_variables.tohs - + times_variables.theat + + times_variables.t_fusion_ramp + times_variables.tburn + times_variables.tqnch ) @@ -173,7 +173,7 @@ def physics(self): times_variables.tcycle = ( times_variables.tramp + times_variables.tohs - + times_variables.theat + + times_variables.t_fusion_ramp + times_variables.tburn + times_variables.tqnch + times_variables.tdwell @@ -608,7 +608,7 @@ def physics(self): physics_variables.rmajor, physics_variables.rplas, physics_variables.plascur, - times_variables.theat, + times_variables.t_fusion_ramp, times_variables.tburn, physics_variables.rli, ) @@ -1284,7 +1284,7 @@ def vscalc( rmajor, rplas, plascur, - theat, + t_fusion_ramp, tburn, rli, ): @@ -1299,7 +1299,7 @@ def vscalc( rli : input real : plasma normalised inductivity rmajor : input real : plasma major radius (m) rplas : input real : plasma resistance (ohm) - theat : input real : heating time (s) + t_fusion_ramp : input real : heating time (s) tburn : input real : burn time (s) phiint : output real : internal plasma volt-seconds (Wb) rlp : output real : plasma inductance (H) @@ -1353,7 +1353,7 @@ def vscalc( # if the pulsed reactor option is used, but the value # will be correct on subsequent calls. - vsbrn = vburn * (theat + tburn) + vsbrn = vburn * (t_fusion_ramp + tburn) vsstt = vsstt + vsbrn return phiint, rlp, vsbrn, vsind, vsres, vsstt @@ -2594,7 +2594,12 @@ def outtim(self): "(tohs)", times_variables.tohs, ) - po.ovarrf(self.outfile, "Heating time (s)", "(theat)", times_variables.theat) + po.ovarrf( + self.outfile, + "Heating time (s)", + "(t_fusion_ramp)", + times_variables.t_fusion_ramp, + ) po.ovarre( self.outfile, "Burn time (s)", "(tburn)", times_variables.tburn, "OP " ) diff --git a/process/power.py b/process/power.py index a2f3dd39de..2acb0a170d 100644 --- a/process/power.py +++ b/process/power.py @@ -2069,7 +2069,7 @@ def power3(self, output: bool): t_ip_up = times_variables.tohs # Plasma heating phase (s) - t_heat = times_variables.theat + t_heat = times_variables.t_fusion_ramp # Flat-top phase (s) t_flat_top = times_variables.tburn @@ -2152,7 +2152,7 @@ def power3(self, output: bool): po.write(self.outfile, "Pulse timings [s]:") po.oblnkl(self.outfile) - po.write(self.outfile, "tramp tohs theat tburn tqnch tdwell") + po.write(self.outfile, "tramp tohs t_fusion_ramp tburn tqnch tdwell") po.write(self.outfile, "----- ---- ----- ----- ----- ------") po.write( self.outfile, @@ -2163,7 +2163,7 @@ def power3(self, output: bool): po.write(self.outfile, "Continous power usage [MWe]:") po.oblnkl(self.outfile) - po.write(self.outfile, "System tramp tohs theat tburn tqnch tdwell") + po.write(self.outfile, "System tramp tohs t_fusion_ramp tburn tqnch tdwell") po.write(self.outfile, "------ ----- ---- ----- ----- ----- ------") po.write( self.outfile, @@ -2212,7 +2212,7 @@ def power3(self, output: bool): po.write(self.outfile, "Intermittent power usage [MWe]:") po.oblnkl(self.outfile) - po.write(self.outfile, "System tramp tohs theat tburn tqnch tdwell") + po.write(self.outfile, "System tramp tohs t_fusion_ramp tburn tqnch tdwell") po.write(self.outfile, "------ ----- ---- ----- ----- ----- ------") po.write( self.outfile, @@ -2238,7 +2238,7 @@ def power3(self, output: bool): po.write(self.outfile, "Power production [MWe]:") po.oblnkl(self.outfile) - po.write(self.outfile, " tramp tohs theat tburn tqnch tdwell avg") + po.write(self.outfile, " tramp tohs t_fusion_ramp tburn tqnch tdwell avg") po.write(self.outfile, " ----- ---- ----- ----- ----- ------ ---") po.write( self.outfile, diff --git a/process/pulse.py b/process/pulse.py index 545b41c7b0..55ad29826e 100755 --- a/process/pulse.py +++ b/process/pulse.py @@ -158,12 +158,12 @@ def burn(self, output: bool): # Burn time (s) - tb = vsmax / vburn - times_variables.theat + tb = vsmax / vburn - times_variables.t_fusion_ramp if tb < 0.0e0: error_handling.fdiags[0] = tb error_handling.fdiags[1] = vsmax error_handling.fdiags[2] = vburn - error_handling.fdiags[3] = times_variables.theat + error_handling.fdiags[3] = times_variables.t_fusion_ramp error_handling.report_error(93) times_variables.tburn = max(0.0e0, tb) diff --git a/process/utilities/errorlist.json b/process/utilities/errorlist.json index c85fb76c88..7aa7d672be 100644 --- a/process/utilities/errorlist.json +++ b/process/utilities/errorlist.json @@ -473,7 +473,7 @@ { "no": 93, "level": 2, - "message": "BURN: Negative burn time available; reduce theat or raise PF coil V-s capability" + "message": "BURN: Negative burn time available; reduce t_fusion_ramp or raise PF coil V-s capability" }, { "no": 94, diff --git a/source/fortran/input.f90 b/source/fortran/input.f90 index af2f82ca21..8cc0ce9c1c 100644 --- a/source/fortran/input.f90 +++ b/source/fortran/input.f90 @@ -343,7 +343,7 @@ subroutine parse_input_file(in_file,out_file,show_changes) sig_tf_wp_max, eyoung_cond_trans, i_tf_cond_eyoung_axial, i_tf_cond_eyoung_trans, & str_wp_max, str_tf_con_res, i_str_wp, max_vv_stress, theta1_coil, theta1_vv - use times_variables, only: tohs, pulsetimings, tqnch, theat, tramp, tburn, & + use times_variables, only: tohs, pulsetimings, tqnch, t_fusion_ramp, tramp, tburn, & tdwell, tohsin use vacuum_variables, only: dwell_pump, pbase, tn, pumpspeedfactor, & initialpressure, outgasfactor, prdiv, pumpspeedmax, rat, outgasindex, & @@ -1124,8 +1124,8 @@ subroutine parse_input_file(in_file,out_file,show_changes) case ('tdwell') call parse_real_variable('tdwell', tdwell, 0.0D0, 1.0D8, & 'Time between burns (s)') - case ('theat') - call parse_real_variable('theat', theat, 0.0D0, 1.0D4, & + case ('t_fusion_ramp') + call parse_real_variable('t_fusion_ramp', t_fusion_ramp, 0.0D0, 1.0D4, & 'Heating time after current ramp (s)') case ('tohs') call parse_real_variable('tohs', tohs, 0.0D0, 1.0D4, & diff --git a/source/fortran/stellarator.f90 b/source/fortran/stellarator.f90 index a3e2f7e534..6acfa36bc1 100644 --- a/source/fortran/stellarator.f90 +++ b/source/fortran/stellarator.f90 @@ -61,7 +61,7 @@ subroutine stinit use numerics, only: boundl, boundu use stellarator_variables, only: istell use tfcoil_variables, only: n_tf - use times_variables, only: tburn, tcycle, tdown, tdwell, theat, tohs, & + use times_variables, only: tburn, tcycle, tdown, tdwell, t_fusion_ramp, tohs, & tpulse, tqnch, tramp use global_variables, only: icase use constants, only: pi, rmu0, nout @@ -115,9 +115,9 @@ subroutine stinit tohs = 0.0D0 tburn = 3.15576D7 ! one year tqnch = 0.0D0 - tpulse = tohs + theat + tburn + tqnch + tpulse = tohs + t_fusion_ramp + tburn + tqnch tdown = tramp + tohs + tqnch + tdwell - tcycle = tramp + tohs + theat + tburn + tqnch + tdwell + tcycle = tramp + tohs + t_fusion_ramp + tburn + tqnch + tdwell end subroutine stinit end module stellarator_module diff --git a/source/fortran/times_variables.f90 b/source/fortran/times_variables.f90 index 62303bd605..35614321f4 100644 --- a/source/fortran/times_variables.f90 +++ b/source/fortran/times_variables.f90 @@ -36,7 +36,7 @@ module times_variables real(dp) :: tdwell !! time between pulses in a pulsed reactor (s) (`iteration variable 17`) - real(dp) :: theat + real(dp) :: t_fusion_ramp !! heating time, after current ramp up (s) real(dp), dimension(6) :: tim @@ -59,7 +59,7 @@ module times_variables !! - <>0, tohs = tohsin; tramp, tqnch are input real(dp) :: tpulse - !! pulse length = tohs + theat + tburn + tqnch + !! pulse length = tohs + t_fusion_ramp + tburn + tqnch real(dp) :: tqnch !! shut down time for PF coils (s); if pulsed, = tohs @@ -79,7 +79,7 @@ subroutine init_times_variables tcycle = 0.0D0 tdown = 0.0D0 tdwell = 1800.0D0 - theat = 10.0D0 + t_fusion_ramp = 10.0D0 tim = 0.0D0 timelabel = (/ 'Start', & 'BOP ', & @@ -87,11 +87,11 @@ subroutine init_times_variables 'BOF ', & 'EOF ', & 'EOP ' /) - intervallabel = (/ 'tramp', & - 'tohs ', & - 'theat', & - 'tburn', & - 'tqnch' /) + intervallabel = (/ 'tramp ', & + 'tohs ', & + 't_fusion_ramp', & + 'tburn ', & + 'tqnch ' /) tohs = 30.0D0 tohsin = 0.0D0 tpulse = 0.0D0 diff --git a/tests/integration/ref_dicts.json b/tests/integration/ref_dicts.json index 55362f1fff..5b7d452538 100644 --- a/tests/integration/ref_dicts.json +++ b/tests/integration/ref_dicts.json @@ -2613,7 +2613,7 @@ "intervallabel": [ "tramp", "tohs", - "theat", + "t_fusion_ramp", "tburn", "tqnch" ], @@ -7562,7 +7562,7 @@ "tgain": 85.0, "th_joint_contact": 0.03, "thcomp": null, - "theat": 10.0, + "t_fusion_ramp": 10.0, "theta": null, "theta_coil": 0.0, "thick_bp_ib": 0.0, @@ -10807,7 +10807,7 @@ "tgain": "IFE target gain (if `ifedrv = 0`) (`iteration variable 83`)", "th_joint_contact": "TF sliding joints contact pad width [m]", "thcomp": "", - "theat": "heating time, after current ramp up (s)", + "t_fusion_ramp": "heating time, after current ramp up (s)", "theta": "", "theta_coil": "Half toroidal angular extent of a single TF coil inboard leg", "thick_bp_ib": "", @@ -10862,7 +10862,7 @@ "tpeak": "peak first wall temperature (K)", "tpeakfwi": "Inboard/outboard first wall peak temperature (K)", "tpeakfwo": "Inboard/outboard first wall peak temperature (K)", - "tpulse": "pulse length = tohs + theat + tburn + tqnch", + "tpulse": "pulse length = tohs + t_fusion_ramp + tburn + tqnch", "tqnch": "shut down time for PF coils (s); if pulsed, = tohs", "tramp": "initial PF coil charge time (s); if pulsed, = tohs", "transp_clrnc": "transportation clearance between components (m)", @@ -14554,7 +14554,7 @@ "lb": 0.0, "ub": 1.0 }, - "theat": { + "t_fusion_ramp": { "lb": 0.0, "ub": 10000.0 }, @@ -19743,7 +19743,7 @@ "tcycle", "tdown", "tdwell", - "theat", + "t_fusion_ramp", "tim", "timelabel", "intervallabel", @@ -20788,7 +20788,7 @@ "tfwmatmax": "real_variable", "tgain": "real_variable", "th_joint_contact": "real_variable", - "theat": "real_variable", + "t_fusion_ramp": "real_variable", "thicndut": "real_variable", "thkcas": "real_variable", "thshield": "real_variable", diff --git a/tests/integration/test_pfcoil_int.py b/tests/integration/test_pfcoil_int.py index ad4ff6e7f3..8c462355f6 100644 --- a/tests/integration/test_pfcoil_int.py +++ b/tests/integration/test_pfcoil_int.py @@ -8,6 +8,7 @@ are also many variables that could be asserted, so a few key variables central to the testing of the subroutine have been chosen. """ + import numpy as np from numpy.testing import assert_array_almost_equal import pytest @@ -139,7 +140,7 @@ def test_pfcoil(monkeypatch, pfcoil): monkeypatch.setattr(tv, "tburn", 7.1263e-1) monkeypatch.setattr(tv, "tohs", 1.82538e2) monkeypatch.setattr(tv, "tqnch", 1.82538e2) - monkeypatch.setattr(tv, "theat", 1.0e1) + monkeypatch.setattr(tv, "t_fusion_ramp", 1.0e1) monkeypatch.setattr(constants, "dcopper", 8.9e3) monkeypatch.setattr(pf, "first_call", True) diff --git a/tests/unit/test_physics.py b/tests/unit/test_physics.py index 14ddcc2afb..18cf72d0d6 100644 --- a/tests/unit/test_physics.py +++ b/tests/unit/test_physics.py @@ -1,4 +1,5 @@ """Unit tests for physics.f90.""" + from typing import Any, NamedTuple from process.fortran import ( physics_variables, @@ -1290,7 +1291,7 @@ class VscalcParam(NamedTuple): tburn: Any = None - theat: Any = None + t_fusion_ramp: Any = None expected_phiint: Any = None @@ -1319,7 +1320,7 @@ class VscalcParam(NamedTuple): rmajor=8, rplas=3.7767895536275952e-09, tburn=1000, - theat=10, + t_fusion_ramp=10, expected_phiint=111.57651734747576, expected_rlp=1.4075705307248088e-05, expected_vsbrn=42.109179697761263, @@ -1338,7 +1339,7 @@ class VscalcParam(NamedTuple): rmajor=8, rplas=3.7767895536275952e-09, tburn=0, - theat=10, + t_fusion_ramp=10, expected_phiint=111.57651734747576, expected_rlp=1.4075705307248088e-05, expected_vsbrn=0.41692257126496302, @@ -1369,7 +1370,7 @@ def test_vscalc(vscalcparam, physics): rmajor=vscalcparam.rmajor, rplas=vscalcparam.rplas, tburn=vscalcparam.tburn, - theat=vscalcparam.theat, + t_fusion_ramp=vscalcparam.t_fusion_ramp, ) assert phiint == pytest.approx(vscalcparam.expected_phiint) diff --git a/tests/unit/test_power.py b/tests/unit/test_power.py index b02a551405..a068111996 100644 --- a/tests/unit/test_power.py +++ b/tests/unit/test_power.py @@ -971,7 +971,7 @@ class PfpwrParam(NamedTuple): intervallabel=( "tramp ", "tohs ", - "theat ", + "t_fusion_ramp ", "tburn ", "tqnch ", ), @@ -1713,7 +1713,7 @@ class PfpwrParam(NamedTuple): intervallabel=( "tramp ", "tohs ", - "theat ", + "t_fusion_ramp ", "tburn ", "tqnch ", ), @@ -2669,7 +2669,7 @@ class Power3Param(NamedTuple): tburn: Any = None - theat: Any = None + t_fusion_ramp: Any = None tdwell: Any = None @@ -2705,7 +2705,7 @@ class Power3Param(NamedTuple): ).transpose(), tramp=500, tburn=0, - theat=10, + t_fusion_ramp=10, tdwell=0, tqnch=177.21306969367816, tohs=177.21306969367816, @@ -2738,7 +2738,7 @@ class Power3Param(NamedTuple): ).transpose(), tramp=500, tburn=10230.533336387543, - theat=10, + t_fusion_ramp=10, tdwell=0, tqnch=177.21306969367816, tohs=177.21306969367816, @@ -2786,7 +2786,7 @@ def test_power3(power3param, monkeypatch, power): monkeypatch.setattr(times_variables, "tburn", power3param.tburn) - monkeypatch.setattr(times_variables, "theat", power3param.theat) + monkeypatch.setattr(times_variables, "t_fusion_ramp", power3param.t_fusion_ramp) monkeypatch.setattr(times_variables, "tdwell", power3param.tdwell) diff --git a/tests/unit/test_pulse.py b/tests/unit/test_pulse.py index d212ae70bd..9442052941 100755 --- a/tests/unit/test_pulse.py +++ b/tests/unit/test_pulse.py @@ -91,7 +91,7 @@ class BurnParam(NamedTuple): tburn: Any = None - theat: Any = None + t_fusion_ramp: Any = None outfile: Any = None @@ -1281,7 +1281,7 @@ def test_tohswg(tohswgparam, monkeypatch, pulse): csawth=1, lpulse=1, tburn=0, - theat=10, + t_fusion_ramp=10, outfile=11, iprint=0, expected_tburn=0, @@ -1297,7 +1297,7 @@ def test_tohswg(tohswgparam, monkeypatch, pulse): csawth=1, lpulse=1, tburn=10234.092022756307, - theat=10, + t_fusion_ramp=10, outfile=11, iprint=0, expected_tburn=10230.533336387545, @@ -1337,7 +1337,7 @@ def test_burn(burnparam, monkeypatch, initialise_error_module, pulse): monkeypatch.setattr(times_variables, "tburn", burnparam.tburn) - monkeypatch.setattr(times_variables, "theat", burnparam.theat) + monkeypatch.setattr(times_variables, "t_fusion_ramp", burnparam.t_fusion_ramp) pulse.burn(output=True)