FE-Project
Loading...
Searching...
No Matches
scale_mesh_base2d Module Reference

module FElib / Mesh / Base 2D More...

Data Types

type  meshbase2d
 Derived type to manage a computational mesh (base type for 2D domain) More...
interface  meshbase2d_generate

Functions/Subroutines

subroutine, public meshbase2d_init (this, refelem, nlocalmeshperprc, nprocs, myrank)
 Initialize an object to manage a 2D computational mesh.
subroutine, public meshbase2d_final (this)
 Finalize an object to manage a 2D computational mesh.
subroutine, public meshbase2d_setgeometricinfo (lcmesh, coord_conv, calc_normal)

Variables

integer, public meshbase2d_dimtype_num = 4
integer, public meshbase2d_dimtypeid_x = 1
integer, public meshbase2d_dimtypeid_y = 2
integer, public meshbase2d_dimtypeid_xy = 3
integer, public meshbase2d_dimtypeid_xyt = 4

Detailed Description

module FElib / Mesh / Base 2D

Description
Base module to manage 2D meshes for element-based methods
Author
Yuta Kawai, Team SCALE

Function/Subroutine Documentation

◆ meshbase2d_init()

subroutine, public scale_mesh_base2d::meshbase2d_init ( class(meshbase2d), intent(inout) this,
class(elementbase2d), intent(in), target refelem,
integer, intent(in) nlocalmeshperprc,
integer, intent(in), optional nprocs,
integer, intent(in), optional myrank )

Initialize an object to manage a 2D computational mesh.

Definition at line 76 of file scale_mesh_base2d.F90.

79
80 implicit none
81 class(MeshBase2D), intent(inout) :: this
82 class(ElementBase2D), intent(in), target :: refElem
83 integer, intent(in) :: NLocalMeshPerPrc
84 integer, intent(in), optional :: nprocs
85 integer, intent(in), optional :: myrank
86
87 integer :: n
88 !-----------------------------------------------------------------------------
89
90 this%refElem2D => refelem
91 call meshbase_init( this, &
92 meshbase2d_dimtype_num, refelem, &
93 nlocalmeshperprc, 4, &
94 nprocs )
95
96 allocate( this%lcmesh_list(this%LOCAL_MESH_NUM) )
97 do n=1, this%LOCAL_MESH_NUM
98 call localmesh2d_init( this%lcmesh_list(n), n, refelem, myrank )
99 end do
100
101 call this%SetDimInfo( meshbase2d_dimtypeid_x, "x", "m", "X-coordinate" )
102 call this%SetDimInfo( meshbase2d_dimtypeid_y, "y", "m", "Y-coordinate" )
103 call this%SetDimInfo( meshbase2d_dimtypeid_xy, "xy", "m", "XY-coordinate" )
104 call this%SetDimInfo( meshbase2d_dimtypeid_xyt, "xyt", "m", "XY-coordinate" )
105
106 return

References scale_localmesh_2d::localmesh2d_init(), meshbase2d_dimtype_num, meshbase2d_dimtypeid_x, meshbase2d_dimtypeid_xy, meshbase2d_dimtypeid_xyt, meshbase2d_dimtypeid_y, and scale_mesh_base::meshbase_init().

Referenced by scale_mesh_base2d::meshbase2d_generate::meshbase2d_generate(), scale_mesh_cubedspheredom2d::meshcubedspheredom2d_init(), and scale_mesh_rectdom2d::meshrectdom2d_init().

◆ meshbase2d_final()

subroutine, public scale_mesh_base2d::meshbase2d_final ( class(meshbase2d), intent(inout) this)

Finalize an object to manage a 2D computational mesh.

Definition at line 111 of file scale_mesh_base2d.F90.

112 implicit none
113 class(MeshBase2D), intent(inout) :: this
114 integer :: n
115 !-----------------------------------------------------------------------------
116
117 if ( allocated ( this%lcmesh_list ) ) then
118 do n=1, this%LOCAL_MESH_NUM
119 call localmesh2d_final( this%lcmesh_list(n), this%isGenerated )
120 end do
121
122 deallocate( this%lcmesh_list )
123 end if
124
125 call meshbase_final(this)
126
127 return

References scale_localmesh_2d::localmesh2d_final(), and scale_mesh_base::meshbase_final().

