FE-Project
Loading...
Searching...
No Matches
scale_meshfield_filter_operation_base.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module FElib / Data / Filter operation base
3!!
4!! @par Description
5!! This module provides a base class 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
24 use scale_meshfieldcomm_base, only: &
26
27 !-----------------------------------------------------------------------------
28 implicit none
29 private
30
31 !-----------------------------------------------------------------------------
32 !
33 !++ Public type & procedure
34 !
35
36 !> Base type to represent filter operation
38 integer :: operator_type
39 integer :: hhalosize
40
41 integer :: nnode_h1d_reconst
42
43 !- Reconstruction matrices
44 real(rp), allocatable :: filtermat_h1d(:,:)
45
46 !- Reconstruction matrices
47 real(rp), allocatable :: minv_ml_tr(:,:)
48 real(rp), allocatable :: minv_mc_tr(:,:)
49 real(rp), allocatable :: minv_mr_tr(:,:)
50 real(rp), allocatable :: intrpmat(:,:)
51
52 !- Reconstruction matrices (2)
53 real(rp), allocatable :: ml_tr(:,:)
54 real(rp), allocatable :: mc_tr(:,:)
55 real(rp), allocatable :: mr_tr(:,:)
56
57 !- Modal Filter
58 type(modalfilter) :: m_filter
59
60 !- Interface Correction
61 integer :: if_r = 8
62 real(rp), allocatable :: if_gl(:)
63 real(rp), allocatable :: if_gr(:)
64
65 contains
66 procedure, private :: prepair_filtermat => meshfieldfilteroperationbase_prepair_filter_matrix
67 procedure, private :: prepair_reconstmat => meshfieldfilteroperationbase_prepair_reconstruct_matrix
68 procedure, private :: prepair_reconstmat2 => meshfieldfilteroperationbase_prepair_reconstruct2_matrix
69 procedure, private :: prepair_reconstmat2_gl => meshfieldfilteroperationbase_prepair_reconstruct2_gl_matrix
70 procedure, private :: prepair_interfacecorrection => meshfieldfilteroperationbase_prepair_interface_correction
72
75
83
84 !-----------------------------------------------------------------------------
85 !
86 !++ Public parameters & variables
87 !
88
89 !-----------------------------------------------------------------------------
90 !
91 !++ Private type & procedure
92 !
93 private :: calc_filter_kenrnel
94
95
96 !-----------------------------------------------------------------------------
97 !
98 !++ Private parameters & variables
99 !
100
101 integer, parameter, public :: filter_optrtype_convfilter = 1
102 integer, parameter, public :: filter_optrtype_reconstruct = 2
103 integer, parameter, public :: filter_optrtype_reconstruct2 = 3
104 integer, parameter, public :: filter_optrtype_reconstruct2_gl = 4
105 integer, public, parameter :: filter_optrtype_interface_correction = 5
106 integer, parameter, public :: filter_optrtype_modalfilter = 6
107
108contains
109!OCL SERIAL
111 Nnode_h1D, &
112 FilterOptrType, FilterShape, FilterWidthFac, Nnode_h1D_reconst, &
113 Nnode_h1D_GL, IF_r )
114 implicit none
115 class(meshfieldfilteroperationbase), intent(inout) :: this
116 integer, intent(in) :: nnode_h1d
117 character(*), intent(in) :: filteroptrtype
118 character(*), intent(in) :: filtershape
119 real(rp), intent(in) :: filterwidthfac
120 integer, intent(in) :: nnode_h1d_reconst
121 integer, intent(in), optional :: nnode_h1d_gl
122 integer, intent(in), optional :: if_r
123 !------------------------------
124
125 select case(filteroptrtype)
126 case ('ConvolFilter')
127 call this%Prepair_FilterMat( nnode_h1d, filtershape, filterwidthfac )
128 this%operator_type = filter_optrtype_convfilter
129 case ('Reconstruction')
130 call this%Prepair_ReconstMat( nnode_h1d, nnode_h1d_reconst )
131 this%operator_type = filter_optrtype_reconstruct
132 this%Nnode_h1D_reconst = nnode_h1d_reconst
133 case ('Reconstruction2')
134 call this%Prepair_ReconstMat2( nnode_h1d, nnode_h1d_reconst )
135 this%operator_type = filter_optrtype_reconstruct2
136 this%Nnode_h1D_reconst = nnode_h1d_reconst
137 case ('Reconstruction2_GL')
138 call this%Prepair_ReconstMat2_GL( nnode_h1d, nnode_h1d_reconst, nnode_h1d_gl )
139 this%operator_type = filter_optrtype_reconstruct2_gl
140 this%Nnode_h1D_reconst = nnode_h1d_reconst
141 case ('InterfaceCorrection')
142 call this%Prepair_InterfaceCorrection( nnode_h1d, if_r )
143 this%operator_type = filter_optrtype_interface_correction
144 case default
145 log_info('MeshFieldFilterOperationBase_Init',*) "Unsupported filter operation is specified. Check!", trim(filteroptrtype)
146 call prc_abort
147 end select
148 return
150
152 implicit none
153 class(meshfieldfilteroperationbase), intent(inout) :: this
154 !------------------------------
155
156 if ( allocated(this%FilterMat_h1D) ) then
157 deallocate( this%FilterMat_h1D )
158 end if
159 if ( allocated(this%Minv_Ml_tr) ) then
160 deallocate( this%Minv_Ml_tr, this%Minv_Mc_tr, this%Minv_Mr_tr, this%IntrpMat )
161 end if
162 if ( allocated(this%Ml_tr) ) then
163 deallocate( this%Ml_tr, this%Mc_tr, this%Mr_tr )
164 end if
165 if ( allocated(this%IF_gL) ) then
166 deallocate( this%IF_gL, this%IF_gR )
167 end if
168
169 return
171
172!OCL SERIAL
173 subroutine meshfieldfilteroperationbase_apply_filter1d_x( q, q0, Filter1D, Npx, Npy, Npz, Ne, NeA, Nnode_h1D )
174 implicit none
175 integer, intent(in) :: npx, npy, npz, ne
176 integer, intent(in) :: nea
177 integer, intent(in) :: nnode_h1d
178 real(rp), intent(out) :: q(npx,npy,npz,nea)
179 real(rp), intent(in) :: q0(-npx+1:2*npx,-npy+1:2*npy,npz,ne)
180 real(rp), intent(in) :: filter1d(nnode_h1d,-npx+1:2*npx)
181
182 integer :: ke, pz, py, px, p
183 real(rp) :: tmp
184 !-------------------------------------
185
186 !$omp parallel do private(ke,px,py,pz,p,tmp) collapse(2)
187 do ke=1, ne
188 do pz=1, npz
189 do py=1, npy
190 do px=1, npx
191 tmp = 0.0_rp
192 do p=-npx+1, npx+npx
193 tmp = tmp + filter1d(px,p) * q0(p,py,pz,ke)
194 end do
195 q(px,py,pz,ke) = tmp
196 end do
197 end do
198 end do
199 end do
200 return
202
203!OCL SERIAL
204 subroutine meshfieldfilteroperationbase_apply_reconst1d_x( q, q0, Minv_Ml_tr, Minv_Mc_tr, Minv_Mr_tr, IntrpMat, &
205 Npx, Npy, Npz, Ne, Npx_reconst, lmesh )
206 implicit none
207 class(localmeshbase), intent(in) :: lmesh
208 integer, intent(in) :: npx, npy, npz, ne
209 integer, intent(in) :: npx_reconst
210 real(rp), intent(out) :: q(npx,npy,npz,lmesh%nea)
211 real(rp), intent(in) :: q0(-npx+1:2*npx,-npy+1:2*npy,npz,ne)
212 real(rp), intent(in) :: minv_ml_tr(npx,npx_reconst)
213 real(rp), intent(in) :: minv_mc_tr(npx,npx_reconst)
214 real(rp), intent(in) :: minv_mr_tr(npx,npx_reconst)
215 real(rp), intent(in) :: intrpmat(npx,npx_reconst)
216
217 integer :: ke, pz, py, px
218
219 integer :: i,j
220
221 real(rp) :: tmp(npx_reconst)
222 real(rp) :: s
223 !-------------------------------------
224
225 !$omp parallel do private(ke,px,py,pz,i,j, tmp,s) collapse(2)
226 do ke=1, ne
227 do pz=1, npz
228 do py=1, npy
229 do i=1, npx_reconst
230 s = 0.0_rp
231 do j=1, npx
232 s = s &
233 + minv_ml_tr(j,i) * q0(j-npx,py,pz,ke) &
234 + minv_mc_tr(j,i) * q0( j,py,pz,ke) &
235 + minv_mr_tr(j,i) * q0(j+npx,py,pz,ke)
236 end do
237 tmp(i) = s
238 end do
239 q(:,py,pz,ke) = matmul(intrpmat, tmp)
240 end do
241 end do
242 end do
243 return
245
246!OCL SERIAL
247 subroutine meshfieldfilteroperationbase_apply_reconst1d_x_2( q, q0, Minv_Ml_tr, Minv_Mc_tr, Minv_Mr_tr, &
248 Npx, Npy, Npz, Ne, Npx_reconst, lmesh )
249 implicit none
250 class(localmeshbase), intent(in) :: lmesh
251 integer, intent(in) :: npx, npy, npz, ne
252 integer, intent(in) :: npx_reconst
253 real(rp), intent(out) :: q(npx,npy,npz,lmesh%nea)
254 real(rp), intent(in) :: q0(-npx+1:2*npx,-npy+1:2*npy,npz,ne)
255 real(rp), intent(in) :: minv_ml_tr(npx,npx)
256 real(rp), intent(in) :: minv_mc_tr(npx,npx)
257 real(rp), intent(in) :: minv_mr_tr(npx,npx)
258
259 integer :: ke, pz, py, px
260
261 integer :: i,j
262
263 real(rp) :: tmp(npx)
264 real(rp) :: s
265 !-------------------------------------
266
267 !$omp parallel do private(ke,px,py,pz,i,j, tmp,s) collapse(2)
268 do ke=1, ne
269 do pz=1, npz
270 do py=1, npy
271 do i=1, npx
272 s = 0.0_rp
273 do j=1, npx
274 s = s &
275 + minv_ml_tr(j,i) * q0(j-npx,py,pz,ke) &
276 + minv_mc_tr(j,i) * q0( j,py,pz,ke) &
277 + minv_mr_tr(j,i) * q0(j+npx,py,pz,ke)
278 end do
279 tmp(i) = s
280 end do
281 q(:,py,pz,ke) = tmp(:)
282 end do
283 end do
284 end do
285 return
287
288!OCL SERIAL
290 Npx, Npy, Npz, Ne, lmesh )
291 implicit none
292 class(localmeshbase), intent(in) :: lmesh
293 integer, intent(in) :: npx, npy, npz, ne
294 real(rp), intent(out) :: q(npx,npy,npz,lmesh%nea)
295 real(rp), intent(in) :: q0(-npx+1:2*npx,-npy+1:2*npy,npz,ne)
296 real(rp), intent(in) :: gl(npx)
297 real(rp), intent(in) :: gr(npx)
298
299 integer :: ke, px, py, pz
300
301 real(rp) :: ql, qr
302 real(rp) :: qpl, qpr
303 real(rp) :: qstarl, qstarr
304 real(rp) :: dql, dqr
305 !-----------------------------------------------------
306
307 !$omp parallel do private(ke, px,py,pz,qL,qR,qPL,qPR,qstarL,qstarR,dqL,dqR) collapse(3)
308 do ke=1, ne
309 do pz=1, npz
310 do py=1, npy
311 ! Current-element traces
312 ql = q0(1, py,pz,ke)
313 qr = q0(npx, py,pz,ke)
314 ! Neighbor traces
315 qpl = q0(0, py,pz,ke)
316 qpr = q0(npx+1, py,pz,ke)
317
318 ! Common interface values
319 qstarl = 0.5_rp * ( ql + qpl )
320 qstarr = 0.5_rp * ( qr + qpr )
321
322 dql = qstarl - ql
323 dqr = qstarr - qr
324
325 do px=1, npx
326 q(px,py,pz,ke) = q0(px,py,pz,ke) &
327 + dql * gl(px) &
328 + dqr * gr(px)
329 end do
330
331 end do
332 end do
333 end do
334
335 return
337
338!OCL SERIAL
339 subroutine meshfieldfilteroperationbase_apply_filter1d_y( q, q0, Filter1D, Npx, Npy, Npz, Ne, NeA, Nnode_h1D )
340 implicit none
341 integer, intent(in) :: npx, npy, npz, ne
342 integer, intent(in) :: nea
343 integer, intent(in) :: nnode_h1d
344 real(rp), intent(out) :: q(npx,npy,npz,nea)
345 real(rp), intent(in) :: q0(-npx+1:2*npx,-npy+1:2*npy,npz,ne)
346 real(rp), intent(in) :: filter1d(nnode_h1d,-npy+1:2*npy)
347
348 integer :: ke, px, py, pz, p
349 real(rp) :: tmp
350 !-------------------------------------
351
352 !$omp parallel do private(ke,px,py,pz,p,tmp) collapse(2)
353 do ke=1, ne
354 do pz=1, npz
355 do py=1, npy
356 do px=1, npx
357 tmp = 0.0_rp
358 do p=-npy+1, npy+npy
359 tmp = tmp + filter1d(py,p) * q0(px,p,pz,ke)
360 end do
361 q(px,py,pz,ke) = tmp
362 end do
363 end do
364 end do
365 end do
366 return
368
369
370!OCL SERIAL
371 subroutine meshfieldfilteroperationbase_apply_reconst1d_y( q, q0, Minv_Ml_tr, Minv_Mc_tr, Minv_Mr_tr, IntrpMat, &
372 Npx, Npy, Npz, Ne, Npy_reconst, lmesh )
373 implicit none
374 class(localmeshbase), intent(in) :: lmesh
375 integer, intent(in) :: npx, npy, npz, ne
376 integer, intent(in) :: npy_reconst
377 real(rp), intent(out) :: q(npx,npy,npz,lmesh%nea)
378 real(rp), intent(in) :: q0(-npx+1:2*npx,-npy+1:2*npy,npz,ne)
379 real(rp), intent(in) :: minv_ml_tr(npy,npy_reconst)
380 real(rp), intent(in) :: minv_mc_tr(npy,npy_reconst)
381 real(rp), intent(in) :: minv_mr_tr(npy,npy_reconst)
382 real(rp), intent(in) :: intrpmat(npy,npy_reconst)
383
384 integer :: ke, pz, py, px
385
386 integer :: i,j
387 real(rp) :: tmp(npy_reconst)
388 real(rp) :: s
389 real(rp) :: q0_l(npy), q0_c(npy), q0_r(npy)
390 !-------------------------------------
391
392 !$omp parallel do private(ke,px,py,pz,i,j, tmp,s, &
393 !$omp q0_L,q0_C,q0_R) collapse(2)
394 do ke=1, ne
395 do pz=1, npz
396 do px=1, npx
397 do j=1, npy
398 q0_l(j) = q0(px,j-npy,pz,ke)
399 q0_c(j) = q0(px,j ,pz,ke)
400 q0_r(j) = q0(px,j+npy,pz,ke)
401 end do
402 do i=1, npy_reconst
403 s = 0.0_rp
404 do j=1, npy
405 s = s &
406 + minv_ml_tr(j,i) * q0_l(j) &
407 + minv_mc_tr(j,i) * q0_c(j) &
408 + minv_mr_tr(j,i) * q0_r(j)
409 end do
410 tmp(i) = s
411 end do
412 q(px,:,pz,ke) = matmul(intrpmat, tmp)
413 end do
414 end do
415 end do
416 return
418
419!OCL SERIAL
420 subroutine meshfieldfilteroperationbase_apply_reconst1d_y_2( q, q0, Minv_Ml_tr, Minv_Mc_tr, Minv_Mr_tr, &
421 Npx, Npy, Npz, Ne, Npy_reconst, lmesh )
422 implicit none
423 class(localmeshbase), intent(in) :: lmesh
424 integer, intent(in) :: npx, npy, npz, ne
425 integer, intent(in) :: npy_reconst
426 real(rp), intent(out) :: q(npx,npy,npz,lmesh%nea)
427 real(rp), intent(in) :: q0(-npx+1:2*npx,-npy+1:2*npy,npz,ne)
428 real(rp), intent(in) :: minv_ml_tr(npy,npy)
429 real(rp), intent(in) :: minv_mc_tr(npy,npy)
430 real(rp), intent(in) :: minv_mr_tr(npy,npy)
431
432 integer :: ke, pz, py, px
433
434 integer :: i,j
435 real(rp) :: tmp(npy)
436 real(rp) :: s
437 real(rp) :: q0_l(npy), q0_c(npy), q0_r(npy)
438 !-------------------------------------
439
440 !$omp parallel do private(ke,px,py,pz,i,j, tmp,s, &
441 !$omp q0_L,q0_C,q0_R) collapse(2)
442 do ke=1, ne
443 do pz=1, npz
444 do px=1, npx
445 do j=1, npy
446 q0_l(j) = q0(px,j-npy,pz,ke)
447 q0_c(j) = q0(px,j ,pz,ke)
448 q0_r(j) = q0(px,j+npy,pz,ke)
449 end do
450 do i=1, npy
451 s = 0.0_rp
452 do j=1, npy
453 s = s &
454 + minv_ml_tr(j,i) * q0_l(j) &
455 + minv_mc_tr(j,i) * q0_c(j) &
456 + minv_mr_tr(j,i) * q0_r(j)
457 end do
458 tmp(i) = s
459 end do
460 q(px,:,pz,ke) = tmp(:)
461 end do
462 end do
463 end do
464 return
466
467!-- Private routines -----------------
468
469!OCL SERIAL
470 subroutine meshfieldfilteroperationbase_prepair_filter_matrix( this, Nnode_h1D, FilterShape, FilterWidthFac )
471 use scale_polynomial, only: &
476 implicit none
477 class(meshfieldfilteroperationbase), intent(inout) :: this
478 integer, intent(in) :: nnode_h1d
479 character(*), intent(in) :: filtershape
480 real(rp), intent(in) :: filterwidthfac
481
482 integer :: p1, p2
483
484 real(rp) :: filterw
485 real(rp) :: filterw2
486 type(lineelement) :: elem1d
487 type(lineelement) :: elem1d_intrp
488
489 real(rp), allocatable :: lag(:,:)
490 real(rp), allocatable :: filter_func(:)
491
492 integer :: nintnode
493 real(rp), allocatable :: r_int1d(:)
494 real(rp), allocatable :: w_int1d(:)
495
496 integer :: polyorder_h
497 !--------------------------
498
499 polyorder_h = nnode_h1d - 1
500 call elem1d%Init( polyorder_h, .false. )
501 call elem1d_intrp%Init( min(2*polyorder_h, 11), .false. )
502
503 ! LOG_INFO("prepair_filter_matrix Pos:",*) elem1D%x1(:)
504 ! LOG_INFO("prepair_filter_matrix IntWeight:",*) elem1D%IntWeight_lgl(:)
505
506 allocate( this%FilterMat_h1D(elem1d%Np,-elem1d%Np+1:elem1d%Np+elem1d%Np) )
507
508 nintnode = min(2*polyorder_h, 11)
509 ! NGLnodes = elem1D_intrp%Np
510
511 allocate( r_int1d(nintnode), w_int1d(nintnode) )
512 r_int1d(:) = polynomial_gengausslegendrept( nintnode )
513 w_int1d(:) = polynomial_gengausslegendreptintweight( nintnode )
514 ! r_int1D(:) = elem1D_intrp%x1(:)
515 ! w_int1D(:) = elem1D_intrp%IntWeight_lgl(:)
516
517 allocate( filter_func(nintnode) )
518
519 allocate( lag(nintnode,elem1d%PolyOrder+1) )
520 lag(:,:) = polynomial_genlagrangepoly( elem1d%PolyOrder, elem1d%x1, r_int1d(:) )
521
522 this%FilterMat_h1D(:,:) = 0.0_rp
523
524 filterw = filterwidthfac * 2.0_rp / real(elem1d%Np,kind=rp)
525 this%hHaloSize = elem1d%Np
526
527 ! LOG_INFO("prepair_filter_matrix FilterW:",*) filterW
528
529 do p1=1, elem1d%Np
530 !--
531 call calc_filter_kenrnel( filter_func, &
532 filtershape, r_int1d(:) - elem1d%x1(p1), filterw, nintnode )
533 do p2=1, elem1d%Np
534 this%FilterMat_h1D(p1,p2) = sum( w_int1d(:) * lag(:,p2) * filter_func(:) )
535 end do
536 filterw2 = sum( w_int1d(:) * filter_func(:) )
537
538 !--
539 call calc_filter_kenrnel( filter_func, &
540 filtershape, r_int1d(:) - 2.0_rp - elem1d%x1(p1), filterw, nintnode )
541
542 ! this%FilterMat_h1D(p1,0) = sum( elem1D_intrp%IntWeight_lgl(:) * filter_func(:) )
543 do p2=1, elem1d%Np
544 this%FilterMat_h1D(p1,-elem1d%Np+p2) = sum( w_int1d(:) * lag(:,p2) * filter_func(:) )
545 end do
546 filterw2 = filterw2 + sum( w_int1d(:) * filter_func(:) )
547
548 !--
549 call calc_filter_kenrnel( filter_func, &
550 filtershape, r_int1d(:) + 2.0_rp - elem1d%x1(p1), filterw, nintnode )
551
552 ! this%FilterMat_h1D(p1,elem1D%Np+1) = sum( elem1D_intrp%IntWeight_lgl(:) * filter_func(:) )
553 do p2=1, elem1d%Np
554 this%FilterMat_h1D(p1,elem1d%Np+p2) = sum( w_int1d(:) * lag(:,p2) * filter_func(:) )
555 end do
556 filterw2 = filterw2 + sum( w_int1d(:) * filter_func(:) )
557
558 ! LOG_INFO("prepair_filter_matrix",*) p1, ":", filterW2, ":", this%FilterMat_h1D(p1,:)
559 this%FilterMat_h1D(p1,:) = this%FilterMat_h1D(p1,:) / filterw2 ! normalization
560 end do
561
562 call elem1d%Final()
563 call elem1d_intrp%Final()
564 return
565 end subroutine meshfieldfilteroperationbase_prepair_filter_matrix
566
567!OCL SERIAL
568 subroutine meshfieldfilteroperationbase_prepair_reconstruct_matrix( this, Nnode_h1D, Nnode_h1D_reconst )
569 use scale_polynomial, only: &
575 implicit none
576 class(meshfieldfilteroperationbase), intent(inout) :: this
577 integer, intent(in) :: nnode_h1d
578 integer, intent(in) :: nnode_h1d_reconst
579
580 integer :: p1, p2
581
582 type(lineelement) :: elem1d
583 type(lineelement) :: elem1d_reconst
584
585 real(rp), allocatable :: lagr_l(:,:)
586 real(rp), allocatable :: lagr_c(:,:)
587 real(rp), allocatable :: lagr_r(:,:)
588
589 real(rp), allocatable :: rec_lagr_l(:,:)
590 real(rp), allocatable :: rec_lagr_c(:,:)
591 real(rp), allocatable :: rec_lagr_r(:,:)
592
593 integer :: nintnode
594 real(rp), allocatable :: r_int1d(:)
595 real(rp), allocatable :: w_int1d(:)
596
597 real(rp) :: m_h1d_l(nnode_h1d_reconst,nnode_h1d)
598 real(rp) :: m_h1d_c(nnode_h1d_reconst,nnode_h1d)
599 real(rp) :: m_h1d_r(nnode_h1d_reconst,nnode_h1d)
600
601 real(rp) :: minv(nnode_h1d_reconst,nnode_h1d_reconst)
602 real(rp) :: tmpm(nnode_h1d_reconst,nnode_h1d)
603
604 real(rp), allocatable :: x_int(:)
605 real(rp) :: x_c(nnode_h1d)
606
607 integer :: polyorder
608 integer :: polyorder_reconst
609 type(modalfilter) :: modalfilter1d
610 !--------------------------
611
612 polyorder = nnode_h1d - 1
613 polyorder_reconst = nnode_h1d_reconst - 1
614
615 call elem1d%Init( polyorder, .false. )
616 call elem1d_reconst%Init( polyorder_reconst, .false. )
617 call modalfilter1d%Init(elem1d_reconst, 0.0_rp, 2e1_rp, 16)
618
619 this%hHaloSize = elem1d%Np
620
621 ! NIntNode = elem1D%Np
622 nintnode = ceiling( 0.5_rp * ( polyorder + polyorder_reconst ) ) + 1
623
624 allocate( r_int1d(nintnode), w_int1d(nintnode) )
625 allocate( x_int(nintnode) )
626 r_int1d(:) = polynomial_gengausslegendrept( nintnode )
627 w_int1d(:) = polynomial_gengausslegendreptintweight( nintnode )
628
629 !-
630 allocate( lagr_l(nintnode,elem1d%PolyOrder+1), rec_lagr_l(nintnode,polyorder_reconst+1) )
631 allocate( lagr_c(nintnode,elem1d%PolyOrder+1), rec_lagr_c(nintnode,polyorder_reconst+1) )
632 allocate( lagr_r(nintnode,elem1d%PolyOrder+1), rec_lagr_r(nintnode,polyorder_reconst+1) )
633
634 !-
635! x_int(:) = -1.0_RP + 0.25_RP * ( 1.0_RP + r_int1D(:) )
636 x_int(:) = -1.0_rp + (1.0_rp / 3.0_rp ) * ( 1.0_rp + r_int1d(:) )
637 rec_lagr_l(:,:) = polynomial_genlagrangepoly( polyorder_reconst, elem1d_reconst%x1, x_int(:) )
638
639! x_int(:) = 0.0_RP + 0.5_RP * ( 1.0_RP + r_int1D(:) )
640 x_int(:) = r_int1d(:)
641 lagr_l(:,:) = polynomial_genlagrangepoly( elem1d%PolyOrder, elem1d%x1, x_int(:) )
642
643 !-
644! x_int(:) = -0.5_RP + 0.5_RP * ( 1.0_RP + r_int1D(:) )
645 x_int(:) = -1.0_rp/3.0_rp + (1.0_rp / 3.0_rp ) * ( 1.0_rp + r_int1d(:) )
646 rec_lagr_c(:,:) = polynomial_genlagrangepoly( polyorder_reconst, elem1d_reconst%x1, x_int(:) )
647
648 x_int(:) = r_int1d(:)
649 lagr_c(:,:) = polynomial_genlagrangepoly( elem1d%PolyOrder, elem1d%x1, x_int(:) )
650
651 !-
652! x_int(:) = 0.5_RP + 0.25_RP * ( 1.0_RP + r_int1D(:) )
653 x_int(:) = +1.0_rp/3.0_rp + (1.0_rp / 3.0_rp ) * ( 1.0_rp + r_int1d(:) )
654 rec_lagr_r(:,:) = polynomial_genlagrangepoly( polyorder_reconst, elem1d_reconst%x1, x_int(:) )
655
656 ! x_int(:) = -1.0_RP + 0.5_RP * ( 1.0_RP + r_int1D(:) )
657 x_int(:) = r_int1d(:)
658 lagr_r(:,:) = polynomial_genlagrangepoly( elem1d%PolyOrder, elem1d%x1, x_int(:) )
659
660 !$omp parallel do collapse(2)
661 do p2=1, elem1d%Np
662 do p1=1, elem1d_reconst%Np
663 ! M_h1D_l(p1,p2) = 0.25_RP * sum( w_int1D(:) * lagr_l(:,p2) * rec_lagr_l(:,p1) )
664 ! M_h1D_c(p1,p2) = 0.5_RP * sum( w_int1D(:) * lagr_c(:,p2) * rec_lagr_c(:,p1) )
665 ! M_h1D_r(p1,p2) = 0.25_RP * sum( w_int1D(:) * lagr_r(:,p2) * rec_lagr_r(:,p1) )
666 m_h1d_l(p1,p2) = 1.0_rp/3.0_rp * sum( w_int1d(:) * lagr_l(:,p2) * rec_lagr_l(:,p1) )
667 m_h1d_c(p1,p2) = 1.0_rp/3.0_rp * sum( w_int1d(:) * lagr_c(:,p2) * rec_lagr_c(:,p1) )
668 m_h1d_r(p1,p2) = 1.0_rp/3.0_rp * sum( w_int1d(:) * lagr_r(:,p2) * rec_lagr_r(:,p1) )
669 end do
670 end do
671
672 allocate( this%Minv_Ml_tr(elem1d%Np,nnode_h1d_reconst) )
673 allocate( this%Minv_Mc_tr(elem1d%Np,nnode_h1d_reconst) )
674 allocate( this%Minv_Mr_tr(elem1d%Np,nnode_h1d_reconst) )
675 allocate( this%IntrpMat(elem1d%Np,nnode_h1d_reconst) )
676
677 minv(:,:) = elem1d_reconst%invM(:,:)
678 ! Minv(:,:) = matmul( modalFilter1D%FilterMat, Minv )
679
680 tmpm(:,:) = matmul(minv, m_h1d_l)
681 this%Minv_Ml_tr(:,:) = transpose(tmpm)
682
683 tmpm(:,:) = matmul(minv, m_h1d_c)
684 this%Minv_Mc_tr(:,:) = transpose(tmpm)
685
686 tmpm(:,:) = matmul(minv, m_h1d_r)
687 this%Minv_Mr_tr(:,:) = transpose(tmpm)
688
689! x_c(:) = -0.5_RP + 0.5_RP * ( 1.0_RP + elem1D%x1(:) )
690 x_c(:) = - 1.0_rp/3.0_rp + (1.0_rp/3.0_rp) * ( 1.0_rp + elem1d%x1(:) )
691 this%IntrpMat(:,:) = polynomial_genlagrangepoly( elem1d_reconst%PolyOrder, elem1d_reconst%x1, x_c(:) )
692
693 !-
694 call elem1d%Final()
695 call elem1d_reconst%Final()
696 call modalfilter1d%Final()
697 return
698 end subroutine meshfieldfilteroperationbase_prepair_reconstruct_matrix
699
700!OCL SERIAL
701 subroutine meshfieldfilteroperationbase_prepair_reconstruct2_matrix( this, Nnode_h1D, Nnode_h1D_reconst )
702 use scale_const, only: &
703 eps => const_eps
704 use scale_polynomial, only: &
710 implicit none
711 class(meshfieldfilteroperationbase), intent(inout) :: this
712 integer, intent(in) :: nnode_h1d
713 integer, intent(in) :: nnode_h1d_reconst
714
715 integer :: p0, p1, p2
716 real(rp) :: x0
717 real(rp) :: xr_rec, xl_rec
718 real(rp) :: xr, xl
719 real(rp) :: coef_l, coef_c, coef_r
720
721 type(lineelement) :: elem1d
722 type(lineelement) :: elem1d_reconst
723
724 real(rp), allocatable :: lagr_l(:,:)
725 real(rp), allocatable :: lagr_c(:,:)
726 real(rp), allocatable :: lagr_r(:,:)
727
728 real(rp), allocatable :: rec_lagr_l(:,:)
729 real(rp), allocatable :: rec_lagr_c(:,:)
730 real(rp), allocatable :: rec_lagr_r(:,:)
731
732 integer :: nintnode
733 real(rp), allocatable :: r_int1d(:)
734 real(rp), allocatable :: w_int1d(:)
735
736 real(rp) :: m_h1d_l(nnode_h1d_reconst,nnode_h1d)
737 real(rp) :: m_h1d_c(nnode_h1d_reconst,nnode_h1d)
738 real(rp) :: m_h1d_r(nnode_h1d_reconst,nnode_h1d)
739
740 real(rp) :: minv(nnode_h1d_reconst,nnode_h1d_reconst)
741
742 real(rp) :: minv_ml(nnode_h1d_reconst,nnode_h1d,nnode_h1d)
743 real(rp) :: minv_mc(nnode_h1d_reconst,nnode_h1d,nnode_h1d)
744 real(rp) :: minv_mr(nnode_h1d_reconst,nnode_h1d,nnode_h1d)
745
746 real(rp) :: intrpmat(1,nnode_h1d_reconst)
747 real(rp) :: tmpmat(1,nnode_h1d)
748
749 real(rp), allocatable :: x_int(:)
750 real(rp) :: x_c(1)
751
752 integer :: polyorder
753 integer :: polyorder_reconst
754 type(modalfilter) :: modalfilter1d
755 !--------------------------
756
757 polyorder = nnode_h1d - 1
758 polyorder_reconst = nnode_h1d_reconst - 1
759
760 call elem1d%Init( polyorder, .false. )
761 call elem1d_reconst%Init( polyorder_reconst, .false. )
762 call modalfilter1d%Init(elem1d_reconst, 0.0_rp, 1d3, 16)
763
764 this%hHaloSize = elem1d%Np
765
766 ! NIntNode = elem1D%Np
767 nintnode = ceiling( 0.5_rp * ( polyorder + polyorder_reconst ) ) + 1
768
769 allocate( r_int1d(nintnode), w_int1d(nintnode) )
770 allocate( x_int(nintnode) )
771 r_int1d(:) = polynomial_gengausslegendrept( nintnode )
772 w_int1d(:) = polynomial_gengausslegendreptintweight( nintnode )
773
774 !-
775 allocate( lagr_l(nintnode,elem1d%PolyOrder+1), rec_lagr_l(nintnode,polyorder_reconst+1) )
776 allocate( lagr_c(nintnode,elem1d%PolyOrder+1), rec_lagr_c(nintnode,polyorder_reconst+1) )
777 allocate( lagr_r(nintnode,elem1d%PolyOrder+1), rec_lagr_r(nintnode,polyorder_reconst+1) )
778
779 !-
780 minv(:,:) = elem1d_reconst%invM(:,:)
781 ! Minv(:,:) = matmul( modalFilter1D%FilterMat, Minv )
782
783 do p0=1, elem1d%Np
784 x0 = elem1d%x1(p0)
785
786 xl_rec = - 1.0_rp
787 xr_rec = xl_rec + 0.5_rp * ( 1.0_rp - x0 )
788 coef_l = 0.5_rp * ( xr_rec - xl_rec )
789 x_int(:) = xl_rec + coef_l * ( 1.0_rp + r_int1d(:) )
790 rec_lagr_l(:,:) = polynomial_genlagrangepoly( polyorder_reconst, elem1d_reconst%x1, x_int(:) )
791
792 xl = x0
793 xr = 1.0_rp
794 x_int(:) = xl + 0.5_rp * ( xr - xl ) * ( 1.0_rp + r_int1d(:) )
795 lagr_l(:,:) = polynomial_genlagrangepoly( elem1d%PolyOrder, elem1d%x1, x_int(:) )
796
797 !-
798 xl_rec = xr_rec
799 xr_rec = xl_rec + 0.5_rp * 2.0_rp
800 coef_c = 0.5_rp * ( xr_rec - xl_rec )
801 x_int(:) = xl_rec + coef_c * ( 1.0_rp + r_int1d(:) )
802 rec_lagr_c(:,:) = polynomial_genlagrangepoly( polyorder_reconst, elem1d_reconst%x1, x_int(:) )
803
804 x_int(:) = r_int1d(:)
805 lagr_c(:,:) = polynomial_genlagrangepoly( elem1d%PolyOrder, elem1d%x1, x_int(:) )
806
807 !-
808 xl_rec = xr_rec
809 xr_rec = xl_rec + 0.5_rp * ( x0 + 1.0_rp )
810 coef_r = 0.5_rp * ( xr_rec - xl_rec )
811 x_int(:) = xl_rec + coef_r * ( 1.0_rp + r_int1d(:) )
812 rec_lagr_r(:,:) = polynomial_genlagrangepoly( polyorder_reconst, elem1d_reconst%x1, x_int(:) )
813
814 xl = -1.0_rp
815 xr = x0
816 x_int(:) = xl + 0.5_rp * ( xr - xl ) * ( 1.0_rp + r_int1d(:) )
817 lagr_r(:,:) = polynomial_genlagrangepoly( elem1d%PolyOrder, elem1d%x1, x_int(:) )
818
819 !$omp parallel do collapse(2)
820 do p2=1, elem1d%Np
821 do p1=1, elem1d_reconst%Np
822 m_h1d_l(p1,p2) = coef_l * sum( w_int1d(:) * lagr_l(:,p2) * rec_lagr_l(:,p1) )
823 m_h1d_c(p1,p2) = coef_c * sum( w_int1d(:) * lagr_c(:,p2) * rec_lagr_c(:,p1) )
824 m_h1d_r(p1,p2) = coef_r * sum( w_int1d(:) * lagr_r(:,p2) * rec_lagr_r(:,p1) )
825 end do
826 end do
827
828 minv_ml(:,:,p0) = matmul( minv, m_h1d_l )
829 minv_mc(:,:,p0) = matmul( minv, m_h1d_c )
830 minv_mr(:,:,p0) = matmul( minv, m_h1d_r )
831 end do
832
833 x_c(:) = 0.0_rp
834 intrpmat(:,:) = polynomial_genlagrangepoly( elem1d_reconst%PolyOrder, elem1d_reconst%x1, x_c(:) )
835
836 allocate( this%Ml_tr(elem1d%Np,elem1d%Np) )
837 allocate( this%Mc_tr(elem1d%Np,elem1d%Np) )
838 allocate( this%Mr_tr(elem1d%Np,elem1d%Np) )
839
840 do p0=1, nnode_h1d
841 tmpmat(:,:) = matmul(intrpmat, minv_ml(:,:,p0))
842 this%Ml_tr(:,p0) = tmpmat(1,:)
843
844 tmpmat(:,:) = matmul(intrpmat, minv_mc(:,:,p0))
845 this%Mc_tr(:,p0) = tmpmat(1,:)
846
847 tmpmat(:,:) = matmul(intrpmat, minv_mr(:,:,p0))
848 this%Mr_tr(:,p0) = tmpmat(1,:)
849 end do
850
851 !-
852 call elem1d%Final()
853 call elem1d_reconst%Final()
854 call modalfilter1d%Final()
855 return
856 end subroutine meshfieldfilteroperationbase_prepair_reconstruct2_matrix
857
858!OCL SERIAL
859subroutine meshfieldfilteroperationbase_prepair_reconstruct2_gl_matrix( this, &
860 Nnode_h1D, Nnode_h1D_reconst, Nnode_h1D_GL )
861
862 use scale_polynomial, only: &
867
868 implicit none
869
870 class(meshfieldfilteroperationbase), intent(inout) :: this
871 integer, intent(in) :: nnode_h1d
872 integer, intent(in) :: nnode_h1d_reconst
873 integer, intent(in), optional :: nnode_h1d_gl
874
875 integer :: pg, p1, p2
876
877 real(rp) :: x0
878 real(rp) :: xr_rec, xl_rec
879 real(rp) :: xr, xl
880 real(rp) :: coef_l, coef_c, coef_r
881
882 type(lineelement) :: elem1d
883 type(lineelement) :: elem1d_reconst
884
885 real(rp), allocatable :: lagr_l(:,:)
886 real(rp), allocatable :: lagr_c(:,:)
887 real(rp), allocatable :: lagr_r(:,:)
888
889 real(rp), allocatable :: rec_lagr_l(:,:)
890 real(rp), allocatable :: rec_lagr_c(:,:)
891 real(rp), allocatable :: rec_lagr_r(:,:)
892
893 integer :: nintnode
894 real(rp), allocatable :: r_int1d(:)
895 real(rp), allocatable :: w_int1d(:)
896 real(rp), allocatable :: x_int(:)
897
898 real(rp) :: m_h1d_l(nnode_h1d_reconst,nnode_h1d)
899 real(rp) :: m_h1d_c(nnode_h1d_reconst,nnode_h1d)
900 real(rp) :: m_h1d_r(nnode_h1d_reconst,nnode_h1d)
901
902 real(rp) :: minv(nnode_h1d_reconst,nnode_h1d_reconst)
903
904 real(rp) :: minv_ml(nnode_h1d_reconst,nnode_h1d)
905 real(rp) :: minv_mc(nnode_h1d_reconst,nnode_h1d)
906 real(rp) :: minv_mr(nnode_h1d_reconst,nnode_h1d)
907
908 real(rp) :: intrpmat(1,nnode_h1d_reconst)
909 real(rp) :: tmpmat(1,nnode_h1d)
910
911 real(rp) :: x_c(1)
912
913 integer :: polyorder
914 integer :: polyorder_reconst
915
916 integer :: nnode_h1d_gl_
917 real(rp), allocatable :: x_gl(:)
918 !------------------------------------------------------------
919
920 polyorder = nnode_h1d - 1
921 polyorder_reconst = nnode_h1d_reconst - 1
922
923 if ( present(nnode_h1d_gl) ) then
924 nnode_h1d_gl_ = nnode_h1d_gl
925 else
926 nnode_h1d_gl_ = nnode_h1d
927 end if
928
929 ! Original DG element:
930 ! DOFs are located at LGL nodes.
931 call elem1d%Init( polyorder, .false. )
932
933 this%hHaloSize = elem1d%Np
934
935
936 ! Polynomial space used for patch reconstruction.
937 call elem1d_reconst%Init( polyorder_reconst, .false. )
938
939 ! GL points at which reconstructed values are required.
940 allocate( x_gl(nnode_h1d_gl_) )
941 x_gl(:) = polynomial_gengausslegendrept( nnode_h1d_gl_ )
942
943 ! Quadrature used to construct projection matrices.
944 ! Keep the same choice as Reconstruction2.
945 !
946 nintnode = ceiling( &
947 0.5_rp * real(polyorder + polyorder_reconst,kind=rp) ) + 1
948
949 allocate( r_int1d(nintnode) )
950 allocate( w_int1d(nintnode) )
951 allocate( x_int(nintnode) )
952
953 r_int1d(:) = polynomial_gengausslegendrept( nintnode )
954 w_int1d(:) = polynomial_gengausslegendreptintweight( nintnode )
955
956 allocate( lagr_l(nintnode,nnode_h1d) )
957 allocate( lagr_c(nintnode,nnode_h1d) )
958 allocate( lagr_r(nintnode,nnode_h1d) )
959
960 allocate( rec_lagr_l(nintnode,nnode_h1d_reconst) )
961 allocate( rec_lagr_c(nintnode,nnode_h1d_reconst) )
962 allocate( rec_lagr_r(nintnode,nnode_h1d_reconst) )
963
964 ! Inverse mass matrix in reconstruction space.
965 minv(:,:) = elem1d_reconst%invM(:,:)
966
967 ! The target point is always mapped onto the center of the reconstructed patch.
968 x_c(1) = 0.0_rp
969 intrpmat(:,:) = polynomial_genlagrangepoly( elem1d_reconst%PolyOrder, elem1d_reconst%x1, x_c )
970
971
972 allocate( this%Ml_tr(nnode_h1d,nnode_h1d_gl_) )
973 allocate( this%Mc_tr(nnode_h1d,nnode_h1d_gl_) )
974 allocate( this%Mr_tr(nnode_h1d,nnode_h1d_gl_) )
975
976 this%Ml_tr(:,:) = 0.0_rp
977 this%Mc_tr(:,:) = 0.0_rp
978 this%Mr_tr(:,:) = 0.0_rp
979
980 !- Loop over arbitrary-order GL nodes.
981 !
982
983 do pg = 1, nnode_h1d_gl_
984
985 x0 = x_gl(pg)
986
987 !==========================================================
988 ! Left element contribution
989 !
990 ! Original-coordinate interval: [x0, 1]
991 ! is mapped to the left part of the reconstructed patch.
992 !==========================================================
993
994 xl_rec = -1.0_rp
995 xr_rec = xl_rec + 0.5_rp * (1.0_rp - x0)
996
997 coef_l = 0.5_rp * (xr_rec - xl_rec)
998
999 x_int(:) = xl_rec &
1000 + coef_l * (1.0_rp + r_int1d(:))
1001
1002 rec_lagr_l(:,:) = polynomial_genlagrangepoly( &
1003 polyorder_reconst, &
1004 elem1d_reconst%x1, &
1005 x_int )
1006
1007 xl = x0
1008 xr = 1.0_rp
1009
1010 x_int(:) = xl &
1011 + 0.5_rp * (xr-xl) * (1.0_rp+r_int1d(:))
1012
1013 lagr_l(:,:) = polynomial_genlagrangepoly( &
1014 elem1d%PolyOrder, &
1015 elem1d%x1, &
1016 x_int )
1017
1018 !==========================================================
1019 ! Center element contribution
1020 !==========================================================
1021
1022 xl_rec = xr_rec
1023 xr_rec = xl_rec + 1.0_rp
1024
1025 coef_c = 0.5_rp * (xr_rec-xl_rec)
1026
1027 x_int(:) = xl_rec &
1028 + coef_c * (1.0_rp+r_int1d(:))
1029
1030 rec_lagr_c(:,:) = polynomial_genlagrangepoly( &
1031 polyorder_reconst, &
1032 elem1d_reconst%x1, &
1033 x_int )
1034
1035 x_int(:) = r_int1d(:)
1036
1037 lagr_c(:,:) = polynomial_genlagrangepoly( &
1038 elem1d%PolyOrder, &
1039 elem1d%x1, &
1040 x_int )
1041
1042 !==========================================================
1043 ! Right element contribution
1044 !
1045 ! Original-coordinate interval: [-1, x0]
1046 ! is mapped to the right part of the reconstructed patch.
1047 !==========================================================
1048
1049 xl_rec = xr_rec
1050 xr_rec = xl_rec + 0.5_rp * (x0 + 1.0_rp)
1051 coef_r = 0.5_rp * (xr_rec-xl_rec)
1052 x_int(:) = xl_rec + coef_r * (1.0_rp+r_int1d(:))
1053 rec_lagr_r(:,:) = polynomial_genlagrangepoly( polyorder_reconst, elem1d_reconst%x1, x_int )
1054
1055 xl = -1.0_rp
1056 xr = x0
1057 x_int(:) = xl + 0.5_rp * (xr-xl) * (1.0_rp+r_int1d(:))
1058 lagr_r(:,:) = polynomial_genlagrangepoly( elem1d%PolyOrder, elem1d%x1, x_int )
1059
1060 !==========================================================
1061 ! Cross mass matrices
1062 !==========================================================
1063
1064 do p2 = 1, nnode_h1d
1065 do p1 = 1, nnode_h1d_reconst
1066 m_h1d_l(p1,p2) = coef_l * sum( w_int1d(:) * lagr_l(:,p2) * rec_lagr_l(:,p1) )
1067 m_h1d_c(p1,p2) = coef_c * sum( w_int1d(:) * lagr_c(:,p2) * rec_lagr_c(:,p1) )
1068 m_h1d_r(p1,p2) = coef_r * sum( w_int1d(:) * lagr_r(:,p2) * rec_lagr_r(:,p1) )
1069 end do
1070 end do
1071
1072 !==========================================================
1073 ! Reconstruction coefficients
1074 !==========================================================
1075
1076 minv_ml(:,:) = matmul( minv, m_h1d_l )
1077 minv_mc(:,:) = matmul( minv, m_h1d_c )
1078 minv_mr(:,:) = matmul( minv, m_h1d_r )
1079
1080 !==========================================================
1081 ! Evaluate reconstructed polynomial at patch center.
1082 !
1083 ! The center corresponds to x0 in the original
1084 ! central element.
1085 !==========================================================
1086
1087 tmpmat(:,:) = matmul( intrpmat, minv_ml )
1088 this%Ml_tr(:,pg) = tmpmat(1,:)
1089
1090 tmpmat(:,:) = matmul( intrpmat, minv_mc )
1091 this%Mc_tr(:,pg) = tmpmat(1,:)
1092
1093 tmpmat(:,:) = matmul( intrpmat, minv_mr )
1094 this%Mr_tr(:,pg) = tmpmat(1,:)
1095 end do
1096
1097 !------------------------------------------------------------
1098
1099 deallocate( lagr_l, lagr_c, lagr_r )
1100 deallocate( rec_lagr_l, rec_lagr_c, rec_lagr_r )
1101 deallocate( r_int1d, w_int1d, x_int )
1102
1103 call elem1d%Final()
1104 call elem1d_reconst%Final()
1105 return
1106end subroutine meshfieldfilteroperationbase_prepair_reconstruct2_gl_matrix
1107
1108!OCL SERIAL
1109 subroutine meshfieldfilteroperationbase_prepair_interface_correction( this, Nnode_h1D, IF_r )
1111 implicit none
1112 class(meshfieldfilteroperationbase), intent(inout) :: this
1113 integer, intent(in) :: nnode_h1d
1114 integer, intent(in), optional :: if_r
1115
1116 type(lineelement) :: elem1d
1117 !---------------------------------------------
1118
1119 if ( present(if_r) ) then
1120 this%IF_r = if_r
1121 else
1122 this%IF_r = nnode_h1d
1123 end if
1124 call elem1d%Init( nnode_h1d-1, .false. )
1125
1126 this%hHaloSize = elem1d%Np
1127
1128 allocate( this%IF_gL(elem1d%Np) )
1129 allocate( this%IF_gR(elem1d%Np) )
1130 this%IF_gL(:) = ( 0.5_rp * ( 1.0_rp - elem1d%x1(:) ) )**this%IF_r
1131 this%IF_gR(:) = ( 0.5_rp * ( 1.0_rp + elem1d%x1(:) ) )**this%IF_r
1132
1133 call elem1d%Final()
1134 return
1135 end subroutine meshfieldfilteroperationbase_prepair_interface_correction
1136
1137!OCL SERIAL
1138 subroutine calc_filter_kenrnel( filter_kernel, &
1139 FilterShape, x, filter_width, Np )
1140 implicit none
1141 integer, intent(in) :: np
1142 real(rp), intent(out) :: filter_kernel(np)
1143 character(*), intent(in) :: filtershape
1144 real(rp), intent(in) :: x(np)
1145 real(rp), intent(in) :: filter_width
1146 !------------------------------------------------
1147
1148 select case(filtershape)
1149 case( "GAUSSIAN")
1150 filter_kernel(:) = exp( - (x(:)/filter_width)**2 )
1151 case( "TOPHAT")
1152 filter_kernel(:) = 0.5_rp * ( sign(1.0_rp, x(:) + 0.5_rp * filter_width) - sign(1.0_rp, x(:) - 0.5_rp * filter_width) )
1153 case default
1154 log_error("MeshFieldFilterOperation3D_calc_filter_kernel",*) "The specified FilterShape is not supported. Check!", filtershape
1155 call prc_abort
1156 end select
1157 return
1158 end subroutine calc_filter_kenrnel
1159
module FElib / Element / line
module FElib / Element/ ModalFilter
module FElib / Mesh / Local, Base
module FElib / Data / Filter operation base
subroutine, public meshfieldfilteroperationbase_apply_filter1d_y(q, q0, filter1d, npx, npy, npz, ne, nea, nnode_h1d)
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_y_2(q, q0, minv_ml_tr, minv_mc_tr, minv_mr_tr, npx, npy, npz, ne, npy_reconst, 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_apply_reconst1d_y(q, q0, minv_ml_tr, minv_mc_tr, minv_mr_tr, intrpmat, npx, npy, npz, ne, npy_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 base
Module common / Polynomial.
real(rp) function, dimension(nord), public polynomial_gengausslegendreptintweight(nord)
A function to calculate the Gauss-Legendre (GL) weights.
real(rp) function, dimension(size(x), nord+1), public polynomial_genlagrangepoly(nord, x_lgl, x)
A function to obtain the Lagrange basis functions related to the Gauss-Legendre-Lobatto (GLL) points.
real(rp) function, dimension(nord), public polynomial_gengausslegendrept(nord)
A function to calculate the Gauss-Legendre (GL) points.
Derived type representing a line element.
Derived type representing a modal filter.
Derived type to manage a local computational domain (base type)
Derived type representing a field with local mesh (base type)
Container to save a pointer of MeshField(1D, 2D, 3D) object.