Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 11 additions & 31 deletions process/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
numerics,
stellarator_variables,
process_output as po,
profiles_module,
)


Expand Down Expand Up @@ -987,7 +986,8 @@ def physics(self):
current_drive_variables.pscf_scene = ps_fraction_scene(physics_variables.beta)

current_drive_variables.bscf_sauter = (
current_drive_variables.cboot * self.bootstrap_fraction_sauter()
current_drive_variables.cboot
* self.bootstrap_fraction_sauter(self.plasma_profile)
)

current_drive_variables.bscf_sakai = (
Expand Down Expand Up @@ -4553,7 +4553,7 @@ def bootstrap_fraction_nevins(
return 1.0e6 * aibs / plascur

@staticmethod
def bootstrap_fraction_sauter():
def bootstrap_fraction_sauter(plasma_profile):
"""Bootstrap current fraction from Sauter et al scaling
author: P J Knight, CCFE, Culham Science Centre
None
Expand All @@ -4566,38 +4566,20 @@ def bootstrap_fraction_sauter():
O. Sauter, C. Angioni and Y. R. Lin-Liu, (ERRATA)
Physics of Plasmas <B>9</B> (2002) 5140
"""
NR = 200

roa = np.arange(1, NR + 1, step=1) / NR
NR = plasma_profile.profile_size

roa = plasma_profile.neprofile.profile_x
rho = np.sqrt(physics_variables.xarea / np.pi) * roa

sqeps = np.sqrt(roa * (physics_variables.rminor / physics_variables.rmajor))

ne = 1e-19 * np.vectorize(
lambda r: profiles_module.nprofile(
r,
physics_variables.rhopedn,
physics_variables.ne0,
physics_variables.neped,
physics_variables.nesep,
physics_variables.alphan,
)
)(roa)
ne = plasma_profile.neprofile.profile_y * 1e-19
ni = (physics_variables.dnitot / physics_variables.dene) * ne
tempe = np.vectorize(
lambda r: profiles_module.tprofile(
r,
physics_variables.rhopedt,
physics_variables.te0,
physics_variables.teped,
physics_variables.tesep,
physics_variables.alphat,
physics_variables.tbeta,
)
)(roa)
tempi = (physics_variables.ti / physics_variables.te) * tempe

zef = np.full_like(tempi, physics_variables.zeff) # Flat Zeff profile assumed
tempe = plasma_profile.teprofile.profile_y
tempi = (physics_variables.ti / physics_variables.te) * tempe
# Flat Zeff profile assumed
zef = np.full_like(tempi, physics_variables.zeff)

# mu = 1/safety factor
# Parabolic q profile assumed
Expand All @@ -4620,13 +4602,11 @@ def bootstrap_fraction_sauter():
# Looping from 2 because dcsa etc should return 0 @ j == 1
nr_rng = np.arange(2, NR)
nr_rng_1 = nr_rng - 1

drho = rho[nr_rng] - rho[nr_rng_1]
da = 2 * np.pi * rho[nr_rng_1] * drho # area of annulus
dlogte_drho = (np.log(tempe[nr_rng]) - np.log(tempe[nr_rng_1])) / drho
dlogti_drho = (np.log(tempi[nr_rng]) - np.log(tempi[nr_rng_1])) / drho
dlogne_drho = (np.log(ne[nr_rng]) - np.log(ne[nr_rng_1])) / drho

jboot = (
0.5
* (
Expand Down
32 changes: 16 additions & 16 deletions tests/unit/test_physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,33 +350,33 @@ class BootstrapFractionSauterParam(NamedTuple):
"bootstrapfractionsauterparam",
(
BootstrapFractionSauterParam(
dnitot=6.6125550702454276e19,
dnitot=7.1297522422781575e19,
rminor=2.6666666666666665,
tesep=0.10000000000000001,
ti=12,
ti=12.570861186498382,
triang=0.5,
q0=1,
afuel=2.5,
zeff=2.0909945616489103,
rhopedn=0.94000000000000006,
bt=5.7000000000000002,
plascur=18398455.678867526,
zeff=2.5211399464385624,
rhopedn=0.9400000000000001,
bt=5.326133750416047,
plascur=16528278.760008096,
xarea=38.39822223637151,
fhe3=0,
teped=5.5,
dene=7.5e19,
te=12,
dene=8.016748468651018e19,
te=12.570861186498382,
rmajor=8,
q=3.5,
nesep=4.1177885154594193e19,
te0=24.402321098330372,
neped=7.000240476281013e19,
nesep=3.6992211545476006e19,
te0=25.986118047669795,
neped=6.2886759627309195e19,
tbeta=2,
ne0=8.515060981068918e19,
ne0=1.054474759840606e20,
alphan=1,
rhopedt=0.94000000000000006,
rhopedt=0.9400000000000001,
alphat=1.45,
expected_bfs=0.27635918746616817,
expected_bfs=0.4110838247346975,
),
),
)
Expand Down Expand Up @@ -462,8 +462,8 @@ def test_bootstrap_fraction_sauter(bootstrapfractionsauterparam, monkeypatch, ph
monkeypatch.setattr(
physics_variables, "alphat", bootstrapfractionsauterparam.alphat
)

bfs = physics.bootstrap_fraction_sauter()
physics.plasma_profile.run()
bfs = physics.bootstrap_fraction_sauter(physics.plasma_profile)

assert bfs == pytest.approx(bootstrapfractionsauterparam.expected_bfs)

Expand Down