22 use scale_const,
only: &
24 rplanet => const_radius
60 integer,
parameter,
public ::
i_flat = 2
72 private :: mktopo_flat
73 private :: mktopo_bellshape
74 private :: mktopo_schaer_type_mountain
75 private :: mktopo_bellshape_global
76 private :: mktopo_barocwave_global_jw2006
82 character(len=H_LONG) :: out_basename =
''
83 character(len=H_MID) :: out_varname =
'topo'
84 character(len=H_MID) :: out_title =
'SCALE-DG TOPOGRAPHY'
85 character(len=H_SHORT) :: out_dtype =
'DEFAULT'
94 character(len=H_SHORT) :: toponame =
'NONE'
96 namelist / param_mktopo / &
98 out_basename, out_varname, &
106 log_info(
"MKTOPO_setup",*)
'Setup'
110 read(io_fid_conf,nml=param_mktopo,iostat=ierr)
112 log_info(
"MKTOPO_setup",*)
'Not found namelist. Default used.'
113 elseif( ierr > 0 )
then
114 log_error(
"MKTOPO_setup",*)
'Not appropriate names in namelist PARAM_MKTOPO. Check!'
117 log_nml(param_mktopo)
119 select case(trim(toponame))
130 case(
'BELLSHAPE_GLOBAL')
132 case(
'SCHAER_GLOBAL')
134 case(
'BAROCWAVE_GLOBAL_JW2006')
137 log_error(
"MKTOPO_setup",*)
'Not appropriate toponame. Check!', toponame
147 subroutine mktopo( output, model_mesh, topography )
151 logical,
intent(out) :: output
152 class(
atmosmesh),
target,
intent(in) :: model_mesh
163 mesh => model_mesh%ptr_mesh
167 log_progress(*)
'skip making topography data'
171 log_progress(*)
'start making topography data'
173 call prof_rapstart(
'_MkTOPO_main', 3)
175 call mesh%GetMesh2D( mesh2d )
179 call mktopo_input_file( mesh2d, topography%topo )
181 call mktopo_flat( mesh2d, topography%topo )
183 call mktopo_bellshape( mesh2d, topography%topo )
185 call mktopo_schaer_type_mountain( mesh2d, topography%topo )
187 call mktopo_bellshape_global( mesh2d, topography%topo )
189 call mktopo_schaer_type_global( mesh2d, topography%topo )
191 call mktopo_barocwave_global_jw2006( mesh2d, topography%topo )
194 call prof_rapend (
'_MkTOPO_main', 3)
195 log_progress(*)
'end making topography data'
208 use scale_time,
only: &
209 nowdate => time_nowdate, &
210 nowsubsec => time_nowsubsec, &
211 nowdaysec => time_nowdaysec
212 use scale_prc,
only: prc_myrank
221 class(
atmosmesh),
target,
intent(in) :: model_mesh
227 logical :: file_existed
228 integer,
parameter :: vid_topo = 1
232 call model_mesh%ptr_mesh%GetMesh2D( mesh )
235 call file%Init( 1, meshcubedsphere2d=mesh )
237 call file%Init( 1, mesh2d=mesh )
240 call file%Create( out_basename, out_title, out_dtype, &
244 if ( .not. file_existed )
then
245 call file%Put_GlobalAttribute_time( nowdate, nowsubsec )
248 call file%Def_Var( topography%topo,
"TOPOGRAPHY", vid_topo, mftype2d_xy,
'XY' )
250 call file%Write_var2D( vid_topo, topography%topo, nowdaysec, nowdaysec )
263 subroutine mktopo_input_file( mesh, topo )
275 character(len=H_LONG) :: in_basename
276 character(len=H_MID) :: varname
278 namelist / param_mktopo_input_file / &
289 logical :: file_existed
292 log_info(
"MKTOPO_input_file",*)
'Setup'
296 read(io_fid_conf,nml=param_mktopo_input_file,iostat=ierr)
298 log_info(
"MKTOPO_input_file",*)
'Not found namelist. Default used.'
299 elseif( ierr > 0 )
then
300 log_error(
"MKTOPO_input_file",*)
'Not appropriate names in namelist PARAM_MKTOPO_INPUT_FILE. Check!'
303 log_nml(param_mktopo_input_file)
309 call file%Init( 1, meshcubedsphere2d=mesh )
311 call file%Init( 1, mesh2d=mesh )
314 call file%Open( in_basename, myrank=prc_myrank)
315 call file%Read_Var( mftype2d_xy, varname, topo )
321 end subroutine mktopo_input_file
328 subroutine mktopo_flat( mesh, topo )
331 class(meshbase2d),
intent(in),
target :: mesh
335 real(rp) :: flat_height = 100.0_rp
337 namelist / param_mktopo_flat / &
346 log_info(
"MKTOPO_flat",*)
'Setup'
350 read(io_fid_conf,nml=param_mktopo_flat,iostat=ierr)
352 log_info(
"MKTOPO_flat",*)
'Not found namelist. Default used.'
353 elseif( ierr > 0 )
then
354 log_error(
"MKTOPO_flat",*)
'Not appropriate names in namelist PARAM_MKTOPO_FLAT. Check!'
357 log_nml(param_mktopo_flat)
359 do n=1, mesh%LOCAL_MESH_NUM
360 lmesh2d => mesh%lcmesh_list(n)
362 do ke2d=lmesh2d%NeS, lmesh2d%NeE
363 topo%local(n)%val(:,ke2d) = flat_height
368 end subroutine mktopo_flat
375 subroutine mktopo_bellshape( mesh, topo )
378 class(meshbase2d),
intent(in),
target :: mesh
382 real(rp) :: bell_cx = 0.0e0_rp
383 real(rp) :: bell_cy = 0.0e3_rp
384 real(rp) :: bell_r = 2.e3_rp
385 real(rp) :: bell_height = 100.0_rp
386 logical :: bell_quasi_2d = .false.
387 namelist / param_mktopo_bellshape / &
400 real(rp),
allocatable :: r2(:)
401 real(rp) :: fac_y_quasi2d
404 log_info(
"MKTOPO_bellshape",*)
'Setup'
408 read(io_fid_conf,nml=param_mktopo_bellshape,iostat=ierr)
410 log_info(
"MKTOPO_bellshape",*)
'Not found namelist. Default used.'
411 elseif( ierr > 0 )
then
412 log_error(
"MKTOPO_bellshape",*)
'Not appropriate names in namelist PARAM_MKTOPO_BELLSHAPE. Check!'
415 log_nml(param_mktopo_bellshape)
417 if ( bell_quasi_2d )
then
418 fac_y_quasi2d = 0.0_rp
420 fac_y_quasi2d = 1.0_rp
423 do n=1, mesh%LOCAL_MESH_NUM
424 lmesh2d => mesh%lcmesh_list(n)
425 elem => lmesh2d%refElem2D
427 allocate( r2(elem%Np) )
429 do ke2d=lmesh2d%NeS, lmesh2d%NeE
430 r2(:) = ( ( lmesh2d%pos_en(:,ke2d,1) - bell_cx )**2 &
431 + fac_y_quasi2d * ( lmesh2d%pos_en(:,ke2d,2) - bell_cy )**2 ) &
433 topo%local(n)%val(:,ke2d) = bell_height / ( 1.0_rp + r2(:) )
439 end subroutine mktopo_bellshape
448 subroutine mktopo_schaer_type_mountain( mesh, topo )
451 class(meshbase2d),
intent(in),
target :: mesh
455 real(rp) :: schaer_cx = 25.e3_rp
456 real(rp) :: schaer_rx = 5.e3_rp
457 real(rp) :: schaer_lambda = 4.e3_rp
458 real(rp) :: schaer_height = 250.0_rp
459 namelist / param_mktopo_schaer / &
471 real(rp),
allocatable :: dist(:)
472 real(rp) :: fac_y_quasi2d
475 log_info(
"MKTOPO_Schaer",*)
'Setup'
479 read(io_fid_conf,nml=param_mktopo_schaer,iostat=ierr)
481 log_info(
"MKTOPO_Schaer",*)
'Not found namelist. Default used.'
482 elseif( ierr > 0 )
then
483 log_error(
"MKTOPO_Schaer",*)
'Not appropriate names in namelist PARAM_MKTOPO_SCAHER. Check!'
486 log_nml(param_mktopo_schaer)
488 do n=1, mesh%LOCAL_MESH_NUM
489 lmesh2d => mesh%lcmesh_list(n)
490 elem => lmesh2d%refElem2D
492 allocate( dist(elem%Np) )
494 do ke2d=lmesh2d%NeS, lmesh2d%NeE
495 dist(:) = exp( - ( lmesh2d%pos_en(:,ke2d,1) - schaer_cx )**2 / schaer_rx**2 )
496 topo%local(n)%val(:,ke2d) = schaer_height * dist(:) * ( cos( pi * ( lmesh2d%pos_en(:,ke2d,1) - schaer_cx ) / schaer_lambda ) )**2
502 end subroutine mktopo_schaer_type_mountain
507 subroutine mktopo_bellshape_global( mesh, topo )
510 class(meshbase2d),
intent(in),
target :: mesh
514 real(rp) :: bell_clon = 0.0e0_rp
515 real(rp) :: bell_clat = 0.0e0_rp
516 real(rp) :: bell_r = 2.e3_rp
517 real(rp) :: bell_height = 100.0_rp
518 namelist / param_mktopo_bellshape_global / &
530 real(rp),
allocatable :: r(:)
533 log_info(
"MKTOPO_bellshape_global",*)
'Setup'
537 read(io_fid_conf,nml=param_mktopo_bellshape_global,iostat=ierr)
539 log_info(
"MKTOPO_bellshape_global",*)
'Not found namelist. Default used.'
540 elseif( ierr > 0 )
then
541 log_error(
"MKTOPO_bellshape_global",*)
'Not appropriate names in namelist PARAM_MKTOPO_BELLSHAPE_GLOBAL. Check!'
544 log_nml(param_mktopo_bellshape_global)
546 do n=1, mesh%LOCAL_MESH_NUM
547 lmesh2d => mesh%lcmesh_list(n)
548 elem => lmesh2d%refElem2D
550 allocate( r(elem%Np) )
552 do ke2d=lmesh2d%NeS, lmesh2d%NeE
553 r(:) = rplanet / bell_r &
554 * acos( sin(bell_clat) * sin(lmesh2d%lat(:,ke2d)) &
555 + cos(bell_clat) * cos(lmesh2d%lat(:,ke2d)) * cos(lmesh2d%lon(:,ke2d) - bell_clon) )
556 topo%local(n)%val(:,ke2d) = bell_height / ( 1.0_rp + r(:)**2 )
562 end subroutine mktopo_bellshape_global
570 subroutine mktopo_schaer_type_global( mesh, topo )
573 class(meshbase2d),
intent(in),
target :: mesh
577 real(rp) :: schaer_clon
578 real(rp) :: schaer_clat
580 real(rp) :: schaer_lambda
581 integer :: schaer_shape_id
582 real(rp) :: schaer_height
583 logical :: quasi_2d_flag
585 namelist / param_mktopo_schaer_global / &
600 real(rp),
allocatable :: r(:)
601 real(rp),
allocatable :: mwt_shape(:)
605 log_info(
"MKTOPO_Schaer_global",*)
'Setup'
607 schaer_clon = 1.0_rp / 4.0_rp * pi
609 schaer_r = rplanet * 3.0_rp / 4.0_rp * pi
610 schaer_lambda = rplanet * pi / 16.0_rp
612 schaer_height = 2000.0_rp
613 quasi_2d_flag = .false.
617 read(io_fid_conf,nml=param_mktopo_schaer_global,iostat=ierr)
619 log_info(
"MKTOPO_Schaer_global",*)
'Not found namelist. Default used.'
620 elseif( ierr > 0 )
then
621 log_error(
"MKTOPO_Schaer_global",*)
'Not appropriate names in namelist PARAM_MKTOPO_SCHAER_GLOBAL. Check!'
624 log_nml(param_mktopo_schaer_global)
626 do n=1, mesh%LOCAL_MESH_NUM
627 lmesh2d => mesh%lcmesh_list(n)
628 elem => lmesh2d%refElem2D
630 allocate( r(elem%Np), mwt_shape(elem%Np) )
632 do ke2d=lmesh2d%NeS, lmesh2d%NeE
633 if ( quasi_2d_flag )
then
635 r(:) = rplanet * abs(lmesh2d%lon(:,ke2d) - schaer_clon)
638 * acos( sin(schaer_clat) * sin(lmesh2d%lat(:,ke2d)) &
639 + cos(schaer_clat) * cos(lmesh2d%lat(:,ke2d)) * cos(lmesh2d%lon(:,ke2d) - schaer_clon) )
642 if ( schaer_shape_id == 1 )
then
643 mwt_shape(:) = exp( - ( r(:) / schaer_r )**2 )
644 else if ( schaer_shape_id == 2 )
then
645 where ( r(:) < schaer_r )
646 mwt_shape(:) = 0.5_rp * ( 1.0_rp + cos( pi * r(:) / schaer_r ) )
648 mwt_shape(:) = 0.0_rp
652 if ( quasi_2d_flag )
then
653 mwt_shape(:) = mwt_shape(:) * cos(lmesh2d%lat(:,ke2d))
656 topo%local(n)%val(:,ke2d) = schaer_height * mwt_shape(:) * cos( pi * r(:) / schaer_lambda )**2
658 deallocate( r, mwt_shape )
662 end subroutine mktopo_schaer_type_global
671 subroutine mktopo_barocwave_global_jw2006( mesh, topo )
676 class(meshbase2d),
intent(in),
target :: mesh
680 real(rp) :: eta0 = 0.252_rp
681 real(rp) :: u0 = 35.e0_rp
683 namelist / param_mktopo_barocwave_global_jw2006 / &
693 log_info(
"MKTOPO_barocwave_JW2006",*)
'Setup'
697 read(io_fid_conf, nml=param_mktopo_barocwave_global_jw2006, iostat=ierr)
699 log_info(
"MKTOPO_barocwave_JW2006",*)
'Not found namelist. Default used.'
700 elseif( ierr > 0 )
then
701 log_error(
"MKTOPO_barocwave_JW2006",*)
'Not appropriate names in namelist PARAM_MKTOPO_BAROCWAVE_GLOBAL_JW2006. Check!'
704 log_nml(param_mktopo_barocwave_global_jw2006)
706 do n=1, mesh%LOCAL_MESH_NUM
707 lmesh2d => mesh%lcmesh_list(n)
708 elem => lmesh2d%refElem2D
711 do ke2d=lmesh2d%NeS, lmesh2d%NeE
712 call calc_topo( topo%local(n)%val(:,ke2d), &
713 u0, eta0, lmesh2d%lat(:,ke2d), elem%Np )
718 end subroutine mktopo_barocwave_global_jw2006
module ATMOSPHERE component
module Utility for mktopo
subroutine, public mktopoutil_barocwave_global_jw2006_calc_topo(topo, u0, eta0, lat, np)
Calculate a topography for a global test case of idealized baroclinic wave in Jablonowski and William...
integer, parameter, public i_input_file
integer, parameter, public i_barocwave_global_jw2006
integer, parameter, public i_bellshape_global
subroutine, public mktopo_setup
Setup.
subroutine, public mktopo(output, model_mesh, topography)
Driver.
integer, parameter, public i_ignore
subroutine, public mktopo_write(model_mesh, topography)
Output topography data.
integer, parameter, public i_scaer
integer, parameter, public i_flat
integer, public mktopo_type
integer, parameter, public i_scaher_global
integer, parameter, public i_bellshape
module FElib / Element / Base
module FElib / Element / hexahedron
module FElib / File / Base
module FElib / Mesh / Local 2D
module FElib / Mesh / Local 3D
module FElib / Data / base
module FElib / Mesh / Base 2D
integer, public meshbase2d_dimtypeid_xy
module FElib / Mesh / Base 3D
module FElib / Mesh / Cubed-sphere 2D domain
module FElib / Mesh / Rectangle 2D domain
module FElib / Mesh / Topography
module FElib / Data / base
FElib / model framework / variable manager.