SCALE-RM
Functions/Subroutines | Variables
scale_io Module Reference

module STDIO More...

Functions/Subroutines

subroutine, public io_setup (APPNAME, conf_name, prefix, allow_noconf)
 Setup. More...
 
subroutine, public io_log_setup (myrank, is_master)
 Setup LOG. More...
 
subroutine, public io_finalize
 
integer function, public io_get_available_fid ()
 search & get available file ID More...
 
subroutine, public io_set_universalrank (myrank, jobid, domainid)
 Put for error log. More...
 
subroutine, public io_get_fname (outstr, instr, rank, ext, len)
 generate process specific filename More...
 
character(len=h_long) function, public io_arg_getfname (is_master, allow_noconf)
 get config filename from argument More...
 
integer function, public io_cnf_open (fname, is_master)
 open config file More...
 

Variables

integer, parameter, public h_short = File_HSHORT
 Character length (short=16) More...
 
integer, parameter, public h_mid = File_HMID
 Character length (short=64) More...
 
integer, parameter, public h_long = File_HLONG
 Character length (short=256) More...
 
character(len=h_mid), public h_appname
 name of the application More...
 
character(len=h_mid), public h_libname
 name and version of the library More...
 
character(len=h_mid), public h_source
 for file header More...
 
character(len=h_mid), public h_institute = 'RIKEN'
 for file header More...
 
character(len=9), parameter, public io_nullfile = "/dev/null"
 
character(len=6), parameter, public io_stdout = "STDOUT"
 
integer, parameter, public io_fid_stdout = 6
 
integer, public io_fid_conf = -1
 Config file ID. More...
 
integer, public io_fid_log = -1
 Log file ID. More...
 
integer, public io_fid_nml = -1
 Log file ID (only for output namelist) More...
 
character(len=h_long), public io_log_basename = 'LOG'
 basename of logfile More...
 
character(len=h_long), public io_nml_filename = ''
 filename of logfile (only for output namelist) More...
 
logical, public io_l = .false.
 output log or not? (this process) More...
 
logical, public io_nml = .false.
 output log or not? (for namelist, this process) More...
 
logical, public io_log_suppress = .false.
 suppress all of log output? More...
 
logical, public io_log_nml_suppress = .false.
 suppress all of log output? (for namelist) More...
 
logical, public io_log_allnode = .false.
 output log for each node? More...
 
integer, public io_step_to_stdout = -1
 interval for output current step to STDOUT (negative is off) More...
 
character(len=6), public io_universalrank = "UNKNWN"
 universal rank for error log More...
 
character(len=6), public io_jobid = "UNKNWN"
 bulk job id for error log More...
 
character(len=6), public io_domainid = "UNKNWN"
 nesting domain id for error log More...
 
character(len=6), public io_localrank = "UNKNWN"
 local rank for error log More...
 

Detailed Description

module STDIO

Description
Standard, common I/O module
Author
Team SCALE
NAMELIST
  • PARAM_IO
    nametypedefault valuecomment
    H_SOURCE character(len=H_MID) for file header
    H_INSTITUTE character(len=H_MID) 'RIKEN' for file header
    IO_LOG_BASENAME character(len=H_LONG) 'LOG' basename of logfile
    IO_NML_FILENAME character(len=H_LONG) '' filename of logfile (only for output namelist)
    IO_LOG_SUPPRESS logical .false. suppress all of log output?
    IO_LOG_NML_SUPPRESS logical .false. suppress all of log output? (for namelist)
    IO_LOG_ALLNODE logical .false. output log for each node?

History Output
No history output

Function/Subroutine Documentation

◆ io_setup()

subroutine, public scale_io::io_setup ( character(len=*), intent(in)  APPNAME,
character(len=*), intent(in), optional  conf_name,
character(len=*), intent(in), optional  prefix,
logical, intent(in), optional  allow_noconf 
)

Setup.

Parameters
[in]appnamename of the application
[in]conf_namename of config file for each process
[in]prefixprefix for files
[in]allow_noconfif true, allow program to run without configure file

Definition at line 99 of file scale_io.F90.

99 
100  implicit none
101 
102  namelist / param_io / &
103  h_source, &
104  h_institute, &
105  io_log_basename, &
106  io_nml_filename, &
107  io_log_suppress, &
108  io_log_nml_suppress, &
109  io_log_allnode, &
110  io_step_to_stdout
111 
112  character(len=*), intent(in) :: APPNAME
113  character(len=*), intent(in), optional :: conf_name
114  character(len=*), intent(in), optional :: prefix
115  logical, intent(in), optional :: allow_noconf
116 
117  character(len=H_LONG) :: fname
118 
119  integer :: ierr
120  !---------------------------------------------------------------------------
121 
122  if ( present(conf_name) ) then
123  fname = conf_name
124  else
125  fname = io_arg_getfname( is_master=.true., allow_noconf=allow_noconf )
126  io_log_basename = io_stdout
127  endif
128 
129  if ( present(prefix) ) then
130  io_prefix = prefix
131  else
132  io_prefix = ""
133  end if
134 
135  !--- Open config file till end
136  io_fid_conf = io_cnf_open( fname, & ! [IN]
137  is_master=.true. ) ! [IN]
138 
139  h_appname = trim(appname)
140  h_libname = 'SCALE Library ver. '//trim(libversion)
141  h_source = trim(appname)
142 
143  !--- read PARAM
144  if ( io_fid_conf > 0 ) then
145  rewind(io_fid_conf)
146  read(io_fid_conf,nml=param_io,iostat=ierr)
147  if ( ierr > 0 ) then !--- fatal error
148  log_error('IO_setup',*) 'Not appropriate names in namelist PARAM_IO . Check!'
149  stop
150  endif
151  end if
152 
153  return

