Skip to content

Commit 05976db

Browse files
tamaranormanTorax team
authored andcommitted
Update compilation_benchmark and delete default_config.py
PiperOrigin-RevId: 954709550
1 parent da242b3 commit 05976db

29 files changed

Lines changed: 236 additions & 186 deletions

torax/_src/fvm/tests/calc_coeffs_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ def test_calc_coeffs_smoke_test(
5656
solver=dict(
5757
use_predictor_corrector=False, theta_implicit=theta_implicit
5858
),
59-
transport=dict(model_name='constant', chi_min=0, chi_i=1),
59+
transport=dict(
60+
model_name='combined',
61+
transport_models=[dict(model_name='constant', chi_i=1)],
62+
chi_min=0,
63+
),
6064
time_step_calculator=dict(),
6165
)
6266
)

torax/_src/fvm/tests/fvm_test.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ def test_nonlinear_solve_block_loss_minimum(
225225
solver=dict(
226226
use_predictor_corrector=False, theta_implicit=theta_implicit
227227
),
228-
transport=dict(model_name='constant', chi_min=0, chi_i=1),
228+
transport=dict(
229+
model_name='combined',
230+
transport_models=[dict(model_name='constant', chi_i=1)],
231+
chi_min=0,
232+
),
229233
time_step_calculator=dict(),
230234
)
231235
)
@@ -333,7 +337,11 @@ def test_implicit_solve_block_uses_updated_boundary_conditions(self):
333337
pedestal=dict(),
334338
sources=source_config,
335339
solver=dict(use_predictor_corrector=False, theta_implicit=1.0),
336-
transport=dict(model_name='constant', chi_min=0, chi_i=1),
340+
transport=dict(
341+
model_name='combined',
342+
transport_models=[dict(model_name='constant', chi_i=1)],
343+
chi_min=0,
344+
),
337345
time_step_calculator=dict(),
338346
)
339347
)
@@ -444,7 +452,11 @@ def test_theta_residual_uses_updated_boundary_conditions(self):
444452
pedestal=dict(),
445453
sources=source_config,
446454
solver=dict(use_predictor_corrector=False, theta_implicit=0.0),
447-
transport=dict(model_name='constant', chi_min=0, chi_i=1),
455+
transport=dict(
456+
model_name='combined',
457+
transport_models=[dict(model_name='constant', chi_i=1)],
458+
chi_min=0,
459+
),
448460
time_step_calculator=dict(),
449461
)
450462
)

