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
27 
28  !-----------------------------------------------------------------------------
29  !
30  !++ Public parameters & variables
31  !
32  !-----------------------------------------------------------------------------
33  !
34  !++ Private procedure
35  !
36  !-----------------------------------------------------------------------------
37  !
38  !++ Private parameters & variables
39  !
40  logical, public :: restart_run = .false.
41  logical, public :: restart_output = .false.
42 
43  character(len=H_LONG), public :: restart_in_basename = ''
44  character(len=H_LONG), public :: restart_out_basename = ''
45  character(len=H_MID), public :: restart_out_title = ''
46  character(len=H_MID), public :: restart_out_dtype = 'DEFAULT'
47 
48  !-----------------------------------------------------------------------------
49 contains
50  !-----------------------------------------------------------------------------
52  subroutine admin_restart_setup
53  use scale_process, only: &
55  use mod_atmos_vars, only: &
61  use mod_atmos_dyn_vars, only: &
67  use mod_atmos_phy_cp_vars, only: &
73  use mod_atmos_phy_mp_vars, only: &
79  use mod_atmos_phy_rd_vars, only: &
85  use mod_atmos_phy_sf_vars, only: &
91  use mod_atmos_phy_tb_vars, only: &
97  use mod_atmos_phy_ch_vars, only: &
103  use mod_atmos_phy_ae_vars, only: &
109  use mod_ocean_vars, only: &
115  use mod_land_vars, only: &
121  use mod_urban_vars, only: &
127 
128  implicit none
129 
130  namelist / param_restart / &
131  restart_run, &
132  restart_output, &
137 
138  integer :: ierr
139  !---------------------------------------------------------------------------
140 
141  if( io_l ) write(io_fid_log,*)
142  if( io_l ) write(io_fid_log,*) '++++++ Module[ADMIN] / Categ[RESTART] / Origin[SCALE-RM]'
143 
144  !--- read namelist
145  rewind(io_fid_conf)
146  read(io_fid_conf,nml=param_restart,iostat=ierr)
147  if( ierr < 0 ) then !--- missing
148  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
149  elseif( ierr > 0 ) then !--- fatal error
150  write(*,*) 'xxx Not appropriate names in namelist PARAM_RESTART. Check!'
151  call prc_mpistop
152  endif
153  if( io_lnml ) write(io_fid_log,nml=param_restart)
154 
155  !--- set default output switch
168 
169  !--- set default input filename
170  if ( restart_in_basename /= '' ) then
183  endif
184 
185  !--- set default output filename
186  if ( restart_out_basename /= '' ) then
199  endif
200 
201  !--- set default output title
202  if ( restart_out_title /= '' ) then
215  endif
216 
217  !--- set default output data type
218  if ( restart_out_dtype /= '' ) then
231  endif
232 
233  return
234  end subroutine admin_restart_setup
235 
236  subroutine admin_restart
237  use mod_ocean_vars, only: &
238  ocean_sw_restart => ocean_restart_output, &
244  use mod_land_vars, only: &
245  land_sw_restart => land_restart_output, &
251  use mod_urban_vars, only: &
252  urban_sw_restart => urban_restart_output, &
258  use mod_atmos_vars, only: &
259  atmos_sw_restart => atmos_restart_output, &
265  use mod_admin_time, only: &
270  implicit none
271 
272  ! restart files can be different for different models
273 
274  ! cread restart netCDF file
275  if( ocean_sw_restart .AND. time_doocean_restart ) call ocean_vars_restart_create
276  if( land_sw_restart .AND. time_doland_restart ) call land_vars_restart_create
277  if( urban_sw_restart .AND. time_dourban_restart ) call urban_vars_restart_create
278  if( atmos_sw_restart .AND. time_doatmos_restart ) call atmos_vars_restart_create
279 
280  ! define metadata in netCDF file
281  if( ocean_sw_restart .AND. time_doocean_restart ) call ocean_vars_restart_def_var
282  if( land_sw_restart .AND. time_doland_restart ) call land_vars_restart_def_var
283  if( urban_sw_restart .AND. time_dourban_restart ) call urban_vars_restart_def_var
284  if( atmos_sw_restart .AND. time_doatmos_restart ) call atmos_vars_restart_def_var
285 
286  ! exit define mode
287  if( ocean_sw_restart .AND. time_doocean_restart ) call ocean_vars_restart_enddef
288  if( land_sw_restart .AND. time_doland_restart ) call land_vars_restart_enddef
289  if( urban_sw_restart .AND. time_dourban_restart ) call urban_vars_restart_enddef
290  if( atmos_sw_restart .AND. time_doatmos_restart ) call atmos_vars_restart_enddef
291 
292  ! write variabes to netCDF file
293  if( ocean_sw_restart .AND. time_doocean_restart ) call ocean_vars_restart_write_var
294  if( land_sw_restart .AND. time_doland_restart ) call land_vars_restart_write_var
295  if( urban_sw_restart .AND. time_dourban_restart ) call urban_vars_restart_write_var
296  if( atmos_sw_restart .AND. time_doatmos_restart ) call atmos_vars_restart_write_var
297 
298  ! clode the restart file
299  if( ocean_sw_restart .AND. time_doocean_restart ) call ocean_vars_restart_close
300  if( land_sw_restart .AND. time_doland_restart ) call land_vars_restart_close
301  if( urban_sw_restart .AND. time_dourban_restart ) call urban_vars_restart_close
302  if( atmos_sw_restart .AND. time_doatmos_restart ) call atmos_vars_restart_close
303 
304  end subroutine admin_restart
305 
306 end module mod_admin_restart
character(len=h_mid), public ocean_restart_out_dtype
REAL4 or REAL8.
character(len=h_mid), public restart_out_dtype
REAL4 or REAL8.
character(len=h_long), public atmos_phy_ae_restart_in_basename
basename of the restart file
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 restart file
character(len=h_long), public atmos_dyn_restart_in_basename
basename of the restart file
subroutine, public atmos_vars_restart_close
Close restart file.
character(len=h_long), public atmos_phy_rd_restart_in_basename
basename of the restart 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:59
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 restart file
module Atmosphere / Dynamics
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?
module ATMOSPHERIC Variables
character(len=h_long), public atmos_phy_cp_restart_out_basename
basename of the output file
module STDIO
Definition: scale_stdio.F90:12
logical, public time_doatmos_restart
execute atmosphere restart output in this step?
logical, public time_doocean_restart
execute ocean restart output in this step?
subroutine, public ocean_vars_restart_def_var
Define ocean variables in restart file.
subroutine, public land_vars_restart_enddef
Exit netCDF define mode.
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 restart file
module URBAN Variables
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
subroutine, public urban_vars_restart_write_var
Write urban restart.
character(len=h_mid), public atmos_phy_sf_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
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 restart file
character(len=h_mid), public atmos_phy_tb_restart_out_dtype
REAL4 or REAL8.
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
character(len=h_long), public urban_restart_out_basename
basename of the output file
subroutine, public admin_restart_setup
Setup.
character(len=h_mid), public atmos_restart_out_dtype
REAL4 or REAL8.
subroutine, public land_vars_restart_write_var
Write land variables to restart 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?
subroutine, public ocean_vars_restart_write_var
Write ocean variables to restart 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_long), public atmos_phy_ch_restart_out_basename
basename of the output file
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 restart file
character(len=h_mid), public atmos_phy_sf_restart_out_title
title of the output file
module PROCESS
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
character(len=h_mid), public atmos_phy_ae_restart_out_dtype
REAL4 or REAL8.
character(len=h_mid), public atmos_phy_ch_restart_out_dtype
REAL4 or REAL8.
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
module LAND Variables
module administrator for restart
character(len=h_mid), public atmos_phy_rd_restart_out_dtype
REAL4 or REAL8.
character(len=h_mid), public atmos_phy_mp_restart_out_dtype
REAL4 or REAL8.
subroutine, public atmos_vars_restart_write_var
Write restart of atmospheric variables.
character(len=h_mid), public urban_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
character(len=h_mid), public land_restart_out_dtype
REAL4 or REAL8.
subroutine, public atmos_vars_restart_create
Create atmospheric restart file.
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
character(len=h_long), public atmos_phy_tb_restart_out_basename
basename of the output file
logical, public io_lnml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:60
logical, public atmos_phy_tb_restart_output
output restart file?
character(len=h_long), public atmos_restart_in_basename
basename of the restart file
character(len=h_long), public restart_in_basename
basename of the restart file
module PRECISION
character(len=h_long), public atmos_restart_out_basename
basename of the output 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?
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 admin_restart
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.
character(len=h_mid), public atmos_dyn_restart_out_dtype
REAL4 or REAL8.
character(len=h_long), public atmos_phy_ae_restart_out_basename
basename of the output file
module ATMOSPHERE / Physics Aerosol Microphysics
character(len=h_mid), public atmos_phy_cp_restart_out_dtype
REAL4 or REAL8.
module OCEAN Variables
character(len=h_long), public urban_restart_in_basename
basename of the restart file
character(len=h_long), public atmos_phy_ch_restart_in_basename
basename of the restart file
character(len=h_mid), public ocean_restart_out_title
title of the 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?