References h_appname, h_institute, h_libname, h_source, io_arg_getfname(), io_cnf_open(), io_fid_conf, io_log_allnode, io_log_basename, io_log_nml_suppress, io_log_suppress, io_nml_filename, io_stdout, and io_step_to_stdout.

Referenced by mod_rm_driver::rm_driver(), mod_rm_prep::rm_prep(), and scale::scale_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ io_log_setup()

subroutine, public scale_io::io_log_setup ( integer, intent(in)  myrank,
logical, intent(in)  is_master 
)

Setup LOG.

Parameters
[in]myrankmy rank ID
[in]is_mastermaster process?

Definition at line 161 of file scale_io.F90.

161  implicit none
162 
163  integer, intent(in) :: myrank
164  logical, intent(in) :: is_master
165 
166  namelist / param_io / &
167  h_source, &
168  h_institute, &
169  io_log_basename, &
170  io_nml_filename, &
171  io_log_suppress, &
172  io_log_nml_suppress, &
173  io_log_allnode
174 
175  character(len=H_LONG) :: fname
176 
177  integer :: ierr
178  !---------------------------------------------------------------------------
179 
180  if ( io_log_suppress ) then
181  io_l = .false.
182  else
183  if ( is_master ) then ! master node
184  io_l = .true.
185  else
186  io_l = io_log_allnode
187  endif
188  endif
189 
190  if ( io_log_nml_suppress ) then
191  io_nml = .false.
192  else
193  io_nml = io_l
194  endif
195 
196  if ( io_l ) then
197 
198  !--- Open logfile
199  if ( io_log_basename == io_stdout ) then
200  io_fid_log = io_fid_stdout
201  else
202  io_fid_log = io_get_available_fid()
203  call io_get_fname(fname, io_log_basename, rank=myrank)
204  open( unit = io_fid_log, &
205  file = trim(fname), &
206  form = 'formatted', &
207  iostat = ierr )
208  if ( ierr /= 0 ) then
209  log_error('IO_LOG_setup',*) 'File open error! :', trim(fname)
210  stop
211  endif
212  endif
213 
214  if ( io_fid_log .ne. io_fid_stdout ) then
215  write(io_fid_log,*) ''
216  write(io_fid_log,*) ' -+++++++++; '
217  write(io_fid_log,*) ' ++++++++++++++= '
218  write(io_fid_log,*) ' ++++++++++++++++++- '
219  write(io_fid_log,*) ' +++++++++++++++++++++ '
220  write(io_fid_log,*) ' .+++++++++++++++++++++++ '
221  write(io_fid_log,*) ' +++++++++++++++++++++++++ '
222  write(io_fid_log,*) ' +++++++++++++++++++++++++++ '
223  write(io_fid_log,*) ' =++++++=x######+++++++++++++; '
224  write(io_fid_log,*) ' .++++++X####XX####++++++++++++ '
225  write(io_fid_log,*) ' =+xxx=, ++++ +++++=##+ .###++++++++++- '
226  write(io_fid_log,*) ' ,xxxxxxxxxx- +++++.+++++=## .##++++++++++ '
227  write(io_fid_log,*) ' xxxxxxxxxxxxx -+++x#;+++++#+ ##+++++++++. '
228  write(io_fid_log,*) ' xxxxxxxx##xxxx, ++++# +++++XX #+++++++++- '
229  write(io_fid_log,*) ' xxxxxxx####+xx+x ++++#.++++++# #+++++++++ '
230  write(io_fid_log,*) ' +xxxxxX#X #Xx#= =+++#x=++++=#. x=++++++++ '
231  write(io_fid_log,*) ' xxxxxx#, x### .++++#,+++++#= x++++++++ '
232  write(io_fid_log,*) ' xxxxxx#. ++++# +++++x# #++++++++ '
233  write(io_fid_log,*) ' xxxxxx+ ++++#-+++++=# #++++++++ '
234  write(io_fid_log,*) ',xxxxxX -+++XX-+++++#, +++++++++ '
235  write(io_fid_log,*) '=xxxxxX .++++#.+++++#x -++++++++ '
236  write(io_fid_log,*) '+xxxxx= ++++#.++++++# ++++++++# '
237  write(io_fid_log,*) 'xxxxxx; ++++#+=++++=# ++++++++# '
238  write(io_fid_log,*) 'xxxxxxx ,+++x#,+++++#- ;++++++++- '
239  write(io_fid_log,*) '#xxxxxx +++=# +++++xX ++++++++# '
240  write(io_fid_log,*) 'xxxxxxxx ++++#-+++++=# +++++++++X '
241  write(io_fid_log,*) '-+xxxxxx+ ++++X#-++++=#. -++; =++++++++# '
242  write(io_fid_log,*) ' #xxxxxxxx. .+++++# +++++#x =++++- +++++++++XX '
243  write(io_fid_log,*) ' #xxxxxxxxxx=--=++++++#.++++++# ++++++ -+++++++++x# '
244  write(io_fid_log,*) ' #+xxxxxxxxxx+++++++#x=++++=# ++++++;=+++++++++++x# '
245  write(io_fid_log,*) ' =#+xxxxxxxx+++++++##,+++++#= =++++++++++++++++++##. '
246  write(io_fid_log,*) ' X#xxxxxxxx++++++## +++++x# ;x++++++++++++++++##. '
247  write(io_fid_log,*) ' x##+xxxx+++++x## +++++=# ##++++++++++++x##X '
248  write(io_fid_log,*) ' ,###Xx+++x###x -++++=#, .####x+++++X####. '
249  write(io_fid_log,*) ' -########+ -#####x .X#########+. '
250  write(io_fid_log,*) ' .,. ...... .,. '
251  write(io_fid_log,*) ' '
252  write(io_fid_log,*) ' .X####### +###- =###+ ###x x######## '
253  write(io_fid_log,*) ' .######### ######X ####### #### .#########x '
254  write(io_fid_log,*) ' ####+++++= X#######. -#######x .###; ####x+++++. '
255  write(io_fid_log,*) ' ### ###= #### #### x### #### -###. '
256  write(io_fid_log,*) ' .### #### ###+ X### ###X =###. #### '
257  write(io_fid_log,*) ' ###- ;###, .###+ -### #### x##########+ '
258  write(io_fid_log,*) ' +####x #### #### #### #### ###########. '
259  write(io_fid_log,*) ' x######. =### ###, .###- ###+ x###-------- '
260  write(io_fid_log,*) ' =##### X### -### #### ,### #### '
261  write(io_fid_log,*) ' .###=x###; .###+ ###X ###X ####. '
262  write(io_fid_log,*) ' ###########; ###########+ ########### ########### ,##########. '
263  write(io_fid_log,*) '-########### ,##########, #########X ########## +######### '
264  write(io_fid_log,*) ',,,,,,,,,,. ,,,,,,,,, .,,,,,,,. .,,,,,,,, ,,,,,,,, '
265  write(io_fid_log,*) ' '
266  write(io_fid_log,*) ' SCALE : Scalable Computing by Advanced Library and Environment '
267  write(io_fid_log,*) ''
268  write(io_fid_log,*) trim(h_libname)
269  write(io_fid_log,*) trim(h_appname)
270 
271 
272  log_newline
273  log_info("IO_LOG_setup",*) 'Setup'
274 
275  log_info('IO_LOG_setup','(1x,A,I3)') 'Open config file, FID = ', io_fid_conf
276  log_info('IO_LOG_setup','(1x,A,I3)') 'Open log file, FID = ', io_fid_log
277  log_info('IO_LOG_setup','(1x,2A)') 'basename of log file = ', trim(io_log_basename)
278  log_newline
279  end if
280 
281  else
282  if( is_master ) write(*,*) '*** Log report is suppressed.'
283  endif
284 
285  if ( io_nml_filename /= '' ) then
286  call io_get_fname(fname, io_nml_filename)
287  log_info("IO_LOG_setup",*) 'The used configurations are output to the file.'
288  log_info("IO_LOG_setup",*) 'filename of used config file = ', trim(fname)
289 
290  if ( is_master ) then ! write from master node only
291  io_nml = .true. ! force on
292  io_fid_nml = io_get_available_fid()
293  open( unit = io_fid_nml, &
294  file = fname, &
295  form = 'formatted', &
296  iostat = ierr )
297  if ( ierr /= 0 ) then
298  log_error('IO_LOG_setup',*) 'File open error! :', trim(fname)
299  stop 1
300  endif
301 
302  log_info("IO_LOG_setup",'(1x,A,I3)') 'Open file to output used config, FID = ', io_fid_nml
303 
304  write(io_fid_nml,'(A)') '################################################################################'
305  write(io_fid_nml,'(A)') '#! configulation'
306  write(io_fid_nml,'(2A)') '#! ', trim(h_libname)
307  write(io_fid_nml,'(2A)') '#! ', trim(h_appname)
308  write(io_fid_nml,'(A)') '################################################################################'
309  log_nml(param_io)
310  else
311  io_nml = .false. ! force off
312  io_fid_nml = -1
313 
314  log_info("IO_LOG_setup",*) 'The file for used config is open by the master rank'
315  endif
316  else
317  if ( io_nml ) then
318  io_fid_nml = io_fid_log
319 
320  log_info("IO_LOG_setup",*) 'The used config is output to the log.'
321  else
322  log_info("IO_LOG_setup",*) 'The used config is not output.'
323  endif
324  endif
325 
326  write(io_localrank,'(I6.6)') myrank
327 
328  !$acc update device(IO_L, IO_LOCALRANK)
329 
330  return

