diff --git a/tests/simulator/advance/test_fields_advance_2d.py b/tests/simulator/advance/test_fields_advance_2d.py index 0a5540897..3879c39eb 100644 --- a/tests/simulator/advance/test_fields_advance_2d.py +++ b/tests/simulator/advance/test_fields_advance_2d.py @@ -98,7 +98,7 @@ def test_field_coarsening_via_subcycles(self, interp_order, refinement_boxes): ndim, interp_order, refinement_boxes, dl=0.3 ) - @unittest.skip("should change with moments") + @unittest.skip("should change to work with moments") @data( # only supports a hierarchy with 2 levels *per_interp(({"L0": [Box2D(0, 4)]})), *per_interp(({"L0": [Box2D(10, 14)]})), diff --git a/tests/simulator/refinement/test_2d_10_core.py b/tests/simulator/refinement/test_2d_10_core.py index dfb88703a..031c8cfba 100644 --- a/tests/simulator/refinement/test_2d_10_core.py +++ b/tests/simulator/refinement/test_2d_10_core.py @@ -167,11 +167,13 @@ def post_advance(new_time): L0L1_datahier = check_hier(get_hier(L0L1_diags)) extra_collections = [] errors = test.base_test_overlaped_fields_are_equal(L0L1_datahier, new_time) - errors = ( - test.base_test_field_level_ghosts_via_subcycles_and_coarser_interpolation( - L0_datahier, L0L1_datahier - ) - ) + + # The test commented out, see warning in test_advance.py + # errors = ( + # test.base_test_field_level_ghosts_via_subcycles_and_coarser_interpolation( + # L0_datahier, L0L1_datahier + # ) + # ) print(f"errors {type(errors)}") if isinstance(errors, list): extra_collections += [ diff --git a/tests/simulator/refinement/test_2d_2_core.py b/tests/simulator/refinement/test_2d_2_core.py index af017f60c..6a33830ca 100644 --- a/tests/simulator/refinement/test_2d_2_core.py +++ b/tests/simulator/refinement/test_2d_2_core.py @@ -165,6 +165,7 @@ def post_advance_1(new_time): L0L1_datahier = get_hier(L0L1_diags) extra_collections = [] errors = test.base_test_overlaped_fields_are_equal(L0L1_datahier, new_time) + # The test commented out, see warning in test_advance.py # errors = test.base_test_field_level_ghosts_via_subcycles_and_coarser_interpolation(L0_datahier, L0L1_datahier) if isinstance(errors, list): extra_collections += [ diff --git a/tests/simulator/test_advance.py b/tests/simulator/test_advance.py index 569f2c873..e38597fd1 100644 --- a/tests/simulator/test_advance.py +++ b/tests/simulator/test_advance.py @@ -540,6 +540,10 @@ def _test_field_coarsening_via_subcycles( def base_test_field_level_ghosts_via_subcycles_and_coarser_interpolation( self, L0_datahier, L0L1_datahier, quantities=None ): + """ + extracted from _test_field_level_ghosts_via_subcycles_and_coarser_interpolation + because also used in test_2d_2_core.py and test_2d_10_core.py + """ if quantities is None: quantities = [f"{EM}{xyz}" for EM in ["E", "B"] for xyz in ["x", "y", "z"]] @@ -590,6 +594,7 @@ def assert_time_in_hier(*ts): L0L1_datahier, quantities, fine_ilvl, fine_subcycle_time ) for qty in quantities: + print("ZOB", qty) for fine_level_ghost_box_data in fine_level_qty_ghost_boxes[qty]: fine_subcycle_pd = fine_level_ghost_box_data["pdata"] @@ -688,14 +693,34 @@ def _test_field_level_ghosts_via_subcycles_and_coarser_interpolation( self, ndim, interp_order, refinement_boxes ): """ + This test intends to check that level ghost field values during substeps + are indeed the result of the space and time interpolation of the coarser level values. + + This requires: + - to dump diagnostics at substeps + - refine spatially and temporally L0 values and compare them to L1 level ghost values + + The time interpolation needs both t and t+dt coarse values. + However, L0 values at t+dt are not available in diags since they are written after + L0 receives coarser values from L1, while the L0 values at t+dt used in the simulation + to do the time interpolation are the one **before** the coarsening correction. + + To achieve the test, we thus also run a L0-only simulation witht the same exact initial + setup, and use the t0 and t0+dt diagnostics of the L0-only run to perform the + space and time interpolation values to compare to L1 level ghosts of the former simulation. + This test runs two virtually identical simulations for one step. L0_datahier has no refined levels L0L1_datahier has one refined level - This is done to compare L0 values that haven't received the coarsened values of L1 because there is no L1, - to the level field ghost of L1 of L0L1_datahier - The simulations are no longer comparable after the first advance, so this test cannot work beyond that. + + + WARNING: this test is now skipped in nD test field advance because it is + as it is now, working on E and B, which, since the divB correction, are not + time refined anymore. Only n, Vi and J are time refined and the test should + thus be changed accordingly. + """ print( "test_field_coarsening_via_subcycles for dim/interp : {}/{}".format( @@ -712,7 +737,7 @@ def _getHier(diag_dir, boxes=[]): ndim, interp_order, boxes, - "moments", + "moments", # only N, Vi and J are space/time interpolated, only test moments cells=30, time_step_nbr=1, largest_patch_size=15,