FE-Project
Loading...
Searching...
No Matches
scale_meshfield_filter_operation_1d.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module FElib / Data / Filter operation 1D
3!!
4!! @par Description
5!! This module provides classes to apply filter operations to MeshField data
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, only: prc_abort
20
26
27 use scale_meshfield_base, only: &
30 use scale_meshfieldcomm_1d, only: &
32 use scale_meshfieldcomm_base, only: &
34
46
47 !-----------------------------------------------------------------------------
48 implicit none
49 private
50
51 !-----------------------------------------------------------------------------
52 !
53 !++ Public type & procedure
54 !
55
56 !> Derived type to represent filter operation for 1D mesh field
58 type(meshfieldcomm1d) :: vars_comm
59
60 integer :: nnode_gl
61 contains
63 procedure :: final => meshfieldfilteroperation1d_final
64 procedure :: apply => meshfieldfilteroperation1d_apply_filter
65 procedure :: apply_gl_lc => meshfieldfilteroperation1d_apply_filter_gl_lc
67
68 !-----------------------------------------------------------------------------
69 !
70 !++ Public parameters & variables
71 !
72
73 !-----------------------------------------------------------------------------
74 !
75 !++ Private type & procedure
76 !
77 private :: extract_tmp1d
78
79 !-----------------------------------------------------------------------------
80 !
81 !++ Private parameters & variables
82 !
83
84contains
85 !> Initialize an object to represent filter operation for 1D mesh field
86!OCL SERIAL
88 FilterOptrType, &
89 FilterShape, FilterWidthFac, &
90 Nnode_1D_reconst, &
91 sfield_num, &
92 mesh1D, Nnode_1D_GL, IF_r )
93 implicit none
94 class(meshfieldfilteroperation1d), intent(inout) :: this
95 class(meshbase1d), intent(in) :: mesh1D
96 character(*), intent(in) :: FilterOptrType
97 character(*), intent(in) :: FilterShape
98 real(RP), intent(in) :: FilterWidthFac
99 integer, intent(in) :: Nnode_1D_reconst
100 integer, intent(in) :: sfield_num
101 integer, intent(in), optional :: Nnode_1D_GL
102 integer, intent(in), optional :: IF_r
103 !------------------------------------------
104
105 call meshfieldfilteroperationbase_init( this, mesh1d%refElem1D%Np, &
106 filteroptrtype, filtershape, filterwidthfac, &
107 nnode_1d_reconst, nnode_1d_gl, if_r )
108
109 if (present(nnode_1d_gl)) then
110 this%Nnode_GL = nnode_1d_gl
111 else
112 this%Nnode_GL = mesh1d%refElem1D%Np
113 end if
114
115 select type(mesh1d)
116 class is (meshbase1d)
117 call this%vars_comm%Init( sfield_num, 0, mesh1d, &
118 halosize_1d=this%hHaloSize )
119 class default
120 log_info('MeshFieldFilterOperation1D_Init',*) "Unsupported mesh type is specified. Check!"
121 call prc_abort
122 end select
123 return
125
126 !> Finalize an object to represent filter operation for 1D mesh field
127!OCL SERIAL
128 subroutine meshfieldfilteroperation1d_final( this )
129 implicit none
130 class(meshfieldfilteroperation1d), intent(inout) :: this
131 !------------------------------------------
133 call this%vars_comm%Final()
134 return
135 end subroutine meshfieldfilteroperation1d_final
136
137 !> Apply filter operation to 1D mesh field data
138!OCL serial
139 subroutine meshfieldfilteroperation1d_apply_filter( this, q_list, &
140 mesh1D )
141 implicit none
142 class(meshfieldfilteroperation1d), intent(inout) :: this
143 type(meshfield1d), intent(inout), target :: q_list(this%vars_comm%field_num_tot)
144 class(meshbase1d), intent(in), target :: mesh1D
145
146 class(localmesh1d), pointer :: lmesh1D
147 class(elementbase1d), pointer :: elem1D
148 real(RP), allocatable :: tmp1D(:,:,:)
149
150 integer :: iv
151 integer :: n
152 type(meshfieldcontainer) :: comm_vars_list(this%vars_comm%field_num_tot)
153 !-----------------------------------------------------
154
155 do iv=1, this%vars_comm%field_num_tot
156 comm_vars_list(iv)%field1D => q_list(iv)
157 end do
158 call this%vars_comm%Put(comm_vars_list, 1)
159 call this%vars_comm%Exchange()
160 call this%vars_comm%Get(comm_vars_list, 1)
161
162 do n=1, mesh1d%LOCAL_MESH_NUM
163 lmesh1d => mesh1d%lcmesh_list(n)
164 elem1d => lmesh1d%refElem1D
165 allocate( tmp1d(-this%hHaloSize+1:elem1d%Np+this%hHaloSize,0:2,lmesh1d%Ne) )
166
167 do iv=1, this%vars_comm%field_num_tot
168 call extract_tmp1d( tmp1d, &
169 q_list(iv)%local(n)%val, q_list(iv)%local(n)%val, lmesh1d, elem1d, lmesh1d%VMapP, this%hHaloSize )
170
171 select case (this%operator_type)
173 call apply_filter1d_x( q_list(iv)%local(n)%val, &
174 tmp1d, this%FilterMat_h1D, elem1d%Np, 1, 1, lmesh1d%Ne, lmesh1d%NeA, elem1d%Np )
176 call apply_reconst1d_x( q_list(iv)%local(n)%val, &
177 tmp1d, this%Minv_Ml_tr, this%Minv_Mc_tr, this%Minv_Mr_tr, this%IntrpMat, elem1d%Np, 1, 1, lmesh1d%Ne, this%Nnode_h1D_reconst, lmesh1d )
179 call apply_reconst1d_x_2( q_list(iv)%local(n)%val, &
180 tmp1d, this%Ml_tr, this%Mc_tr, this%Mr_tr, elem1d%Np, 1, 1, lmesh1d%Ne, this%Nnode_h1D_reconst, lmesh1d )
182 call apply_interface_correction1d_x( q_list(iv)%local(n)%val, &
183 tmp1d, this%IF_gL, this%IF_gR, elem1d%Np, 1, 1, lmesh1d%Ne, lmesh1d )
184 end select
185
186 end do
187 deallocate( tmp1d )
188 end do
189 return
190 end subroutine meshfieldfilteroperation1d_apply_filter
191
192
193 !> Apply filter operation to 1D mesh field data
194!OCL serial
195 subroutine meshfieldfilteroperation1d_apply_filter_gl_lc( this, &
196 q_GL, &
197 q_list, &
198 lmesh, elem1D )
199 implicit none
200 class(meshfieldfilteroperation1d), intent(inout) :: this
201 class(localmesh1d), intent(in) :: lmesh
202 class(elementbase1d), intent(in) :: elem1D
203 real(RP), intent(out) :: q_GL(this%Nnode_GL,lmesh%Ne,this%vars_comm%field_num_tot)
204 type(meshfield1d), intent(inout), target :: q_list(this%vars_comm%field_num_tot)
205
206 real(RP), allocatable :: tmp1D(:,:,:)
207
208 integer :: iv
209 integer :: n
210 type(meshfieldcontainer) :: comm_vars_list(this%vars_comm%field_num_tot)
211 !-----------------------------------------------------
212
213 do iv=1, this%vars_comm%field_num_tot
214 comm_vars_list(iv)%field1D => q_list(iv)
215 end do
216 call this%vars_comm%Put(comm_vars_list, 1)
217 call this%vars_comm%Exchange()
218 call this%vars_comm%Get(comm_vars_list, 1)
219
220 allocate( tmp1d(-this%hHaloSize+1:elem1d%Np+this%hHaloSize,0:2,lmesh%Ne) )
221
222 n = lmesh%lcdomID
223 do iv=1, this%vars_comm%field_num_tot
224 call extract_tmp1d( tmp1d, &
225 q_list(iv)%local(n)%val, q_list(iv)%local(n)%val, lmesh, elem1d, lmesh%VMapP, this%hHaloSize )
226
227 select case (this%operator_type)
229 call apply_reconst1d_x_2_gl( q_gl(:,:,iv), &
230 tmp1d, this%Ml_tr, this%Mc_tr, this%Mr_tr, elem1d%Np, this%Nnode_GL, lmesh%Ne, this%Nnode_h1D_reconst, lmesh )
231 end select
232
233 end do
234 return
235 end subroutine meshfieldfilteroperation1d_apply_filter_gl_lc
236
237!- Private -----------------------
238
239!OCL SERIAL
240 subroutine apply_reconst1d_x_2_gl( q, q0, Minv_Ml_tr, Minv_Mc_tr, Minv_Mr_tr, &
241 Npx, NpxGL, Ne, Npx_reconst, lmesh )
242 implicit none
243 class(localmeshbase), intent(in) :: lmesh
244 integer, intent(in) :: Npx, NpxGL, Ne
245 integer, intent(in) :: Npx_reconst
246 real(RP), intent(out) :: q(NpxGL,lmesh%Ne)
247 real(RP), intent(in) :: q0(-Npx+1:2*Npx,0:2,Ne)
248 real(RP), intent(in) :: Minv_Ml_tr(Npx,NpxGL)
249 real(RP), intent(in) :: Minv_Mc_tr(Npx,NpxGL)
250 real(RP), intent(in) :: Minv_Mr_tr(Npx,NpxGL)
251
252 integer :: ke
253
254 integer :: i,j
255
256 real(RP) :: tmp(NpxGL)
257 real(RP) :: s
258 !-------------------------------------
259
260 !$omp parallel do private(ke,i,j, tmp,s)
261 do ke=1, ne
262 do i=1, npxgl
263 s = 0.0_rp
264 do j=1, npx
265 s = s &
266 + minv_ml_tr(j,i) * q0(j-npx,1,ke) &
267 + minv_mc_tr(j,i) * q0( j,1,ke) &
268 + minv_mr_tr(j,i) * q0(j+npx,1,ke)
269 end do
270 tmp(i) = s
271 end do
272 q(:,ke) = tmp(:)
273 end do
274 return
275 end subroutine apply_reconst1d_x_2_gl
276
277!OCL SERIAL
278 subroutine extract_tmp1d( tmp1D, q0, q0_, lmesh1D, elem1D, vmapP, hHaloSize )
279 implicit none
280 class(localmesh1d), intent(in) :: lmesh1D
281 class(elementbase1d), intent(in) :: elem1D
282 integer, intent(in) :: hHaloSize
283 real(RP), intent(out) :: tmp1D(-hHaloSize+1:elem1D%Np+hHaloSize,0:2,lmesh1D%Ne)
284 real(RP), intent(in) :: q0(elem1D%Np*lmesh1D%NeA)
285 real(RP), intent(in) :: q0_(elem1D%Np,lmesh1D%NeA)
286 integer, intent(in) :: vmapP(elem1D%NfpTot,lmesh1D%Ne)
287
288 integer :: ke, i, f
289 integer :: fso
290 integer :: ph
291 integer :: iP
292 real(RP) :: halo_h(hHaloSize,2)
293 !------------------------------
294
295 do f=1, 2
296 fso = lmesh1d%Ne * elem1d%Np + hhalosize * ( f-1 )
297 do ph=1, hhalosize
298 halo_h(ph,f) = q0(fso+ph)
299 end do
300 end do
301
302 !$omp parallel private(ke, i, ph, iP)
303 !$omp do
304 do ke=1, lmesh1d%Ne
305 tmp1d(1:elem1d%Np,1,ke) = q0_(:,ke)
306
307 ! Face 2
308 ip = vmapp(2,ke)
309 if ( ip <= lmesh1d%Ne * elem1d%Np ) then
310 do ph=1, hhalosize
311 tmp1d(ph+elem1d%Np,1,ke) = q0(ip + (ph-1))
312 end do
313 else
314 do ph=1, hhalosize
315 tmp1d(ph+elem1d%Np,1,ke) = halo_h(ph,2)
316 end do
317 end if
318
319 ! Face 1
320 ip = vmapp(1,ke)
321 if ( ip <= lmesh1d%Ne * elem1d%Np ) then
322 do ph=1, hhalosize
323 tmp1d(-ph+1,1,ke) = q0(ip - (ph-1))
324 end do
325 else
326 do ph=1, hhalosize
327 tmp1d(-ph+1,1,ke) = halo_h(ph,1)
328 end do
329 end if
330 end do
331
332 !$omp end parallel
333 return
334 end subroutine extract_tmp1d
module FElib / Element / Base
module FElib / Element/ ModalFilter
module FElib / Mesh / Local 1D
module FElib / Mesh / Local, Base
module FElib / Mesh / Base 1D
module FElib / Data / base
module FElib / Data / Filter operation 1D
subroutine meshfieldfilteroperation1d_init(this, filteroptrtype, filtershape, filterwidthfac, nnode_1d_reconst, sfield_num, mesh1d, nnode_1d_gl, if_r)
Initialize an object to represent filter operation for 1D mesh field.
module FElib / Data / Filter operation base
subroutine, public meshfieldfilteroperationbase_apply_filter1d_x(q, q0, filter1d, npx, npy, npz, ne, nea, nnode_h1d)
subroutine, public meshfieldfilteroperationbase_apply_interface_correction1d_x(q, q0, gl, gr, npx, npy, npz, ne, lmesh)
subroutine, public meshfieldfilteroperationbase_apply_reconst1d_x_2(q, q0, minv_ml_tr, minv_mc_tr, minv_mr_tr, npx, npy, npz, ne, npx_reconst, lmesh)
subroutine, public meshfieldfilteroperationbase_init(this, nnode_h1d, filteroptrtype, filtershape, filterwidthfac, nnode_h1d_reconst, nnode_h1d_gl, if_r)
subroutine, public meshfieldfilteroperationbase_apply_reconst1d_x(q, q0, minv_ml_tr, minv_mc_tr, minv_mr_tr, intrpmat, npx, npy, npz, ne, npx_reconst, lmesh)
module FElib / Data / Communication 1D
module FElib / Data / Communication base
Derived type representing a 1D reference element.
Derived type representing a modal filter.
Derived type representing a local mesh for 1D domain.
Derived type to manage a local computational domain (base type)
Derived type representing a field with local mesh (base type)
Derived type to manage a computational mesh (base type for 1D domain)
Derived type representing a field with 1D mesh.
Derived type to represent filter operation for 1D mesh field.
Base derived type to manage data communication with 1D domain.
Container to save a pointer of MeshField(1D, 2D, 3D) object.