References h_appname, h_institute, h_libname, h_source, io_fid_conf, io_fid_log, io_fid_nml, io_fid_stdout, io_get_available_fid(), io_get_fname(), io_l, io_localrank, io_log_allnode, io_log_basename, io_log_nml_suppress, io_log_suppress, io_nml, io_nml_filename, and io_stdout.

Referenced by mod_rm_driver::rm_driver(), mod_rm_prep::rm_prep(), and scale::scale_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ io_finalize()

subroutine, public scale_io::io_finalize

Definition at line 334 of file scale_io.F90.

334  implicit none
335 
336  integer :: fid
337  logical :: i_opened
338  !---------------------------------------------------------------------------
339 
340  log_newline
341  log_progress(*) 'Closing LOG file'
342 
343  if ( io_fid_conf > 0 ) then
344  close( io_fid_conf )
345  io_fid_conf = -1
346  end if
347 
348  if ( io_fid_log > 0 .and. io_fid_log /= io_fid_stdout ) then
349  close( io_fid_log )
350  io_fid_log = -1
351  end if
352 
353  if ( io_fid_nml > 0 ) then
354  close( io_fid_nml )
355  io_fid_nml = -1
356  end if
357 
358  do fid = io_minfid, io_maxfid
359  inquire(fid,opened=i_opened)
360  if ( i_opened ) close(fid)
361  enddo
362 
363  io_l = .false.
364  io_nml = .false.
365 
366  return

