26 public :: filter_hyperdiff
28 interface filter_hyperdiff
29 module procedure filter_hyperdiff_2d
31 end interface filter_hyperdiff
49 subroutine filter_hyperdiff_2d( &
50 IA, IS, IE, JA, JS, JE, &
58 integer,
intent(in) :: IA, IS, IE
59 integer,
intent(in) :: JA, JS, JE
61 real(RP),
intent(inout) :: data(IA,JA)
63 integer,
intent(in) :: order
64 integer,
intent(in) :: nite
66 real(RP),
intent(in),
optional :: limiter_sign(IA,JA)
68 real(RP),
pointer :: p1(:,:)
69 real(RP),
pointer :: p2(:,:)
70 real(RP),
target :: work1(IA,JA)
71 real(RP),
target :: work2(IA,JA)
80 if ( mod(order,2) .ne. 0 )
then
81 log_error(
"FILTER_hyperdiff_2D", *)
"order must be even"
85 limiter =
present( limiter_sign )
93 call comm_vars8(
data(:,:), 1 )
94 call comm_wait (
data(:,:), 1, .false. )
100 work2(i,j) =
data(i,j)
111 do j = max(js,2), min(je,ja-1)
112 do i = max(is,2), min(ie,ia-1)
113 p2(i,j) = ( - p1(i+1,j) + p1(i,j)*2.0_rp - p1(i-1,j) &
114 - p1(i,j+1) + p1(i,j)*2.0_rp - p1(i,j-1) ) / 8.0_rp
121 do i = max(is,2), min(ie,ia-1)
122 p2(i,js) = ( - p1(i+1,js) + p1(i,js)*2.0_rp - p1(i-1,js) &
123 - p1(i,js+1) + p1(i,js) ) / 6.0_rp
129 do i = max(is,2), min(ie,ia-1)
130 p2(i,js-1) = p2(i,js)
137 do i = max(is,2), min(ie,ia-1)
138 p2(i,je) = ( - p1(i+1,je) + p1(i,je)*2.0_rp - p1(i-1,je) &
139 + p1(i,je) - p1(i,je-1) ) / 6.0_rp
145 do i = max(is,2), min(ie,ia-1)
146 p2(i,je+1) = p2(i,je)
153 do j = max(js,2), min(je,ja-1)
154 p2(is,j) = ( - p1(is+1,j) + p1(is,j) &
155 - p1(is,j+1) + p1(is,j)*2.0_rp - p1(is,j-1) ) / 6.0_rp
160 p2(is,js) = ( - p1(is+1,js) + p1(is,js) &
161 - p1(is,js+1) + p1(is,js) ) / 4.0_rp
166 p2(is,je) = ( - p1(is+1,je) + p1(is,je) &
167 + p1(is,je) - p1(is,je-1) ) / 4.0_rp
172 do j = max(js-1,1), min(je+1,ja)
173 p2(is-1,j) = p2(is,j)
180 do j = max(js,2), min(je,ja-1)
181 p2(ie,j) = ( + p1(ie,j) - p1(ie-1,j) &
182 - p1(ie,j+1) + p1(ie,j)*2.0_rp - p1(ie,j-1) ) / 6.0_rp
187 p2(ie,js) = ( + p1(ie,js) - p1(ie-1,js) &
188 - p1(ie,js+1) + p1(ie,js) ) / 4.0_rp
193 p2(ie,je) = ( + p1(ie,je) - p1(ie-1,je) &
194 + p1(ie,je) - p1(ie,je-1) ) / 4.0_rp
199 do j = max(js-1,1), min(je+1,ja)
200 p2(ie+1,j) = p2(ie,j)
205 call comm_vars8( p2(:,:), 1 )
206 call comm_wait ( p2(:,:), 1, .false. )
208 if ( mod(n,2) == 0 )
then
221 data(i,j) =
data(i,j) - p1(i,j)
231 data(i,j) = sign( max(
data(i,j) * limiter_sign(i,j), 0.0_rp ), limiter_sign(i,j) )
244 end subroutine filter_hyperdiff_2d
249 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
257 integer,
intent(in) :: KA, KS, KE
258 integer,
intent(in) :: IA, IS, IE
259 integer,
intent(in) :: JA, JS, JE
261 real(RP),
intent(inout) :: data(KA,IA,JA)
263 integer,
intent(in) :: order
264 integer,
intent(in) :: nite
266 real(RP),
intent(in),
optional :: limiter_sign(KA,IA,JA)
268 real(RP) :: work_data(IA,JA)
269 real(RP) :: work_sign(IA,JA)
275 if (
present(limiter_sign) )
then
290 work_data(i,j) =
data(k,i,j)
299 work_sign(i,j) = limiter_sign(k,i,j)
304 call filter_hyperdiff_2d( ia, is, ie, ja, js, je, &
305 work_data(:,:), order, nite, &
306 limiter_sign = work_sign )
310 call filter_hyperdiff_2d( ia, is, ie, ja, js, je, &
311 work_data(:,:), order, nite )
319 data(k,i,j) = work_data(i,j)