diff --git a/.github/workflows/ci_doxygen.yaml b/.github/workflows/ci_doxygen.yaml index 40c2e6b..8817c38 100644 --- a/.github/workflows/ci_doxygen.yaml +++ b/.github/workflows/ci_doxygen.yaml @@ -28,6 +28,8 @@ jobs: sudo apt-get install libopenmpi-dev sudo apt-get install libscalapack-openmpi-dev sudo apt-get install doxygen + sudo apt-get install libblas-dev + sudo apt-get install liblapack-dev - name: Configure CMake shell: bash working-directory: ${{runner.workspace}}/Stellarator-Tools/build diff --git a/.github/workflows/ci_test.yaml b/.github/workflows/ci_test.yaml index 9640168..0ebb893 100644 --- a/.github/workflows/ci_test.yaml +++ b/.github/workflows/ci_test.yaml @@ -41,6 +41,8 @@ jobs: sudo apt-get install libnetcdff-dev sudo apt-get install libopenmpi-dev sudo apt-get install libscalapack-openmpi-dev + sudo apt-get install libblas-dev + sudo apt-get install liblapack-dev - name: Configure CMake Mac if: ${{matrix.os == 'macos-latest'}} shell: bash diff --git a/.github/workflows/ci_test_master.yaml b/.github/workflows/ci_test_master.yaml index 7a9e1a9..93ff61d 100644 --- a/.github/workflows/ci_test_master.yaml +++ b/.github/workflows/ci_test_master.yaml @@ -41,6 +41,8 @@ jobs: sudo apt-get install libnetcdff-dev sudo apt-get install libopenmpi-dev sudo apt-get install libscalapack-openmpi-dev + sudo apt-get install libblas-dev + sudo apt-get install liblapack-dev - name: Configure CMake Mac if: ${{matrix.os == 'macos-latest'}} shell: bash diff --git a/Sources/Input_Output/CMakeLists.txt b/Sources/Input_Output/CMakeLists.txt index f19ff0f..e96e757 100644 --- a/Sources/Input_Output/CMakeLists.txt +++ b/Sources/Input_Output/CMakeLists.txt @@ -22,4 +22,5 @@ target_sources(vmec $ $ $ + $ ) diff --git a/Sources/TimeStep/eqsolve.f b/Sources/TimeStep/eqsolve.f index 0b76feb..8524429 100644 --- a/Sources/TimeStep/eqsolve.f +++ b/Sources/TimeStep/eqsolve.f @@ -1,4 +1,4 @@ - SUBROUTINE eqsolve(ier_flag, lscreen) + SUBROUTINE eqsolve(ier_flag, lscreen, restart_obj) USE vmec_main USE vmec_params, ONLY: ntmax, ns4, jac75_flag, norm_term_flag, & bad_jacobian_flag, more_iter_flag, @@ -11,14 +11,17 @@ SUBROUTINE eqsolve(ier_flag, lscreen) ! Add below JDH 2010-08-03 USE vmec_history USE parallel_include_module - USE parallel_vmec_module, ONLY: ZeroLastNType + USE parallel_vmec_module, ONLY: ZeroLastNType, Parallel2Serial4X USE vacmod, ONLY: nuv, nuv3 + USE restart + IMPLICIT NONE !----------------------------------------------- ! D u m m y A r g u m e n t s !----------------------------------------------- - INTEGER :: ier_flag - LOGICAL :: lscreen + INTEGER, INTENT(inout) :: ier_flag + LOGICAL, INTENT(in) :: lscreen + CLASS (restart_class), INTENT(in) :: restart_obj !----------------------------------------------- ! L o c a l P a r a m e t e r s !----------------------------------------------- @@ -177,6 +180,14 @@ SUBROUTINE eqsolve(ier_flag, lscreen) & iter2 .eq. 1 .or. & .not.liter_flag) THEN CALL printout(iter2, delt0r, w0, lscreen) + + IF (PARVMEC) THEN + CALL Gather4XArray(pxc) + END IF + IF (grank .EQ. 0) THEN + CALL Parallel2Serial4X(pxc, xc) + CALL restart_obj%write() + END IF END IF iter2 = iter2 + 1 iterc = iterc + 1 diff --git a/Sources/TimeStep/runvmec.f b/Sources/TimeStep/runvmec.f index 7f29118..f47724f 100644 --- a/Sources/TimeStep/runvmec.f +++ b/Sources/TimeStep/runvmec.f @@ -1,11 +1,13 @@ SUBROUTINE runvmec(ictrl_array, input_file0, - & lscreen, COMM_WORLD, reset_file_name) + & lscreen, COMM_WORLD, reset_file_name, + & restart_file_name) USE vmec_main USE vmec_params, ONLY: bad_jacobian_flag, more_iter_flag, & norm_term_flag, successful_term_flag, & restart_flag, readin_flag, & timestep_flag, ns_error_flag, & reset_jacdt_flag, lamscale + USE restart USE realspace USE vmec_params, ONLY: ntmax USE vacmod, ONLY: nuv, nuv3 @@ -29,6 +31,7 @@ SUBROUTINE runvmec(ictrl_array, input_file0, LOGICAL, INTENT(in) :: lscreen CHARACTER(LEN=*), INTENT(in) :: input_file0 CHARACTER(LEN=*), OPTIONAL :: reset_file_name + CHARACTER(LEN=*), OPTIONAL :: restart_file_name INTEGER, INTENT(IN), OPTIONAL :: COMM_WORLD C----------------------------------------------- C L o c a l V a r i a b l e s @@ -50,6 +53,7 @@ SUBROUTINE runvmec(ictrl_array, input_file0, INTEGER :: blklength, grid_id, i, js, & nsmin, nsmax CHARACTER(LEN=20) :: fname + CLASS (restart_class), POINTER :: restart_obj C----------------------------------------------- ! @@ -110,6 +114,13 @@ SUBROUTINE initialize_radial(nsval, ns_old, delt0, LOGICAL, INTENT(in) :: lscreen REAL(rprec), INTENT(out) :: delt0 END SUBROUTINE initialize_radial + + SUBROUTINE eqsolve(ier_flag, lscreen, restart_obj) + USE restart + INTEGER, INTENT(inout) :: ier_flag + LOGICAL, INTENT(in) :: lscreen + CLASS (restart_class), INTENT(in) :: restart_obj + END SUBROUTINE END INTERFACE RUNVMEC_PASS = RUNVMEC_PASS + 1 @@ -319,7 +330,7 @@ END SUBROUTINE initialize_radial grid_size(grid_id) = nsval grid_procs(grid_id) = nranks - + ! JDH 2012-06-20. V3FIT fix, inserted with change from VMEC 8.48 -> 8.49 ! (Not sure just what in initialize_radial messes up convergence - happens slowly) ! Logical l_v3fit is declared in vmec_input, available via vmec_main @@ -339,7 +350,29 @@ END SUBROUTINE initialize_radial niter = numsteps + iter2 - 1 END IF - CALL eqsolve (ier_flag, lscreen) + IF (PRESENT(restart_file_name) .and. & + & LEN_TRIM(restart_file_name) .ne. 0 .and. & + & .not. (ns_old .ne. nsval)) THEN + IF (grank .EQ. 0) THEN + restart_obj => restart_construct_open(restart_file_name) + CALL restart_obj%read() + CALL Serial2Parallel4X(xc,pxc) + END IF + IF (PARVMEC) THEN + CALL MPI_Bcast(pxc, SIZE(pxc), MPI_REAL8, 0, + & RUNVMEC_COMM_WORLD, MPI_ERR) + END IF + ELSE + IF (grank .EQ. 0) THEN + restart_obj => restart_construct_new('restart.nc') + END IF + END IF + + CALL eqsolve (ier_flag, lscreen, restart_obj) + + IF (grank .EQ. 0) THEN + DEALLOCATE(restart_obj) + END IF IF (numsteps .GT. 0) THEN niter = niter_store diff --git a/Sources/TimeStep/vmec.f b/Sources/TimeStep/vmec.f index e5e0465..8fddb05 100644 --- a/Sources/TimeStep/vmec.f +++ b/Sources/TimeStep/vmec.f @@ -1,3 +1,30 @@ +!------------------------------------------------------------------------------- +! The @header2, @begin_table, @item3 and @end_table commands are custom defined +! commands in Doxygen.in. They are defined under ALIASES. For the page created +! here, the 80 column limit is exceeded. Arguments of aliases are separated by +! ','. If you intended ',' to be a string you must use an escaped comma '\,'. +! +!> @page vmec_cl_parsing_sec Command Line Arguments +!> +!> @section vmec_cl_parsing_intro Introduction +!> This contains a description of the command line arguments. All arguments +!> take the form of +!> +!> @fixed_width{xvmec [