References io_fid_conf, io_fid_log, io_fid_nml, io_fid_stdout, io_l, and io_nml.

Referenced by mod_rm_driver::rm_driver(), and mod_rm_prep::rm_prep().

Here is the caller graph for this function:

◆ io_get_available_fid()

integer function, public scale_io::io_get_available_fid

search & get available file ID

Returns
fid
file ID

Definition at line 373 of file scale_io.F90.

373  implicit none
374 
375  integer :: fid
376  logical :: i_opened
377  !---------------------------------------------------------------------------
378 
379  do fid = io_minfid, io_maxfid
380  inquire(fid,opened=i_opened)
381  if ( .NOT. i_opened ) return
382  enddo
383 
384  if ( fid >= io_maxfid ) then ! reach limit
385  log_error("IO_get_available_fid",*) 'Used I/O unit number reached to the limit! STOP'
386  stop
387  endif
388 

Referenced by scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_setup(), scale_atmos_phy_lt_sato2019::atmos_phy_lt_sato2019_setup(), scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10_setup(), scale_atmos_phy_rd_mstrnx::atmos_phy_rd_mstrnx_flux(), scale_atmos_phy_rd_profile::atmos_phy_rd_profile_finalize(), scale_atmos_phy_rd_profile::atmos_phy_rd_profile_setup_zgrid(), scale_atmos_sfc_ch_rn222::atmos_sfc_ch_rn222_setup(), scale_land_phy_snow_ky90::cal_r1r2(), scale_comm_cartesc_nest::comm_cartesc_nest_domain_regist_file(), scale_file_grads::file_grads_close(), scale_file_grads::file_grads_open(), scale_file_tiledata::file_tiledata_read_catalog_file(), scale_file_tiledata::file_tiledata_read_data_int1_int(), scale_file_tiledata::file_tiledata_read_data_int2_int(), scale_file_tiledata::file_tiledata_read_data_int2_real(), scale_file_tiledata::file_tiledata_read_data_int4_int(), scale_file_tiledata::file_tiledata_read_data_int4_real(), scale_file_tiledata::file_tiledata_read_data_real4_int(), scale_file_tiledata::file_tiledata_read_data_real4_real(), scale_file_tiledata::file_tiledata_read_data_real8_real(), io_cnf_open(), io_log_setup(), mod_land_vars::land_vars_check(), scale_letkf::letkf_add_inflation_setup(), scale_monitor::monitor_write(), mod_realinput_netcdf::parentatmossetupnetcdf(), mod_realinput_netcdf::parentlandsetupnetcdf(), mod_realinput_netcdf::parentoceansetupnetcdf(), scale_prc_icoa::prc_icoa_setup(), mod_mkinit::read_sounding(), and scale_urban_dyn_kusaka01::urban_dyn_kusaka01().

Here is the caller graph for this function:

◆ io_set_universalrank()

subroutine, public scale_io::io_set_universalrank ( integer, intent(in)  myrank,
integer, intent(in)  jobid,
integer, intent(in)  domainid 
)

Put for error log.

Parameters
[in]myrankmy rank ID (universal)
[in]jobidbulk job ID
[in]domainidnesting domain ID

Definition at line 397 of file scale_io.F90.

397  implicit none
398 
399  integer, intent(in) :: myrank
400  integer, intent(in) :: jobid
401  integer, intent(in) :: domainid
402  !---------------------------------------------------------------------------
403 
404  write(io_universalrank,'(I6.6)') myrank
405  write(io_jobid ,'(I6.6)') jobid
406  write(io_domainid ,'(I6.6)') domainid
407 
408  !$acc update device(IO_UNIVERSALRANK, IO_JOBID, IO_DOMAINID)
409 
410  return

References io_domainid, io_jobid, and io_universalrank.

Referenced by mod_launcher::launcher().

Here is the caller graph for this function:

◆ io_get_fname()

subroutine, public scale_io::io_get_fname ( character(len=*), intent(out)  outstr,
character(len=*), intent(in)  instr,
integer, intent(in), optional  rank,
character(len=*), intent(in), optional  ext,
integer, intent(in), optional  len 
)

generate process specific filename

Parameters
[out]outstrgenerated string
[in]instrstrings
[in]extextention

Definition at line 421 of file scale_io.F90.