torax/examples/basic_config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141
},
4242
'pedestal': {},
4343
'transport': {
44-
'model_name': 'constant',
44+
'model_name': 'combined',
45+
'transport_models': [
46+
{'model_name': 'constant'},
47+
],
4548
},
4649
'solver': {
4750
'solver_type': 'linear',

torax/examples/iterhybrid_predictor_corrector.py

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -134,37 +134,47 @@
134134
'rho_norm_ped_top': 0.9, # set ped top location in normalized radius
135135
},
136136
'transport': {
137-
'model_name': 'qlknn',
138-
# set inner core transport coefficients (ad-hoc MHD/EM transport)
139-
'apply_inner_patch': True,
140-
'D_e_inner': 0.25,
141-
'V_e_inner': 0.0,
142-
'chi_i_inner': 1.0,
143-
'chi_e_inner': 1.0,
144-
'rho_inner': 0.2, # radius below which patch transport is applied
145-
# set outer core transport coefficients (L-mode near edge region)
146-
'apply_outer_patch': True,
147-
'D_e_outer': 0.1,
148-
'V_e_outer': 0.0,
149-
'chi_i_outer': 2.0,
150-
'chi_e_outer': 2.0,
151-
'rho_outer': 0.9, # radius above which patch transport is applied
152-
# allowed chi and diffusivity bounds
153-
'chi_min': 0.05, # minimum chi
154-
'chi_max': 100, # maximum chi (can be helpful for stability)
155-
'D_e_min': 0.05, # minimum electron diffusivity
156-
# qlknn params.
157-
'DV_effective': True,
158-
'include_ITG': True, # to toggle ITG modes on or off
159-
'include_TEM': True, # to toggle TEM modes on or off
160-
'include_ETG': True, # to toggle ETG modes on or off
161-
# ensure that smag - fusion > -0.2 always, to compensate for no slab
162-
# modes
163-
'avoid_big_negative_s': True,
164-
# minimum |R/Lne| below which effective V is used instead of
165-
# effective D
166-
'An_min': 0.05,
167-
'ITG_flux_ratio_correction': 1,
137+
'model_name': 'combined',
138+
'transport_models': [
139+
{
140+
'model_name': 'constant',
141+
'rho_max': 0.2,
142+
'chi_i': 1.0,
143+
'chi_e': 1.0,
144+
'D_e': 0.25,
145+
'V_e': 0.0,
146+
},
147+
{
148+
'model_name': 'qlknn',
149+
'rho_min': 0.2,
150+
'rho_max': 0.9,
151+
'DV_effective': True,
152+
'include_ITG': True,
153+
'include_TEM': True,
154+
'include_ETG': True,
155+
'avoid_big_negative_s': True,
156+
'An_min': 0.05,
157+
'ITG_flux_ratio_correction': 1,
158+
},
159+
{
160+
'model_name': 'constant',
161+
'rho_min': 0.9,
162+
'chi_i': 2.0,
163+
'chi_e': 2.0,
164+
'D_e': 0.1,
165+
'V_e': 0.0,
166+
},
167+
],
168+
'chi_min': 0.05,
169+
'chi_max': 100,
170+
'D_e_min': 0.05,
171+
'smoothing_zones': [
172+
{
173+
'rho_min': 0.2,
174+
'rho_max': 0.9,
175+
'smoothing_width': 0.1,
176+
},
177+
],
168178
},
169179
'solver': {
170180
'solver_type': 'linear',

torax/examples/iterhybrid_rampup.py

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -141,41 +141,50 @@
141141
'rho_norm_ped_top': 0.9, # set ped top location in normalized radius
142142
},
143143
'transport': {
144-
'model_name': 'qlknn',
145-
# set inner core transport coefficients (ad-hoc MHD/EM transport)
146-
'apply_inner_patch': True,
147-
'D_e_inner': 0.25,
148-
'V_e_inner': 0.0,
149-
'chi_i_inner': 1.5,
150-
'chi_e_inner': 1.5,
151-
'rho_inner': 0.3, # radius below which patch transport is applied
152-
# set outer core transport coefficients (L-mode near edge region)
153-
'apply_outer_patch': True,
154-
'D_e_outer': 0.1,
155-
'V_e_outer': 0.0,
156-
'chi_i_outer': 2.0,
157-
'chi_e_outer': 2.0,
158-
'rho_outer': 0.9, # radius above which patch transport is applied
159-
# allowed chi and diffusivity bounds
160-
'chi_min': 0.05, # minimum chi
161-
'chi_max': 100, # maximum chi (can be helpful for stability)
162-
'D_e_min': 0.05, # minimum electron diffusivity
163-
'D_e_max': 50, # maximum electron diffusivity
164-
'V_e_min': -10, # minimum electron convection
165-
'V_e_max': 10, # minimum electron convection
166-
'smoothing_width': 0.1,
167-
# qlknn params.
168-
'DV_effective': True,
169-
'include_ITG': True, # to toggle ITG modes on or off
170-
'include_TEM': True, # to toggle TEM modes on or off
171-
'include_ETG': True, # to toggle ETG modes on or off
172-
# ensure that smag - alpha > -0.2 always, to compensate for no slab
173-
# modes
174-
'avoid_big_negative_s': True,
175-
# minimum |R/Lne| below which effective V is used instead of
176-
# effective D
177-
'An_min': 0.05,
178-
'ITG_flux_ratio_correction': 1,
144+
'model_name': 'combined',
145+
'transport_models': [
146+
{
147+
'model_name': 'constant',
148+
'rho_max': 0.3,
149+
'chi_i': 1.5,
150+
'chi_e': 1.5,
151+
'D_e': 0.25,
152+
'V_e': 0.0,
153+
},
154+
{
155+
'model_name': 'qlknn',
156+
'rho_min': 0.3,
157+
'rho_max': 0.9,
158+
'DV_effective': True,
159+
'include_ITG': True,
160+
'include_TEM': True,
161+
'include_ETG': True,
162+
'avoid_big_negative_s': True,
163+
'An_min': 0.05,
164+
'ITG_flux_ratio_correction': 1,
165+
},
166+
{
167+
'model_name': 'constant',
168+
'rho_min': 0.9,
169+
'chi_i': 2.0,
170+
'chi_e': 2.0,
171+
'D_e': 0.1,
172+
'V_e': 0.0,
173+
},
174+
],
175+
'chi_min': 0.05,
176+
'chi_max': 100,
177+
'D_e_min': 0.05,
178+
'D_e_max': 50,
179+
'V_e_min': -10,
180+
'V_e_max': 10,
181+
'smoothing_zones': [
182+
{
183+
'rho_min': 0.3,
184+
'rho_max': 0.9,
185+
'smoothing_width': 0.1,
186+
},
187+
],
179188
},
180189
'solver': {
181190
'solver_type': 'newton_raphson',

torax/examples/step_flattop_bgb.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,24 @@
133133
},
134134
},
135135
"transport": {
136-
"model_name": "bohm-gyrobohm",
137-
# BgB settings from [2] sec 3.3
138-
# Tuning factor to achieve desired confinement
139-
"chi_e_bohm_multiplier": bgb_multiplier,
140-
"chi_i_bohm_multiplier": bgb_multiplier,
141-
"chi_e_gyrobohm_multiplier": bgb_multiplier,
142-
"chi_i_gyrobohm_multiplier": bgb_multiplier,
143-
# Base coefficients
144-
"chi_e_bohm_coeff": 0.01 * 2e-4,
145-
"chi_e_gyrobohm_coeff": 50 * 5e-6,
146-
"chi_i_bohm_coeff": 0.001 * 2e-4,
147-
"chi_i_gyrobohm_coeff": 1.0 * 5e-6,
148-
"D_face_c1": 1,
149-
"D_face_c2": 0.3,
150-
"V_face_coeff": -0.1,
136+
"model_name": "combined",
137+
"transport_models": [{
138+
"model_name": "bohm-gyrobohm",
139+
# BgB settings from [2] sec 3.3
140+
# Tuning factor to achieve desired confinement
141+
"chi_e_bohm_multiplier": bgb_multiplier,
142+
"chi_i_bohm_multiplier": bgb_multiplier,
143+
"chi_e_gyrobohm_multiplier": bgb_multiplier,
144+
"chi_i_gyrobohm_multiplier": bgb_multiplier,
145+
# Base coefficients
146+
"chi_e_bohm_coeff": 0.01 * 2e-4,
147+
"chi_e_gyrobohm_coeff": 50 * 5e-6,
148+
"chi_i_bohm_coeff": 0.001 * 2e-4,
149+
"chi_i_gyrobohm_coeff": 1.0 * 5e-6,
150+
"D_face_c1": 1,
151+
"D_face_c2": 0.3,
152+
"V_face_coeff": -0.1,
153+
}],
151154
# Clipping
152155
"chi_min": 0.15,
153156
"chi_max": 100.0,
@@ -156,7 +159,6 @@
156159
"V_e_min": -50.0,
157160
"V_e_max": 50.0,
158161
# Smoothing
159-
"smooth_everywhere": True,
160162
"smoothing_width": 0.05,
161163
},
162164
"neoclassical": {

torax/tests/test_data/compilation_benchmark.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@
6565
'n_e_ped': 1e20,
6666
},
6767
'transport': {
68-
'model_name': 'qlknn',
69-
'qlknn_params': {
68+
'model_name': 'combined',
69+
'transport_models': [{
70+
'model_name': 'qlknn',
7071
'DV_effective': False,
71-
},
72+
}],
73+
'smoothing_width': 0.1,
7274
},
7375
'solver': {
7476
'solver_type': 'newton_raphson',

torax/tests/test_data/default_config.py

Lines changed: 0 additions & 53 deletions
This file was deleted.

torax/tests/test_data/test_all_transport_fusion_qlknn.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@
7070
'n_e_ped': 1.0e20,
7171
},
7272
'transport': {
73-
'model_name': 'qlknn',
74-
'DV_effective': False,
73+
'model_name': 'combined',
74+
'transport_models': [{
75+
'model_name': 'qlknn',
76+
'DV_effective': False,
77+
}],
78+
'smoothing_width': 0.1,
7579
},
7680
'solver': {
7781
'solver_type': 'linear',

torax/tests/test_data/test_bohmgyrobohm_all.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@
7070
'n_e_ped_is_fGW': True,
7171
},
7272
'transport': {
73-
'model_name': 'bohm-gyrobohm',
73+
'model_name': 'combined',
74+
'transport_models': [{
75+
'model_name': 'bohm-gyrobohm',
76+
}],
7477
},
7578
'solver': {
7679
'solver_type': 'linear',

0 commit comments

Comments
 (0)