Skip to content

Commit efa523c

Browse files
authored
Merge pull request #1014 from ProjectTorreyPines/BgB_pinch
Update analytic_turbulence_actor.jl
2 parents 640527a + ec5b7c6 commit efa523c

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

src/actors/transport/analytic_turbulence_actor.jl

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ end
2727
Evaluates analytic turbulent transport models including GyroBohm and Bohm+gyro-Bohm (BgB) models.
2828
2929
The actor supports two transport models:
30-
- `:GyroBohm`: Simple gyro-Bohm scaling returning unit fluxes
31-
- `:BgB`: Detailed Bohm + gyro-Bohm model calculating electron and ion energy diffusivities (χe, χi)
32-
and particle flux (Γe) based on local plasma parameters, pressure gradients, and magnetic geometry
30+
31+
- `:GyroBohm`: Simple gyro-Bohm scaling returning unit fluxes
32+
- `:BgB`: Detailed Bohm + gyro-Bohm model calculating electron and ion energy diffusivities (χe, χi)
33+
and particle flux (Γe) based on local plasma parameters, pressure gradients, and magnetic geometry
34+
Tholerus, Emmi, et al. Nuclear Fusion 64.10 (2024): 106030
3335
3436
The BgB model computes transport coefficients using local temperature and density gradients,
35-
safety factor profiles, and magnetic field geometry. Results are normalized to gyro-Bohm
37+
safety factor profiles, and magnetic field geometry. Results are normalized to gyro-Bohm
3638
and stored in `dd.core_transport` as anomalous transport fluxes.
3739
"""
3840
function ActorAnalyticTurbulence(dd::IMAS.dd, act::ParametersAllActors; kw...)
@@ -54,11 +56,12 @@ end
5456
Runs the selected analytic turbulent transport model on specified radial grid points.
5557
5658
For the BgB model, calculates:
57-
- χeB, χeGB: Bohm and gyro-Bohm electron heat diffusivities
58-
- χiB, χiGB: Bohm and gyro-Bohm ion heat diffusivities
59-
- Γe: Electron particle flux based on density gradients
6059
61-
All transport coefficients are scaled by user-specified coefficients and stored as
60+
- χeB, χeGB: Bohm and gyro-Bohm electron heat diffusivities
61+
- χiB, χiGB: Bohm and gyro-Bohm ion heat diffusivities
62+
- Γe: Electron particle flux based on density gradients
63+
64+
All transport coefficients are scaled by user-specified coefficients and stored as
6265
FluxSolution objects normalized to gyro-Bohm units.
6366
"""
6467
function _step(actor::ActorAnalyticTurbulence{D,P}) where {D<:Real,P<:Real}
@@ -84,7 +87,10 @@ function _step(actor::ActorAnalyticTurbulence{D,P}) where {D<:Real,P<:Real}
8487

8588
bax = eqt.global_quantities.magnetic_axis.b_field_tor
8689
q_profile = IMAS.interp1d(rho_eq, eqt1d.q).(rho_cp)
90+
volume = IMAS.interp1d(rho_eq, eqt1d.volume).(rho_cp)
91+
dvoldrho = IMAS.interp1d(rho_eq, eqt1d.dvolume_drho_tor).(rho_cp)*eqt1d.rho_tor[end]
8792
vprime_miller = IMAS.interp1d(rho_eq, GACODE.volume_prime_miller_correction(eqt)).(rho_cp)
93+
surf = IMAS.interp1d(rho_eq, eqt1d.surface).(rho_cp)
8894

8995
rmin = GACODE.r_min_core_profiles(eqt1d, rho_cp)
9096
Te = cp1d.electrons.temperature
@@ -107,9 +113,13 @@ function _step(actor::ActorAnalyticTurbulence{D,P}) where {D<:Real,P<:Real}
107113
χiB = 2.0 * χeB
108114
χiGB = 0.5 * χeGB
109115

110-
χe = @. actor.par.αBgB * (actor.par.χeB_coefficient * χeB + actor.par.χeGB_coefficient * χeGB)
116+
χe = @. actor.par.αBgB * (actor.par.χeB_coefficient * χeB + actor.par.χeGB_coefficient * χeGB)
111117
χi = @. actor.par.αBgB * (actor.par.χiB_coefficient * χiB + actor.par.χiGB_coefficient * χiGB)
112-
Γe = @. (A1 + (A2 - A1) * rho_cp) * χe * χi / (χe + χi) * dlnnedr * ne
118+
119+
Dp = @. (A1 + (A2 - A1) * rho_cp) * χe * χi / (χe + χi)
120+
vin = @. 0.5 * Dp * (surf ^ 2 / volume) / dvoldrho
121+
vin[1] = 0.0
122+
Γe = @. (Dp * dlnnedr - vin) * ne
113123

114124
gridpoint_cp = [argmin_abs(cp1d.grid.rho_tor_norm, ρ) for ρ in par.rho_transport]
115125

src/optimization.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function optimization_engine(
8989
# save empty dd and error to directory
9090
save(savedir, nothing, ini, act; error=e, timer=true, freeze=false, overwrite_files=true)
9191

92-
# rethrow(e) # uncomment for debugging purposes
92+
#rethrow(e) # uncomment for debugging purposes
9393

9494
ff = Float64[Inf for f in objective_functions]
9595
gg = Float64[Inf for g in constraint_functions]
@@ -265,7 +265,7 @@ function optimization_engine(
265265
CSV.write(csv_filepath, df)
266266
end
267267

268-
# rethrow(e) # uncomment for debugging purposes
268+
#rethrow(e) # uncomment for debugging purposes
269269

270270
ff = Float64[Inf for f in objective_functions]
271271
gg = Float64[Inf for g in constraint_functions]

0 commit comments

Comments
 (0)