11#include "scaleFElib.h"
19 use scale_prc,
only: &
22 use scale_file_h,
only: &
65 type :: file_restart_meshfield
66 type(FILE_base_meshfield) :: base
68 logical :: flag_output
69 character(len=H_LONG) :: in_basename
70 logical :: in_postfix_timelabel
72 character(len=H_LONG) :: out_basename
73 logical :: out_postfix_timelabel
74 character(len=H_MID) :: out_title
75 character(len=H_SHORT) :: out_dtype
76 end type file_restart_meshfield
83 character(len=H_SHORT) :: comp_name
85 procedure :: init1 => file_restart_meshfield_component_init1
86 procedure :: init2 => file_restart_meshfield_component_init2
87 generic :: init => init1, init2
88 procedure :: open => file_restart_meshfield_component_open
89 procedure :: file_restart_meshfield_component_create
90 generic :: create => file_restart_meshfield_component_create
91 procedure :: file_restart_meshfield_component_def_var
92 generic :: def_var => file_restart_meshfield_component_def_var
93 procedure :: end_def => file_restart_meshfield_component_enddef
94 procedure :: file_restart_meshfield_component_write_var2d
95 procedure :: file_restart_meshfield_component_write_var3d
96 generic :: write_var => &
97 file_restart_meshfield_component_write_var2d, &
98 file_restart_meshfield_component_write_var3d
99 procedure :: close => file_restart_meshfield_component_close
100 procedure :: file_restart_meshfield_component_read_var2d
101 procedure :: file_restart_meshfield_component_read_var3d
102 generic :: read_var => &
103 file_restart_meshfield_component_read_var2d, &
104 file_restart_meshfield_component_read_var3d
105 procedure :: final => file_restart_meshfield_component_final
125 logical :: output_flag = .false.
126 character(len=H_LONG) :: in_basename =
''
127 logical :: in_postfix_timelabel = .false.
128 character(len=H_LONG) :: out_basename =
''
129 logical :: out_postfix_timelabel = .true.
130 character(len=H_MID) :: out_title =
''
131 character(len=H_SHORT) :: out_dtype =
'DEFAULT'
133 namelist / param_restart / &
136 in_postfix_timelabel, &
138 out_postfix_timelabel, &
149 read(io_fid_conf,nml=param_restart,iostat=ierr)
151 log_info(
"FILE_restart_meshfield_setup",*)
'Not found namelist. Default used.'
152 elseif( ierr > 0 )
then
153 log_error(
"FILE_restart_meshfield_setup",*)
'Not appropriate names in namelist PARAM_RESTART. Check!'
156 log_nml(param_restart)
161 restart_file%in_postfix_timelabel = in_postfix_timelabel
164 restart_file%out_postfix_timelabel = out_postfix_timelabel
174 subroutine file_restart_meshfield_component_init1( this, &
176 var_num, mesh1D, mesh2D, meshCubedSphere2D, &
177 mesh3D, meshCubedSphere3D )
185 character(*),
intent(in) :: comp_name
186 integer,
intent(in) :: var_num
187 class(
meshbase1d),
target,
optional,
intent(in) :: mesh1d
200 var_num, mesh1d, mesh2d, meshcubedsphere2d, mesh3d, meshcubedsphere3d )
203 end subroutine file_restart_meshfield_component_init1
206 subroutine file_restart_meshfield_component_init2( this, &
208 in_basename, in_postfix_timelabel, &
209 out_basename, out_postfix_timelabel, &
210 out_dtype, out_title, &
213 mesh2D, meshCubedSphere2D, &
214 mesh3D, meshCubedSphere3D )
219 character(*),
intent(in) :: comp_name
220 character(*),
intent(in) :: in_basename
221 logical,
intent(in) :: in_postfix_timelabel
222 character(*),
intent(in) :: out_basename
223 logical,
intent(in) :: out_postfix_timelabel
224 character(*),
intent(in) :: out_title
225 character(*),
intent(in) :: out_dtype
226 integer,
intent(in) :: var_num
227 class(
meshbase1d),
target,
optional,
intent(in) :: mesh1d
233 this%comp_name = comp_name
235 this%in_basename = in_basename
236 this%in_postfix_timelabel = in_postfix_timelabel
238 this%out_basename = out_basename
239 this%out_postfix_timelabel = out_postfix_timelabel
240 this%out_title = out_title
241 this%out_dtype = out_dtype
244 call this%base%Init( var_num, mesh1d, mesh2d, meshcubedsphere2d, mesh3d, meshcubedsphere3d )
247 end subroutine file_restart_meshfield_component_init2
250 subroutine file_restart_meshfield_component_open( &
253 use scale_time,
only: &
259 character(len=19) :: timelabel
260 character(len=H_LONG) :: basename
263 if ( this%in_basename ==
'' )
then
264 log_info(trim(this%comp_name)//
"_vars_restart_open",*)
'restart file is not specified. Check!'
269 if ( this%in_postfix_timelabel )
then
270 call time_gettimelabel( timelabel )
271 basename = trim(this%in_basename)//
'_'//trim(timelabel)
273 basename = trim(this%in_basename)
279 log_info(trim(this%comp_name)//
"_vars_restart_open",*)
'Open restart file'
280 call this%base%open( basename, myrank=prc_myrank )
283 end subroutine file_restart_meshfield_component_open
286 subroutine file_restart_meshfield_component_create( &
289 use scale_time,
only: &
291 nowdate => time_nowdate, &
292 nowsubsec => time_nowsubsec
297 character(len=19) :: timelabel
298 character(len=H_LONG) :: basename
299 character(len=34) :: tunits
300 character(len=H_SHORT) :: calendar
301 logical :: fileexisted
304 if ( this%out_basename ==
'' )
return
309 log_info(trim(this%comp_name)//
"_vars_restart_create",*)
'Create restart file'
311 if ( this%out_postfix_timelabel )
then
312 call time_gettimelabel( timelabel )
313 basename = trim(this%out_basename)//
'_'//trim(timelabel)
315 basename = trim(this%out_basename)
318 log_info(trim(this%comp_name)//
"_vars_restart_create",*)
'basename: ', trim(basename)
321 call this%base%Create( basename, this%out_title, this%out_dtype, &
323 myrank=prc_myrank, tunits=tunits, calendar=calendar )
325 if ( .not. fileexisted )
then
326 call this%base%Put_GlobalAttribute_time( nowdate, nowsubsec )
330 end subroutine file_restart_meshfield_component_create
333 subroutine file_restart_meshfield_component_def_var( this, &
334 field, desc, vid, dim_type_id )
340 character(len=*),
intent(in) :: desc
341 integer,
intent(in) :: vid
342 integer,
intent(in) :: dim_type_id
345 call this%base%Def_var( &
346 field, desc, vid, dim_type_id, this%out_dtype )
349 end subroutine file_restart_meshfield_component_def_var
352 subroutine file_restart_meshfield_component_enddef( this )
358 call this%base%End_def()
360 end subroutine file_restart_meshfield_component_enddef
363 subroutine file_restart_meshfield_component_write_var2d( this, &
366 use scale_time,
only: time_nowdaysec
370 integer,
intent(in) :: vid
374 call this%base%Write_var2D( vid, field2d, time_nowdaysec, time_nowdaysec )
377 end subroutine file_restart_meshfield_component_write_var2d
380 subroutine file_restart_meshfield_component_write_var3d( this, &
383 use scale_time,
only: time_nowdaysec
387 integer,
intent(in) :: vid
391 call this%base%Write_var3D( vid, field3d, time_nowdaysec, time_nowdaysec )
394 end subroutine file_restart_meshfield_component_write_var3d
397 subroutine file_restart_meshfield_component_read_var2d( this, &
398 dim_typeid, varname, field2d, step, allow_missing )
404 integer,
intent(in) :: dim_typeid
405 character(*),
intent(in) :: varname
407 integer,
intent(in),
optional :: step
408 logical,
intent(in),
optional :: allow_missing
411 call this%base%Read_Var( &
412 dim_typeid, varname, field2d, step, allow_missing )
415 end subroutine file_restart_meshfield_component_read_var2d
418 subroutine file_restart_meshfield_component_read_var3d( this, &
419 dim_typeid, varname, field3d, step, allow_missing )
425 integer,
intent(in) :: dim_typeid
426 character(*),
intent(in) :: varname
428 integer,
intent(in),
optional :: step
429 logical,
intent(in),
optional :: allow_missing
432 call this%base%Read_Var( &
433 dim_typeid, varname, field3d, step, allow_missing )
436 end subroutine file_restart_meshfield_component_read_var3d
439 subroutine file_restart_meshfield_component_close( this )
445 if ( this%base%fid /= -1 )
then
447 log_info(trim(this%comp_name)//
"_vars_restart_close",*)
'Close restart file'
448 call this%base%Close()
452 end subroutine file_restart_meshfield_component_close
455 subroutine file_restart_meshfield_component_final( this )
460 call this%base%Final()
463 end subroutine file_restart_meshfield_component_final
module FElib / Element / Base
module FElib / File / Base
module FElib / File / Common
module FElib / File / Restart
subroutine, public file_restart_meshfield_setup()
type(file_restart_meshfield), public restart_file
module FElib / Mesh / Local 1D
module FElib / Mesh / Local 2D
module FElib / Mesh / Local 3D
module FElib / Mesh / Base 1D
integer, public meshbase1d_dimtype_num
integer, public meshbase1d_dimtypeid_x
module FElib / Mesh / Base 2D
integer, public meshbase2d_dimtypeid_x
integer, public meshbase2d_dimtype_num
integer, public meshbase2d_dimtypeid_y
module FElib / Mesh / Base 3D
integer, public meshbase3d_dimtypeid_y
integer, public meshbase3d_dimtypeid_z
integer, public meshbase3d_dimtype_num
integer, public meshbase3d_dimtypeid_x
module FElib / Mesh / Cubic 3D domain
module FElib / Mesh / Cubed-sphere 2D domain
module FElib / Mesh / Cubed-sphere 3D domain
module FElib / Mesh / Rectangle 2D domain
module FElib / Data / base
module FElib / Data / base