Skip to content

Commit 0da2ed6

Browse files
jcitrinTorax team
authored andcommitted
Add varying Vloop boundary condition test. Increases coverage.
PiperOrigin-RevId: 739222295
1 parent 41c11e5 commit 0da2ed6

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

torax/core_profiles/updaters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def compute_boundary_conditions_for_t_plus_dt(
416416
dt=dt,
417417
vloop_lcfs_t=dynamic_runtime_params_slice_t.profile_conditions.vloop_lcfs,
418418
vloop_lcfs_t_plus_dt=profile_conditions_t_plus_dt.vloop_lcfs,
419-
psi_lcfs_t=core_profiles_t.psi.face_value()[-1],
419+
psi_lcfs_t=core_profiles_t.psi.right_face_constraint,
420420
theta=static_runtime_params_slice.stepper.theta_imp,
421421
)
422422
if profile_conditions_t_plus_dt.use_vloop_lcfs_boundary_condition

torax/tests/sim_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,10 @@ class SimTest(sim_test_case.SimTestCase):
438438
0,
439439
),
440440
# Tests current diffusion with vloop BC.
441-
# Initial Ip from parameters and psi from CHEASE.
441+
# Initial Ip from parameters and psi from CHEASE, varying vloop BC.
442442
(
443-
'test_psichease_ip_parameters_vloop',
444-
'test_psichease_ip_parameters_vloop.py',
443+
'test_psichease_ip_parameters_vloop_varying',
444+
'test_psichease_ip_parameters_vloop_varying.py',
445445
_ALL_PROFILES,
446446
0,
447447
),

torax/tests/test_data/test_psichease_ip_parameters_vloop.nc renamed to torax/tests/test_data/test_psichease_ip_parameters_vloop_varying.nc

1.61 MB
Binary file not shown.

torax/tests/test_data/test_psichease_ip_parameters_vloop.py renamed to torax/tests/test_data/test_psichease_ip_parameters_vloop_varying.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
"""Identical to test_psichease_ip_chease but V-loop boundary condition."""
15+
"""Identical to test_psichease_ip_chease_vloop but with varying vloop_lcfs."""
1616

1717
import copy
18+
import numpy as np
1819
from torax.tests.test_data import test_psichease_ip_parameters
1920

2021

2122
CONFIG = copy.deepcopy(test_psichease_ip_parameters.CONFIG)
23+
times = np.linspace(0, 3, 100)
24+
# 1 Hz frequency
25+
vloop = 8.7 + 10 * np.sin(2 * np.pi * times)
26+
2227
CONFIG['runtime_params']['profile_conditions'][
2328
'use_vloop_lcfs_boundary_condition'
2429
] = True
25-
CONFIG['runtime_params']['profile_conditions']['vloop_lcfs'] = 8.7
30+
CONFIG['runtime_params']['profile_conditions']['vloop_lcfs'] = (times, vloop)

0 commit comments

Comments
 (0)