13#include "scaleFElib.h"
33 use scale_file_history,
only: &
34 file_history_set_nowdate
69 character(len=H_MID),
private,
parameter :: MODELNAME =
"SCALE-DG ver. "//version
71 type(AtmosComponent) :: atmos
72 type(OceanComponent) :: ocean
73 type(CouplerComponent) :: coupler
78 comm_world, cnf_fname, path, add_path )
82 time_nowdate, time_nowsubsec, time_nowstep, time_nstep, &
87 integer,
intent(in) :: comm_world
88 character(len=*),
intent(in) :: cnf_fname
89 character(len=*),
intent(in) :: path
90 logical,
intent(in) :: add_path
97 logical :: output_topo
104 if ( add_path .and. path /=
"" )
then
105 call io_setup( modelname, trim(path)//cnf_fname, prefix=path )
108 call io_setup( modelname, trim(path)//cnf_fname )
114 call prc_local_setup( comm_world, &
119 call io_log_setup( myrank, ismaster )
126 call prof_setprefx(
'MAIN')
127 call prof_rapstart(
'Main_prep', 0)
132 call prof_rapstart(
'MkTopo',1)
133 call mktopo( output_topo, &
134 atmos%mesh, atmos%mesh%topography )
135 call prof_rapend (
'MkTopo',1)
138 call atmos%mesh%Setup_vcoordinate()
141 call prof_rapstart(
'MkInit',1)
144 atmos%vars%container%PROGVARS_manager, &
145 atmos%vars%container%AUXVARS_manager, &
146 atmos%vars%container%QTRCVARS_manager )
149 call user_%mkinit( atmos )
150 if ( atmos%dyn_proc%dyncore_driver%ENTOT_CONSERVE_SCHEME_FLAG )
then
151 call set_total_energy( atmos%vars%container%PROGVARS_manager, &
152 atmos%vars%container%AUXVARS_manager, atmos%mesh )
155 if ( ocean%IsActivated() )
call user_%mkinit_ocn( ocean )
157 call prof_rapend (
'MkInit',1)
158 call prof_rapend(
'Main_prep', 0)
162 if ( output_topo )
call mktopo_write( atmos%mesh, atmos%mesh%topography )
165 call prof_rapstart(
'MkInit_restart',1)
167 call prof_rapend (
'MkInit_restart',1)
179 subroutine initialize()
181 use scale_const,
only: const_setup
182 use scale_calendar,
only: calendar_setup
183 use scale_random,
only: random_setup
184 use scale_atmos_hydrometeor,
only: atmos_hydrometeor_setup
203 call prof_setprefx(
'INIT')
204 call prof_rapstart(
'Initialize', 0)
217 call atmos_hydrometeor_setup
226 call coupler%evaluate_activation( ocean )
227 call user_%setup( atmos )
229 call atmos%setup_vars()
230 call atmos%set_coupler( coupler )
232 if ( ocean%IsActivated() )
call ocean%setup_vars()
233 if ( coupler%IsActivated() )
call coupler%setup_vars( atmos%mesh%ptr_mesh, ocean%mesh%ptr_mesh )
241 call prof_rapend(
'Initialize', 0)
244 end subroutine initialize
246 subroutine finalize()
255 call prof_setprefx(
'FIN')
256 call prof_rapstart(
'All', 1)
259 call prof_rapstart(
'File', 2)
262 call prof_rapend (
'File', 2)
265 call atmos%finalize()
266 call ocean%finalize()
267 call coupler%finalize()
272 call prof_rapend (
'All', 1)
273 call prof_rapreport()
276 end subroutine finalize
278 subroutine set_total_energy( atm_prgvars_manager, & ! (inout)
279 atm_auxvars_manager, model_mesh )
291 atmosvars_getlocalmeshprgvars
297 class(
atmosmesh),
target,
intent(in) :: model_mesh
308 real(rp),
allocatable :: drhot_save(:,:)
309 real(rp),
allocatable :: rhot_hyd_save(:,:)
312 mesh => model_mesh%ptr_mesh
313 do n=1, mesh%LOCAL_MESH_NUM
314 call atmosvars_getlocalmeshprgvars( n, &
315 mesh, atm_prgvars_manager, atm_auxvars_manager, &
316 ddens, momx, momy, momz, therm, &
317 dens_hyd, pres_hyd, rtot, cvtot, cptot, &
320 allocate( drhot_save(lcmesh3d%refElem3D%Np,lcmesh3d%NeA) )
321 allocate( rhot_hyd_save(lcmesh3d%refElem3D%Np,lcmesh3d%NeA) )
324 do ke=lcmesh3d%NeS, lcmesh3d%NeE
325 drhot_save(:,ke) = therm%val(:,ke)
329 pres_hyd%val, lcmesh3d, lcmesh3d%refElem3D )
332 ddens%val, momx%val, momy%val, momz%val, drhot_save, &
333 dens_hyd%val, pres_hyd%val, rhot_hyd_save, &
334 rtot%val, cvtot%val, cptot%val, &
335 lcmesh3d, lcmesh3d%refElem3D )
337 deallocate( drhot_save )
341 end subroutine set_total_energy
343 subroutine restart_write
346 logical :: is_restart_write_atmos
347 logical :: is_restart_write_ocean
350 is_restart_write_atmos = atmos%IsActivated()
351 is_restart_write_ocean = ocean%IsActivated()
354 if ( is_restart_write_atmos )
then
355 call atmos%vars%Write_restart_file_prep()
356 if ( atmos%phy_rd_proc%IsActivated() )
call atmos%phy_rd_proc%vars%Write_restart_file_prep()
358 if ( is_restart_write_ocean )
call ocean%vars%Write_restart_file_prep()
361 if ( is_restart_write_atmos )
then
362 call atmos%vars%Write_restart_file()
363 if ( atmos%phy_rd_proc%IsActivated() )
call atmos%phy_rd_proc%vars%Write_restart_file()
365 if ( is_restart_write_ocean )
call ocean%vars%Write_restart_file()
368 if ( is_restart_write_atmos )
then
369 call atmos%vars%Write_restart_file_post()
370 if ( atmos%phy_rd_proc%IsActivated() )
call atmos%phy_rd_proc%vars%Write_restart_file_post()
372 if ( is_restart_write_ocean )
call ocean%vars%Write_restart_file_post()
375 end subroutine restart_write
module Atmosphere component
module Atmosphere / Variables
subroutine, public dg_prep(comm_world, cnf_fname, path, add_path)
subroutine, public mkinit_setup
Setup.
subroutine, public mkinit(output, model_mesh, atm_prgvars_manager, atm_auxvars_manager, atm_trcvars_manager)
Driver.
subroutine, public mktopo_setup
Setup.
subroutine, public mktopo(output, model_mesh, topography)
Driver.
subroutine, public mktopo_write(model_mesh, topography)
Output topography data.
module FElib / Fluid dyn solver / Atmosphere / Nonhydrostatic model / Common
subroutine, public atm_dyn_dgm_nonhydro3d_common_drhot2entot(entot, ddens, momx, momy, momz, drhot, dens_hyd, pres_hyd, therm_hyd, rtot, cvtot, cptot, lcmesh, elem3d)
subroutine, public atm_dyn_dgm_nonhydro3d_common_calc_rhot_hyd(rhot_hyd, pres_hyd, lcmesh, elem3d)
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 / Restart
subroutine, public file_restart_meshfield_finalize()
Finalize the main restart file.
subroutine, public file_restart_meshfield_setup()
Setup the main restart file.
module FElib / Mesh / Local 3D
module FElib / Data / base
module FElib / Mesh / Base 3D
FElib / model framework / variable manager.
subroutine, public time_manager_advance()
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 a computational mesh (base class)
Derived type to manage coupler component.
Derived type to manage oceanic component.
Derived type to manage a local 3D computational domain.
Derived type representing a field with local mesh (base type)
Derived type to manage a computational mesh (base type for 3D domain)