421  implicit none
422 
423  character(len=*), intent(out) :: outstr
424  character(len=*), intent(in) :: instr
425  integer, intent(in), optional :: rank
426  character(len=*), intent(in), optional :: ext
427  integer, intent(in), optional :: len
428 
429  integer :: len_
430  character(len=H_SHORT) :: ext_
431  character(len=8) :: srank
432  character(len=6) :: fmt
433  !---------------------------------------------------------------------------
434 
435  if ( present(rank) ) then
436  if ( present(ext) ) then
437  ext_ = ext
438  else
439  ext_ = "pe"
440  end if
441  if ( rank >= 0 ) then
442  if ( present(len) ) then
443  len_ = len
444  else
445  len_ = 6
446  end if
447  write(fmt,'(A,I1,A,I1,A)') '(I', len_, '.', len_, ')'
448  write(srank, fmt) rank
449  outstr = trim(instr)//'.'//trim(ext_)//trim(srank)
450  else
451  outstr = trim(instr)//'.'//trim(ext_)//"all"
452  end if
453  else
454  outstr = instr
455  end if
456 
457  if ( io_prefix /= "" .and. outstr(1:1) /= "/" ) then
458  outstr = trim(io_prefix) // trim(outstr)
459  end if
460 
461  return

Referenced by scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_setup(), scale_atmos_phy_rd_mstrnx::atmos_phy_rd_mstrnx_flux(), scale_atmos_phy_rd_profile::atmos_phy_rd_profile_finalize(), scale_atmos_phy_rd_profile::atmos_phy_rd_profile_setup_zgrid(), scale_atmos_sfc_ch_rn222::atmos_sfc_ch_rn222_setup(), scale_land_phy_snow_ky90::cal_r1r2(), scale_comm_cartesc_nest::comm_cartesc_nest_domain_regist_file(), scale_file_grads::file_grads_close(), scale_file_grads::file_grads_open(), scale_file_tiledata::file_tiledata_read_catalog_file(), scale_file_tiledata::file_tiledata_read_data_int1_int(), scale_file_tiledata::file_tiledata_read_data_int2_int(), scale_file_tiledata::file_tiledata_read_data_int2_real(), scale_file_tiledata::file_tiledata_read_data_int4_int(), scale_file_tiledata::file_tiledata_read_data_int4_real(), scale_file_tiledata::file_tiledata_read_data_real4_int(), scale_file_tiledata::file_tiledata_read_data_real4_real(), scale_file_tiledata::file_tiledata_read_data_real8_real(), io_log_setup(), mod_land_vars::land_vars_check(), scale_monitor::monitor_write(), mod_realinput_netcdf::parentatmossetupnetcdf(), mod_realinput_netcdf::parentlandsetupnetcdf(), mod_realinput_netcdf::parentoceansetupnetcdf(), scale_prc_icoa::prc_icoa_setup(), mod_mkinit::read_sounding(), and scale_urban_dyn_kusaka01::urban_dyn_kusaka01().

Here is the caller graph for this function:

◆ io_arg_getfname()

character(len=h_long) function, public scale_io::io_arg_getfname ( logical, intent(in)  is_master,
logical, intent(in), optional  allow_noconf 
)

get config filename from argument

Returns
fname
filename

Definition at line 468 of file scale_io.F90.

468  implicit none
469  logical, intent(in) :: is_master
470  logical, intent(in), optional :: allow_noconf
471 
472  character(len=H_LONG) :: fname
473  logical :: allow_noconf_
474  !---------------------------------------------------------------------------
475 
476  if ( command_argument_count() < 1 ) then
477  allow_noconf_ = .false.
478  if ( present(allow_noconf) ) allow_noconf_ = allow_noconf
479  if ( .not. allow_noconf_ ) then
480  if(is_master) then
481  log_error("IO_ARG_getfname",*) 'Program needs config file from argument! STOP.'
482  end if
483  stop
484  else
485  fname = io_nullfile
486  end if
487  else
488  call get_command_argument(1,fname)
489  endif
490 

References io_nullfile.

Referenced by io_setup(), and mod_launcher::launcher().

Here is the caller graph for this function:

◆ io_cnf_open()

integer function, public scale_io::io_cnf_open ( character(len=*), intent(in)  fname,
logical, intent(in)  is_master 
)

open config file

Returns
fid
Parameters
[in]fnamefilename
[in]is_mastermaster process?
Returns
file ID

Definition at line 500 of file scale_io.F90.

500  implicit none
501 
502  character(len=*), intent(in) :: fname
503  logical, intent(in) :: is_master
504  integer :: fid
505 
506  integer :: ierr
507  !---------------------------------------------------------------------------
508 
509  fid = io_get_available_fid()
510 
511  open( unit = fid, &
512  file = trim(fname), &
513  form = 'formatted', &
514  status = 'old', &
515  iostat = ierr )
516 
517  if ( ierr /= 0 ) then
518  if(is_master) then
519  log_error("IO_CNF_open",*) 'Failed to open config file! STOP.'
520  log_error("IO_CNF_open",*) 'filename : ', trim(fname)
521  end if
522  stop
523  endif
524 

References io_get_available_fid().

Referenced by io_setup(), and mod_launcher::launcher().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ h_short

integer, parameter, public scale_io::h_short = File_HSHORT

Character length (short=16)

Definition at line 45 of file scale_io.F90.

45  integer, public, parameter :: H_SHORT = file_hshort

Referenced by scale_comm_cartesc_nest::comm_cartesc_nest_domain_shape(), scale_file_history::file_history_reg(), and scale_prc::prc_timereorder().

