11#include "scaleFElib.h"
19 use scale_prc,
only: prc_abort
38 integer :: operator_type
41 integer :: nnode_h1d_reconst
44 real(rp),
allocatable :: filtermat_h1d(:,:)
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(:,:)
53 real(rp),
allocatable :: ml_tr(:,:)
54 real(rp),
allocatable :: mc_tr(:,:)
55 real(rp),
allocatable :: mr_tr(:,:)
62 real(rp),
allocatable :: if_gl(:)
63 real(rp),
allocatable :: if_gr(:)
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
93 private :: calc_filter_kenrnel
112 FilterOptrType, FilterShape, FilterWidthFac, Nnode_h1D_reconst, &
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
125 select case(filteroptrtype)
126 case (
'ConvolFilter')
127 call this%Prepair_FilterMat( nnode_h1d, filtershape, filterwidthfac )
129 case (
'Reconstruction')
130 call this%Prepair_ReconstMat( nnode_h1d, nnode_h1d_reconst )
132 this%Nnode_h1D_reconst = nnode_h1d_reconst
133 case (
'Reconstruction2')
134 call this%Prepair_ReconstMat2( nnode_h1d, nnode_h1d_reconst )
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 )
140 this%Nnode_h1D_reconst = nnode_h1d_reconst
141 case (
'InterfaceCorrection')
142 call this%Prepair_InterfaceCorrection( nnode_h1d, if_r )
145 log_info(
'MeshFieldFilterOperationBase_Init',*)
"Unsupported filter operation is specified. Check!", trim(filteroptrtype)
156 if (
allocated(this%FilterMat_h1D) )
then
157 deallocate( this%FilterMat_h1D )
159 if (
allocated(this%Minv_Ml_tr) )
then
160 deallocate( this%Minv_Ml_tr, this%Minv_Mc_tr, this%Minv_Mr_tr, this%IntrpMat )
162 if (
allocated(this%Ml_tr) )
then
163 deallocate( this%Ml_tr, this%Mc_tr, this%Mr_tr )
165 if (
allocated(this%IF_gL) )
then
166 deallocate( this%IF_gL, this%IF_gR )
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)
182 integer :: ke, pz, py, px, p
193 tmp = tmp + filter1d(px,p) * q0(p,py,pz,ke)
205 Npx, Npy, Npz, Ne, Npx_reconst, 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)
217 integer :: ke, pz, py, px
221 real(rp) :: tmp(npx_reconst)
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)
239 q(:,py,pz,ke) = matmul(intrpmat, tmp)
248 Npx, Npy, Npz, Ne, Npx_reconst, 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)
259 integer :: ke, pz, py, px
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)
281 q(:,py,pz,ke) = tmp(:)
290 Npx, Npy, Npz, Ne, 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)
299 integer :: ke, px, py, pz
303 real(rp) :: qstarl, qstarr
313 qr = q0(npx, py,pz,ke)
315 qpl = q0(0, py,pz,ke)
316 qpr = q0(npx+1, py,pz,ke)
319 qstarl = 0.5_rp * ( ql + qpl )
320 qstarr = 0.5_rp * ( qr + qpr )
326 q(px,py,pz,ke) = q0(px,py,pz,ke) &
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)
348 integer :: ke, px, py, pz, p
359 tmp = tmp + filter1d(py,p) * q0(px,p,pz,ke)
372 Npx, Npy, Npz, Ne, Npy_reconst, 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)
384 integer :: ke, pz, py, px
387 real(rp) :: tmp(npy_reconst)
389 real(rp) :: q0_l(npy), q0_c(npy), q0_r(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)
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)
412 q(px,:,pz,ke) = matmul(intrpmat, tmp)
421 Npx, Npy, Npz, Ne, Npy_reconst, 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)
432 integer :: ke, pz, py, px
437 real(rp) :: q0_l(npy), q0_c(npy), q0_r(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)
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)
460 q(px,:,pz,ke) = tmp(:)
470 subroutine meshfieldfilteroperationbase_prepair_filter_matrix( this, Nnode_h1D, FilterShape, FilterWidthFac )
478 integer,
intent(in) :: nnode_h1d
479 character(*),
intent(in) :: filtershape
480 real(rp),
intent(in) :: filterwidthfac
489 real(rp),
allocatable :: lag(:,:)
490 real(rp),
allocatable :: filter_func(:)
493 real(rp),
allocatable :: r_int1d(:)
494 real(rp),
allocatable :: w_int1d(:)
496 integer :: polyorder_h
499 polyorder_h = nnode_h1d - 1
500 call elem1d%Init( polyorder_h, .false. )
501 call elem1d_intrp%Init( min(2*polyorder_h, 11), .false. )
506 allocate( this%FilterMat_h1D(elem1d%Np,-elem1d%Np+1:elem1d%Np+elem1d%Np) )
508 nintnode = min(2*polyorder_h, 11)
511 allocate( r_int1d(nintnode), w_int1d(nintnode) )
517 allocate( filter_func(nintnode) )
519 allocate( lag(nintnode,elem1d%PolyOrder+1) )
522 this%FilterMat_h1D(:,:) = 0.0_rp
524 filterw = filterwidthfac * 2.0_rp / real(elem1d%Np,kind=rp)
525 this%hHaloSize = elem1d%Np
531 call calc_filter_kenrnel( filter_func, &
532 filtershape, r_int1d(:) - elem1d%x1(p1), filterw, nintnode )
534 this%FilterMat_h1D(p1,p2) = sum( w_int1d(:) * lag(:,p2) * filter_func(:) )
536 filterw2 = sum( w_int1d(:) * filter_func(:) )
539 call calc_filter_kenrnel( filter_func, &
540 filtershape, r_int1d(:) - 2.0_rp - elem1d%x1(p1), filterw, nintnode )
544 this%FilterMat_h1D(p1,-elem1d%Np+p2) = sum( w_int1d(:) * lag(:,p2) * filter_func(:) )
546 filterw2 = filterw2 + sum( w_int1d(:) * filter_func(:) )
549 call calc_filter_kenrnel( filter_func, &
550 filtershape, r_int1d(:) + 2.0_rp - elem1d%x1(p1), filterw, nintnode )
554 this%FilterMat_h1D(p1,elem1d%Np+p2) = sum( w_int1d(:) * lag(:,p2) * filter_func(:) )
556 filterw2 = filterw2 + sum( w_int1d(:) * filter_func(:) )
559 this%FilterMat_h1D(p1,:) = this%FilterMat_h1D(p1,:) / filterw2
563 call elem1d_intrp%Final()
565 end subroutine meshfieldfilteroperationbase_prepair_filter_matrix
568 subroutine meshfieldfilteroperationbase_prepair_reconstruct_matrix( this, Nnode_h1D, Nnode_h1D_reconst )
577 integer,
intent(in) :: nnode_h1d
578 integer,
intent(in) :: nnode_h1d_reconst
585 real(rp),
allocatable :: lagr_l(:,:)
586 real(rp),
allocatable :: lagr_c(:,:)
587 real(rp),
allocatable :: lagr_r(:,:)
589 real(rp),
allocatable :: rec_lagr_l(:,:)
590 real(rp),
allocatable :: rec_lagr_c(:,:)
591 real(rp),
allocatable :: rec_lagr_r(:,:)
594 real(rp),
allocatable :: r_int1d(:)
595 real(rp),
allocatable :: w_int1d(:)
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)
601 real(rp) :: minv(nnode_h1d_reconst,nnode_h1d_reconst)
602 real(rp) :: tmpm(nnode_h1d_reconst,nnode_h1d)
604 real(rp),
allocatable :: x_int(:)
605 real(rp) :: x_c(nnode_h1d)
608 integer :: polyorder_reconst
612 polyorder = nnode_h1d - 1
613 polyorder_reconst = nnode_h1d_reconst - 1
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)
619 this%hHaloSize = elem1d%Np
622 nintnode = ceiling( 0.5_rp * ( polyorder + polyorder_reconst ) ) + 1
624 allocate( r_int1d(nintnode), w_int1d(nintnode) )
625 allocate( x_int(nintnode) )
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) )
636 x_int(:) = -1.0_rp + (1.0_rp / 3.0_rp ) * ( 1.0_rp + r_int1d(:) )
640 x_int(:) = r_int1d(:)
645 x_int(:) = -1.0_rp/3.0_rp + (1.0_rp / 3.0_rp ) * ( 1.0_rp + r_int1d(:) )
648 x_int(:) = r_int1d(:)
653 x_int(:) = +1.0_rp/3.0_rp + (1.0_rp / 3.0_rp ) * ( 1.0_rp + r_int1d(:) )
657 x_int(:) = r_int1d(:)
662 do p1=1, elem1d_reconst%Np
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) )
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) )
677 minv(:,:) = elem1d_reconst%invM(:,:)
680 tmpm(:,:) = matmul(minv, m_h1d_l)
681 this%Minv_Ml_tr(:,:) = transpose(tmpm)
683 tmpm(:,:) = matmul(minv, m_h1d_c)
684 this%Minv_Mc_tr(:,:) = transpose(tmpm)
686 tmpm(:,:) = matmul(minv, m_h1d_r)
687 this%Minv_Mr_tr(:,:) = transpose(tmpm)
690 x_c(:) = - 1.0_rp/3.0_rp + (1.0_rp/3.0_rp) * ( 1.0_rp + elem1d%x1(:) )
695 call elem1d_reconst%Final()
696 call modalfilter1d%Final()
698 end subroutine meshfieldfilteroperationbase_prepair_reconstruct_matrix
701 subroutine meshfieldfilteroperationbase_prepair_reconstruct2_matrix( this, Nnode_h1D, Nnode_h1D_reconst )
702 use scale_const,
only: &
712 integer,
intent(in) :: nnode_h1d
713 integer,
intent(in) :: nnode_h1d_reconst
715 integer :: p0, p1, p2
717 real(rp) :: xr_rec, xl_rec
719 real(rp) :: coef_l, coef_c, coef_r
724 real(rp),
allocatable :: lagr_l(:,:)
725 real(rp),
allocatable :: lagr_c(:,:)
726 real(rp),
allocatable :: lagr_r(:,:)
728 real(rp),
allocatable :: rec_lagr_l(:,:)
729 real(rp),
allocatable :: rec_lagr_c(:,:)
730 real(rp),
allocatable :: rec_lagr_r(:,:)
733 real(rp),
allocatable :: r_int1d(:)
734 real(rp),
allocatable :: w_int1d(:)
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)
740 real(rp) :: minv(nnode_h1d_reconst,nnode_h1d_reconst)
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)
746 real(rp) :: intrpmat(1,nnode_h1d_reconst)
747 real(rp) :: tmpmat(1,nnode_h1d)
749 real(rp),
allocatable :: x_int(:)
753 integer :: polyorder_reconst
757 polyorder = nnode_h1d - 1
758 polyorder_reconst = nnode_h1d_reconst - 1
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)
764 this%hHaloSize = elem1d%Np
767 nintnode = ceiling( 0.5_rp * ( polyorder + polyorder_reconst ) ) + 1
769 allocate( r_int1d(nintnode), w_int1d(nintnode) )
770 allocate( x_int(nintnode) )
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) )
780 minv(:,:) = elem1d_reconst%invM(:,:)
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(:) )
794 x_int(:) = xl + 0.5_rp * ( xr - xl ) * ( 1.0_rp + r_int1d(:) )
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(:) )
804 x_int(:) = r_int1d(:)
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(:) )
816 x_int(:) = xl + 0.5_rp * ( xr - xl ) * ( 1.0_rp + r_int1d(:) )
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) )
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 )
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) )
841 tmpmat(:,:) = matmul(intrpmat, minv_ml(:,:,p0))
842 this%Ml_tr(:,p0) = tmpmat(1,:)
844 tmpmat(:,:) = matmul(intrpmat, minv_mc(:,:,p0))
845 this%Mc_tr(:,p0) = tmpmat(1,:)
847 tmpmat(:,:) = matmul(intrpmat, minv_mr(:,:,p0))
848 this%Mr_tr(:,p0) = tmpmat(1,:)
853 call elem1d_reconst%Final()
854 call modalfilter1d%Final()
856 end subroutine meshfieldfilteroperationbase_prepair_reconstruct2_matrix
859subroutine meshfieldfilteroperationbase_prepair_reconstruct2_gl_matrix( this, &
860 Nnode_h1D, Nnode_h1D_reconst, Nnode_h1D_GL )
871 integer,
intent(in) :: nnode_h1d
872 integer,
intent(in) :: nnode_h1d_reconst
873 integer,
intent(in),
optional :: nnode_h1d_gl
875 integer :: pg, p1, p2
878 real(rp) :: xr_rec, xl_rec
880 real(rp) :: coef_l, coef_c, coef_r
885 real(rp),
allocatable :: lagr_l(:,:)
886 real(rp),
allocatable :: lagr_c(:,:)
887 real(rp),
allocatable :: lagr_r(:,:)
889 real(rp),
allocatable :: rec_lagr_l(:,:)
890 real(rp),
allocatable :: rec_lagr_c(:,:)
891 real(rp),
allocatable :: rec_lagr_r(:,:)
894 real(rp),
allocatable :: r_int1d(:)
895 real(rp),
allocatable :: w_int1d(:)
896 real(rp),
allocatable :: x_int(:)
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)
902 real(rp) :: minv(nnode_h1d_reconst,nnode_h1d_reconst)
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)
908 real(rp) :: intrpmat(1,nnode_h1d_reconst)
909 real(rp) :: tmpmat(1,nnode_h1d)
914 integer :: polyorder_reconst
916 integer :: nnode_h1d_gl_
917 real(rp),
allocatable :: x_gl(:)
920 polyorder = nnode_h1d - 1
921 polyorder_reconst = nnode_h1d_reconst - 1
923 if (
present(nnode_h1d_gl) )
then
924 nnode_h1d_gl_ = nnode_h1d_gl
926 nnode_h1d_gl_ = nnode_h1d
931 call elem1d%Init( polyorder, .false. )
933 this%hHaloSize = elem1d%Np
937 call elem1d_reconst%Init( polyorder_reconst, .false. )
940 allocate( x_gl(nnode_h1d_gl_) )
946 nintnode = ceiling( &
947 0.5_rp * real(polyorder + polyorder_reconst,kind=rp) ) + 1
949 allocate( r_int1d(nintnode) )
950 allocate( w_int1d(nintnode) )
951 allocate( x_int(nintnode) )
956 allocate( lagr_l(nintnode,nnode_h1d) )
957 allocate( lagr_c(nintnode,nnode_h1d) )
958 allocate( lagr_r(nintnode,nnode_h1d) )
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) )
965 minv(:,:) = elem1d_reconst%invM(:,:)
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_) )
976 this%Ml_tr(:,:) = 0.0_rp
977 this%Mc_tr(:,:) = 0.0_rp
978 this%Mr_tr(:,:) = 0.0_rp
983 do pg = 1, nnode_h1d_gl_
995 xr_rec = xl_rec + 0.5_rp * (1.0_rp - x0)
997 coef_l = 0.5_rp * (xr_rec - xl_rec)
1000 + coef_l * (1.0_rp + r_int1d(:))
1003 polyorder_reconst, &
1004 elem1d_reconst%x1, &
1011 + 0.5_rp * (xr-xl) * (1.0_rp+r_int1d(:))
1023 xr_rec = xl_rec + 1.0_rp
1025 coef_c = 0.5_rp * (xr_rec-xl_rec)
1028 + coef_c * (1.0_rp+r_int1d(:))
1031 polyorder_reconst, &
1032 elem1d_reconst%x1, &
1035 x_int(:) = r_int1d(:)
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(:))
1057 x_int(:) = xl + 0.5_rp * (xr-xl) * (1.0_rp+r_int1d(:))
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) )
1076 minv_ml(:,:) = matmul( minv, m_h1d_l )
1077 minv_mc(:,:) = matmul( minv, m_h1d_c )
1078 minv_mr(:,:) = matmul( minv, m_h1d_r )
1087 tmpmat(:,:) = matmul( intrpmat, minv_ml )
1088 this%Ml_tr(:,pg) = tmpmat(1,:)
1090 tmpmat(:,:) = matmul( intrpmat, minv_mc )
1091 this%Mc_tr(:,pg) = tmpmat(1,:)
1093 tmpmat(:,:) = matmul( intrpmat, minv_mr )
1094 this%Mr_tr(:,pg) = tmpmat(1,:)
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 )
1104 call elem1d_reconst%Final()
1106end subroutine meshfieldfilteroperationbase_prepair_reconstruct2_gl_matrix
1109 subroutine meshfieldfilteroperationbase_prepair_interface_correction( this, Nnode_h1D, IF_r )
1113 integer,
intent(in) :: nnode_h1d
1114 integer,
intent(in),
optional :: if_r
1119 if (
present(if_r) )
then
1122 this%IF_r = nnode_h1d
1124 call elem1d%Init( nnode_h1d-1, .false. )
1126 this%hHaloSize = elem1d%Np
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
1135 end subroutine meshfieldfilteroperationbase_prepair_interface_correction
1138 subroutine calc_filter_kenrnel( filter_kernel, &
1139 FilterShape, x, filter_width, Np )
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
1148 select case(filtershape)
1150 filter_kernel(:) = exp( - (x(:)/filter_width)**2 )
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) )
1154 log_error(
"MeshFieldFilterOperation3D_calc_filter_kernel",*)
"The specified FilterShape is not supported. Check!", filtershape
1158 end subroutine calc_filter_kenrnel
module FElib / Element / line
module FElib / Element/ ModalFilter
module FElib / Mesh / Local, Base
module FElib / Data / base
module FElib / Data / Filter operation base
subroutine, public meshfieldfilteroperationbase_apply_filter1d_y(q, q0, filter1d, npx, npy, npz, ne, nea, nnode_h1d)
integer, parameter, public filter_optrtype_reconstruct2
subroutine, public meshfieldfilteroperationbase_apply_filter1d_x(q, q0, filter1d, npx, npy, npz, ne, nea, nnode_h1d)
integer, parameter, public filter_optrtype_reconstruct
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)
integer, parameter, public filter_optrtype_interface_correction
integer, parameter, public filter_optrtype_reconstruct2_gl
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)
integer, parameter, public filter_optrtype_modalfilter
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)
integer, parameter, public filter_optrtype_convfilter
subroutine, public meshfieldfilteroperationbase_final(this)
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)
Base type to represent filter operation.
Container to save a pointer of MeshField(1D, 2D, 3D) object.