FE-Project
Loading...
Searching...
No Matches
scale_atm_dyn_dgm_modalfilter Module Reference

module FElib / Fluid dyn solver / Atmosphere / Common / Modal filter More...

Functions/Subroutines

subroutine, public atm_dyn_dgm_modalfilter_apply (ddens_, momx_, momy_, momz_, drhot_, lmesh, elem, elem_operation, do_weight_gsqrt)
subroutine, public atm_dyn_dgm_tracer_modalfilter_apply (qtrc_, dens_hyd_, ddens0_, ddens_, lmesh, elem, elem_operation)
 Apply a modal filtering to tracer variables.

Detailed Description

module FElib / Fluid dyn solver / Atmosphere / Common / Modal filter

Description
Modal filter for Atmospheric dynamical process. The modal filter suppresses the numerical instability due to the aliasing errors.
Author
Yuta Kawai, Team SCALE

Function/Subroutine Documentation

◆ atm_dyn_dgm_modalfilter_apply()

subroutine, public scale_atm_dyn_dgm_modalfilter::atm_dyn_dgm_modalfilter_apply ( real(rp), dimension(elem%np,lmesh%nea), intent(inout) ddens_,
real(rp), dimension(elem%np,lmesh%nea), intent(inout) momx_,
real(rp), dimension(elem%np,lmesh%nea), intent(inout) momy_,
real(rp), dimension(elem%np,lmesh%nea), intent(inout) momz_,
real(rp), dimension(elem%np,lmesh%nea), intent(inout) drhot_,
class(localmeshbase), intent(in) lmesh,
class(elementbase), intent(in) elem,
class(elementoperationbase3d), intent(in) elem_operation,
logical, intent(in), optional do_weight_gsqrt )

Definition at line 49 of file scale_atm_dyn_dgm_modalfilter.F90.

53
54 implicit none
55
56 class(LocalMeshBase), intent(in) :: lmesh
57 class(ElementBase), intent(in) :: elem
58 real(RP), intent(inout) :: DDENS_(elem%Np,lmesh%NeA)
59 real(RP), intent(inout) :: MOMX_(elem%Np,lmesh%NeA)
60 real(RP), intent(inout) :: MOMY_(elem%Np,lmesh%NeA)
61 real(RP), intent(inout) :: MOMZ_(elem%Np,lmesh%NeA)
62 real(RP), intent(inout) :: DRHOT_(elem%Np,lmesh%NeA)
63 class(ElementOperationBase3D), intent(in) :: elem_operation
64 logical, intent(in), optional :: do_weight_Gsqrt
65
66 integer :: ke
67 real(RP) :: tmp(elem%Np,5)
68 real(RP) :: work(elem%Np)
69 real(RP) :: tmp_out(elem%Np,5)
70
71 integer :: kk
72 logical :: do_weight_Gsqrt_
73 real(RP) :: RGsqrt(elem%Np)
74 !------------------------------------
75
76 if ( present( do_weight_gsqrt ) ) then
77 do_weight_gsqrt_ = do_weight_gsqrt
78 else
79 do_weight_gsqrt_ = .false.
80 end if
81
82 if ( do_weight_gsqrt_ ) then
83 !$omp parallel do private( tmp, tmp_out, work, kk, RGsqrt )
84 do ke=lmesh%NeS, lmesh%NeE
85 do kk=1, elem%Np
86 tmp(kk,1) = lmesh%Gsqrt(kk,ke) * ddens_(kk,ke)
87 tmp(kk,2) = lmesh%Gsqrt(kk,ke) * momx_(kk,ke)
88 tmp(kk,3) = lmesh%Gsqrt(kk,ke) * momy_(kk,ke)
89 tmp(kk,4) = lmesh%Gsqrt(kk,ke) * momz_(kk,ke)
90 tmp(kk,5) = lmesh%Gsqrt(kk,ke) * drhot_(kk,ke)
91 end do
92
93 call elem_operation%ModalFilter_var5( tmp, work, &
94 tmp_out ) ! (out)
95
96 rgsqrt(:) = 1.0_rp / lmesh%Gsqrt(:,ke)
97 ddens_(:,ke) = tmp_out(:,1) * rgsqrt(:)
98 momx_(:,ke) = tmp_out(:,2) * rgsqrt(:)
99 momy_(:,ke) = tmp_out(:,3) * rgsqrt(:)
100 momz_(:,ke) = tmp_out(:,4) * rgsqrt(:)
101 drhot_(:,ke) = tmp_out(:,5) * rgsqrt(:)
102 end do
103
104 else
105
106 !$omp parallel do private( tmp, work, kk )
107 do ke=lmesh%NeS, lmesh%NeE
108
109 do kk=1, elem%Np
110 tmp(kk,1) = ddens_(kk,ke)
111 tmp(kk,2) = momx_(kk,ke)
112 tmp(kk,3) = momy_(kk,ke)
113 tmp(kk,4) = momz_(kk,ke)
114 tmp(kk,5) = drhot_(kk,ke)
115 end do
116
117 call elem_operation%ModalFilter_var5( tmp, work, &
118 tmp_out )
119
120 ddens_(:,ke) = tmp(:,1)
121 momx_(:,ke) = tmp(:,2)
122 momy_(:,ke) = tmp(:,3)
123 momz_(:,ke) = tmp(:,4)
124 drhot_(:,ke) = tmp(:,5)
125 end do
126
127 end if
128
129 return