◆ h_mid

integer, parameter, public scale_io::h_mid = File_HMID

Character length (short=64)

Definition at line 46 of file scale_io.F90.

46  integer, public, parameter :: H_MID = file_hmid

◆ h_long

integer, parameter, public scale_io::h_long = File_HLONG

Character length (short=256)

Definition at line 47 of file scale_io.F90.

47  integer, public, parameter :: H_LONG = file_hlong

◆ h_appname

character(len=h_mid), public scale_io::h_appname

name of the application

Definition at line 49 of file scale_io.F90.

49  character(len=H_MID), public :: H_APPNAME

Referenced by io_log_setup(), and io_setup().

◆ h_libname

character(len=h_mid), public scale_io::h_libname

name and version of the library

Definition at line 50 of file scale_io.F90.

50  character(len=H_MID), public :: H_LIBNAME

Referenced by io_log_setup(), and io_setup().

◆ h_source

character(len=h_mid), public scale_io::h_source

for file header

Definition at line 51 of file scale_io.F90.

51  character(len=H_MID), public :: H_SOURCE

Referenced by scale_file_cartesc::file_cartesc_create(), scale_file_cartesc::file_cartesc_setup(), scale_file_history_cartesc::file_history_cartesc_setup(), io_log_setup(), and io_setup().

◆ h_institute

character(len=h_mid), public scale_io::h_institute = 'RIKEN'

for file header

Definition at line 52 of file scale_io.F90.

52  character(len=H_MID), public :: H_INSTITUTE = 'RIKEN'

Referenced by scale_file_cartesc::file_cartesc_create(), scale_file_cartesc::file_cartesc_setup(), scale_file_history_cartesc::file_history_cartesc_setup(), io_log_setup(), and io_setup().

◆ io_nullfile

character(len=9), parameter, public scale_io::io_nullfile = "/dev/null"

Definition at line 54 of file scale_io.F90.

54  character(len=9), public, parameter :: IO_NULLFILE = "/dev/null"

Referenced by io_arg_getfname().

◆ io_stdout

character(len=6), parameter, public scale_io::io_stdout = "STDOUT"

Definition at line 55 of file scale_io.F90.

55  character(len=6), public, parameter :: IO_STDOUT = "STDOUT"

Referenced by io_log_setup(), and io_setup().

◆ io_fid_stdout

integer, parameter, public scale_io::io_fid_stdout = 6

Definition at line 56 of file scale_io.F90.

56  integer, public, parameter :: IO_FID_STDOUT = 6

Referenced by io_finalize(), io_log_setup(), scale_prc::prc_timereorder(), and scale_prof::prof_rapreport().

◆ io_fid_conf

integer, public scale_io::io_fid_conf = -1

Config file ID.

Definition at line 57 of file scale_io.F90.

57  integer, public :: IO_FID_CONF = -1

