SCALE-RM
mod_admin_restart.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
9 !-------------------------------------------------------------------------------
11  !-----------------------------------------------------------------------------
12  !
13  !++ used modules
14  !
15  use scale_precision
16  use scale_stdio
17  use scale_prof
18  !-----------------------------------------------------------------------------
19  implicit none
20  private
21  !-----------------------------------------------------------------------------
22  !
23  !++ Public procedure
24  !
25  public :: admin_restart_setup
26  public :: admin_restart_write
27  public :: admin_restart_read
28 
29  !-----------------------------------------------------------------------------
30  !
31  !++ Public parameters & variables
32  !
33  !-----------------------------------------------------------------------------
34  !
35  !++ Private procedure
36  !
37  !-----------------------------------------------------------------------------
38  !
39  !++ Private parameters & variables
40  !
41  logical, public :: restart_run = .false.
42  logical, public :: restart_output = .false.
43 
44  character(len=H_LONG), public :: restart_in_basename = ''
45  logical, public :: restart_in_postfix_timelabel = .false.
46  character(len=H_LONG), public :: restart_out_basename = ''
47  logical, public :: restart_out_postfix_timelabel = .true.
48  character(len=H_MID), public :: restart_out_title = ''
49  character(len=H_SHORT), public :: restart_out_dtype = 'DEFAULT'
50 
51  !-----------------------------------------------------------------------------
52 contains
53  !-----------------------------------------------------------------------------
55  subroutine admin_restart_setup
56  use scale_process, only: &
58  use mod_atmos_vars, only: &
66  use mod_atmos_dyn_vars, only: &
74  use mod_atmos_phy_mp_vars, only: &
82  use mod_atmos_phy_ae_vars, only: &
90  use mod_atmos_phy_ch_vars, only: &
98  use mod_atmos_phy_rd_vars, only: &
106  use mod_atmos_phy_sf_vars, only: &
114  use mod_atmos_phy_tb_vars, only: &
122  use mod_atmos_phy_cp_vars, only: &
130  use mod_ocean_vars, only: &
138  use mod_land_vars, only: &
146  use mod_urban_vars, only: &
154  implicit none
155 
156  namelist / param_restart / &
157  restart_run, &
158  restart_output, &
165 
166  integer :: ierr
167  !---------------------------------------------------------------------------
168 
169  if( io_l ) write(io_fid_log,*)
170  if( io_l ) write(io_fid_log,*) '++++++ Module[RESTART] / Categ[ADMIN] / Origin[SCALE-RM]'
171 
172  !--- read namelist
173  rewind(io_fid_conf)
174  read(io_fid_conf,nml=param_restart,iostat=ierr)
175  if( ierr < 0 ) then !--- missing
176  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
177  elseif( ierr > 0 ) then !--- fatal error
178  write(*,*) 'xxx Not appropriate names in namelist PARAM_RESTART. Check!'
179  call prc_mpistop
180  endif
181  if( io_nml ) write(io_fid_nml,nml=param_restart)
182 
183  !--- set default output switch
196 
197  !--- set default input filename
198  if ( restart_in_basename /= '' ) then
211  endif
212 
225 
226  !--- set default output filename
227  if ( restart_out_basename /= '' ) then
240  endif
241 
254 
255  !--- set default output title
256  if ( restart_out_title /= '' ) then
269  endif
270 
271  !--- set default output data type
272  if ( restart_out_dtype /= '' ) then
285  endif
286 
287  return
288  end subroutine admin_restart_setup
289 
290  !-----------------------------------------------------------------------------
292  subroutine admin_restart_write
293  use mod_admin_time, only: &
298  use mod_atmos_vars, only: &
305  use mod_ocean_vars, only: &
312  use mod_land_vars, only: &
319  use mod_urban_vars, only: &
326  implicit none
327  !---------------------------------------------------------------------------
328 
329  ! restart files can be different for different models
330 
331  ! cread restart netCDF file(s)
336 
337  ! define metadata (dimensions, variables, attributes) in netCDF file
342 
343  ! exit define mode
348 
349  ! write variabes to netCDF file
354 
355  ! clode the restart file
360 
361  return
362  end subroutine admin_restart_write
363 
364  !-----------------------------------------------------------------------------
366  subroutine admin_restart_read
367  use mod_atmos_admin, only: &
368  atmos_do
369  use mod_ocean_admin, only: &
370  ocean_do
371  use mod_land_admin, only: &
372  land_do
373  use mod_urban_admin, only: &
374  urban_do
375  use mod_ocean_vars, only: &
379  use mod_land_vars, only: &
383  use mod_urban_vars, only: &
387  use mod_atmos_vars, only: &
391  implicit none
392 
393  ! restart files can be different for different models
394 
395  ! open restart netCDF file
398  if ( land_do ) call land_vars_restart_open
400 
401  ! read restart data
404  if ( land_do ) call land_vars_restart_read
406 
407  ! clode the restart file
410  if ( land_do ) call land_vars_restart_close
412 
413  end subroutine admin_restart_read
414 
415 end module mod_admin_restart
logical, public atmos_phy_ae_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
module ATMOS admin
logical, public atmos_dyn_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
module Land admin
logical, public atmos_phy_rd_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
character(len=h_long), public atmos_phy_ae_restart_in_basename
Basename of the input file.
subroutine, public atmos_vars_restart_open
Open restart file for reading atmospheric variables.
character(len=h_mid), public atmos_phy_ch_restart_out_title
title of the output file
module Atmosphere / Physics Cumulus
subroutine, public land_vars_restart_close
Close restart file.
character(len=h_mid), public atmos_phy_cp_restart_out_title
title of the output file
subroutine, public prc_mpistop
Abort MPI.
logical, public land_restart_output
Output restart file?
character(len=h_long), public atmos_phy_sf_restart_out_basename
Basename of the output file.
character(len=h_long), public atmos_phy_cp_restart_in_basename
Basename of the input file.
character(len=h_short), public atmos_dyn_restart_out_dtype
REAL4 or REAL8.
subroutine, public ocean_vars_restart_open
Open ocean restart file for read.
character(len=h_long), public atmos_dyn_restart_in_basename
Basename of the input file.
subroutine, public atmos_vars_restart_close
Close restart file.
character(len=h_long), public atmos_phy_rd_restart_in_basename
Basename of the input file.
subroutine, public urban_vars_restart_create
Create urban restart file.
module Atmosphere / Physics Cloud Microphysics
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:61
logical, public atmos_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
character(len=h_mid), public atmos_phy_rd_restart_out_title
title of the output file
character(len=h_long), public atmos_phy_mp_restart_in_basename
Basename of the input file.
module Atmosphere / Dynamics
subroutine, public ocean_vars_restart_write
Write ocean variables to restart file.
logical, public atmos_phy_cp_restart_output
output restart file?
subroutine, public urban_vars_restart_enddef
Exit netCDF define mode.
logical, public atmos_phy_ae_restart_output
output restart file?
logical, public ocean_do
module ATMOSPHERIC Variables
subroutine, public urban_vars_restart_read
Read urban restart.
logical, public atmos_phy_cp_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
character(len=h_long), public atmos_phy_cp_restart_out_basename
Basename of the output file.
subroutine, public atmos_vars_restart_write
Write restart of atmospheric variables.
module STDIO
Definition: scale_stdio.F90:12
character(len=h_short), public ocean_restart_out_dtype
REAL4 or REAL8.
logical, public atmos_phy_mp_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
logical, public time_doatmos_restart
execute atmosphere restart output in this step?
character(len=h_short), public atmos_restart_out_dtype
REAL4 or REAL8.
logical, public time_doocean_restart
execute ocean restart output in this step?
logical, public restart_out_postfix_timelabel
Add timelabel to the basename of output file?
logical, public atmos_phy_ae_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
subroutine, public ocean_vars_restart_def_var
Define ocean variables in restart file.
logical, public urban_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
logical, public atmos_phy_cp_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
subroutine, public land_vars_restart_enddef
Exit netCDF define mode.
logical, public atmos_phy_tb_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
character(len=h_mid), public atmos_phy_tb_restart_out_title
title of the output file
character(len=h_long), public land_restart_in_basename
Basename of the input file.
character(len=h_short), public land_restart_out_dtype
REAL4 or REAL8.
module URBAN Variables
logical, public atmos_dyn_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
subroutine, public ocean_vars_restart_enddef
Exit netCDF define mode.
character(len=h_mid), public atmos_dyn_restart_out_title
title of the output file
logical, public atmos_phy_ch_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
character(len=h_short), public atmos_phy_cp_restart_out_dtype
REAL4 or REAL8.
character(len=h_short), public urban_restart_out_dtype
REAL4 or REAL8.
logical, public restart_output
Output restart file?
subroutine, public land_vars_restart_create
Create land restart file.
logical, public atmos_restart_output
Output restart file?
subroutine, public ocean_vars_restart_create
Create ocean restart file.
module Atmosphere / Physics Radiation
subroutine, public urban_vars_restart_write
Write urban restart.
subroutine, public land_vars_restart_read
Read land restart.
character(len=h_long), public atmos_phy_rd_restart_out_basename
Basename of the output file.
character(len=h_long), public atmos_phy_tb_restart_in_basename
Basename of the input file.
module ATMOSPHERIC Surface Variables
subroutine, public urban_vars_restart_close
Close restart file.
character(len=h_mid), public atmos_phy_mp_restart_out_title
title of the output file
logical, public io_nml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:62
character(len=h_long), public urban_restart_out_basename
Basename of the output file.
subroutine, public admin_restart_setup
Setup.
logical, public atmos_phy_tb_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
logical, public atmos_phy_ch_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
character(len=h_long), public atmos_phy_mp_restart_out_basename
Basename of the output file.
logical, public atmos_dyn_restart_output
output restart file?
logical, public land_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
logical, public ocean_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
logical, public atmos_phy_ch_restart_output
output restart file?
character(len=h_long), public land_restart_out_basename
Basename of the output file.
character(len=h_short), public atmos_phy_ch_restart_out_dtype
REAL4 or REAL8.
character(len=h_long), public atmos_phy_ch_restart_out_basename
Basename of the output file.
logical, public atmos_do
subroutine, public land_vars_restart_def_var
Define land variables in restart file.
character(len=h_long), public atmos_phy_sf_restart_in_basename
Basename of the input file.
logical, public ocean_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
character(len=h_short), public atmos_phy_sf_restart_out_dtype
REAL4 or REAL8.
character(len=h_mid), public atmos_phy_sf_restart_out_title
title of the output file
module PROCESS
module Ocean admin
logical, public atmos_phy_rd_restart_output
output restart file?
character(len=h_mid), public atmos_phy_ae_restart_out_title
title of the output file
logical, public atmos_phy_mp_restart_output
output restart file?
character(len=h_long), public restart_out_basename
Basename of the output file.
module Atmosphere / Physics Turbulence
logical, public atmos_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
subroutine, public ocean_vars_restart_read
Read ocean restart.
module LAND Variables
logical, public atmos_phy_sf_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
module administrator for restart
character(len=h_short), public atmos_phy_ae_restart_out_dtype
REAL4 or REAL8.
character(len=h_short), public atmos_phy_mp_restart_out_dtype
REAL4 or REAL8.
character(len=h_short), public atmos_phy_rd_restart_out_dtype
REAL4 or REAL8.
logical, public time_dourban_restart
execute urban restart output in this step?
logical, public urban_restart_output
Output restart file?
module Atmosphere / Physics Chemistry
logical, public land_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
subroutine, public atmos_vars_restart_create
Create atmospheric restart file.
subroutine, public admin_restart_write
Write data to restart files.
subroutine, public atmos_vars_restart_enddef
Exit netCDF define mode.
module profiler
Definition: scale_prof.F90:10
character(len=h_mid), public land_restart_out_title
Title of the output file.
character(len=h_mid), public atmos_restart_out_title
Title of the output file.
subroutine, public urban_vars_restart_open
Open urban restart file for read.
character(len=h_long), public atmos_phy_tb_restart_out_basename
Basename of the output file.
logical, public urban_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
logical, public restart_in_postfix_timelabel
Add timelabel to the basename of input file?
logical, public atmos_phy_tb_restart_output
output restart file?
character(len=h_long), public atmos_restart_in_basename
Basename of the input file.
character(len=h_long), public restart_in_basename
Basename of the input file.
module PRECISION
character(len=h_long), public atmos_restart_out_basename
Basename of the output file.
logical, public atmos_phy_sf_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
character(len=h_long), public ocean_restart_in_basename
Basename of the input file.
logical, public time_doland_restart
execute land restart output in this step?
character(len=h_short), public restart_out_dtype
REAL4 or REAL8.
module ADMIN TIME
subroutine, public urban_vars_restart_def_var
Define urban variables in restart file.
character(len=h_mid), public restart_out_title
Title of the output file.
subroutine, public land_vars_restart_open
Open land restart file for read.
character(len=h_long), public ocean_restart_out_basename
Basename of the output file.
integer, public io_fid_conf
Config file ID.
Definition: scale_stdio.F90:55
subroutine, public atmos_vars_restart_def_var
Define atmospheric variables in restart file.
logical, public restart_run
Is this run restart?
logical, public ocean_restart_output
Output restart file?
integer, public io_fid_log
Log file ID.
Definition: scale_stdio.F90:56
subroutine, public ocean_vars_restart_close
Close restart file.
subroutine, public land_vars_restart_write
Write land variables to restart file.
character(len=h_short), public atmos_phy_tb_restart_out_dtype
REAL4 or REAL8.
character(len=h_long), public atmos_phy_ae_restart_out_basename
Basename of the output file.
module Urban admin
logical, public urban_do
module ATMOSPHERE / Physics Aerosol Microphysics
module OCEAN Variables
integer, public io_fid_nml
Log file ID (only for output namelist)
Definition: scale_stdio.F90:57
logical, public land_do
logical, public atmos_phy_mp_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
subroutine, public atmos_vars_restart_read
Read restart of atmospheric variables.
subroutine, public admin_restart_read
Read from restart files.
character(len=h_long), public urban_restart_in_basename
Basename of the input file.
character(len=h_long), public atmos_phy_ch_restart_in_basename
Basename of the input file.
character(len=h_mid), public ocean_restart_out_title
Title of the output file.
logical, public atmos_phy_rd_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
character(len=h_mid), public urban_restart_out_title
Title of the output file.
character(len=h_long), public atmos_dyn_restart_out_basename
Basename of the output file.
logical, public atmos_phy_sf_restart_output
output restart file?