11#include "scaleFElib.h"
52 procedure :: final => atmosmeshrm_final
53 procedure :: create_communicator => atmosmeshrm_create_communicator
54 procedure :: setup_restartfile1 => atmosmeshrm_setup_restartfile1
55 procedure :: setup_restartfile2 => atmosmeshrm_setup_restartfile2
56 procedure :: calc_uvmet => atmosmeshrm_calc_uvmet
57 procedure :: setup_vcoordinate => atmosmeshrm_setup_vcoordinate
92 real(RP) :: dom_xmin = 0.0_rp
93 real(RP) :: dom_xmax = 100.0e3_rp
94 real(RP) :: dom_ymin = 0.0_rp
95 real(RP) :: dom_ymax = 100.0e3_rp
96 real(RP) :: dom_zmin = 0.0_rp
97 real(RP) :: dom_zmax = 10.0e3_rp
98 logical :: isPeriodicX = .true.
99 logical :: isPeriodicY = .true.
100 logical :: isPeriodicZ = .false.
107 integer :: PolyOrder_h = 2
108 integer :: PolyOrder_v = 2
109 logical :: LumpedMassMatFlag = .false.
111 character(len=H_LONG) :: TOPO_IN_BASENAME =
''
112 character(len=H_MID) :: TOPO_IN_VARNAME =
'topo'
113 character(len=H_MID) :: VERTICAL_COORD_NAME =
"TERRAIN_FOLLOWING"
115 logical :: COMM_USE_MPI_PC = .false.
117 character(len=H_SHORT) :: Element_operation_type =
'General'
118 character(len=H_SHORT) :: SpMV_storage_format =
'ELL'
120 integer,
parameter :: ATMOS_MESH_NLocalMeshPerPrc = 1
122 integer,
parameter :: FZ_nmax = 1000
123 real(RP) :: FZ(FZ_nmax)
125 namelist / param_atmos_mesh / &
126 dom_xmin, dom_xmax, &
127 dom_ymin, dom_ymax, &
128 dom_zmin, dom_zmax, &
130 isperiodicx, isperiodicy, isperiodicz, &
132 polyorder_h, polyorder_v, lumpedmassmatflag, &
133 element_operation_type, &
134 spmv_storage_format, &
136 topo_in_basename, topo_in_varname, &
137 vertical_coord_name, &
141 logical :: is_spec_FZ
149 log_info(
"ATMOS_MESH_setup",*)
'Setup'
154 read(io_fid_conf,nml=param_atmos_mesh,iostat=ierr)
156 log_info(
"ATMOS_MESH_setup",*)
'Not found namelist. Default used.'
157 elseif( ierr > 0 )
then
158 log_error(
"ATMOS_MESH_setup",*)
'Not appropriate names in namelist PARAM_ATM_MESH. Check!'
161 log_nml(param_atmos_mesh)
167 call this%element%Init( polyorder_h, polyorder_v, lumpedmassmatflag )
168 call this%element_v1D%Init( polyorder_v, lumpedmassmatflag )
174 if (fz(k) < 0.0_rp)
then
179 call this%mesh%Init( &
180 nprcx*nex, nprcy*ney, nez, &
181 dom_xmin, dom_xmax,dom_ymin, dom_ymax, dom_zmin, dom_zmax, &
182 isperiodicx, isperiodicy, isperiodicz, &
183 this%element, atmos_mesh_nlocalmeshperprc, nprcx, nprcy, &
186 call this%mesh%Init( &
187 nprcx*nex, nprcy*ney, nez, &
188 dom_xmin, dom_xmax,dom_ymin, dom_ymax, dom_zmin, dom_zmax, &
189 isperiodicx, isperiodicy, isperiodicz, &
190 this%element, atmos_mesh_nlocalmeshperprc, nprcx, nprcy )
193 call this%mesh%Generate()
196 call this%AtmosMesh_Init( this%mesh )
197 call this%PrepairElementOperation( element_operation_type, spmv_storage_format )
201 if ( topo_in_basename /=
'' )
then
202 log_info(
"ATMOS_MESH_setup",*)
'Read topography data'
204 call file_topo%Init(1, mesh2d=this%mesh%mesh2D )
205 call file_topo%Open( topo_in_basename, myrank=prc_myrank )
206 call file_topo%Read_Var( mftype2d_xy, topo_in_varname, this%topography%topo )
207 call file_topo%Close()
208 call file_topo%Final()
212 call this%Setup_vcoordinate()
215 this%comm_use_mpi_pc = comm_use_mpi_pc
222 subroutine atmosmeshrm_final(this)
229 do commid=1, this%communicator_num
230 call this%comm_list(commid)%Final()
233 call this%mesh%Final()
234 call this%AtmosMesh_Final()
237 end subroutine atmosmeshrm_final
239 subroutine atmosmeshrm_create_communicator( this, sfield_num, hvfield_num, htensorfield_num, &
240 var_manager, field_list, commid )
243 integer,
intent(in) :: sfield_num
244 integer,
intent(in) :: hvfield_num
245 integer,
intent(in) :: htensorfield_num
248 integer,
intent(out) :: commid
252 call this%comm_list(commid)%Init(sfield_num, hvfield_num, htensorfield_num, this%mesh )
253 if ( this%comm_use_mpi_pc )
call this%comm_list(commid)%Prepare_PC()
254 call var_manager%MeshFieldComm_Prepair( this%comm_list(commid), field_list )
257 end subroutine atmosmeshrm_create_communicator
259 subroutine atmosmeshrm_setup_restartfile1( this, restart_file, var_num )
263 integer,
intent(in) :: var_num
266 call restart_file%Init(
'ATMOS', var_num, mesh3d=this%mesh )
268 end subroutine atmosmeshrm_setup_restartfile1
270 subroutine atmosmeshrm_setup_restartfile2( this, restart_file, &
271 in_basename, in_postfix_timelabel, &
272 out_basename, out_postfix_timelabel, &
273 out_dtype, out_title, var_num )
277 character(*),
intent(in) :: in_basename
278 logical,
intent(in) :: in_postfix_timelabel
279 character(*),
intent(in) :: out_basename
280 logical,
intent(in) :: out_postfix_timelabel
281 character(*),
intent(in) :: out_title
282 character(*),
intent(in) :: out_dtype
283 integer,
intent(in) :: var_num
286 call restart_file%Init(
'ATMOS', in_basename, in_postfix_timelabel, &
287 out_basename, out_postfix_timelabel, out_dtype, out_title, var_num, &
291 end subroutine atmosmeshrm_setup_restartfile2
293 subroutine atmosmeshrm_calc_uvmet( this, U, V, &
307 do n=1, this%mesh%LOCAL_MESH_NUM
308 lcmesh => this%mesh%lcmesh_list(n)
310 do ke=lcmesh%NeS, lcmesh%NeE
311 umet%local(n)%val(:,ke) = u%local(n)%val(:,ke)
312 vmet%local(n)%val(:,ke) = v%local(n)%val(:,ke)
317 end subroutine atmosmeshrm_calc_uvmet
319 subroutine atmosmeshrm_setup_vcoordinate( this )
328 call comm2d%Init( 1, 0, 0, this%mesh%mesh2D )
329 call comm3d%Init( 2, 1, 0, this%mesh )
331 call this%topography%SetVCoordinate( this%ptr_mesh, &
332 this%vcoord_type_id, this%mesh%zmax_gl, comm3d, comm2d )
338 end SUBROUTINE atmosmeshrm_setup_vcoordinate
340end module mod_atmos_mesh_rm
subroutine atmosmeshrm_init(this)
Initialize a object to manage computational mesh.
integer, parameter, public atm_mesh_max_commnuicator_num
module FElib / Element / Base
module FElib / Element / hexahedron
module FElib / File / Base
module FElib / File / Restart
module FElib / Mesh / Local 3D
module FElib / Mesh / Base 2D
integer, public meshbase2d_dimtypeid_xy
module FElib / Mesh / Base 3D
module FElib / Mesh / Cubic 3D domain
module FElib / Data / base
module FElib / Data / Communication 3D cubic domain
module FElib / Data / Communication 2D rectangle domain
module FElib / Mesh / utility for general vertical coordinate
integer function, public meshutil_get_vcoord_typeid(vcoord_type)
FElib / model framework / mesh manager.
FElib / model framework / variable manager.
module common / sparsemat
Derived type to manage a computational mesh of regional atmospheric model.