Referenced by scale_mesh_base2d::meshbase2d_generate::meshbase2d_generate(), scale_mesh_cubedspheredom2d::meshcubedspheredom2d_init(), and scale_mesh_rectdom2d::meshrectdom2d_init().

◆ meshbase2d_setgeometricinfo()

subroutine, public scale_mesh_base2d::meshbase2d_setgeometricinfo ( type(localmesh2d), intent(inout) lcmesh,
external subroutine(real(rp), dimension(elem%np), intent(out) x, real(rp), dimension(elem%np), intent(out) y, real(rp), dimension(elem%np), intent(out) xr, real(rp), dimension(elem%np), intent(out) xs, real(rp), dimension(elem%np), intent(out) yr, real(rp), dimension(elem%np), intent(out) ys, real(rp), dimension(elem%nv), intent(in) vx, real(rp), dimension(elem%nv), intent(in) vy, type(elementbase2d), intent(in) elem) coord_conv,
external subroutine(real(rp), dimension(elem%nfptot,2), intent(out) normal_fn, real(rp), dimension(elem%nfptot,2,2), intent(in) escale_f, integer, dimension(elem%nfp,elem%nfaces), intent(in) fid, type(elementbase2d), intent(in) elem) calc_normal )

Definition at line 144 of file scale_mesh_base2d.F90.

