11#include "scaleFElib.h"
19 use scale_prc,
only: prc_abort
63 procedure :: final => meshfieldfilteroperation2d_final
64 procedure :: apply => meshfieldfilteroperation2d_apply_filter
76 private :: extract_tmp2d
88 FilterShape, FilterWidthFac, &
90 sfield_num, hvfield_num, htensorfield_num, &
95 character(*),
intent(in) :: FilterOptrType
96 character(*),
intent(in) :: FilterShape
97 real(RP),
intent(in) :: FilterWidthFac
98 integer,
intent(in) :: Nnode_h1D_reconst
99 integer,
intent(in) :: sfield_num
100 integer,
intent(in) :: hvfield_num
101 integer,
intent(in) :: htensorfield_num
105 filteroptrtype, filtershape, filterwidthfac, &
110 call this%vars_comm%Init( sfield_num, hvfield_num, htensorfield_num, mesh2d, &
111 halosize_1d=this%hHaloSize )
113 log_info(
'MeshFieldFilterOperation2D_Init',*)
"Unsupported mesh type is specified. Check!"
121 subroutine meshfieldfilteroperation2d_final( this )
126 call this%vars_comm%Final()
128 end subroutine meshfieldfilteroperation2d_final
132 subroutine meshfieldfilteroperation2d_apply_filter( this, q_list, &
136 type(
meshfield2d),
intent(inout),
target :: q_list(this%vars_comm%field_num_tot)
137 class(
meshbase2d),
intent(in),
target :: mesh2D
141 real(RP),
allocatable :: tmp2D(:,:,:)
148 do iv=1, this%vars_comm%field_num_tot
149 comm_vars_list(iv)%field2d => q_list(iv)
151 call this%vars_comm%Put(comm_vars_list, 1)
152 call this%vars_comm%Exchange()
153 call this%vars_comm%Get(comm_vars_list, 1)
155 do n=1, mesh2d%LOCAL_MESH_NUM
156 lmesh2d => mesh2d%lcmesh_list(n)
157 elem2d => lmesh2d%refElem2D
158 allocate( tmp2d(-this%hHaloSize+1:elem2d%Nfp+this%hHaloSize,-this%hHaloSize+1:elem2d%Nfp+this%hHaloSize,lmesh2d%Ne) )
160 do iv=1, this%vars_comm%field_num_tot
161 call extract_tmp2d( tmp2d, &
162 q_list(iv)%local(n)%val, q_list(iv)%local(n)%val, lmesh2d, elem2d, lmesh2d%VMapP, this%hHaloSize, 0 )
164 select case (this%operator_type)
166 call apply_filter1d_x( q_list(iv)%local(n)%val, &
167 tmp2d, this%FilterMat_h1D, elem2d%Nfp, elem2d%Nfp, 1, lmesh2d%Ne, lmesh2d%NeA, elem2d%Nfp )
169 call apply_reconst1d_x( q_list(iv)%local(n)%val, &
170 tmp2d, this%Minv_Ml_tr, this%Minv_Mc_tr, this%Minv_Mr_tr, this%IntrpMat, elem2d%Nfp, elem2d%Nfp, 1, lmesh2d%Ne, this%Nnode_h1D_reconst, lmesh2d )
172 call apply_reconst1d_x_2( q_list(iv)%local(n)%val, &
173 tmp2d, this%Ml_tr, this%Mc_tr, this%Mr_tr, elem2d%Nfp, elem2d%Nfp, 1, lmesh2d%Ne, this%Nnode_h1D_reconst, lmesh2d )
180 call this%vars_comm%Put(comm_vars_list, 1)
181 call this%vars_comm%Exchange()
182 call this%vars_comm%Get(comm_vars_list, 1)
184 do n=1, mesh2d%LOCAL_MESH_NUM
185 lmesh2d => mesh2d%lcmesh_list(n)
186 elem2d => lmesh2d%refElem2D
187 allocate( tmp2d(-this%hHaloSize+1:elem2d%Nfp+this%hHaloSize,-this%hHaloSize+1:elem2d%Nfp+this%hHaloSize,lmesh2d%Ne) )
189 do iv=1, this%vars_comm%field_num_tot
190 call extract_tmp2d( tmp2d, &
191 q_list(iv)%local(n)%val, q_list(iv)%local(n)%val, lmesh2d, elem2d, lmesh2d%VMapP, this%hHaloSize, 1 )
193 select case (this%operator_type)
195 call apply_filter1d_y( q_list(iv)%local(n)%val, &
196 tmp2d, this%FilterMat_h1D, elem2d%Nfp, elem2d%Nfp, 1, lmesh2d%Ne, lmesh2d%NeA, elem2d%Nfp )
198 call apply_reconst1d_y( q_list(iv)%local(n)%val, &
199 tmp2d, this%Minv_Ml_tr, this%Minv_Mc_tr, this%Minv_Mr_tr, this%IntrpMat, elem2d%Nfp, elem2d%Nfp, 1, lmesh2d%Ne, this%Nnode_h1D_reconst, lmesh2d )
201 call apply_reconst1d_y_2( q_list(iv)%local(n)%val, &
202 tmp2d, this%Ml_tr, this%Mc_tr, this%Mr_tr, elem2d%Nfp, elem2d%Nfp, 1, lmesh2d%Ne, this%Nnode_h1D_reconst, lmesh2d )
210 end subroutine meshfieldfilteroperation2d_apply_filter
215 subroutine extract_tmp2d( tmp2D, q0, q0_, lmesh2D, elem2D, vmapP, hHaloSize, x_or_y )
219 integer,
intent(in) :: hHaloSize
220 real(RP),
intent(out) :: tmp2D(-hHaloSize+1:elem2D%Nfp+hHaloSize,-hHaloSize+1:elem2D%Nfp+hHaloSize,lmesh2D%Ne)
221 real(RP),
intent(in) :: q0(elem2D%Np*lmesh2D%NeA)
222 real(RP),
intent(in) :: q0_(elem2D%Nfp,elem2D%Nfp,lmesh2D%NeA)
223 integer,
intent(in) :: vmapP(elem2D%NfpTot,lmesh2D%Ne)
224 integer,
intent(in) :: x_or_y
226 integer :: ke, ke_h, ke_x, ke_y, px, py, ph, i, f
227 integer :: fso, fs, fe
228 integer :: iP(elem2D%Nfp)
229 real(RP) :: halo_h(elem2D%Nfp,hHaloSize,max(lmesh2D%NeX,lmesh2D%NeY),4)
234 neh_f(:) = (/ lmesh2d%NeX, lmesh2d%NeY, lmesh2d%NeX, lmesh2d%NeY /)
237 neh_os(f) = neh_os(f-1) + neh_f(f-1)
245 fso = lmesh2d%Ne * elem2d%Np &
246 + elem2d%Nfp*hhalosize * ( neh_os(f) + (ke_h-1) )
249 fs = fso + 1 + (ph-1)*elem2d%Nfp
250 fe = fso + elem2d%Nfp - 1
251 halo_h(:,ph,ke_h,f) = q0(fs:fe)
257 do ke_y=1, lmesh2d%NeY
258 do ke_x=1, lmesh2d%NeX
259 ke = ke_x + (ke_y-1) * lmesh2d%NeX
263 tmp2d(px,py,ke) = q0_(px,py,ke)
267 if ( x_or_y == 1 )
then
270 fs = fso + 1; fe = fs + elem2d%Nfp - 1
271 ip(:) = vmapp(fs:fe,ke)
272 if ( ip(1) <= lmesh2d%Ne * elem2d%Np )
then
274 tmp2d(1:elem2d%Nfp,-ph+1,ke) = q0(ip(:) - (ph-1)*elem2d%Nfp)
278 tmp2d(1:elem2d%Nfp,-ph+1,ke) = halo_h(:,ph,ke_x,1)
284 fs = fso + 1; fe = fs + elem2d%Nfp - 1
285 ip(:) = vmapp(fs:fe,ke)
286 if ( ip(1) <= lmesh2d%Ne * elem2d%Np )
then
288 tmp2d(1:elem2d%Nfp,ph+elem2d%Nfp,ke) = q0(ip(:) + (ph-1)*elem2d%Nfp)
292 tmp2d(1:elem2d%Nfp,ph+elem2d%Nfp,ke) = halo_h(:,ph,ke_x,3)
295 else if ( x_or_y == 0 )
then
298 fs = fso + 1; fe = fs + elem2d%Nfp - 1
299 ip(:) = vmapp(fs:fe,ke)
300 if ( ip(1) <= lmesh2d%Ne * elem2d%Np )
then
302 tmp2d(ph+elem2d%Nfp,1:elem2d%Nfp,ke) = q0(ip(:) + (ph-1))
306 tmp2d(ph+elem2d%Nfp,1:elem2d%Nfp,ke) = halo_h(:,ph,ke_y,2)
312 fs = fso + 1; fe = fs + elem2d%Nfp - 1
313 ip(:) = vmapp(fs:fe,ke)
314 if ( ip(1) <= lmesh2d%Ne * elem2d%Np )
then
316 tmp2d(-ph+1,1:elem2d%Nfp,ke) = q0(ip(:) - (ph-1))
320 tmp2d(-ph+1,1:elem2d%Nfp,ke) = halo_h(:,ph,ke_y,4)
329 end subroutine extract_tmp2d
module FElib / Element / Base
module FElib / Element/ ModalFilter
module FElib / Mesh / Local 2D
module FElib / Mesh / Local, Base
module FElib / Data / base
module FElib / Mesh / Base 2D
module FElib / Mesh / Rectangle 2D domain
module FElib / Data / base
module FElib / Data / Filter operation 2D
subroutine meshfieldfilteroperation2d_init(this, filteroptrtype, filtershape, filterwidthfac, nnode_h1d_reconst, sfield_num, hvfield_num, htensorfield_num, mesh2d)
Initialize an object to represent filter operation for 2D mesh field.
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_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)
integer, parameter, public filter_optrtype_convfilter
subroutine, public meshfieldfilteroperationbase_final(this)
module FElib / Data / Communication base
module FElib / Data / Communication 2D rectangle domain
Derived type representing a 2D reference element.
Derived type representing a 3D reference element.
Derived type representing a modal filter.
Derived type representing a local mesh for 2D 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 2D domain)
Derived type to manage a rectangular 2D computational domain.
Derived type representing a field with 2D mesh.
Derived type to represent filter operation for 2D mesh field.
Base type to represent filter operation.
Container to save a pointer of MeshField(1D, 2D, 3D) object.
Base derived type to manage data communication with 2D rectangle domain.