Referenced by mod_admin_restart::admin_restart_setup(), mod_admin_time::admin_time_setup(), mod_admin_versioncheck::admin_versioncheck(), mod_atmos_admin::atmos_admin_setup(), mod_atmos_bnd_driver::atmos_boundary_driver_setup(), mod_atmos_dyn_driver::atmos_dyn_driver_setup(), scale_atmos_dyn_tstep_large_fvm_heve::atmos_dyn_tstep_large_fvm_heve_setup(), scale_atmos_dyn_tstep_short_fvm_hivi::atmos_dyn_tstep_short_fvm_hivi_setup(), mod_atmos_dyn_vars::atmos_dyn_vars_setup(), scale_atmos_grid_cartesc_index::atmos_grid_cartesc_index_setup_main(), scale_atmos_grid_cartesc_metric::atmos_grid_cartesc_metric_setup(), scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_setup(), scale_atmos_grid_cartesc::atmos_grid_cartesc_setup(), scale_atmos_grid_icoa_index::atmos_grid_icoa_index_setup(), scale_atmos_hydrostatic::atmos_hydrostatic_setup(), scale_atmos_phy_ae_kajino13::atmos_phy_ae_kajino13_setup(), scale_atmos_phy_ae_kajino13::atmos_phy_ae_kajino13_tracer_setup(), scale_atmos_phy_ae_offline::atmos_phy_ae_offline_setup(), mod_atmos_phy_ae_vars::atmos_phy_ae_vars_setup(), scale_atmos_phy_bl_mynn_jmapplib::atmos_phy_bl_mynn_jmapplib_setup(), scale_atmos_phy_bl_mynn::atmos_phy_bl_mynn_setup(), scale_atmos_phy_bl_mynn::atmos_phy_bl_mynn_tracer_setup(), mod_atmos_phy_bl_vars::atmos_phy_bl_vars_setup(), scale_atmos_phy_ch_rn222::atmos_phy_ch_rn222_setup(), mod_atmos_phy_ch_vars::atmos_phy_ch_vars_setup(), scale_atmos_phy_cp_common::atmos_phy_cp_common_setup(), scale_atmos_phy_cp_kf_jmapplib::atmos_phy_cp_kf_jmapplib_setup(), scale_atmos_phy_cp_kf::atmos_phy_cp_kf_setup(), mod_atmos_phy_cp_vars::atmos_phy_cp_vars_setup(), mod_atmos_phy_lt_driver::atmos_phy_lt_driver_setup(), scale_atmos_phy_lt_sato2019::atmos_phy_lt_sato2019_setup(), mod_atmos_phy_lt_vars::atmos_phy_lt_vars_setup(), mod_atmos_phy_mp_driver::atmos_phy_mp_driver_setup(), scale_atmos_phy_mp_sn14::atmos_phy_mp_sn14_setup(), scale_atmos_phy_mp_sn14::atmos_phy_mp_sn14_terminal_velocity(), scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10_setup(), scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10_tracer_setup(), scale_atmos_phy_mp_tomita08::atmos_phy_mp_tomita08_setup(), mod_atmos_phy_mp_vars::atmos_phy_mp_vars_setup(), mod_atmos_phy_rd_driver::atmos_phy_rd_driver_setup(), scale_atmos_phy_rd_mstrnx::atmos_phy_rd_mstrnx_setup(), scale_atmos_phy_rd_offline::atmos_phy_rd_offline_setup(), scale_atmos_phy_rd_profile::atmos_phy_rd_profile_setup(), mod_atmos_phy_rd_vars::atmos_phy_rd_vars_setup(), scale_atmos_phy_sf_bulk::atmos_phy_sf_bulk_setup(), scale_atmos_phy_sf_const::atmos_phy_sf_const_setup(), mod_atmos_phy_sf_vars::atmos_phy_sf_vars_setup(), scale_atmos_phy_tb_d1980::atmos_phy_tb_d1980_setup(), scale_atmos_phy_tb_dns::atmos_phy_tb_dns_setup(), scale_atmos_phy_tb_smg::atmos_phy_tb_smg_setup(), mod_atmos_phy_tb_vars::atmos_phy_tb_vars_setup(), scale_atmos_refstate::atmos_refstate_setup(), scale_atmos_saturation::atmos_saturation_setup(), scale_atmos_sfc_ch_rn222::atmos_sfc_ch_rn222_setup(), scale_atmos_solarins::atmos_solarins_setup(), mod_atmos_vars::atmos_vars_setup(), scale_bulkflux::bulkflux_setup(), scale_calendar::calendar_setup(), mod_cnvlanduse::cnvlanduse(), mod_cnvlanduse::cnvlanduse_setup(), mod_cnvtopo::cnvtopo(), mod_cnvtopo::cnvtopo_setup(), mod_cnvuser::cnvuser_setup(), scale_comm_cartesc_nest::comm_cartesc_nest_setup(), scale_comm_icoa::comm_setup(), scale_comm_cartesc::comm_setup(), scale_const::const_setup(), mod_convert::convert_setup(), mod_copytopo::copytopo(), scale_coriolis::coriolis_setup(), scale_cpl_phy_sfc_skin::cpl_phy_sfc_skin_setup(), mod_da_admin::da_admin_setup(), mod_da_param_estimation::da_param_estimation_setup(), mod_da_vars::da_vars_setup(), scale_file_cartesc::file_cartesc_setup(), scale_file_external_input::file_external_input_setup(), scale_file_history_cartesc::file_history_cartesc_setup(), scale_file_history::file_history_setup(), scale_file::file_setup(), mod_mkinit::flux_setup(), scale_interp::interp_setup(), io_finalize(), io_log_setup(), io_setup(), mod_land_admin::land_admin_setup(), scale_land_dyn_bucket::land_dyn_bucket_setup(), scale_land_grid_cartesc_index::land_grid_cartesc_index_setup(), scale_land_grid_cartesc::land_grid_cartesc_setup(), scale_land_grid_icoa_index::land_grid_icoa_index_setup(), scale_land_grid_icoa::land_grid_icoa_setup(), scale_land_phy_matsiro::land_phy_matsiro_setup(), scale_land_phy_snow_ky90::land_phy_snow_ky90_setup(), mod_mkinit::land_setup(), mod_land_vars::land_vars_check(), mod_land_vars::land_vars_setup(), scale_landuse::landuse_setup(), scale_letkf::letkf_setup(), scale_mapprojection::mapprojection_setup(), mod_mkinit::mkinit(), mod_mkinit::mkinit_setup(), mod_mktopo::mktopo(), mod_mktopo::mktopo_setup(), scale_monitor::monitor_setup(), mod_ocean_admin::ocean_admin_setup(), scale_ocean_dyn_offline::ocean_dyn_offline_setup(), scale_ocean_dyn_slab::ocean_dyn_slab_setup(), scale_ocean_grid_cartesc_index::ocean_grid_cartesc_index_setup(), scale_ocean_grid_cartesc::ocean_grid_cartesc_setup(), scale_ocean_grid_icoa_index::ocean_grid_icoa_index_setup(), scale_ocean_grid_icoa::ocean_grid_icoa_setup(), scale_ocean_phy_albedo::ocean_phy_albedo_const_setup(), scale_ocean_phy_albedo::ocean_phy_albedo_seaice_setup(), scale_ocean_phy_ice_simple::ocean_phy_ice_setup(), scale_ocean_phy_roughness::ocean_phy_roughness_const_setup(), scale_ocean_phy_roughness_miller92::ocean_phy_roughness_miller92_setup(), scale_ocean_phy_roughness_moon07::ocean_phy_roughness_moon07_setup(), scale_ocean_phy_roughness::ocean_phy_roughness_seaice_setup(), scale_ocean_phy_roughness::ocean_phy_roughness_setup(), scale_ocean_phy_tc::ocean_phy_tc_seaice_setup(), mod_mkinit::ocean_setup(), mod_ocean_vars::ocean_vars_setup(), mod_realinput_netcdf::parentatmossetupnetcdf(), mod_realinput_netcdf::parentlandsetupnetcdf(), mod_realinput_netcdf::parentoceansetupnetcdf(), scale_prc_cartesc::prc_cartesc_setup(), scale_prc_icoa::prc_icoa_setup(), scale_prc::prc_timereorder(), scale_prof::prof_setup(), scale_random::random_setup(), mod_mkinit::read_sounding(), mod_realinput::realinput_atmos(), mod_realinput::realinput_surface(), mod_mkinit::rect_setup(), scale_spnudge::spnudge_setup(), scale_statistics::statistics_setup(), mod_mkinit::tke_setup(), scale_topography::topography_setup(), mod_urban_admin::urban_admin_setup(), scale_urban_dyn_kusaka01::urban_dyn_kusaka01_setup(), scale_urban_grid_cartesc_index::urban_grid_cartesc_index_setup(), scale_urban_grid_cartesc::urban_grid_cartesc_setup(), scale_urban_grid_icoa_index::urban_grid_icoa_index_setup(), scale_urban_grid_icoa::urban_grid_icoa_setup(), mod_mkinit::urban_setup(), mod_urban_vars::urban_vars_setup(), and mod_user::user_setup().