146 implicit none
147 type(LocalMesh2D), intent(inout) :: lcmesh
148 interface
149 subroutine coord_conv( x, y, xr, xs, yr, ys, &
150 vx, vy, elem )
151 import elementbase2d
152 import rp
153 type(ElementBase2D), intent(in) :: elem
154 real(RP), intent(out) :: x(elem%Np), y(elem%Np)
155 real(RP), intent(out) :: xr(elem%Np), xs(elem%Np), yr(elem%Np), ys(elem%Np)
156 real(RP), intent(in) :: vx(elem%Nv), vy(elem%Nv)
157 end subroutine coord_conv
158 subroutine calc_normal( normal_fn, &
159 Escale_f, fid, elem )
160 import elementbase2d
161 import rp
162 type(ElementBase2D), intent(in) :: elem
163 real(RP), intent(out) :: normal_fn(elem%NfpTot,2)
164 integer, intent(in) :: fid(elem%Nfp,elem%Nfaces)
165 real(RP), intent(in) :: Escale_f(elem%NfpTot,2,2)
166 end subroutine calc_normal
167 end interface
168
169 class(ElementBase2D), pointer :: refElem
170 integer :: ke
171 integer :: f
172 integer :: i, j
173 integer :: d
174 integer :: node_ids(lcmesh%refElem%Nv)
175 real(RP) :: vx(lcmesh%refElem%Nv), vy(lcmesh%refElem%Nv)
176 real(RP) :: xr(lcmesh%refElem%Np), xs(lcmesh%refElem%Np)
177 real(RP) :: yr(lcmesh%refElem%Np), ys(lcmesh%refElem%Np)
178 integer :: fmask(lcmesh%refElem%NfpTot)
179 integer :: fid(lcmesh%refElem2D%Nfp,lcmesh%refElem2D%Nfaces)
180 real(RP) :: Escale_f(lcmesh%refElem%NfpTot,2,2)
181
182 !-----------------------------------------------------------------------------
183
184 refelem => lcmesh%refElem2D
185
186 call meshbase_setgeometricinfo(lcmesh, 2)
187
188 allocate( lcmesh%G_ij(refelem%Np,lcmesh%Ne,2,2) )
189 allocate( lcmesh%GIJ (refelem%Np,lcmesh%Ne,2,2) )
190 allocate( lcmesh%lon(refelem%Np,lcmesh%Ne) )
191 allocate( lcmesh%lat(refelem%Np,lcmesh%Ne) )
192 !$acc enter data create(lcmesh%G_ij, lcmesh%GIJ, lcmesh%lon, lcmesh%lat)
193
194 fmask(:) = reshape(refelem%Fmask, shape(fmask))
195 do f=1, refelem%Nfaces
196 do i=1, refelem%Nfp
197 fid(i,f) = i + (f-1)*refelem%Nfp
198 end do
199 end do
200
201 do ke=1, lcmesh%Ne
202 node_ids(:) = lcmesh%EToV(ke,:)
203 vx(:) = lcmesh%pos_ev(node_ids(:),1)
204 vy(:) = lcmesh%pos_ev(node_ids(:),2)
205 call coord_conv( &
206 lcmesh%pos_en(:,ke,1), lcmesh%pos_en(:,ke,2), xr, xs, yr, ys, & ! (out)
207 vx, vy, refelem ) ! (in)
208
209 lcmesh%J(:,ke) = - xs*yr + xr*ys
210
211 lcmesh%Escale(:,ke,1,1) = ys/lcmesh%J(:,ke)
212 lcmesh%Escale(:,ke,1,2) = - xs/lcmesh%J(:,ke)
213 lcmesh%Escale(:,ke,2,1) = - yr/lcmesh%J(:,ke)
214 lcmesh%Escale(:,ke,2,2) = xr/lcmesh%J(:,ke)
215
216 !* Face
217
218 !
219 !mesh%fx(:,n) = mesh%x(fmask(:),n)
220 !mesh%fy(:,n) = mesh%y(fmask(:),n)
221
222 ! Calculate normal vectors
223 do j=1, 2
224 do i=1, 2
225 escale_f(:,i,j) = lcmesh%Escale(fmask(:),ke,i,j)
226 end do
227 end do
228
229 call calc_normal( lcmesh%normal_fn(:,ke,:), & ! (out)
230 escale_f, fid, refelem ) ! (in)
231
232 lcmesh%sJ(:,ke) = sqrt( lcmesh%normal_fn(:,ke,1)**2 + lcmesh%normal_fn(:,ke,2)**2 )
233 do d=1, 2
234 lcmesh%normal_fn(:,ke,d) = lcmesh%normal_fn(:,ke,d)/lcmesh%sJ(:,ke)
235 end do
236 lcmesh%sJ(:,ke) = lcmesh%sJ(:,ke)*lcmesh%J(fmask(:),ke)
237
238 lcmesh%Fscale(:,ke) = lcmesh%sJ(:,ke)/lcmesh%J(fmask(:),ke)
239 end do
240 !$acc update device(lcmesh%pos_en, lcmesh%normal_fn, lcmesh%sJ, lcmesh%J, lcmesh%Escale, lcmesh%Fscale)
241
242 !$omp parallel
243 !$omp workshare
244 lcmesh%Gsqrt (:,:) = 1.0_rp
245 lcmesh%GIJ (:,:,1,1) = 1.0_rp
246 lcmesh%GIJ (:,:,2,1) = 0.0_rp
247 lcmesh%GIJ (:,:,1,2) = 0.0_rp
248 lcmesh%GIJ (:,:,2,2) = 1.0_rp
249 lcmesh%G_ij (:,:,1,1) = 1.0_rp
250 lcmesh%G_ij (:,:,2,1) = 0.0_rp
251 lcmesh%G_ij (:,:,1,2) = 0.0_rp
252 lcmesh%G_ij (:,:,2,2) = 1.0_rp
253 !$omp end workshare
254 !$omp end parallel
255 !$acc update device(lcmesh%Gsqrt, lcmesh%GIJ, lcmesh%G_ij)
256
257 return
module FElib / Mesh / Base
subroutine, public meshbase_setgeometricinfo(mesh, ndim)

References scale_mesh_base::meshbase_setgeometricinfo().

Referenced by scale_mesh_base2d::meshbase2d_generate::meshbase2d_generate(), scale_mesh_cubedspheredom2d::meshcubedspheredom2d_setuplocaldom(), and scale_mesh_rectdom2d::meshrectdom2d_setuplocaldom().

Variable Documentation

◆ meshbase2d_dimtype_num

integer, public scale_mesh_base2d::meshbase2d_dimtype_num = 4

Definition at line 57 of file scale_mesh_base2d.F90.

57 integer, public :: MESHBASE2D_DIMTYPE_NUM = 4

Referenced by scale_file_history_meshfield::file_history_meshfield_in::file_history_meshfield_in3d(), and meshbase2d_init().

◆ meshbase2d_dimtypeid_x

◆ meshbase2d_dimtypeid_y

◆ meshbase2d_dimtypeid_xy

◆ meshbase2d_dimtypeid_xyt