FE-Project
Loading...
Searching...
No Matches
mod_atmos_mesh.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Atmosphere / Mesh
3!!
4!! @par Description
5!! Base module for mesh with atmospheric model
6!!
7!! @author Yuta kawai, Team SCALE
8!!
9!<
10!-------------------------------------------------------------------------------
11#include "scaleFElib.h"
13 !-----------------------------------------------------------------------------
14 !
15 !++ Used modules
16 !
17 use scale_precision
18 use scale_io
19 use scale_prc
20
29 use scale_sparsemat, only: sparsemat
32
36
37 !-----------------------------------------------------------------------------
38 implicit none
39 private
40 !-----------------------------------------------------------------------------
41 !
42 !++ Public type & procedures
43 !
44
45 !> Derived type to manage a computational mesh (base class)
46 !!
47 type, abstract, extends(modelmesh3d), public :: atmosmesh
48 type(hexahedralelement) :: element !< Object to manage 3D reference element
49 type(lineelement) :: element_v1d !< Object to manage 1D reference element for the vertical direction
50
51 type(meshtopography) :: topography !< Object to manage topography
52 integer :: vcoord_type_id !< ID of vertical coordinate type
53
54 logical :: comm_use_mpi_pc !< Flag whether persistent communication in MPI is used
55 logical :: comm_use_mpi_pc_fujitsu_ext !< Flag whether Fujitsu extension in MPI persistent communication is used
56 contains
57 procedure :: atmosmesh_init
58 procedure :: atmosmesh_final
59 procedure(atmosmesh_setup_restartfile1), public, deferred :: setup_restartfile1
60 procedure(atmosmesh_setup_restartfile2), public, deferred :: setup_restartfile2
61 procedure(atmosmesh_calc_uvmet), public, deferred :: calc_uvmet
62 generic :: setup_restartfile => setup_restartfile1, setup_restartfile2
63 procedure(atmosmesh_setup_vcoord), public, deferred :: setup_vcoordinate
64 procedure :: read_topography_file => atmosmesh_read_topography_file
65 end type atmosmesh
66
67 interface
68 subroutine atmosmesh_setup_restartfile1( this, restart_file, var_num )
69 import atmosmesh
71 class(atmosmesh), target, intent(inout) :: this
72 class(file_restart_meshfield_component), intent(inout) :: restart_file
73 integer, intent(in) :: var_num
74 end subroutine atmosmesh_setup_restartfile1
75 end interface
76 interface
77 subroutine atmosmesh_setup_restartfile2( this, restart_file, &
78 in_basename, in_postfix_timelabel, &
79 out_basename, out_postfix_timelabel, &
80 out_dtype, out_title, var_num, dim_name_postfix )
81 import atmosmesh
83 class(atmosmesh), target, intent(inout) :: this
84 class(file_restart_meshfield_component), intent(inout) :: restart_file
85 character(*), intent(in) :: in_basename
86 logical, intent(in) :: in_postfix_timelabel
87 character(*), intent(in) :: out_basename
88 logical, intent(in) :: out_postfix_timelabel
89 character(*), intent(in) :: out_title
90 character(*), intent(in) :: out_dtype
91 integer, intent(in) :: var_num
92 character(*), intent(in) :: dim_name_postfix
93 end subroutine atmosmesh_setup_restartfile2
94 end interface
95 interface
96 subroutine atmosmesh_calc_uvmet( this, U, V, &
97 Umet, Vmet )
98 import atmosmesh
99 import meshfield3d
100 class(atmosmesh), target, intent(in) :: this
101 type(meshfield3d), intent(in) :: U
102 type(meshfield3d), intent(in) :: V
103 type(meshfield3d), intent(inout) :: Umet
104 type(meshfield3d), intent(inout) :: Vmet
105 end subroutine atmosmesh_calc_uvmet
106 end interface
107 interface
108 subroutine atmosmesh_setup_vcoord( this )
109 import atmosmesh
110 class(atmosmesh), target, intent(inout) :: this
111 end subroutine atmosmesh_setup_vcoord
112 end interface
113 integer, parameter, public :: atm_mesh_max_commnuicator_num = 16
114
115 !-----------------------------------------------------------------------------
116 !
117 !++ Public parameters & variables
118 !
119
120 !-----------------------------------------------------------------------------
121 !
122 !++ Private procedures
123 !
124 !-------------------
125
126 !-----------------------------------------------------------------------------
127 !
128 !++ Private parameters & variables
129 !
130
131contains
132
133!> Setup an object to manage a computational mesh
134 subroutine atmosmesh_init( this, mesh )
135
138
139 implicit none
140 class(atmosmesh), target, intent(inout) :: this
141 class(meshbase3d), intent(in) :: mesh !< Object to manage 3D computational mesh
142
143 class(meshbase2d), pointer :: mesh2d
144 !-------------------------------------------
145
146 call this%ModelMesh3D_Init( mesh )
147
148 !-
149 call file_monitor_meshfield_set_dim( mesh, 'ATM3D' )
150
151 !-
152 call mesh%GetMesh2D( mesh2d )
153 call this%topography%Init( "topo", mesh2d )
154
155 return
156 end subroutine atmosmesh_init
157
158!> Finalize an object to manage a computational mesh
159 subroutine atmosmesh_final(this)
160 implicit none
161
162 class(atmosmesh), intent(inout) :: this
163 !-------------------------------------------
164
165 call this%topography%Final()
166 call this%ModelMesh3D_Final()
167
168 call this%element%Final()
169 call this%element_v1D%Final()
170
171 return
172 end subroutine atmosmesh_final
173
174!OCL SERIAL
175 subroutine atmosmesh_read_topography_file( this, &
176 TOPO_IN_BASENAME, TOPO_IN_VARNAME, mesh2D, dom_zmin )
180 use scale_mesh_base2d, only: &
181 mftype2d_xy => meshbase2d_dimtypeid_xy
182 implicit none
183 class(atmosmesh), target, intent(inout) :: this
184 character(*), intent(in) :: topo_in_basename
185 character(*), intent(in) :: topo_in_varname
186 class(meshbase2d), intent(in), target :: mesh2d
187 real(rp), intent(in) :: dom_zmin
188
189 type(file_base_meshfield) :: file_topo
190
191 integer :: idom, ke2d
192 class(localmesh2d), pointer :: lcmesh2d
193 !-------------------------------------------
194
195 if ( trim(topo_in_basename) /= '' ) then
196 log_info("ATMOS_MESH_setup",*) 'Read topography data'
197
198 select type(mesh2d)
199 type is (meshrectdom2d)
200 call file_topo%Init(1, mesh2d=mesh2d )
201 type is (meshcubedspheredom2d)
202 call file_topo%Init(1, meshcubedsphere2d=mesh2d )
203 end select
204
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()
209 else
210 log_info("ATMOS_MESH_setup",*) 'No topography data is specified. Set the topography to a constant value: ', dom_zmin
211
212 do idom=1, mesh2d%LOCAL_MESH_NUM
213 lcmesh2d => mesh2d%lcmesh_list(idom)
214 !$omp parallel do
215 do ke2d=lcmesh2d%NeS, lcmesh2d%NeE
216 this%topography%topo%local(idom)%val(:,ke2d) = dom_zmin
217 end do
218 end do
219 end if
220
221 return
222 end subroutine atmosmesh_read_topography_file
223
224end module mod_atmos_mesh
module Atmosphere / Mesh
integer, parameter, public atm_mesh_max_commnuicator_num
module FElib / Element / Base
module FElib / Element / hexahedron
module FElib / Element / line
module FElib / Mesh / Local 2D
module FElib / Mesh / Local 3D
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 / mesh manager.
FElib / model framework / variable manager.
Module common / sparsemat.
Derived type to manage a computational mesh (base class)
Derived type representing a 3D reference element.
Derived type representing a hexahedral element.
Derived type representing a line element.
Derived type to manage file output with MeshField data.
Derived type to manage restart file with each component.
Derived type representing a local mesh for 2D domain.
Derived type to manage a local 3D computational domain.
Derived type to manage a computational mesh (base type for 2D domain)
Derived type to manage a computational mesh (base type for 3D domain)
Derived type to manage a cubed-sphere 2D computational domain.
Derived type to manage a rectangular 2D computational domain.
Derived type to manage topography datat and setup vertical coordinate metric.
Derived type representing a field with 2D mesh.
Derived type representing a field with 3D mesh.
Derived type to manage a sparse matrix.