Skip to content

Commit

Permalink
Merge pull request #198 from PrincetonUniversity/bugfix/BEAMS3D_fidasim
Browse files Browse the repository at this point in the history
Bugfix/beams3 d fidasim
  • Loading branch information
lazersos authored Sep 13, 2023
2 parents 5c30188 + 863a90b commit 878a388
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
2 changes: 1 addition & 1 deletion BEAMS3D/Sources/beams3d_runtime.f90
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ SUBROUTINE handle_err(error_num, string_val, ierr)
ELSEIF (error_num .eq. NAMELIST_READ_ERR) THEN
WRITE(6, *) ' BEAMS3D ENCOUNTERED AN ERROR READING A NAMELIST'
WRITE(6, *) ' ', TRIM(string_val)
WRITE(6, *) ' IERR: ', ierr
WRITE(6, *) ' IERR: ', ierr
ELSEIF (error_num .eq. D02CJF_ERR) THEN
WRITE(6, *) ' BEAMS3D ENCOUNTERED A NAG ERROR (D02CJF)'
WRITE(6, *) ' CALLING FUNCTION ', TRIM(string_val)
Expand Down
30 changes: 4 additions & 26 deletions BEAMS3D/Sources/beams3d_write_fidasim.f90
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ SUBROUTINE read_fidasim_namelist_and_make_input_and_geometry
USE mpi_inc

!!!! Namelist
INTEGER, parameter :: MAXCHAN = 300
INTEGER, parameter :: MAXCHAN = 512
INTEGER :: ier, iunit,istat
INTEGER(HID_T) :: qid_gid,temp_gid
LOGICAL :: lexist
Expand Down Expand Up @@ -975,43 +975,21 @@ SUBROUTINE read_fidasim_namelist_and_make_input_and_geometry
aoffz = -1.0
adist = -1.0


!Read namelist
! istat=0
! iunit=12
! INQUIRE(FILE='fidasim.' // TRIM(fidasim_id_string),EXIST=lexist)
! IF (.not.lexist) stop 'Could not find input file'
! CALL safe_open(iunit,istat,'fidasim.' //TRIM(fidasim_id_string),'old','formatted')
! IF (istat /= 0) CALL handle_err(NAMELIST_READ_ERR,'in: '//'fidasim.'//TRIM(fidasim_id_string),istat)
! READ(iunit,NML=fidasim_inputs,IOSTAT=istat)
! IF (istat /= 0 .and. istat /= -1) THEN
! backspace(iunit)
! read(iunit,fmt='(A)') line
! write(6,'(A)') 'Invalid line in namelist: '//TRIM(line)
! CALL handle_err(NAMELIST_READ_ERR,'in: '//'fidasim.'//TRIM(fidasim_id_string),istat)
! END IF
! CLOSE(iunit)

namelist_present = 0
istat=0
iunit=12
!Check that fidasim inputs namelist exists
INQUIRE(FILE='input.' // TRIM(id_string),EXIST=lexist)
IF (.not.lexist) THEN
write(6,'(A)') 'Continuing without FIDASIM input generation'
write(6,'(A)') 'Is the namelist present in the input file?'
IF (lrestart_grid) write(6,'(A)') 'This is the normal behavior with restart_grid for now.'
return
END IF
CALL safe_open(iunit,istat,'input.' // TRIM(id_string),'old','formatted')
IF (istat /= 0) CALL handle_err(NAMELIST_READ_ERR,'beams3d_input in: input.'//TRIM(id_string),istat)
DO WHILE (istat == 0)
read(iunit,fmt='(A)', IOSTAT=istat) line
IF (TRIM(line) == '&fidasim_inputs_b3d') THEN
CALL TOLOWER(line)
IF ( TRIM(line) == '&fidasim_inputs_b3d') THEN
namelist_present=1
EXIT
END IF
IF (istat > 0) CALL handle_err(NAMELIST_READ_ERR,'beams3d_input in: input.'//TRIM(id_string),istat)
IF (istat > 0) CALL handle_err(NAMELIST_READ_ERR,'fidasim_inputs_b3d in: input.'//TRIM(id_string),istat)
END DO
rewind(iunit)
IF (namelist_present==1) THEN
Expand Down

0 comments on commit 878a388

Please sign in to comment.