FE-Project
Loading...
Searching...
No Matches
mod_ocean_mesh.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Ocean / Mesh
3!!
4!! @par Description
5!! Base module for mesh with ocean 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 :: oceanmesh
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 :: oceanmesh_init
58 procedure :: oceanmesh_final
59 procedure(oceanmesh_setup_restartfile1), public, deferred :: setup_restartfile1
60 procedure(oceanmesh_setup_restartfile2), public, deferred :: setup_restartfile2
61 procedure(oceanmesh_calc_uvmet), public, deferred :: calc_uvmet
62 generic :: setup_restartfile => setup_restartfile1, setup_restartfile2
63 procedure(oceanmesh_setup_vcoord), public, deferred :: setup_vcoordinate
64 procedure :: read_topography_file => oceanmesh_read_topography_file
65 end type oceanmesh
66
67 interface
68 subroutine oceanmesh_setup_restartfile1( this, restart_file, var_num, dim_name_postfix )
69 import oceanmesh
71 class(oceanmesh), target, intent(inout) :: this
72 class(file_restart_meshfield_component), intent(inout) :: restart_file
73 integer, intent(in) :: var_num
74 character(*), intent(in) :: dim_name_postfix
75 end subroutine oceanmesh_setup_restartfile1
76 end interface
77 interface
78 subroutine oceanmesh_setup_restartfile2( this, restart_file, &
79 in_basename, in_postfix_timelabel, &
80 out_basename, out_postfix_timelabel, &
81 out_dtype, out_title, var_num, dim_name_postfix )
82 import oceanmesh
84 class(oceanmesh), target, intent(inout) :: this
85 class(file_restart_meshfield_component), intent(inout) :: restart_file
86 character(*), intent(in) :: in_basename
87 logical, intent(in) :: in_postfix_timelabel
88 character(*), intent(in) :: out_basename
89 logical, intent(in) :: out_postfix_timelabel
90 character(*), intent(in) :: out_title
91 character(*), intent(in) :: out_dtype
92 integer, intent(in) :: var_num
93 character(*), intent(in) :: dim_name_postfix
94 end subroutine oceanmesh_setup_restartfile2
95 end interface
96 interface
97 subroutine oceanmesh_calc_uvmet( this, U, V, &
98 Umet, Vmet )
99 import oceanmesh
100 import meshfield3d
101 class(oceanmesh), target, intent(in) :: this
102 type(meshfield3d), intent(in) :: U
103 type(meshfield3d), intent(in) :: V
104 type(meshfield3d), intent(inout) :: Umet
105 type(meshfield3d), intent(inout) :: Vmet
106 end subroutine oceanmesh_calc_uvmet
107 end interface
108 interface
109 subroutine oceanmesh_setup_vcoord( this )
110 import oceanmesh
111 class(oceanmesh), target, intent(inout) :: this
112 end subroutine oceanmesh_setup_vcoord
113 end interface
114 integer, parameter, public :: ocn_mesh_max_commnuicator_num = 16
115
116 !-----------------------------------------------------------------------------
117 !
118 !++ Public parameters & variables
119 !
120
121 !-----------------------------------------------------------------------------
122 !
123 !++ Private procedures
124 !
125 !-------------------
126
127 !-----------------------------------------------------------------------------
128 !
129 !++ Private parameters & variables
130 !
131
132contains
133
134!> Setup an object to manage a computational mesh
135 subroutine oceanmesh_init( this, mesh )
136
139
140 implicit none
141 class(oceanmesh), target, intent(inout) :: this
142 class(meshbase3d), intent(in) :: mesh !< Object to manage 3D computational mesh
143
144 class(meshbase2d), pointer :: mesh2d
145 !-------------------------------------------
146
147 call this%ModelMesh3D_Init( mesh )
148
149 !-
150 call file_monitor_meshfield_set_dim( mesh, 'OCN3D' )
151
152 !-
153 call mesh%GetMesh2D( mesh2d )
154 call this%topography%Init( "topo", mesh2d )
155
156 return
157 end subroutine oceanmesh_init
158
159!> Finalize an object to manage a computational mesh
160 subroutine oceanmesh_final(this)
161 implicit none
162
163 class(oceanmesh), intent(inout) :: this
164 !-------------------------------------------
165
166 call this%topography%Final()
167 call this%ModelMesh3D_Final()
168
169 call this%element%Final()
170 call this%element_v1D%Final()
171
172 return
173 end subroutine oceanmesh_final
174
175!OCL SERIAL
176 subroutine oceanmesh_read_topography_file( this, &
177 TOPO_IN_BASENAME, TOPO_IN_VARNAME, mesh2D, dom_zmin )
181 use scale_mesh_base2d, only: &
182 mftype2d_xy => meshbase2d_dimtypeid_xy
183 implicit none
184 class(oceanmesh), target, intent(inout) :: this
185 character(*), intent(in) :: topo_in_basename
186 character(*), intent(in) :: topo_in_varname
187 class(meshbase2d), intent(in), target :: mesh2d
188 real(rp), intent(in) :: dom_zmin
189
190 type(file_base_meshfield) :: file_topo
191
192 integer :: idom, ke2d
193 class(localmesh2d), pointer :: lcmesh2d
194 !-------------------------------------------
195
196 if ( trim(topo_in_basename) /= '' ) then
197 log_info("OCEAN_MESH_setup",*) 'Read topography data'
198
199 select type(mesh2d)
200 type is (meshrectdom2d)
201 call file_topo%Init(1, mesh2d=mesh2d )
202 type is (meshcubedspheredom2d)
203 call file_topo%Init(1, meshcubedsphere2d=mesh2d )
204 end select
205
206 call file_topo%Open( topo_in_basename, myrank=prc_myrank )
207 call file_topo%Read_Var( mftype2d_xy, topo_in_varname, this%topography%topo )
208 call file_topo%Close()
209 call file_topo%Final()
210 else
211 log_info("OCEAN_MESH_setup",*) 'No topography data is specified. Set the topography to a constant value: ', dom_zmin
212
213 do idom=1, mesh2d%LOCAL_MESH_NUM
214 lcmesh2d => mesh2d%lcmesh_list(idom)
215 !$omp parallel do
216 do ke2d=lcmesh2d%NeS, lcmesh2d%NeE
217 this%topography%topo%local(idom)%val(:,ke2d) = dom_zmin
218 end do
219 end do
220 end if
221
222 return
223 end subroutine oceanmesh_read_topography_file
224
225end module mod_ocean_mesh
module Ocean / Mesh
integer, parameter, public ocn_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.