program grillix !! GRILLIX: An awesome plasma fluid turbulence code !! for the edge and scrape-off layer of tokamaks and stellarators !! !! Workflow of main program: !! 1) Parses input parameter file !! 2) Creates the static data set !! 3) Calls model routine that launches time-stepping, depending on chosen model use screen_io_m, only : get_stdout use error_handling_grillix_m, only: handle_error use status_codes_grillix_m, only : GRILLIX_ERR_NAMELIST use parallelisation_setup_m, only : parallelisation_init, parallelisation_finalize, is_rank_info_writer use startups_m, only : parse_cmd_filename, grillix_banner use comm_handler_m, only : comm_handler_t use static_data_m, only : static_all_components_init, static_data_parpath use perf_m, only : perf_reset use model_diffusion_m, only : model_diffusion use model_braginskii_m, only : model_braginskii use model_template_m, only : model_template use model_zhdanov_m, only : model_zhdanov implicit none type(comm_handler_t) :: comm_handler logical :: use_default_parfile character(len=:), allocatable :: par_filename character(len=32) :: model = "NONE" integer :: io_unit, io_error character(len=256) :: io_errmsg namelist / select_model / model ! Determine parameterfile, where parameters will be read from call parse_cmd_filename(par_filename, use_default_parfile, & fpath_default=static_data_parpath) ! Setup parallel environment call parallelisation_init(par_filename, comm_handler) ! Print welcome message call grillix_banner(is_rank_info_writer) ! Write path of parameter file if (is_rank_info_writer) then write(get_stdout(),*) new_line('a') // repeat('-',80) if (use_default_parfile) then write(get_stdout(),*)"Default path for parameterfile used: ", par_filename else write(get_stdout(),*)"Parameterfile used: ", par_filename endif write(get_stdout(),*) repeat('-',80) // new_line('a') endif ! Create static data set if (use_default_parfile) then call static_all_components_init(comm_handler) else call static_all_components_init(comm_handler, par_filename) endif ! Reset performance statistics, run for static data creation call perf_reset() ! Read model parameter open(newunit=io_unit, file=par_filename, 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=select_model, 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) if (is_rank_info_writer) then write(get_stdout(),nml=select_model) endif ! Enter model select case(model) case('DIFFUSION') call model_diffusion(comm_handler) case('BRAGINSKII') call model_braginskii(comm_handler) case('TEMPLATE') call model_template(comm_handler) case('ZHDANOV') call model_zhdanov(comm_handler) case default if (is_rank_info_writer) then write(get_stdout(),*)'No model selected, finalizing GRILLIX' endif end select call parallelisation_finalize() end program