12#include "scaleFElib.h"
25 use scale_file_history,
only: &
26 file_history_set_nowdate
28 file_monitor_meshfield_write
65 character(len=H_MID),
private,
parameter :: MODELNAME =
"SCALE-DG ver. "//version
67 type(AtmosComponent) :: atmos
68 type(OceanComponent) :: ocean
69 type(CouplerComponent) :: coupler
75 comm_world, cnf_fname, &
80 time_nowdate, time_nowsubsec, time_nowstep, time_nstep, &
85 integer,
intent(in) :: comm_world
86 character(len=*),
intent(in) :: cnf_fname
87 character(len=*),
intent(in) :: path
88 logical,
intent(in) :: add_path
91 integer :: fpm_counter
99 if ( add_path .and. path /=
"" )
then
100 call io_setup( modelname, trim(path)//cnf_fname, prefix=path )
102 call io_setup( modelname, trim(path)//cnf_fname )
106 call prc_local_setup( comm_world, &
111 call io_log_setup( myrank, ismaster )
124 log_progress(*)
'START TIMESTEP'
125 call prof_setprefx(
'MAIN')
126 call prof_rapstart(
'Main_Loop', 0)
139 call file_monitor_meshfield_write(
'MAIN', time_nowstep)
146 call file_history_set_nowdate( time_nowdate, time_nowsubsec, time_nowstep )
151 call user_%update_pre( atmos )
153 if ( ocean%IsActivated() .and. ocean%time_manager%do_step )
call ocean%update()
154 if ( atmos%IsActivated() .and. atmos%time_manager%do_step )
call atmos%update()
155 call user_%update( atmos )
158 if ( atmos%IsActivated() )
call atmos%vars%Monitor()
160 call file_monitor_meshfield_write(
'MAIN', time_nowstep)
165 if ( atmos %IsActivated() .and. atmos%time_manager%do_step )
call atmos%calc_tendency( force=.false. )
166 if ( ocean %IsActivated() .and. ocean%time_manager%do_step )
call ocean%calc_tendency( force=.false. )
167 if ( coupler%IsActivated() .and. atmos%time_manager%do_step )
call atmos%calc_tendency_from_sflux(force=.false.)
168 call user_%calc_tendency( atmos )
172 if ( atmos%IsActivated() )
call atmos%vars%History()
173 if ( atmos%dyn_proc%IsActivated() )
call atmos%dyn_proc%dyn_vars%History()
174 if ( atmos%phy_tb_proc%IsActivated() )
call atmos%phy_tb_proc%vars%History()
175 if ( atmos%phy_mp_proc%IsActivated() )
call atmos%phy_mp_proc%vars%History()
176 if ( atmos%phy_sfc_proc%IsActivated() )
call atmos%phy_sfc_proc%vars%History()
177 if ( atmos%phy_rd_proc%IsActivated() )
call atmos%phy_rd_proc%vars%History()
178 if ( atmos%phy_bl_proc%IsActivated() )
call atmos%phy_bl_proc%vars%History()
179 if ( atmos%phy_cp_proc%IsActivated() )
call atmos%phy_cp_proc%vars%History()
181 if ( ocean%IsActivated() )
call ocean%vars%History()
188 if( io_l )
call flush(io_fid_log)
191 call prof_rapend(
'Main_Loop', 0)
193 log_progress(*)
'END TIMESTEP'
209 subroutine initialize()
211 use scale_const,
only: const_setup
212 use scale_calendar,
only: calendar_setup
213 use scale_random,
only: random_setup
214 use scale_atmos_hydrometeor,
only: atmos_hydrometeor_setup
226 file_monitor_meshfield_setup
237 call prof_setprefx(
'INIT')
238 call prof_rapstart(
'Initialize', 0)
250 call atmos_hydrometeor_setup
255 setup_timeintegration = .true., &
262 call file_monitor_meshfield_setup( time_dtsec )
268 call user_%setup( atmos )
270 call coupler%evaluate_activation( ocean )
271 call atmos%set_coupler( coupler )
272 call ocean%set_coupler( coupler )
274 call atmos%setup_vars()
276 if ( ocean%IsActivated() )
call ocean%setup_vars()
277 if ( coupler%IsActivated() )
call coupler%setup_vars( atmos%mesh%ptr_mesh, ocean%mesh%ptr_mesh )
284 call prof_rapend(
'Initialize', 0)
287 end subroutine initialize
290 subroutine finalize()
291 use scale_file,
only: &
298 file_monitor_meshfield_final
304 call prof_setprefx(
'FIN')
305 call prof_rapstart(
'All', 1)
307 call prof_rapstart(
'Monit', 2)
308 call file_monitor_meshfield_final
309 call prof_rapend (
'Monit', 2)
312 call prof_rapstart(
'File', 2)
315 call prof_rapend (
'File', 2)
318 call atmos%finalize()
319 call ocean%finalize()
320 call coupler%finalize()
326 call prof_rapend (
'All', 1)
330 end subroutine finalize
333 subroutine restart_read()
339 if ( atmos%isActivated() )
then
340 call atmos%vars%Read_restart_file( atmos%mesh, atmos%dyn_proc%dyncore_driver )
341 if ( atmos%phy_rd_proc%IsActivated() )
call atmos%phy_rd_proc%vars%Read_restart_file()
343 if ( ocean%isActivated() )
then
344 call ocean%vars%Read_restart_file( ocean%mesh )
349 if ( atmos%isActivated() )
call atmos%set_surface( countup=.false. )
350 if ( ocean%isActivated() )
call ocean%set_surface( countup=.false. )
354 if ( atmos%IsActivated() )
call atmos%calc_tendency( force= .true. )
355 if ( ocean%IsActivated() )
call ocean%calc_tendency( force= .true. )
356 if ( coupler%IsActivated() )
call atmos%calc_tendency_from_sflux(force=.true.)
358 call user_%calc_tendency( atmos )
362 if ( atmos%isActivated() )
then
363 call atmos%vars%History()
364 if ( atmos%phy_sfc_proc%IsActivated() )
call atmos%phy_sfc_proc%vars%History()
365 if ( atmos%phy_tb_proc%IsActivated() )
call atmos%phy_tb_proc%vars%History()
366 if ( atmos%phy_mp_proc%IsActivated() )
call atmos%phy_mp_proc%vars%History()
367 if ( atmos%phy_rd_proc%IsActivated() )
call atmos%phy_rd_proc%vars%History()
368 if ( atmos%phy_bl_proc%IsActivated() )
call atmos%phy_bl_proc%vars%History()
369 if ( atmos%phy_cp_proc%IsActivated() )
call atmos%phy_cp_proc%vars%History()
370 call atmos%vars%Monitor()
373 if ( ocean%isActivated() )
then
374 call ocean%vars%History()
378 end subroutine restart_read
381 subroutine restart_write()
386 logical :: is_restart_write_atmos
387 logical :: is_restart_write_ocean
392 is_restart_write_atmos = atmos%isActivated() .and. atmos%time_manager%do_restart
393 is_restart_write_ocean = ocean%isActivated() .and. ocean%time_manager%do_restart
396 if ( is_restart_write_atmos )
then
397 call atmos%vars%Write_restart_file_prep()
398 if ( atmos%phy_rd_proc%IsActivated() )
call atmos%phy_rd_proc%vars%Write_restart_file_prep()
400 if ( is_restart_write_ocean )
then
401 call ocean%vars%Write_restart_file_prep()
405 if ( is_restart_write_atmos )
then
406 call atmos%vars%Write_restart_file()
407 if ( atmos%phy_rd_proc%IsActivated() )
call atmos%phy_rd_proc%vars%Write_restart_file()
409 if ( is_restart_write_ocean )
then
410 call ocean%vars%Write_restart_file()
414 if ( is_restart_write_atmos )
then
415 call atmos%vars%Write_restart_file_post()
416 if ( atmos%phy_rd_proc%IsActivated() )
call atmos%phy_rd_proc%vars%Write_restart_file_post()
418 if ( is_restart_write_ocean )
call ocean%vars%Write_restart_file_post()
421 end subroutine restart_write
module Atmosphere component
module SCALE-DG (a main routine of regional/global model)
subroutine, public dg_driver(comm_world, cnf_fname, path, add_path)
module FElib / File / History
subroutine, public file_history_meshfield_write()
Write history data to the file.
subroutine, public file_history_meshfield_finalize()
Finalize the file history module.
module FElib / File / Monitor
module FElib / File / Restart
subroutine, public file_restart_meshfield_finalize()
Finalize the main restart file.
subroutine, public file_restart_meshfield_setup()
Setup the main restart file.
type(file_restart_meshfield), public restart_file
An object to manage main restart file.
module FElib / Data / Statistics
subroutine, public meshfield_statistics_setup()
Setup.
subroutine, public time_manager_advance()
subroutine, public time_manager_report_timeintervals()
subroutine, public time_manager_checkstate()
subroutine, public time_manager_final()
logical, public time_doend
logical, public time_doresume
subroutine, public time_manager_init(setup_timeintegration, restart_in_basename)
Derived type to manage atmospheric component.
Derived type to manage coupler component.
Derived type to manage oceanic component.