submodule (static_data_m) static_data_equi_s !! Handles static data related with equilibrium use equilibrium_factory_m, only : get_equilibrium_identifier, create_equilibrium implicit none character(len=128) :: equi_type = 'CIRCULAR_TOROIDAL' !! Default equilibrium type namelist / equilibrium_type / equi_type contains subroutine read_params_equi_type(par_filepath) character(len=*), intent(in), optional :: par_filepath character(len=:), allocatable :: fpath integer :: io_unit, io_error character(len=256) :: io_errmsg if (present(par_filepath)) then fpath = par_filepath else fpath = static_data_parpath endif open(newunit=io_unit, file=fpath, status='old', action='read', iostat=io_error, iomsg=io_errmsg) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, __LINE__, __FILE__) endif read(io_unit, nml=equilibrium_type, iostat=io_error, iomsg=io_errmsg) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, __LINE__, __FILE__) endif close(io_unit) end subroutine subroutine display_params_equi_type() if (is_rank_info_writer) then write(get_stdout(), nml=equilibrium_type) endif end subroutine module subroutine static_equi_init(par_filepath) character(len=*), intent(in), optional :: par_filepath integer :: equi_id if (is_rank_info_writer) then write(get_stdout(),*)'' write(get_stdout(),*)repeat('-',80) write(get_stdout(),*)'Initializing static data: equi' endif if (present(par_filepath)) then call read_params_equi_type(par_filepath) else call read_params_equi_type() endif call display_params_equi_type() equi_id = get_equilibrium_identifier(equi_type) if (present(par_filepath)) then call create_equilibrium(equi, equi_id, par_filepath) else call create_equilibrium(equi, equi_id, static_data_parpath) endif equi_is_initialized = .true. if (is_rank_info_writer) then write(get_stdout(),*)repeat('-',80) write(get_stdout(),*)'' endif end subroutine end submodule