Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the woutfile optional. #30

Merged
merged 3 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/siesta.f90
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ PROGRAM SIESTA
IF (lrestart) THEN
CALL context%set_restart
ELSE
CALL context%set_vmec
CALL context%set_vmec(.true.)
END IF

CALL context%converge
Expand Down
29 changes: 21 additions & 8 deletions Sources/siesta_run.f90
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ MODULE siesta_run
!> Control state.
INTEGER :: control_state
CONTAINS
PROCEDURE, PASS :: set_vmec => siesta_run_set_vmec
PROCEDURE, PASS :: set_restart => siesta_run_set_restart
PROCEDURE, PASS :: set_1d => siesta_run_set_1d
GENERIC :: set => set_1d
PROCEDURE, PASS :: converge => siesta_run_converge
FINAL :: siesta_run_destruct
! FIXME: Remove _temp after merge of V3FIT fixes.
PROCEDURE :: set_vmec_ => siesta_run_set_vmec
PROCEDURE :: set_vmec_temp => siesta_run_set_vmec_temp
GENERIC :: set_vmec => set_vmec_, set_vmec_temp
PROCEDURE :: set_restart => siesta_run_set_restart
PROCEDURE :: set_1d => siesta_run_set_1d
GENERIC :: set => set_1d
PROCEDURE :: converge => siesta_run_converge
FINAL :: siesta_run_destruct
END TYPE

!*******************************************************************************
Expand Down Expand Up @@ -379,9 +382,18 @@ SUBROUTINE siesta_run_destruct(this)
!> This method loads and sets variables based on the VMEC equilibrium. VMEC
!> controls the metric elements and coordinate system jacobian.
!>
!> @param[inout] this A @ref siesta_run_class instance.
!> @param[inout] this A @ref siesta_run_class instance.
!> @param[in] load_wout Flag to load the wout file.
!-------------------------------------------------------------------------------
! FIXME: Temp routine to make sure CI tests still. Remove once V3FIT changes
! finished.
SUBROUTINE siesta_run_set_vmec(this)
IMPLICIT NONE
CLASS (siesta_run_class), INTENT(inout) :: this
CALL siesta_run_set_vmec_temp(this, .true.)
END SUBROUTINE

SUBROUTINE siesta_run_set_vmec_temp(this, load_wout)
USE siesta_namelist, ONLY: nsin, mpolin, ntorin, nfpin, wout_file, &
l_vessel, ntor_modes
USE metrics, ONLY: init_metric_elements, LoadGrid, sqrtg
Expand All @@ -398,13 +410,14 @@ SUBROUTINE siesta_run_set_vmec(this)

! Declare Arguments
CLASS (siesta_run_class), INTENT(inout) :: this
LOGICAL, INTENT(in) :: load_wout

! local variables
INTEGER :: istat

! Start of executable code
CALL vmec_info_set_wout(wout_file, nsin, mpolin, ntorin, nfpin, &
& ntor_modes(-ntorin:ntorin))
& ntor_modes(-ntorin:ntorin), load_wout)

! CONSTRUCT R, Z, L REAL-SPACE ARRAYS ON SQRT(FLUX) - "POLAR" - MESH AND
! COMPUTE METRIC ELEMENTS AND JACOBIAN
Expand Down
10 changes: 7 additions & 3 deletions Sources/vmec_info.f90
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,10 @@ SUBROUTINE vmec_info_destruct_island
!> @param[in] ntor_in Number of SIESTA toroidal modes.
!> @param[in] nfp_in Number of SIESTA field periods.
!> @param[in] ntor_modes_in SIESTA Toroidal mode numbers.
!> @param[in] load_wout Flag to load the wout file.
!-------------------------------------------------------------------------------
SUBROUTINE vmec_info_set_wout(wout_file, ns_in, mpol_in, ntor_in, &
& nfp_in, ntor_modes_in)
& nfp_in, ntor_modes_in, load_wout)
USE descriptor_mod, ONLY: iam
USE v3_utilities, ONLY: assert_eq, assert
USE island_params
Expand All @@ -267,6 +268,7 @@ SUBROUTINE vmec_info_set_wout(wout_file, ns_in, mpol_in, ntor_in, &
INTEGER, INTENT(IN) :: ntor_in
INTEGER, INTENT(IN) :: nfp_in
INTEGER, DIMENSION(-ntor_in:ntor_in), INTENT(in) :: ntor_modes_in
LOGICAL :: load_wout

! Local variables
INTEGER :: istat
Expand All @@ -276,8 +278,10 @@ SUBROUTINE vmec_info_set_wout(wout_file, ns_in, mpol_in, ntor_in, &
! Start of executable code

! Load wout file.
CALL read_wout_file(wout_file, istat)
CALL assert_eq(0, istat, 'Read-wout error in vmec_info_set_wout')
IF (load_wout) THEN
CALL read_wout_file(wout_file, istat)
CALL assert_eq(0, istat, 'Read-wout error in vmec_info_set_wout')
END IF

IF (nfp_in .lt. 1) THEN
nfp_i = nfp_vmec
Expand Down