FE-Project
Loading...
Searching...
No Matches
scale_localmeshfield_base.F90
Go to the documentation of this file.
1!> module FElib / Data / base
2!!
3!! @par Description
4!! A module for managing field data with subdomains included in each MPI process
5!!
6!! @author Yuta Kawai, Team SCALE
7!!
8!<
9#include "scaleFElib.h"
11
12 !-----------------------------------------------------------------------------
13 !
14 !++ used modules
15 !
16 use scale_precision
17 use scale_io
18
19 use scale_localmesh_base, only: &
21
22 use scale_localmesh_1d, only: &
24
25 use scale_localmesh_2d, only: &
27
28 use scale_localmesh_3d, only: &
30
32
33 !-----------------------------------------------------------------------------
34 implicit none
35 private
36
37 !-----------------------------------------------------------------------------
38 !
39 !++ Public type & procedure
40 !
41
42 !> Derived type representing a field with local mesh (base type)
43 type, public :: localmeshfieldbase
44 real(rp), allocatable :: val(:,:) !< Buffer to save field data at all nodes
45 real(rp), allocatable :: face_val(:,:) !< Buffer to save field data at face nodes
46 end type localmeshfieldbase
47
48 type, public :: localmeshfieldbaselist
49 class(localmeshfieldbase), pointer :: ptr
51
52 !> Derived type representing a field with 1D local mesh
53 type, extends(localmeshfieldbase), public :: localmeshfield1d
54 type(localmesh1d), pointer :: mesh => null()
55 contains
56 procedure :: init => localmeshfield1d_init
57 procedure :: final => localmeshfield1d_final
58 end type localmeshfield1d
59
60 !> Derived type representing a field with 2D local mesh
61 type, extends(localmeshfieldbase), public :: localmeshfield2d
62 type(localmesh2d), pointer :: mesh => null()
63 contains
64 procedure :: init => localmeshfield2d_init
65 procedure :: final => localmeshfield2d_final
66 end type localmeshfield2d
67
68 !> Derived type representing a field with 3D local mesh
69 type, extends(localmeshfieldbase), public :: localmeshfield3d
70 type(localmesh3d), pointer :: mesh => null()
71 contains
72 procedure :: init => localmeshfield3d_init
73 procedure :: final => localmeshfield3d_final
74 end type localmeshfield3d
75
76 !-----------------------------------------------------------------------------
77 !
78 !++ Public parameters & variables
79 !
80 integer, public, parameter :: local_meshfield_type_nodes_val = 1 !< ID of data type with a field on all nodes in local mesh
81 integer, public, parameter :: local_meshfield_type_nodes_faceval = 2 !< ID of data type with a field on face nodes in local mesh
82
83 !-----------------------------------------------------------------------------
84 !
85 !++ Private procedure
86 !
87
88 !-----------------------------------------------------------------------------
89 !
90 !++ Private parameters & variables
91 !
92
93 private :: localmeshfieldbase_init
94 private :: localmeshfieldbase_final
95
96contains
97
98!> Initialize an object to manage a field data (base type)
99!OCL SERIAL
100 subroutine localmeshfieldbase_init( this, lcmesh, data_type )
101 use scale_prc, only: prc_abort
102 implicit none
103 class(localmeshfieldbase), intent(inout) :: this
104 class(localmeshbase), intent(in) :: lcmesh !< Object to manage a field data on a local mesh
105 integer, intent(in), optional :: data_type !< ID of data type (all nodes or face nodes)
106
107 integer :: data_type_
108 !-----------------------------------------------------------------------------
109
110 if ( present(data_type) ) then
111 data_type_ = data_type
112 else
114 end if
115
116 select case( data_type_ )
118 allocate( this%val(lcmesh%refElem%Np,lcmesh%NeA) )
119 !$acc enter data create(this%val)
121 allocate( this%face_val(lcmesh%refElem%NfpTot,lcmesh%Ne) )
122 !$acc enter data create(this%face_val)
123 case default
124 log_error("LocalMeshFieldBase_Init",*) "Unexcepted data_type", data_type_
125 call prc_abort
126 end select
127
128 !$acc enter data copyin(this)
129 return
130 end subroutine localmeshfieldbase_init
131
132!> Finalize an object to manage a field data (base type)
133!OCL SERIAL
134 subroutine localmeshfieldbase_final( this )
135 implicit none
136 class(localmeshfieldbase), intent(inout) :: this
137 !-----------------------------------------------------------------------------
138
139 if ( allocated(this%val) ) then
140 !$acc exit data delete(this%val)
141 deallocate( this%val )
142 end if
143 if ( allocated(this%face_val) ) then
144 !$acc exit data delete(this%face_val)
145 deallocate( this%face_val )
146 end if
147 !$acc exit data delete(this)
148 return
149 end subroutine localmeshfieldbase_final
150
151 !* 1D *********
152
153!> Setup an object to manage a field data on 1D local computational mesh
154!OCL SERIAL
155 subroutine localmeshfield1d_init( this, mesh, data_type )
156 implicit none
157 class(localmeshfield1d), intent(inout) :: this
158 class(localmesh1d), target, intent(in) :: mesh !< Object to manage a field data on a 1D local mesh
159 integer, intent(in), optional :: data_type !< ID of data type (all nodes or face nodes)
160 !-----------------------------------------------------------------------------
161
162 this%mesh => mesh
163 call localmeshfieldbase_init( this, mesh, data_type )
164
165 return
166 end subroutine localmeshfield1d_init
167
168!> Finalize an object to manage a field data on 1D local computational mesh
169!OCL SERIAL
170 subroutine localmeshfield1d_final( this )
171 implicit none
172 class(localmeshfield1d), intent(inout) :: this
173 !-----------------------------------------------------------------------------
174
175 call localmeshfieldbase_final( this )
176
177 return
178 end subroutine localmeshfield1d_final
179
180 !* 2D *********
181
182!> Setup an object to manage a field data on 2D local computational mesh
183!OCL SERIAL
184 subroutine localmeshfield2d_init( this, mesh, data_type )
185 implicit none
186 class(localmeshfield2d), intent(inout) :: this
187 class(localmesh2d), target, intent(in) :: mesh !< Object to manage a field data on a 2D local mesh
188 integer, intent(in), optional :: data_type !< ID of data type (all nodes or face nodes)
189 !-----------------------------------------------------------------------------
190
191 this%mesh => mesh
192 call localmeshfieldbase_init( this, mesh, data_type )
193
194 return
195 end subroutine localmeshfield2d_init
196
197!> Finalize an object to manage a field data on 2D local computational mesh
198!OCL SERIAL
199 subroutine localmeshfield2d_final( this )
200 implicit none
201 class(localmeshfield2d), intent(inout) :: this
202 !-----------------------------------------------------------------------------
203
204 call localmeshfieldbase_final( this )
205 return
206 end subroutine localmeshfield2d_final
207
208 !* 3D *********
209
210!> Setup an object to manage a field data on 3D local computational mesh
211!OCL SERIAL
212 subroutine localmeshfield3d_init( this, mesh, data_type )
213 implicit none
214 class(localmeshfield3d), intent(inout) :: this
215 class(localmesh3d), target, intent(in) :: mesh !< Object to manage a field data on a 3D local mesh
216 integer, optional, intent(in) :: data_type
217 !-----------------------------------------------------------------------------
218
219 this%mesh => mesh
220 call localmeshfieldbase_init( this, mesh, data_type )
221
222 return
223 end subroutine localmeshfield3d_init
224
225!> Finalize an object to manage a field data on 3D local computational mesh
226!OCL SERIAL
227 subroutine localmeshfield3d_final( this )
228 implicit none
229 class(localmeshfield3d), intent(inout) :: this
230 !-----------------------------------------------------------------------------
231
232 call localmeshfieldbase_final( this )
233 return
234 end subroutine localmeshfield3d_final
235
module FElib / Element / Base
module FElib / Mesh / Local 1D
subroutine, public localmesh1d_final(this, is_generated)
Finalize an object to manage a local mesh for 1D domain.
subroutine, public localmesh1d_init(this, lcdomid, refelem, myrank)
Initialize an object to manage a local mesh for 1D domain.
module FElib / Mesh / Local 2D
subroutine, public localmesh2d_final(this, is_generated)
Finalize an object to manage a local mesh for 2D domain.
subroutine, public localmesh2d_init(this, lcdomid, refelem, myrank)
Initialize an object to manage a local mesh for 2D domain.
module FElib / Mesh / Local 3D
subroutine, public localmesh3d_final(this, is_generated)
Finalize an object to manage a 3D local computational domain.
subroutine, public localmesh3d_init(this, lcdomid, refelem, myrank)
Initialize an object to manage a 3D local computational domain.
module FElib / Mesh / Local, Base
integer, parameter, public local_meshfield_type_nodes_faceval
ID of data type with a field on face nodes in local mesh.
integer, parameter, public local_meshfield_type_nodes_val
ID of data type with a field on all nodes in local mesh.
Derived type representing a 2D reference element.
Derived type representing a local mesh for 1D domain.
Derived type representing a local mesh for 2D domain.
Derived type to manage a local 3D computational domain.
Derived type to manage a local computational domain (base type)
Derived type representing a field with 1D local mesh.
Derived type representing a field with 2D local mesh.
Derived type representing a field with 3D local mesh.
Derived type representing a field with local mesh (base type)