Skip to content

Commit

Permalink
Tidying up missed renames
Browse files Browse the repository at this point in the history
  • Loading branch information
j-a-foster committed Dec 2, 2024
1 parent c598999 commit eac36be
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ The recirculating power comprises the electrical power required to run all of th
electrical systems surrounding the fusion power core, plus the on-site building services, offices,
etc., as shown in Figure 1. Of these, the cryogenic plant power includes the power required to cool
the TF coils from the neutron power absorbed by the coils, the PF coils (as defined by the ratio of
the total PF coil stored energy to the fusion power pulse time `tpulse`), and other 'cold' components.
the total PF coil stored energy to the fusion power pulse time `t_pulse_repetition`), and other 'cold' components.

[^1]: C. Harrington, *"Development and Implementation of Improved Balance of Plant Models for PROCESS"*, CCFE C5.M15 Milestone Report, August 2014 (copy stored as CCFE internal note T&M/PKNIGHT/PROCESS/027)
2 changes: 1 addition & 1 deletion documentation/proc-pages/physics-models/pulsed-plant.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ can be set as an iteration variable (65). The ramp-up and shutdown time in the p
equal to `t_current_ramp_up`. To ensure that the plasma current ramp rate during start-up is prevented from being
too high, as governed by the requirement to maintain plasma stability by ensuring that the induced
current has time to diffuse into the body of the plasma, constraint equation no. 41 should be
turned on with iteration variable no. 66 `ft_current_ramp_up` and input `tohsmn`, the minimum plasma current
turned on with iteration variable no. 66 `ft_current_ramp_up` and input `t_current_ramp_up_min`, the minimum plasma current
ramp-up time.

## Burn time
Expand Down
4 changes: 2 additions & 2 deletions process/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1587,10 +1587,10 @@ def physics(self):
# t_ramp_down = max(t_ramp_down,t_current_ramp_up)
times_variables.t_ramp_down = times_variables.t_current_ramp_up

# Reset second times_variables.t_burn value (times_variables.tburn0).
# Reset second times_variables.t_burn value (times_variables.t_burn_0).
# This is used to ensure that the burn time is used consistently;
# see convergence loop in fcnvmc1, evaluators.f90
times_variables.tburn0 = times_variables.t_burn
times_variables.t_burn_0 = times_variables.t_burn

# Pulse and down times : The reactor is assumed to be 'down'
# at all times outside of the plasma current flat-top period.
Expand Down
6 changes: 3 additions & 3 deletions process/pulse.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def tohswg(self, output: bool) -> None:
# Minimum plasma current ramp-up time (s)
# - corrected (bus resistance is not a function of pfcoil_variables.turns)

