Routine that calls the initialisation routines author: P J Knight, CCFE, Culham Science Centre None This routine calls the main initialisation routines that set the default values for the global variables, reads in data from the input file, and checks the run parameters for consistency.
subroutine init
!! Routine that calls the initialisation routines
!! author: P J Knight, CCFE, Culham Science Centre
!! None
!! This routine calls the main initialisation routines that set
!! the default values for the global variables, reads in data from
!! the input file, and checks the run parameters for consistency.
use global_variables, only: verbose, fileprefix, output_prefix
use main_module, only: run_summary
use constants, only: opt_file, vfile, nout, nplot, mfile, sig_file
use error_handling, only: initialise_error_list
use numerics, only: ixc , lablxc, nvar
use process_input, only: nin, input
use stellarator_module, only: stinit
implicit none
! Arguments
! Local variables
integer :: i
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Initialise error handling
call initialise_error_list
! Initialise the program variables
call initial
! Open the input/output external files
if (trim(fileprefix) == "") then
open(unit=nin,file="IN.DAT",status='old')
else
open(unit=nin,file=trim(fileprefix),status='old')
end if
! open(unit=nin,file=trim(fileprefix)//'IN.DAT',status='old')
open(unit=nout ,file=trim(output_prefix)//'OUT.DAT' ,status='unknown')
open(unit=mfile ,file=trim(output_prefix)//'MFILE.DAT' ,status='unknown')
! Input any desired new initial values
call input
! Initialise stellarator parameters if necessary
! This overrides some of the bounds of the tokamak parameters
call stinit
! Check input data for errors/ambiguities
call check
! Write to the output file certain relevant details about this run
call run_summary
! Open verbose diagnostics file
if (verbose == 1) then
open(unit=vfile,file=trim(output_prefix)//'VFILE.DAT',status='unknown')
write(vfile,'(a80)') 'nviter = number of VMCON iterations.'
write(vfile,'(a80)') '(1-mod(ifail,7))=1 indicates that there has '// &
'been an escape from a failed line search.'
write(vfile,'(a80)') 'odd/even is a convenient plotting bit.'
write(vfile,'(100a13)') 'nviter','escape', 'odd/even', 'te','coe','rmajor', &
'powfmw','bt','tburn','sqsumsq', (lablxc(ixc(i)),i=1,nvar)
end if
end subroutine init