From ac629f5e5b132bb6f8495151ef1a75a182fa009a Mon Sep 17 00:00:00 2001 From: Mark Cianciosa Date: Fri, 14 Jun 2024 11:43:44 -0400 Subject: [PATCH 1/3] Enable control the preconditoner iterations. --- Sources/TimeStep/evolve.f | 29 ++++++++++++++----- .../tests/free_boundary_test/CMakeLists.txt | 2 +- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Sources/TimeStep/evolve.f b/Sources/TimeStep/evolve.f index c20e318..efa3bae 100644 --- a/Sources/TimeStep/evolve.f +++ b/Sources/TimeStep/evolve.f @@ -69,13 +69,24 @@ SUBROUTINE evolve(time_step, ier_flag, liter_flag, lscreen) ! INITIATES 2D PRECONDITIONER CALCULATION ! IF (iter_on .EQ. -1) THEN - IF (lqmr) THEN - nstep = 5 - niter = iter2+100 !Limit # preconditioner steps - ELSE - nstep = 20 - niter = iter2+400 + IF (pre_niter .eq. -1) THEN + IF (lqmr) THEN + nstep = 5 + niter = iter2+100 !Limit # preconditioner steps + ELSE + nstep = 20 + niter = iter2+400 + END IF + + WRITE (6,1000) niter + WRITE (nthreed,1000) niter + ELSE IF (pre_niter .eq. 0) THEN + niter = iter2 + pre_niter + + WRITE (6,1000) niter + WRITE (nthreed,1000) niter END IF + iter_on = iter2 !Flag to monitor progress of preconditioner ELSE iter_on = iter2-11 @@ -84,7 +95,9 @@ SUBROUTINE evolve(time_step, ier_flag, liter_flag, lscreen) !SPH022111: ADD NEW CONTROL PARAMETER, l_comp_prec2D, TO FORCE RECALCULATION ! OF PRECONDITIONING BLOCKS IN V3FIT, FOR EXAMPLE IF (lfirst .OR. l_comp_prec2D) THEN - IF (l_v3fit) WRITE(*,*) 'VMEC Evolve:compute_blocks' + IF (l_v3fit) THEN + WRITE(*,*) 'VMEC Evolve:compute_blocks' + END IF IF (PARVMEC) THEN CALL compute_blocks_par (pxc,pxcdot,pgc) ELSE @@ -218,6 +231,8 @@ SUBROUTINE evolve(time_step, ier_flag, liter_flag, lscreen) CALL second0(tevoff) evolve_time = evolve_time + (tevoff - tevon) +1000 FORMAT('Resetting the number of niter to ',i6) + END SUBROUTINE evolve diff --git a/Testing/tests/free_boundary_test/CMakeLists.txt b/Testing/tests/free_boundary_test/CMakeLists.txt index 881c0cb..07e9160 100644 --- a/Testing/tests/free_boundary_test/CMakeLists.txt +++ b/Testing/tests/free_boundary_test/CMakeLists.txt @@ -191,7 +191,7 @@ set_tests_properties (vmec_free_boundary_check_iotaf_test PROPERTIES DEPENDS "vmec_free_boundary_serial_test;vmec_free_boundary_parallel_test") add_test (NAME vmec_free_boundary_check_jcuru_test - COMMAND $/xwout_diff -wout_file1=wout_test_serial.vmec.nc -wout_file2=wout_test_parallel.vmec.nc -quantity=jcuru -tol=4.5E-7) + COMMAND $/xwout_diff -wout_file1=wout_test_serial.vmec.nc -wout_file2=wout_test_parallel.vmec.nc -quantity=jcuru -tol=5.1E-7) set_tests_properties (vmec_free_boundary_check_jcuru_test PROPERTIES DEPENDS "vmec_free_boundary_serial_test;vmec_free_boundary_parallel_test") From b0bfeaeb1b7aad5a843c29b5bd2d683d1444ddfd Mon Sep 17 00:00:00 2001 From: Mark Cianciosa Date: Fri, 14 Jun 2024 12:10:35 -0400 Subject: [PATCH 2/3] Enable controls for niter after the preconditioner is turned on. --- Sources/TimeStep/evolve.f | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Sources/TimeStep/evolve.f b/Sources/TimeStep/evolve.f index efa3bae..9c26fd4 100644 --- a/Sources/TimeStep/evolve.f +++ b/Sources/TimeStep/evolve.f @@ -78,13 +78,17 @@ SUBROUTINE evolve(time_step, ier_flag, liter_flag, lscreen) niter = iter2+400 END IF - WRITE (6,1000) niter - WRITE (nthreed,1000) niter - ELSE IF (pre_niter .eq. 0) THEN + IF (rank .eq. 0) THEN + WRITE (6,1000) niter + WRITE (nthreed,1000) niter + END IF + ELSE IF (pre_niter .ge. 0) THEN niter = iter2 + pre_niter - WRITE (6,1000) niter - WRITE (nthreed,1000) niter + IF (rank .eq. 0) THEN + WRITE (6,1000) niter + WRITE (nthreed,1000) niter + END IF END IF iter_on = iter2 !Flag to monitor progress of preconditioner @@ -231,7 +235,7 @@ SUBROUTINE evolve(time_step, ier_flag, liter_flag, lscreen) CALL second0(tevoff) evolve_time = evolve_time + (tevoff - tevon) -1000 FORMAT('Resetting the number of niter to ',i6) +1000 FORMAT(2x,'Resetting the number of niter to ',i6) END SUBROUTINE evolve From 108c13ef97a6af0d84bf5c29ef626b456bd9cf55 Mon Sep 17 00:00:00 2001 From: Mark Cianciosa Date: Fri, 14 Jun 2024 12:32:09 -0400 Subject: [PATCH 3/3] Add pre_niter to the error message. --- Sources/TimeStep/vmec.f | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/TimeStep/vmec.f b/Sources/TimeStep/vmec.f index 6c77a28..e5e0465 100644 --- a/Sources/TimeStep/vmec.f +++ b/Sources/TimeStep/vmec.f @@ -19,7 +19,8 @@ PROGRAM vmec C----------------------------------------------- INTEGER, PARAMETER :: nseq0 = 12 CHARACTER(LEN=*), PARAMETER :: - & increase_niter = "Try increasing NITER", + & increase_niter = "Try increasing NITER or PRE_NITER if the " + & // "preconditioner is on.", & bad_jacobian = "The jacobian was non-definite!", & full_3d1output_request = "Full threed1-output request!" C-----------------------------------------------