From 0aeaf0e523e72d3cecd11a9f4eebffe5eb88d301 Mon Sep 17 00:00:00 2001 From: Jonathan Schilling Date: Wed, 1 Apr 2026 11:39:25 +0200 Subject: [PATCH] solovev_free_bdy seems to work - snapshot --- .../external_magnetic_field_test.cc | 7 +- .../laplace_solver/laplace_solver_test.cc | 23 +++-- free_boundary/nestor/nestor_test.cc | 13 ++- .../singular_integrals_test.cc | 9 +- .../surface_geometry/surface_geometry_test.cc | 7 +- .../ideal_mhd_model_hot_restart_test.cc | 6 +- vmec/ideal_mhd_model/ideal_mhd_model_test.cc | 86 ++++++++++++------- vmec/vmec/vmec_test.cc | 5 +- .../vmec_hot_restart_test.cc | 8 +- 9 files changed, 111 insertions(+), 53 deletions(-) diff --git a/free_boundary/external_magnetic_field/external_magnetic_field_test.cc b/free_boundary/external_magnetic_field/external_magnetic_field_test.cc index b32b8d1..3af550e 100644 --- a/free_boundary/external_magnetic_field/external_magnetic_field_test.cc +++ b/free_boundary/external_magnetic_field/external_magnetic_field_test.cc @@ -32,6 +32,7 @@ struct DataSource { std::string identifier; double tolerance = 0.0; std::vector iter2_to_test = {1, 2}; + int target_ns = 0; }; class ExternalMagneticFieldTest : public TestWithParam { @@ -58,7 +59,7 @@ TEST_P(ExternalMagneticFieldTest, CheckExternalMagneticField) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_BEXTERN, number_of_iterations).value(); + vmec.run(VmecCheckpoint::VAC1_BEXTERN, number_of_iterations, data_source_.target_ns).value(); ASSERT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -155,6 +156,10 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev_free_bdy", .tolerance = 1.0e-10, .iter2_to_test = {3, 4}}, + DataSource{.identifier = "solovev_free_bdy", + .tolerance = 1.0e-12, + .iter2_to_test = {2, 3}, + .target_ns = 32}, DataSource{.identifier = "cth_like_free_bdy", .tolerance = 1.0e-10, .iter2_to_test = {53, 54}})); diff --git a/free_boundary/laplace_solver/laplace_solver_test.cc b/free_boundary/laplace_solver/laplace_solver_test.cc index d32edfb..37ec8a8 100644 --- a/free_boundary/laplace_solver/laplace_solver_test.cc +++ b/free_boundary/laplace_solver/laplace_solver_test.cc @@ -38,6 +38,7 @@ struct DataSource { std::string identifier; double tolerance = 0.0; std::vector iter2_to_test = {1, 2}; + int target_ns = 0; }; class FourPTest : public TestWithParam { @@ -64,7 +65,7 @@ TEST_P(FourPTest, CheckFourP) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_FOURP, number_of_iterations).value(); + vmec.run(VmecCheckpoint::VAC1_FOURP, number_of_iterations, data_source_.target_ns).value(); ASSERT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -183,7 +184,7 @@ TEST_P(FourISymmTest, CheckFourISymm) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_FOURI_SYMM, number_of_iterations).value(); + vmec.run(VmecCheckpoint::VAC1_FOURI_SYMM, number_of_iterations, data_source_.target_ns).value(); ASSERT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -264,7 +265,7 @@ TEST_P(FourIAccumulateGrpmnTest, CheckFourIAccumulateGrpmn) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_FOURI_KV_DFT, number_of_iterations) + vmec.run(VmecCheckpoint::VAC1_FOURI_KV_DFT, number_of_iterations, data_source_.target_ns) .value(); ASSERT_TRUE(reached_checkpoint); @@ -363,7 +364,7 @@ TEST_P(FourIKvDftTest, CheckFourIKvDft) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_FOURI_KV_DFT, number_of_iterations) + vmec.run(VmecCheckpoint::VAC1_FOURI_KV_DFT, number_of_iterations, data_source_.target_ns) .value(); ASSERT_TRUE(reached_checkpoint); @@ -515,7 +516,7 @@ TEST_P(FourIKuDftTest, CheckFourIKuDft) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_FOURI_KU_DFT, number_of_iterations) + vmec.run(VmecCheckpoint::VAC1_FOURI_KU_DFT, number_of_iterations, data_source_.target_ns) .value(); ASSERT_TRUE(reached_checkpoint); @@ -545,7 +546,7 @@ TEST_P(FourIKuDftTest, CheckFourIKuDft) { if (vmec.m_[0]->get_ivacskip() == 0) { for (int mn = 0; mn < mnpd; ++mn) { - bvec_sin[mn] += ls.bvec_sin[mn] + si.bvec_sin[mn] / s.nfp; + bvec_sin[mn] += ls.bvecSinShare[mn] + si.bvec_sin[mn] / s.nfp; } // mn } // fullUpdate } // thread_id @@ -631,7 +632,7 @@ TEST_P(SolverInputsTest, CheckSolverInputs) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_FOURI_KU_DFT, number_of_iterations) + vmec.run(VmecCheckpoint::VAC1_FOURI_KU_DFT, number_of_iterations, data_source_.target_ns) .value(); ASSERT_TRUE(reached_checkpoint); @@ -661,7 +662,7 @@ TEST_P(SolverInputsTest, CheckSolverInputs) { if (vmec.m_[0]->get_ivacskip() == 0) { for (int mn = 0; mn < mnpd; ++mn) { - bvec_sin[mn] += ls.bvec_sin[mn] + si.bvec_sin[mn] / s.nfp; + bvec_sin[mn] += ls.bvecSinShare[mn] + si.bvec_sin[mn] / s.nfp; } // mn } // fullUpdate } // thread_id @@ -735,7 +736,7 @@ TEST_P(LinearSolverTest, CheckLinearSolver) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_SOLVER, number_of_iterations).value(); + vmec.run(VmecCheckpoint::VAC1_SOLVER, number_of_iterations, data_source_.target_ns).value(); ASSERT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -768,6 +769,10 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev_free_bdy", .tolerance = 1.0e-9, .iter2_to_test = {3, 4}}, + DataSource{.identifier = "solovev_free_bdy", + .tolerance = 1.0e-12, + .iter2_to_test = {2, 3}, + .target_ns = 32}, DataSource{.identifier = "cth_like_free_bdy", .tolerance = 1.0e-9, .iter2_to_test = {53, 54}})); diff --git a/free_boundary/nestor/nestor_test.cc b/free_boundary/nestor/nestor_test.cc index 184d8f8..43e12a2 100644 --- a/free_boundary/nestor/nestor_test.cc +++ b/free_boundary/nestor/nestor_test.cc @@ -36,6 +36,7 @@ struct DataSource { std::string identifier; double tolerance = 0.0; std::vector iter2_to_test = {1, 2}; + int target_ns = 0; }; class InputsToNestorCallTest : public TestWithParam { @@ -64,7 +65,7 @@ TEST_P(InputsToNestorCallTest, CheckInputsToNestorCall) { const HandoverStorage& h = vmec.h_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_VACUUM, number_of_iterations).value(); + vmec.run(VmecCheckpoint::VAC1_VACUUM, number_of_iterations, data_source_.target_ns).value(); ASSERT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -140,6 +141,10 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev_free_bdy", .tolerance = 1.0e-12, .iter2_to_test = {3, 4}}, + DataSource{.identifier = "solovev_free_bdy", + .tolerance = 1.0e-12, + .iter2_to_test = {2, 3}, + .target_ns = 32}, DataSource{.identifier = "cth_like_free_bdy", .tolerance = 1.0e-12, .iter2_to_test = {53, 54}})); @@ -169,7 +174,7 @@ TEST_P(BsqVacTest, CheckBsqVac) { const HandoverStorage& h = vmec.h_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_BSQVAC, number_of_iterations).value(); + vmec.run(VmecCheckpoint::VAC1_BSQVAC, number_of_iterations, data_source_.target_ns).value(); ASSERT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -225,6 +230,10 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev_free_bdy", .tolerance = 1.0e-10, .iter2_to_test = {3, 4}}, + DataSource{.identifier = "solovev_free_bdy", + .tolerance = 1.0e-12, + .iter2_to_test = {2}, + .target_ns = 32}, DataSource{.identifier = "cth_like_free_bdy", .tolerance = 1.0e-10, .iter2_to_test = {53, 54}})); diff --git a/free_boundary/singular_integrals/singular_integrals_test.cc b/free_boundary/singular_integrals/singular_integrals_test.cc index f03c770..8b8fdc5 100644 --- a/free_boundary/singular_integrals/singular_integrals_test.cc +++ b/free_boundary/singular_integrals/singular_integrals_test.cc @@ -35,6 +35,7 @@ struct DataSource { std::string identifier; double tolerance = 0.0; std::vector iter2_to_test = {1, 2}; + int target_ns = 0; }; class CmnsTest : public TestWithParam { @@ -61,7 +62,7 @@ TEST_P(CmnsTest, CheckCmns) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_VACUUM, number_of_iterations).value(); + vmec.run(VmecCheckpoint::VAC1_VACUUM, number_of_iterations, data_source_.target_ns).value(); ASSERT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -131,7 +132,7 @@ TEST_P(AnalytTest, CheckAnalyt) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_ANALYT, number_of_iterations).value(); + vmec.run(VmecCheckpoint::VAC1_ANALYT, number_of_iterations, data_source_.target_ns).value(); ASSERT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -256,6 +257,10 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev_free_bdy", .tolerance = 1.0e-9, .iter2_to_test = {3, 4}}, + DataSource{.identifier = "solovev_free_bdy", + .tolerance = 1.0e-12, + .iter2_to_test = {2, 3}, + .target_ns = 32}, DataSource{.identifier = "cth_like_free_bdy", .tolerance = 1.0e-9, .iter2_to_test = {53, 54}})); diff --git a/free_boundary/surface_geometry/surface_geometry_test.cc b/free_boundary/surface_geometry/surface_geometry_test.cc index 80044dd..fa766e6 100644 --- a/free_boundary/surface_geometry/surface_geometry_test.cc +++ b/free_boundary/surface_geometry/surface_geometry_test.cc @@ -38,6 +38,7 @@ struct DataSource { std::string identifier; double tolerance = 0.0; std::vector iter2_to_test = {1, 2}; + int target_ns = 0; }; class SurfaceGeometryTest : public TestWithParam { @@ -63,7 +64,7 @@ TEST_P(SurfaceGeometryTest, CheckSurfaceGeometry) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VAC1_SURFACE, number_of_iterations).value(); + vmec.run(VmecCheckpoint::VAC1_SURFACE, number_of_iterations, data_source_.target_ns).value(); ASSERT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -190,6 +191,10 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev_free_bdy", .tolerance = 1.0e-12, .iter2_to_test = {3, 4}}, + DataSource{.identifier = "solovev_free_bdy", + .tolerance = 1.0e-12, + .iter2_to_test = {2, 3}, + .target_ns = 32}, DataSource{.identifier = "cth_like_free_bdy", .tolerance = 1.0e-12, .iter2_to_test = {53, 54}})); diff --git a/vmec/ideal_mhd_model/ideal_mhd_model_hot_restart_test.cc b/vmec/ideal_mhd_model/ideal_mhd_model_hot_restart_test.cc index e1a3a8a..cadb987 100644 --- a/vmec/ideal_mhd_model/ideal_mhd_model_hot_restart_test.cc +++ b/vmec/ideal_mhd_model/ideal_mhd_model_hot_restart_test.cc @@ -83,7 +83,7 @@ TEST_P(FourierGeometryToStartWithFromWOutTest, const auto checkpoint = VmecCheckpoint::FOURIER_GEOMETRY_TO_START_WITH; const absl::StatusOr checkpoint_reached = vmec.run(checkpoint, /*maximum_iterations=*/0, - /*maximum_multi_grid_step=*/500, + /*target_ns=*/0, /*maximum_multi_grid_step=*/500, /*initial_state=*/HotRestartState(output_quantities)); ASSERT_TRUE(checkpoint_reached.ok()); ASSERT_TRUE(*checkpoint_reached); @@ -183,7 +183,7 @@ TEST_P(FourierGeometryToStartWithFromDebugOutTest, const auto checkpoint = VmecCheckpoint::FOURIER_GEOMETRY_TO_START_WITH; const absl::StatusOr checkpoint_reached = vmec.run(checkpoint, /*iterations_before_checkpointing=*/0, - /*maximum_multi_grid_step=*/500, + /*target_ns=*/0, /*maximum_multi_grid_step=*/500, /*initial_state=*/HotRestartState(output_quantities)); ASSERT_TRUE(checkpoint_reached.ok()); ASSERT_TRUE(*checkpoint_reached); @@ -279,7 +279,7 @@ TEST_P(InverseFourierTransformGeometryTest, const auto checkpoint = VmecCheckpoint::INV_DFT_GEOMETRY; const absl::StatusOr checkpoint_reached = vmec.run(checkpoint, /*iterations_before_checkpointing=*/0, - /*maximum_multi_grid_step=*/500, + /*target_ns=*/0, /*maximum_multi_grid_step=*/500, /*initial_state=*/HotRestartState(output_quantities)); ASSERT_TRUE(checkpoint_reached.ok()); ASSERT_TRUE(*checkpoint_reached); diff --git a/vmec/ideal_mhd_model/ideal_mhd_model_test.cc b/vmec/ideal_mhd_model/ideal_mhd_model_test.cc index 7cf25fc..250e4ee 100644 --- a/vmec/ideal_mhd_model/ideal_mhd_model_test.cc +++ b/vmec/ideal_mhd_model/ideal_mhd_model_test.cc @@ -44,6 +44,7 @@ struct DataSource { std::string identifier; double tolerance = 0.0; std::vector iter2_to_test = {1, 2}; + int target_ns = 0; }; class SpectralConstraintTest : public TestWithParam { @@ -68,7 +69,9 @@ TEST_P(SpectralConstraintTest, CheckSpectralConstraint) { const Sizes& s = vmec.s_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::SPECTRAL_CONSTRAINT, 1).value(); + vmec.run(VmecCheckpoint::SPECTRAL_CONSTRAINT, 1, + data_source_.target_ns) + .value(); EXPECT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -131,7 +134,7 @@ TEST_P(FourierGeometryToStartWithTest, CheckFourierGeometryToStartWith) { bool reached_checkpoint = vmec.run(VmecCheckpoint::FOURIER_GEOMETRY_TO_START_WITH, - number_of_iterations) + number_of_iterations, data_source_.target_ns) .value(); EXPECT_TRUE(reached_checkpoint); @@ -178,7 +181,8 @@ INSTANTIATE_TEST_SUITE_P( TestIdealMhdModel, FourierGeometryToStartWithTest, Values(DataSource{.identifier = "solovev", .tolerance = 1.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 2.0e-15}, - DataSource{.identifier = "solovev_free_bdy", .tolerance = 1.0e-15, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 2.0e-15, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 1.0e-14}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 1.0e-14}, @@ -213,7 +217,7 @@ TEST_P(InverseFourierTransformGeometryTest, const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::INV_DFT_GEOMETRY, number_of_iterations) + vmec.run(VmecCheckpoint::INV_DFT_GEOMETRY, number_of_iterations, data_source_.target_ns) .value(); EXPECT_TRUE(reached_checkpoint); @@ -342,7 +346,9 @@ INSTANTIATE_TEST_SUITE_P( TestIdealMHDModel, InverseFourierTransformGeometryTest, Values(DataSource{.identifier = "solovev", .tolerance = 2.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 5.0e-15}, - DataSource{.identifier = "solovev_free_bdy", .tolerance = 2.0e-15, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-15, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, + DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 6.0e-14}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 6.0e-14}, @@ -376,7 +382,7 @@ TEST_P(JacobianTest, CheckJacobian) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::JACOBIAN, number_of_iterations).value(); + vmec.run(VmecCheckpoint::JACOBIAN, number_of_iterations, data_source_.target_ns).value(); EXPECT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -433,6 +439,8 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-14, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, + DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 2.0e-14}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 2.0e-14}, @@ -466,7 +474,7 @@ TEST_P(MetricTest, CheckMetric) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::METRIC, number_of_iterations).value(); + vmec.run(VmecCheckpoint::METRIC, number_of_iterations, data_source_.target_ns).value(); EXPECT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -520,6 +528,7 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-14, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 5.0e-15}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 5.0e-15}, @@ -553,7 +562,7 @@ TEST_P(VolumeTest, CheckVolume) { const HandoverStorage& h = vmec.h_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::VOLUME, number_of_iterations).value(); + vmec.run(VmecCheckpoint::VOLUME, number_of_iterations, data_source_.target_ns).value(); EXPECT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -589,6 +598,7 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 1.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 1.0e-15}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 2.0e-14, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 5.0e-16}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 5.0e-16}, @@ -622,7 +632,7 @@ TEST_P(ContravariantMagneticFieldTest, CheckContravariantMagneticField) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::B_CONTRA, number_of_iterations).value(); + vmec.run(VmecCheckpoint::B_CONTRA, number_of_iterations, data_source_.target_ns).value(); EXPECT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -723,6 +733,7 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 5.0e-16}, DataSource{.identifier = "solovev_no_axis", .tolerance = 5.0e-16}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-15, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 5.0e-13}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 5.0e-13}, @@ -756,7 +767,7 @@ TEST_P(CovariantMagneticFieldTest, CheckCovariantMagneticField) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::B_CO, number_of_iterations).value(); + vmec.run(VmecCheckpoint::B_CO, number_of_iterations, data_source_.target_ns).value(); EXPECT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -799,6 +810,7 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 2.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 2.0e-15}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 2.0e-14, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 5.0e-13}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 5.0e-13}, @@ -833,7 +845,7 @@ TEST_P(TotalPressureAndEnergiesTest, CheckTotalPressureAndEnergies) { const HandoverStorage& h = vmec.h_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::ENERGY, number_of_iterations).value(); + vmec.run(VmecCheckpoint::ENERGY, number_of_iterations, data_source_.target_ns).value(); EXPECT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -882,6 +894,7 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 5.0e-16}, DataSource{.identifier = "solovev_no_axis", .tolerance = 5.0e-16}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 2.0e-15, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 5.0e-13}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 5.0e-13}, @@ -914,7 +927,7 @@ TEST_P(RadialForceBalanceTest, CheckRadialForceBalance) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::RADIAL_FORCE_BALANCE, number_of_iterations) + vmec.run(VmecCheckpoint::RADIAL_FORCE_BALANCE, number_of_iterations, data_source_.target_ns) .value(); EXPECT_TRUE(reached_checkpoint); @@ -973,6 +986,8 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 1.0e-14}, DataSource{.identifier = "solovev_no_axis", .tolerance = 1.0e-14}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-13, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, + DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 1.0e-12}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 1.0e-12}, @@ -1007,7 +1022,7 @@ TEST_P(HybridLambdaForceTest, CheckHybridLambdaForce) { const HandoverStorage& h = vmec.h_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::HYBRID_LAMBDA_FORCE, number_of_iterations) + vmec.run(VmecCheckpoint::HYBRID_LAMBDA_FORCE, number_of_iterations, data_source_.target_ns) .value(); EXPECT_TRUE(reached_checkpoint); @@ -1099,6 +1114,7 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 2.0e-14, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 5.0e-13}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 5.0e-13}, @@ -1133,7 +1149,7 @@ TEST_P(UpdateRadialPreconditionerTest, CheckUpdateRadialPreconditioner) { bool reached_checkpoint = vmec.run(VmecCheckpoint::UPDATE_RADIAL_PRECONDITIONER, - number_of_iterations) + number_of_iterations, data_source_.target_ns) .value(); EXPECT_TRUE(reached_checkpoint); @@ -1273,6 +1289,7 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 1.0e-14}, DataSource{.identifier = "solovev_no_axis", .tolerance = 1.0e-14}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 1.0e-14, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 1.0e-12}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 1.0e-12}, @@ -1307,7 +1324,7 @@ TEST_P(ForceNormsTest, CheckForceNorms) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::UPDATE_FORCE_NORMS, number_of_iterations) + vmec.run(VmecCheckpoint::UPDATE_FORCE_NORMS, number_of_iterations, data_source_.target_ns) .value(); EXPECT_TRUE(reached_checkpoint); @@ -1364,6 +1381,7 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 1.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-15, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 5.0e-14}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 5.0e-14}, @@ -1396,7 +1414,7 @@ TEST_P(ConstraintForceMultiplierTest, CheckConstraintForceMultiplier) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::UPDATE_TCON, number_of_iterations).value(); + vmec.run(VmecCheckpoint::UPDATE_TCON, number_of_iterations, data_source_.target_ns).value(); EXPECT_TRUE(reached_checkpoint); // only one file, since only updated every 25 iterations @@ -1435,6 +1453,7 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 2.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 2.0e-15}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-15, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 1.0e-13}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 1.0e-13}, @@ -1472,7 +1491,7 @@ TEST_P(RBsqTest, CheckRBsq) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::RBSQ, number_of_iterations).value(); + vmec.run(VmecCheckpoint::RBSQ, number_of_iterations, data_source_.target_ns).value(); EXPECT_TRUE(reached_checkpoint); // The filename of rbsq debugging output is created based on the number of @@ -1513,6 +1532,7 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev_free_bdy", .tolerance = 1.0e-10, .iter2_to_test = {3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {2, 3}, .target_ns = 32}, DataSource{.identifier = "cth_like_free_bdy", .tolerance = 1.0e-10, .iter2_to_test = {53, 54}})); @@ -1541,7 +1561,7 @@ TEST_P(AliasTest, CheckAlias) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::ALIAS, number_of_iterations).value(); + vmec.run(VmecCheckpoint::ALIAS, number_of_iterations, data_source_.target_ns).value(); EXPECT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -1630,6 +1650,7 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-15, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 2.0e-14}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 2.0e-14}, @@ -1663,7 +1684,7 @@ TEST_P(RealspaceForcesTest, CheckRealspaceForces) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::REALSPACE_FORCES, number_of_iterations) + vmec.run(VmecCheckpoint::REALSPACE_FORCES, number_of_iterations, data_source_.target_ns) .value(); EXPECT_TRUE(reached_checkpoint); @@ -1738,7 +1759,8 @@ INSTANTIATE_TEST_SUITE_P( TestIdealMHDModel, RealspaceForcesTest, Values(DataSource{.identifier = "solovev", .tolerance = 1.0e-14}, DataSource{.identifier = "solovev_no_axis", .tolerance = 2.0e-13}, - DataSource{.identifier = "solovev_free_bdy", .tolerance = 1.0e-13, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 2.0e-13, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 5.0e-11}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 5.0e-11}, @@ -1772,7 +1794,7 @@ TEST_P(ForwardTransformForcesTest, CheckForwardTransformForces) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::FWD_DFT_FORCES, number_of_iterations).value(); + vmec.run(VmecCheckpoint::FWD_DFT_FORCES, number_of_iterations, data_source_.target_ns).value(); EXPECT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -1862,6 +1884,7 @@ INSTANTIATE_TEST_SUITE_P( Values(DataSource{.identifier = "solovev", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-14, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 1.0e-13}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 1.0e-13}, @@ -1899,7 +1922,7 @@ TEST_P(PhysicalForcesTest, CheckPhysicalForces) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::PHYSICAL_FORCES, number_of_iterations).value(); + vmec.run(VmecCheckpoint::PHYSICAL_FORCES, number_of_iterations, data_source_.target_ns).value(); EXPECT_TRUE(reached_checkpoint); filename = absl::StrFormat( @@ -1951,7 +1974,8 @@ INSTANTIATE_TEST_SUITE_P( TestIdealMHDModel, PhysicalForcesTest, Values(DataSource{.identifier = "solovev", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 1.0e-13}, - DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-14, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 1.0e-13, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 1.0e-13}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 1.0e-13}, @@ -1984,7 +2008,7 @@ TEST_P(InvariantResidualsTest, CheckInvariantResiduals) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::INVARIANT_RESIDUALS, number_of_iterations) + vmec.run(VmecCheckpoint::INVARIANT_RESIDUALS, number_of_iterations, data_source_.target_ns) .value(); EXPECT_TRUE(reached_checkpoint); @@ -2012,7 +2036,8 @@ INSTANTIATE_TEST_SUITE_P( TestIdealMHDModel, InvariantResidualsTest, Values(DataSource{.identifier = "solovev", .tolerance = 5.0e-16}, DataSource{.identifier = "solovev_no_axis", .tolerance = 2.0e-15}, - DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-16, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 2.0e-15, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 5.0e-14}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 5.0e-14}, @@ -2049,7 +2074,7 @@ TEST_P(ApplyM1PreconditionerTest, CheckApplyM1Preconditioner) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::APPLY_M1_PRECONDITIONER, number_of_iterations) + vmec.run(VmecCheckpoint::APPLY_M1_PRECONDITIONER, number_of_iterations, data_source_.target_ns) .value(); EXPECT_TRUE(reached_checkpoint); @@ -2097,7 +2122,8 @@ INSTANTIATE_TEST_SUITE_P( TestIdealMHDModel, ApplyM1PreconditionerTest, Values(DataSource{.identifier = "solovev", .tolerance = 5.0e-15}, DataSource{.identifier = "solovev_no_axis", .tolerance = 1.0e-13}, - DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-14, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 1.0e-13, .iter2_to_test = {1, 2, 3, 4}}, + DataSource{.identifier = "solovev_free_bdy", .tolerance = 5.0e-12, .iter2_to_test = {1, 2}, .target_ns = 32}, DataSource{.identifier = "cth_like_fixed_bdy", .tolerance = 1.0e-13}, DataSource{.identifier = "cth_like_fixed_bdy_nzeta_37", .tolerance = 1.0e-13}, @@ -2132,7 +2158,7 @@ TEST_P(AssembleRZPreconditionerTest, CheckAssembleRZPreconditioner) { bool reached_checkpoint = vmec.run(VmecCheckpoint::ASSEMBLE_RZ_PRECONDITIONER, - number_of_iterations) + number_of_iterations, data_source_.target_ns) .value(); EXPECT_TRUE(reached_checkpoint); @@ -2236,7 +2262,7 @@ TEST_P(ApplyPreconditionerTest, CheckApplyPreconditioner) { bool reached_checkpoint = vmec.run(VmecCheckpoint::APPLY_RADIAL_PRECONDITIONER, - number_of_iterations) + number_of_iterations, data_source_.target_ns) .value(); EXPECT_TRUE(reached_checkpoint); @@ -2396,7 +2422,7 @@ TEST_P(PreconditionedResidualsTest, CheckPreconditionedResiduals) { const FlowControl& fc = vmec.fc_; bool reached_checkpoint = - vmec.run(VmecCheckpoint::PRECONDITIONED_RESIDUALS, number_of_iterations) + vmec.run(VmecCheckpoint::PRECONDITIONED_RESIDUALS, number_of_iterations, data_source_.target_ns) .value(); EXPECT_TRUE(reached_checkpoint); diff --git a/vmec/vmec/vmec_test.cc b/vmec/vmec/vmec_test.cc index bf854fe..79ccf7e 100644 --- a/vmec/vmec/vmec_test.cc +++ b/vmec/vmec/vmec_test.cc @@ -325,7 +325,10 @@ TEST_P(MultigridResultTest, CheckMultigridResult) { // run until convergence // TODO(jons): need to limit for first multi-grid step for now ... - bool reached_checkpoint = vmec.run(VmecCheckpoint::NONE, INT_MAX, 1).value(); + bool reached_checkpoint = + vmec.run(VmecCheckpoint::NONE, INT_MAX, /*target_ns=*/0, + /*maximum_multi_grid_step=*/1) + .value(); ASSERT_FALSE(reached_checkpoint); // Here, we implicitly test for correct number of iterations until convergence diff --git a/vmec_hot_restart_test/vmec_hot_restart_test.cc b/vmec_hot_restart_test/vmec_hot_restart_test.cc index c7763be..f9ce4bb 100644 --- a/vmec_hot_restart_test/vmec_hot_restart_test.cc +++ b/vmec_hot_restart_test/vmec_hot_restart_test.cc @@ -81,7 +81,7 @@ TEST_P(GeometryInitializationTest, CheckGeometryInitialization) { const auto checkpoint = VmecCheckpoint::SETUP_INITIAL_STATE; const absl::StatusOr checkpoint_reached = vmec.run(checkpoint, /*maximum_iterations=*/0, - /*maximum_multi_grid_step=*/500, + /*target_ns=*/0, /*maximum_multi_grid_step=*/500, /*initial_state=*/vmecpp::HotRestartState(output_quantities)); ASSERT_TRUE(checkpoint_reached.ok()); ASSERT_TRUE(*checkpoint_reached); @@ -177,7 +177,7 @@ TEST_P(JacobianTest, CheckJacobian) { const auto checkpoint = VmecCheckpoint::JACOBIAN; const absl::StatusOr checkpoint_reached = vmec.run(checkpoint, /*maximum_iterations=*/0, - /*maximum_multi_grid_step=*/500, + /*target_ns=*/0, /*maximum_multi_grid_step=*/500, /*initial_state=*/vmecpp::HotRestartState(output_quantities)); ASSERT_TRUE(checkpoint_reached.ok()); ASSERT_TRUE(*checkpoint_reached); @@ -232,7 +232,7 @@ TEST_P(EnergiesTest, CheckEnergies) { const auto checkpoint = VmecCheckpoint::ENERGY; const absl::StatusOr checkpoint_reached = vmec.run(checkpoint, /*maximum_iterations=*/0, - /*maximum_multi_grid_step=*/500, + /*target_ns=*/0, /*maximum_multi_grid_step=*/500, /*initial_state=*/vmecpp::HotRestartState(output_quantities)); ASSERT_TRUE(checkpoint_reached.ok()); ASSERT_TRUE(*checkpoint_reached); @@ -290,7 +290,7 @@ TEST_P(InvariantForceResidualsTest, CheckInvariantForceResiduals) { const auto checkpoint = VmecCheckpoint::INVARIANT_RESIDUALS; const absl::StatusOr checkpoint_reached = vmec.run(checkpoint, /*maximum_iterations=*/0, - /*maximum_multi_grid_step=*/500, + /*target_ns=*/0, /*maximum_multi_grid_step=*/500, /*initial_state=*/vmecpp::HotRestartState(output_quantities)); ASSERT_TRUE(checkpoint_reached.ok()); ASSERT_TRUE(*checkpoint_reached);