Skip to content

Commit 8b29202

Browse files
tamaranormanTorax team
authored andcommitted
Migrate SPARC configs to combined transport model.
PiperOrigin-RevId: 938598306
1 parent c4c92eb commit 8b29202

29 files changed

Lines changed: 189 additions & 87 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/step_flattop_bgb.py

Lines changed: 18 additions & 15 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,

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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141
'ohmic': {},
4242
},
4343
'transport': {
44-
'model_name': 'constant',
44+
'model_name': 'combined',
45+
'transport_models': [
46+
{'model_name': 'constant'},
47+
],
4548
},
4649
'pedestal': {},
4750
'solver': {

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',

torax/tests/test_data/test_bremsstrahlung_time_dependent_Zimp.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@
5959
'set_pedestal': True,
6060
},
6161
'transport': {
62-
'model_name': 'constant',
63-
'chi_i': 0.5,
64-
'chi_e': 0.5,
62+
'model_name': 'combined',
63+
'transport_models': [{
64+
'model_name': 'constant',
65+
'chi_i': 0.5,
66+
'chi_e': 0.5,
67+
}],
6568
},
6669
'solver': {
6770
'solver_type': 'linear',

torax/tests/test_data/test_chease.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@
6464
},
6565
'pedestal': {},
6666
'transport': {
67-
'model_name': 'constant',
67+
'model_name': 'combined',
68+
'transport_models': [{
69+
'model_name': 'constant',
70+
}],
6871
},
6972
'solver': {
7073
'solver_type': 'linear',

0 commit comments

Comments
 (0)