◆ io_fid_log

integer, public scale_io::io_fid_log = -1

◆ io_fid_nml

integer, public scale_io::io_fid_nml = -1

Log file ID (only for output namelist)

Definition at line 59 of file scale_io.F90.

59  integer, public :: IO_FID_NML = -1

Referenced by io_finalize(), io_log_setup(), scale_monitor::monitor_setup(), scale_prc_cartesc::prc_cartesc_setup(), and scale_prc_icoa::prc_icoa_setup().

◆ io_log_basename

character(len=h_long), public scale_io::io_log_basename = 'LOG'

basename of logfile

Definition at line 61 of file scale_io.F90.

61  character(len=H_LONG), public :: IO_LOG_BASENAME = 'LOG'

Referenced by io_log_setup(), and io_setup().

◆ io_nml_filename

character(len=h_long), public scale_io::io_nml_filename = ''

filename of logfile (only for output namelist)

Definition at line 62 of file scale_io.F90.

62  character(len=H_LONG), public :: IO_NML_FILENAME = ''

Referenced by io_log_setup(), and io_setup().

◆ io_l

logical, public scale_io::io_l = .false.

◆ io_nml

logical, public scale_io::io_nml = .false.

output log or not? (for namelist, this process)

Definition at line 64 of file scale_io.F90.

64  logical, public :: IO_NML = .false.

Referenced by scale_comm_icoa::comm_setup(), io_finalize(), io_log_setup(), scale_prc_cartesc::prc_cartesc_setup(), and scale_prc_icoa::prc_icoa_setup().

◆ io_log_suppress

logical, public scale_io::io_log_suppress = .false.

suppress all of log output?

Definition at line 65 of file scale_io.F90.

65  logical, public :: IO_LOG_SUPPRESS = .false.

Referenced by io_log_setup(), io_setup(), and scale_prof::prof_rapreport().

◆ io_log_nml_suppress

logical, public scale_io::io_log_nml_suppress = .false.

suppress all of log output? (for namelist)

Definition at line 66 of file scale_io.F90.

66  logical, public :: IO_LOG_NML_SUPPRESS = .false.

Referenced by io_log_setup(), and io_setup().

◆ io_log_allnode

logical, public scale_io::io_log_allnode = .false.

output log for each node?

Definition at line 67 of file scale_io.F90.

67  logical, public :: IO_LOG_ALLNODE = .false.

Referenced by io_log_setup(), io_setup(), scale_monitor::monitor_write(), and scale_prof::prof_rapreport().

◆ io_step_to_stdout

integer, public scale_io::io_step_to_stdout = -1

interval for output current step to STDOUT (negative is off)

Definition at line 68 of file scale_io.F90.

68  integer, public :: IO_STEP_TO_STDOUT = -1

Referenced by mod_admin_time::admin_time_checkstate(), and io_setup().

◆ io_universalrank

character(len=6), public scale_io::io_universalrank = "UNKNWN"

universal rank for error log

Definition at line 70 of file scale_io.F90.

70  character(len=6), public :: IO_UNIVERSALRANK = "UNKNWN"

Referenced by io_set_universalrank().

◆ io_jobid

character(len=6), public scale_io::io_jobid = "UNKNWN"

bulk job id for error log

Definition at line 71 of file scale_io.F90.

71  character(len=6), public :: IO_JOBID = "UNKNWN"

Referenced by io_set_universalrank().

◆ io_domainid

character(len=6), public scale_io::io_domainid = "UNKNWN"

nesting domain id for error log

Definition at line 72 of file scale_io.F90.

72  character(len=6), public :: IO_DOMAINID = "UNKNWN"

Referenced by io_set_universalrank().

◆ io_localrank

character(len=6), public scale_io::io_localrank = "UNKNWN"

local rank for error log

Definition at line 73 of file scale_io.F90.

73  character(len=6), public :: IO_LOCALRANK = "UNKNWN"

Referenced by io_log_setup().