constraint_variables.tohsmn = (
constraint_variables.t_current_ramp_up_min = (
loh
* (ioht2 - ioht1)
/ (
Expand All @@ -115,8 +115,8 @@ def tohswg(self, output: bool) -> None:
po.ovarre(
self.outfile,
"Minimum plasma current ramp-up time (s)",
"(tohsmn)",
constraint_variables.tohsmn,
"(t_current_ramp_up_min)",
constraint_variables.t_current_ramp_up_min,
)

def burn(self, output: bool):
Expand Down
12 changes: 6 additions & 6 deletions source/fortran/constraint_equations.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1817,13 +1817,13 @@ subroutine constraint_eqn_041(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units)
!! residual error in physical units; output string; units string
!! Equation for plasma current ramp-up time lower limit
!! #=# times
!! #=#=# ft_current_ramp_up, tohsmn
!! #=#=# ft_current_ramp_up, t_current_ramp_up_min
!! and hence also optional here.
!! Logic change during pre-factoring: err, symbol, units will be assigned only if present.
!! ft_current_ramp_up : input real : f-value for plasma current ramp-up time
!! t_current_ramp_up : input real : plasma current ramp-up time for current initiation (s)
!! tohsmn : input real : minimum plasma current ramp-up time (s)
use constraint_variables, only: ft_current_ramp_up, tohsmn
!! t_current_ramp_up_min : input real : minimum plasma current ramp-up time (s)
use constraint_variables, only: ft_current_ramp_up, t_current_ramp_up_min
use times_variables, only: t_current_ramp_up
implicit none
real(dp), intent(out) :: tmp_cc
Expand All @@ -1832,9 +1832,9 @@ subroutine constraint_eqn_041(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units)
character(len=1), intent(out) :: tmp_symbol
character(len=10), intent(out) :: tmp_units

tmp_cc = 1.0D0 - ft_current_ramp_up * t_current_ramp_up/tohsmn
tmp_con = tohsmn * (1.0D0 - tmp_cc)
tmp_err = tohsmn * tmp_cc
tmp_cc = 1.0D0 - ft_current_ramp_up * t_current_ramp_up/t_current_ramp_up_min
tmp_con = t_current_ramp_up_min * (1.0D0 - tmp_cc)
tmp_err = t_current_ramp_up_min * tmp_cc
tmp_symbol = '>'
tmp_units = 'sec'

Expand Down
4 changes: 2 additions & 2 deletions source/fortran/constraint_variables.f90
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ module constraint_variables
real(dp) :: tcycmn
!! minimum cycle time (s) (`constraint equation 42`)

real(dp) :: tohsmn
real(dp) :: t_current_ramp_up_min
!! minimum plasma current ramp-up time (s) (`constraint equation 41`)

real(dp) :: vvhealw
Expand Down Expand Up @@ -387,7 +387,7 @@ subroutine init_constraint_variables
tbrmin = 1.1D0
t_burn_min = 1.0D0
tcycmn = 0.0D0
tohsmn = 1.0D0
t_current_ramp_up_min = 1.0D0
vvhealw = 1.0D0
walalw = 1.0D0
taulimit = 5.0D0
Expand Down
4 changes: 2 additions & 2 deletions source/fortran/times_variables.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module times_variables
real(dp) :: t_burn
!! flat-top duration (s) (calculated if `lpulse=1`)

real(dp) :: tburn0
real(dp) :: t_burn_0
!! burn time (s) - used for internal consistency

real(dp) :: tcycle
Expand Down Expand Up @@ -75,7 +75,7 @@ subroutine init_times_variables

pulsetimings = 1.0D0
t_burn = 1000.0D0
tburn0 = 0.0D0
t_burn_0 = 0.0D0
tcycle = 0.0D0
tdown = 0.0D0
t_between_pulse = 1800.0D0
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/ref_dicts.json
Original file line number Diff line number Diff line change
Expand Up @@ -7492,7 +7492,7 @@
"tbrmin": 1.1,
"t_burn_min": 1.0,
"t_burn": 1000.0,
"tburn0": 0.0,
"t_burn_0": 0.0,
"tcomrepl": 0.5,
"tconl": 0.0,
"tcoolin": 313.15,
Expand Down Expand Up @@ -7621,7 +7621,7 @@
"tn": 300.0,
"t_current_ramp_up": 30.0,
"tohsin": 0.0,
"tohsmn": 1.0,
"t_current_ramp_up_min": 1.0,
"tok_build_cost_per_vol": 1283.0,
"tol": null,
"toolow": ".false.",
Expand Down Expand Up @@ -10750,7 +10750,7 @@
"tbrmin": "minimum tritium breeding ratio (`constraint equation 52`)",
"t_burn_min": "minimum burn time (s) (KE - no longer itv., see issue #706)",
"t_burn": "burn time (s) (calculated if `lpulse=1`)",
"tburn0": "burn time (s) - used for internal consistency",
"t_burn_0": "burn time (s) - used for internal consistency",
"tcomrepl": "time taken to replace both blanket and divertor (y) (`iavail=1`)",
"tconl": "main plasma connection length (m)",
"tcoolin": "centrepost coolant inlet temperature (K)",
Expand Down Expand Up @@ -10855,7 +10855,7 @@
"tn": "neutral gas temperature in chamber (K)",
"t_current_ramp_up": "plasma current ramp-up time for current initiation (s) (calculated if `lpulse=0`)\n (`iteration variable 65`)",
"tohsin": "Switch for plasma current ramp-up time (if lpulse=0):\n<ul>\n<li>= 0, t_current_ramp_up = t_precharge = t_ramp_down = Ip(MA)/0.5</li>\n<li><>0, t_current_ramp_up = tohsin; t_precharge, t_ramp_down are input</li>\n</ul>",
"tohsmn": "minimum plasma current ramp-up time (s) (`constraint equation 41`)",
"t_current_ramp_up_min": "minimum plasma current ramp-up time (s) (`constraint equation 41`)",
"tok_build_cost_per_vol": "Unit cost for tokamak complex buildings, including building and site services ($/m3)",
"tol": "",
"toolow": "Used for reporting error in function pimpden",
Expand Down Expand Up @@ -17467,7 +17467,7 @@
"tbrmin",
"t_burn_min",
"tcycmn",
"tohsmn",
"t_current_ramp_up_min",
"vvhealw",
"walalw",
"taulimit",
Expand Down Expand Up @@ -19738,7 +19738,7 @@
"times_variables": [
"pulsetimings",
"t_burn",
"tburn0",
"t_burn_0",
"tcycle",
"tdown",
"t_between_pulse",
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/input_files/st_regression.IN.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -3257,7 +3257,7 @@ t_between_pulse = 100.0
* JUSTIFICATION: Turned off, do not care about plasma current ramp up time
* VARIABLES: t_current_ramp_up (s) calculated in-situ

*tohsmn =
*t_current_ramp_up_min =
* DESCRIPTION: Minimum plasma current ramp-up time (s)
* JUSTIFICATION: Turned off, not using icc = 41

Expand Down
14 changes: 9 additions & 5 deletions tests/unit/test_pulse.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def pulse():

class TohswgParam(NamedTuple):

tohsmn: Any = None
t_current_ramp_up_min: Any = None

vpfskv: Any = None

Expand Down Expand Up @@ -104,7 +104,7 @@ class BurnParam(NamedTuple):
"tohswgparam",
(
TohswgParam(
tohsmn=0,
t_current_ramp_up_min=0,
vpfskv=0,
ncirt=8,
ipfres=0,
Expand Down Expand Up @@ -661,7 +661,7 @@ class BurnParam(NamedTuple):
expected_tohsmn=-526.67247746645455,
),
TohswgParam(
tohsmn=-526.67247746645455,
t_current_ramp_up_min=-526.67247746645455,
vpfskv=20,
ncirt=8,
ipfres=0,
Expand Down Expand Up @@ -1232,7 +1232,9 @@ def test_tohswg(tohswgparam, monkeypatch, pulse):
:type monkeypatch: _pytest.monkeypatch.monkeypatch
"""

monkeypatch.setattr(constraint_variables, "tohsmn", tohswgparam.tohsmn)
monkeypatch.setattr(
constraint_variables, "t_current_ramp_up_min", tohswgparam.t_current_ramp_up_min
)

monkeypatch.setattr(pf_power_variables, "vpfskv", tohswgparam.vpfskv)

Expand Down Expand Up @@ -1264,7 +1266,9 @@ def test_tohswg(tohswgparam, monkeypatch, pulse):

pulse.tohswg(output=False)

assert constraint_variables.tohsmn == pytest.approx(tohswgparam.expected_tohsmn)
assert constraint_variables.t_current_ramp_up_min == pytest.approx(
tohswgparam.expected_tohsmn
)


@pytest.mark.parametrize(
Expand Down

0 comments on commit eac36be

Please sign in to comment.