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) )
120 allocate( this%face_val(lcmesh%refElem%NfpTot,lcmesh%Ne) )
121 case default
122 log_error("LocalMeshFieldBase_Init",*) "Unexcepted data_type", data_type_
123 call prc_abort
124 end select
125
126 return
127 end subroutine localmeshfieldbase_init
128
129!> Finalize an object to manage a field data (base type)
130!OCL SERIAL
131 subroutine localmeshfieldbase_final( this )
132 implicit none
133 class(localmeshfieldbase), intent(inout) :: this
134 !-----------------------------------------------------------------------------
135
136 if ( allocated(this%val) ) deallocate( this%val )
137 if ( allocated(this%face_val) ) deallocate( this%face_val )
138
139 return
140 end subroutine localmeshfieldbase_final
141
142 !* 1D *********
143
144!> Setup an object to manage a field data on 1D local computational mesh
145!OCL SERIAL
146 subroutine localmeshfield1d_init( this, mesh, data_type )
147 implicit none
148 class(localmeshfield1d), intent(inout) :: this
149 class(localmesh1d), target, intent(in) :: mesh !< Object to manage a field data on a 1D local mesh
150 integer, intent(in), optional :: data_type !< ID of data type (all nodes or face nodes)
151 !-----------------------------------------------------------------------------
152
153 this%mesh => mesh
154 call localmeshfieldbase_init( this, mesh, data_type )
155
156 return
157 end subroutine localmeshfield1d_init
158
159!> Finalize an object to manage a field data on 1D local computational mesh
160!OCL SERIAL
161 subroutine localmeshfield1d_final( this )
162 implicit none
163 class(localmeshfield1d), intent(inout) :: this
164 !-----------------------------------------------------------------------------
165
166 call localmeshfieldbase_final( this )
167
168 return
169 end subroutine localmeshfield1d_final
170
171 !* 2D *********
172
173!> Setup an object to manage a field data on 2D local computational mesh
174!OCL SERIAL
175 subroutine localmeshfield2d_init( this, mesh, data_type )
176 implicit none
177 class(localmeshfield2d), intent(inout) :: this
178 class(localmesh2d), target, intent(in) :: mesh !< Object to manage a field data on a 2D local mesh
179 integer, intent(in), optional :: data_type !< ID of data type (all nodes or face nodes)
180 !-----------------------------------------------------------------------------
181
182 this%mesh => mesh
183 call localmeshfieldbase_init( this, mesh, data_type )
184
185 return
186 end subroutine localmeshfield2d_init
187
188!> Finalize an object to manage a field data on 2D local computational mesh
189!OCL SERIAL
190 subroutine localmeshfield2d_final( this )
191 implicit none
192 class(localmeshfield2d), intent(inout) :: this
193 !-----------------------------------------------------------------------------
194
195 call localmeshfieldbase_final( this )
196 return
197 end subroutine localmeshfield2d_final
198
199 !* 3D *********
200
201!> Setup an object to manage a field data on 3D local computational mesh
202!OCL SERIAL
203 subroutine localmeshfield3d_init( this, mesh, data_type )
204 implicit none
205 class(localmeshfield3d), intent(inout) :: this
206 class(localmesh3d), target, intent(in) :: mesh !< Object to manage a field data on a 3D local mesh
207 integer, optional, intent(in) :: data_type
208 !-----------------------------------------------------------------------------
209
210 this%mesh => mesh
211 call localmeshfieldbase_init( this, mesh, data_type )
212
213 return
214 end subroutine localmeshfield3d_init
215
216!> Finalize an object to manage a field data on 3D local computational mesh
217!OCL SERIAL
218 subroutine localmeshfield3d_final( this )
219 implicit none
220 class(localmeshfield3d), intent(inout) :: this
221 !-----------------------------------------------------------------------------
222
223 call localmeshfieldbase_final( this )
224 return
225 end subroutine localmeshfield3d_final
226
module FElib / Element / Base
module FElib / Mesh / Local 1D
subroutine, public localmesh1d_final(this, is_generated)
subroutine, public localmesh1d_init(this, lcdomid, refelem, myrank)
module FElib / Mesh / Local 2D
subroutine, public localmesh2d_final(this, is_generated)
subroutine, public localmesh2d_init(this, lcdomid, refelem, myrank)
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 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)