FE-Project
Loading...
Searching...
No Matches
scale_meshfield_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 FEM
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
22
26
27 use scale_localmeshfield_base, only: &
30
31 use scale_element_base, only: &
33
34
35 !-----------------------------------------------------------------------------
36 implicit none
37 private
38
39 !-----------------------------------------------------------------------------
40 !
41 !++ Public type & procedure
42 !
43
44 !> Derived type representing a field (base type)
45 type, abstract, public :: meshfieldbase
46 character(len=H_SHORT) :: varname !< Variable name
47 character(len=H_SHORT) :: unit !< Unit of variable
48 integer :: hist_id !< ID for outputting history data
49 integer :: monitor_id !< ID for monitoring variable
50 contains
51 procedure(meshfieldbase_get_localmeshfield), deferred, public :: getlocalmeshfield
52 end type meshfieldbase
53
54 interface
55 subroutine meshfieldbase_get_localmeshfield( this, domID, ptr_lcmeshField )
56 import meshfieldbase
58 class(meshfieldbase), target, intent(in) :: this
59 integer, intent(in) :: domID
60 class(localmeshfieldbase), pointer, intent(out) :: ptr_lcmeshfield
62 end interface
63
64 !------
65
66 !> Derived type representing a field with 1D mesh
67 type, extends(meshfieldbase), public :: meshfield1d
68 type(localmeshfield1d), allocatable :: local(:) !< Array of objects with 1D field data
69 class(meshbase1d), pointer :: mesh !< Pointer to an object with a 1D computational mesh
70 contains
71 procedure :: init => meshfield1d_init
72 procedure :: final => meshfield1d_final
73 procedure :: getlocalmeshfield => meshfield1d_get_localmeshfield
74 end type meshfield1d
75
76 type, public :: meshfield1dlist
77 class(meshfield1d), pointer :: ptr
78 end type meshfield1dlist
79
80 !> Derived type representing a field with 2D mesh
81 type, extends(meshfieldbase), public :: meshfield2d
82 type(localmeshfield2d), allocatable :: local(:) !< Array of objects with 2D field data
83 class(meshbase2d), pointer :: mesh !< Pointer to an object with a 2D computational mesh
84 contains
85 procedure :: init => meshfield2d_init
86 procedure :: final => meshfield2d_final
87 procedure :: getlocalmeshfield => meshfield2d_get_localmeshfield
88 end type meshfield2d
89
90 type, public :: meshfield2dlist
91 class(meshfield2d), pointer :: ptr
92 end type meshfield2dlist
93
94 !> Derived type representing a field with 3D mesh
95 type, extends(meshfieldbase), public :: meshfield3d
96 type(localmeshfield3d), allocatable :: local(:) !< Array of objects with 3D field data
97 class(meshbase3d), pointer :: mesh !< Pointer to an object with a 3D computational mesh
98 contains
99 procedure :: init => meshfield3d_init
100 procedure :: final => meshfield3d_final
101 procedure :: getlocalmeshfield => meshfield3d_get_localmeshfield
102 end type meshfield3d
103
104 type, public :: meshfield3dlist
105 class(meshfield3d), pointer :: ptr
106 end type meshfield3dlist
107
108 !-----------------------------------------------------------------------------
109 !
110 !++ Public parameters & variables
111 !
112
113 !-----------------------------------------------------------------------------
114 !
115 !++ Private procedure
116 !
117
118 !-----------------------------------------------------------------------------
119 !
120 !++ Private parameters & variables
121 !
122
123contains
124 !**** 1D **********************************************************************
125
126!> Setup an object to manage a field data with a 1D computational mesh
127!OCL SERIAL
128 subroutine meshfield1d_init( this, varname, units, mesh, data_type )
129 implicit none
130 class(meshfield1d), intent(inout) :: this
131 character(len=*), intent(in) :: varname !< Variable name
132 character(len=*), intent(in) :: units !< Unit of variable
133 class(meshbase1d), target, intent(in) :: mesh !< Pointer to an object for a 1D computational mesh
134 integer, intent(in), optional :: data_type !< ID of data type (all nodes or face nodes)
135
136 integer :: n
137 !-----------------------------------------------------------------------------
138
139 this%varname = varname
140 this%unit = units
141 this%mesh => mesh
142 this%hist_id = -1
143 this%monitor_id = -1
144
145 allocate( this%local(mesh%LOCAL_MESH_NUM) )
146 do n=1, mesh%LOCAL_MESH_NUM
147 call this%local(n)%Init( mesh%lcmesh_list(n), data_type )
148 end do
149
150 return
151 end subroutine meshfield1d_init
152
153!> Finalize an object to manage a field data with a 1D computational mesh
154!OCL SERIAL
155 subroutine meshfield1d_final(this)
156 implicit none
157 class(meshfield1d), intent(inout) :: this
158
159 integer :: n
160 !-----------------------------------------------------------------------------
161
162 do n=1, size(this%local)
163 call this%local(n)%Final()
164 end do
165 deallocate( this%local )
166
167 return
168 end subroutine meshfield1d_final
169
170!OCL SERIAL
171 subroutine meshfield1d_get_localmeshfield( this, domID, ptr_lcmeshField )
172 implicit none
173
174 class(meshfield1d), target, intent(in) :: this
175 integer, intent(in) :: domID
176 class(localmeshfieldbase), pointer, intent(out) :: ptr_lcmeshfield
177 !-----------------------------------------------------------------------------
178
179 ptr_lcmeshfield => this%local(domid)
180 return
181 end subroutine meshfield1d_get_localmeshfield
182
183 !**** 2D **********************************************************************
184
185!> Setup an object to manage a field data with a 2D computational mesh
186!OCL SERIAL
187 subroutine meshfield2d_init( this, varname, units, mesh, data_type )
188 implicit none
189
190 class(meshfield2d), intent(inout) :: this
191 character(len=*), intent(in) :: varname !< Variable name
192 character(len=*), intent(in) :: units !< Unit of variable
193 class(meshbase2d), target, intent(in) :: mesh !< Pointer to an object for a 2D computational mesh
194 integer, intent(in), optional :: data_type
195
196 integer :: n
197 !-----------------------------------------------------------------------------
198
199 this%varname = varname
200 this%unit = units
201 this%mesh => mesh
202 this%hist_id = -1
203
204 allocate( this%local(mesh%LOCAL_MESH_NUM) )
205 do n=1, mesh%LOCAL_MESH_NUM
206 call this%local(n)%Init( mesh%lcmesh_list(n), data_type )
207 end do
208
209 return
210 end subroutine meshfield2d_init
211
212!> Finalize an object to manage a field data with a 2D computational mesh
213!OCL SERIAL
214 subroutine meshfield2d_final(this)
215 implicit none
216
217 class(meshfield2d), intent(inout) :: this
218
219 integer :: n
220 !-----------------------------------------------------------------------------
221
222 do n=1, size(this%local)
223 call this%local(n)%Final()
224 end do
225 deallocate( this%local )
226
227 return
228 end subroutine meshfield2d_final
229
230!OCL SERIAL
231 subroutine meshfield2d_get_localmeshfield( this, domID, ptr_lcmeshField )
232 implicit none
233
234 class(meshfield2d), target, intent(in) :: this
235 integer, intent(in) :: domID
236 class(localmeshfieldbase), pointer, intent(out) :: ptr_lcmeshfield
237 !-----------------------------------------------------------------------------
238
239 ptr_lcmeshfield => this%local(domid)
240 return
241 end subroutine meshfield2d_get_localmeshfield
242
243 !**** 3D **********************************************************************
244
245!> Setup an object to manage a field data with a 3D computational mesh
246!OCL SERIAL
247 subroutine meshfield3d_init( this, varname, units, mesh, data_type )
248 implicit none
249
250 class(meshfield3d), intent(inout) :: this
251 character(len=*), intent(in) :: varname !< Variable name
252 character(len=*), intent(in) :: units !< Unit of variable
253 class(meshbase3d), target, intent(in) :: mesh !< Pointer to an object for a 3D computational mesh
254 integer, intent(in), optional :: data_type
255
256 integer :: n
257 !-----------------------------------------------------------------------------
258
259 this%varname = varname
260 this%unit = units
261 this%mesh => mesh
262 this%hist_id = -1
263
264 allocate( this%local(mesh%LOCAL_MESH_NUM) )
265 do n=1, mesh%LOCAL_MESH_NUM
266 call this%local(n)%Init( mesh%lcmesh_list(n), data_type )
267 end do
268
269 return
270 end subroutine meshfield3d_init
271
272!> Finalize an object to manage a field data with a 3D computational mesh
273!OCL SERIAL
274 subroutine meshfield3d_final(this)
275 implicit none
276
277 class(meshfield3d), intent(inout) :: this
278
279 integer :: n
280 !-----------------------------------------------------------------------------
281
282 do n=1, size(this%local)
283 call this%local(n)%Final()
284 end do
285 deallocate( this%local )
286
287 return
288 end subroutine meshfield3d_final
289
290 subroutine meshfield3d_get_localmeshfield( this, domID, ptr_lcmeshField )
291 implicit none
292
293 class(meshfield3d), target, intent(in) :: this
294 integer, intent(in) :: domID
295 class(localmeshfieldbase), pointer, intent(out) :: ptr_lcmeshfield
296 !-----------------------------------------------------------------------------
297
298 ptr_lcmeshfield => this%local(domid)
299 return
300 end subroutine meshfield3d_get_localmeshfield
301
302end module scale_meshfield_base
module FElib / Element / Base
module FElib / Mesh / Local 1D
module FElib / Mesh / Local 2D
module FElib / Mesh / Local 3D
module FElib / Mesh / Base 1D
module FElib / Mesh / Base 2D
module FElib / Mesh / Base 3D
module FElib / Data / base
subroutine meshfield1d_init(this, varname, units, mesh, data_type)
Setup an object to manage a field data with a 1D computational mesh.
Derived type representing a 1D reference element.
Derived type representing a 2D reference element.
Derived type representing a 3D reference element.
Derived type to manage a local 3D computational domain.
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)
Derived type representing a field with 1D mesh.
Derived type representing a field with 2D mesh.
Derived type representing a field with 3D mesh.
Derived type representing a field (base type)