References scale_element_operation_gpu_driver::elementoperationgpu_modalfilter_var5().

Referenced by mod_atmos_phy_preproc::physpreprocnone_init().

◆ atm_dyn_dgm_tracer_modalfilter_apply()

subroutine, public scale_atm_dyn_dgm_modalfilter::atm_dyn_dgm_tracer_modalfilter_apply ( real(rp), dimension(elem%np,lmesh%nea), intent(inout) qtrc_,
real(rp), dimension(elem%np,lmesh%nea), intent(in) dens_hyd_,
real(rp), dimension(elem%np,lmesh%nea), intent(in) ddens0_,
real(rp), dimension (elem%np,lmesh%nea), intent(in) ddens_,
class(localmeshbase), intent(in) lmesh,
class(elementbase), intent(in) elem,
class(elementoperationbase3d), intent(in) elem_operation )

Apply a modal filtering to tracer variables.

Definition at line 235 of file scale_atm_dyn_dgm_modalfilter.F90.

239
240 implicit none
241
242 class(LocalMeshBase), intent(in) :: lmesh
243 class(ElementBase), intent(in) :: elem
244 real(RP), intent(inout) :: QTRC_(elem%Np,lmesh%NeA)
245 real(RP), intent(in) :: DENS_hyd_(elem%Np,lmesh%NeA)
246 real(RP), intent(in) :: DDENS0_(elem%Np,lmesh%NeA)
247 real(RP), intent(in) :: DDENS_ (elem%Np,lmesh%NeA)
248 class(ElementOperationBase3D), intent(in) :: elem_operation
249
250 integer :: ke
251 real(RP) :: tmp(elem%Np)
252 real(RP) :: work(elem%Np)
253 real(RP) :: tmp_out(elem%Np)
254 real(RP) :: weight(elem%Np)
255
256 real(RP) :: qtrc_avg
257 real(RP) :: GsqrtRHOQ_ref(elem%Np)
258 integer :: kk
259 !------------------------------------
260
261 !$omp parallel do private( tmp, tmp_out, work, kk, weight, qtrc_avg, GsqrtRHOQ_ref )
262 do ke=lmesh%NeS, lmesh%NeE
263
264 ! ( dens_hyd + ddens0 ) * ( qtrc_av + dqtrc )
265 ! = ( dens_hyd + ddens ) * qtrc_avg + dens_ * dqtrc
266 !
267 ! dens_hyd * qtrc_avg + qtrc_avg [ MF * ddens ]
268 ! + MF_q [ dqtrc ]
269 qtrc_avg = 0.125_rp * sum(elem%IntWeight_lgl(:) * qtrc_(:,ke))
270 gsqrtrhoq_ref(:) = lmesh%Gsqrt(:,ke) * qtrc_avg * ( &
271 dens_hyd_(:,ke) + ddens_(:,ke) - ddens0_(:,ke) )
272
273 do kk=1, elem%Np
274 weight(kk) = lmesh%Gsqrt(kk,ke) &
275 * ( dens_hyd_(kk,ke) + ddens0_(kk,ke) )
276! tmp(kk) = weight(kk) * QTRC_(kk,ke)
277 tmp(kk) = weight(kk) * qtrc_(kk,ke) &
278 - gsqrtrhoq_ref(kk)
279 end do
280
281 ! del(RHO Q) = RHOQ - RHO_hyd Q_avg
282 ! = (RHO_hyd + dRHO) (Q_avg + dQ) - RHO_hyd Q_avg
283 ! = RHO_hyd dQ + dRHO Q_avg + dR
284 ! RHOQ = RHO_hyd Q_avg + del(RHO Q)
285 call elem_operation%ModalFilter_tracer( tmp, work, &
286 tmp_out )
287
288 qtrc_(:,ke) = ( gsqrtrhoq_ref(:) + tmp_out(:) ) / weight(:)
289 end do
290
291 return

Referenced by mod_atmos_phy_preproc::physpreprocnone_init().