19 implicit none ;
private 43 integer,
intent(in) :: N
44 real,
dimension(:),
intent(in) :: h
45 real,
dimension(:),
intent(in) :: u
46 real,
dimension(:,:),
intent(inout) :: ppoly_E
47 real,
dimension(:,:),
intent(inout) :: ppoly_S
48 real,
dimension(:,:),
intent(inout) :: ppoly_coefficients
57 call p3m_limiter( n, h, u, ppoly_e, ppoly_s, ppoly_coefficients )
65 subroutine p3m_limiter( N, h, u, ppoly_E, ppoly_S, ppoly_coefficients )
80 integer,
intent(in) :: N
81 real,
dimension(:),
intent(in) :: h
82 real,
dimension(:),
intent(in) :: u
83 real,
dimension(:,:),
intent(inout) :: ppoly_E
84 real,
dimension(:,:),
intent(inout) :: ppoly_S
85 real,
dimension(:,:),
intent(inout) :: ppoly_coefficients
96 real :: sigma_l, sigma_c, sigma_r
144 sigma_l = 2.0 * ( u_c - u_l ) / ( h_c +
h_neglect )
145 sigma_c = 2.0 * ( u_r - u_l ) / ( h_l + 2.0*h_c + h_r +
h_neglect )
146 sigma_r = 2.0 * ( u_r - u_c ) / ( h_c +
h_neglect )
148 if ( (sigma_l * sigma_r) .GT. 0.0 )
then 149 slope = sign( min(abs(sigma_l),abs(sigma_c),abs(sigma_r)), sigma_c )
157 if ( abs(u1_l*h_c) .LT. eps )
then 161 if ( abs(u1_r*h_c) .LT. eps )
then 167 if ( abs(u1_l) .GT. abs(sigma_l) )
then 171 if ( abs(u1_r) .GT. abs(sigma_r) )
then 184 if ( monotonic .EQ. 0 )
then 185 call monotonize_cubic( h_c, u0_l, u0_r, sigma_l, sigma_r, slope, u1_l, u1_r )
218 integer,
intent(in) :: N
219 real,
dimension(:),
intent(in) :: h
220 real,
dimension(:),
intent(in) :: u
221 real,
dimension(:,:),
intent(inout) :: ppoly_E
222 real,
dimension(:,:),
intent(inout) :: ppoly_S
223 real,
dimension(:,:),
intent(inout) :: ppoly_coefficients
248 b = ppoly_coefficients(i1,2)
252 slope = 2.0 * ( u1 - u0 ) / ( h0 +
h_neglect )
253 if ( abs(u1_r) .GT. abs(slope) )
then 264 u0_l = 3.0 * u0 + 0.5 * h0*u1_r - 2.0 * u0_r
265 u1_l = ( - 6.0 * u0 - 2.0 * h0*u1_r + 6.0 * u0_r) / ( h0 +
h_neglect )
270 if ( (u0_r-u0_l) * slope .LT. 0.0 )
then 286 if ( monotonic .EQ. 0 )
then 306 b = ppoly_coefficients(i0,2)
307 c = ppoly_coefficients(i0,3)
308 d = ppoly_coefficients(i0,4)
309 u1_l = (b + 2*c + 3*d) / ( h0 +
h_neglect )
312 slope = 2.0 * ( u1 - u0 ) / ( h1 +
h_neglect )
313 if ( abs(u1_l) .GT. abs(slope) )
then 324 u0_r = 3.0 * u1 - 0.5 * h1*u1_l - 2.0 * u0_l
325 u1_r = ( 6.0 * u1 - 2.0 * h1*u1_l - 6.0 * u0_l) / ( h1 +
h_neglect )
330 if ( (u0_r-u0_l) * slope .LT. 0.0 )
then 345 if ( monotonic .EQ. 0 )
then 370 real,
dimension(:),
intent(in) :: h
371 integer,
intent(in) :: k
372 real,
dimension(:,:),
intent(in) :: ppoly_E
373 real,
dimension(:,:),
intent(in) :: ppoly_S
374 real,
dimension(:,:),
intent(inout) :: ppoly_coefficients
380 real :: a0, a1, a2, a3
387 u1_l = ppoly_s(k,1) * h_c
388 u1_r = ppoly_s(k,2) * h_c
392 a2 = 3.0 * ( u0_r - u0_l ) - u1_r - 2.0 * u1_l
393 a3 = u1_r + u1_l + 2.0 * ( u0_l - u0_r )
395 ppoly_coefficients(k,1) = a0
396 ppoly_coefficients(k,2) = a1
397 ppoly_coefficients(k,3) = a2
398 ppoly_coefficients(k,4) = a3
417 real,
dimension(:,:),
intent(in) :: ppoly_coefficients
418 integer,
intent(in) :: k
422 real :: a0, a1, a2, a3
432 a0 = ppoly_coefficients(k,1)
433 a1 = ppoly_coefficients(k,2)
434 a2 = ppoly_coefficients(k,3)
435 a3 = ppoly_coefficients(k,4)
446 if ( rho .GE. 0.0 )
then 447 if ( abs(c) .GT. 1e-15 )
then 448 xi_0 = 0.5 * ( -b - sqrt( rho ) ) / c
449 xi_1 = 0.5 * ( -b + sqrt( rho ) ) / c
450 else if ( abs(b) .GT. 1e-15 )
then 457 if ( ( (xi_0 .GT. eps) .AND. (xi_0 .LT. 1.0-eps) ) .OR. &
458 ( (xi_1 .GT. eps) .AND. (xi_1 .LT. 1.0-eps) ) )
then 477 subroutine monotonize_cubic( h, u0_l, u0_r, sigma_l, sigma_r, slope, u1_l, u1_r )
507 real,
intent(in) :: h
508 real,
intent(in) :: u0_l, u0_r
509 real,
intent(in) :: sigma_l, sigma_r
510 real,
intent(in) :: slope
511 real,
intent(inout) :: u1_l, u1_r
515 integer :: inflexion_l
516 integer :: inflexion_r
532 if ( u1_l*slope .LE. 0.0 )
then 536 if ( u1_r*slope .LE. 0.0 )
then 543 a2 = 3.0 * ( u0_r - u0_l ) - h*(u1_r + 2.0*u1_l)
544 a3 = h*(u1_r + u1_l) + 2.0*(u0_l - u0_r)
549 if ( a3 .NE. 0.0 )
then 551 xi_ip = - a2 / (3.0 * a3)
554 if ( (xi_ip .GE. 0.0) .AND. (xi_ip .LE. 1.0) )
then 564 if ( found_ip .EQ. 1 )
then 565 slope_ip = a1 + 2.0*a2*xi_ip + 3.0*a3*xi_ip*xi_ip
568 if ( slope_ip*slope .LT. 0.0 )
then 569 if ( abs(sigma_l) .LT. abs(sigma_r) )
then 582 if ( inflexion_l .EQ. 1 )
then 584 u1_l_tmp = 1.5*(u0_r-u0_l)/h - 0.5*u1_r
585 u1_r_tmp = 3.0*(u0_r-u0_l)/h - 2.0*u1_l
587 if ( (u1_l_tmp*slope .LT. 0.0) .AND. (u1_r_tmp*slope .LT. 0.0) )
then 590 u1_r = 3.0 * (u0_r - u0_l) / h
592 else if (u1_l_tmp*slope .LT. 0.0)
then 595 u1_l = 1.5*(u0_r - u0_l)/h - 0.5*u1_r
597 else if (u1_r_tmp*slope .LT. 0.0)
then 600 u1_r = 3.0*(u0_r - u0_l)/h - 2.0*u1_l
612 if ( inflexion_r .EQ. 1 )
then 614 u1_l_tmp = 3.0*(u0_r-u0_l)/h - 2.0*u1_r
615 u1_r_tmp = 1.5*(u0_r-u0_l)/h - 0.5*u1_l
617 if ( (u1_l_tmp*slope .LT. 0.0) .AND. (u1_r_tmp*slope .LT. 0.0) )
then 619 u1_l = 3.0 * (u0_r - u0_l) / h
622 else if (u1_l_tmp*slope .LT. 0.0)
then 625 u1_l = 3.0*(u0_r - u0_l)/h - 2.0*u1_r
627 else if (u1_r_tmp*slope .LT. 0.0)
then 630 u1_r = 1.5*(u0_r - u0_l)/h - 0.5*u1_l
641 if ( abs(u1_l*h) .LT. eps )
then 645 if ( abs(u1_r*h) .LT. eps )
then subroutine monotonize_cubic(h, u0_l, u0_r, sigma_l, sigma_r, slope, u1_l, u1_r)
subroutine p3m_limiter(N, h, u, ppoly_E, ppoly_S, ppoly_coefficients)
subroutine, public average_discontinuous_edge_values(N, edge_values)
subroutine, public bound_edge_values(N, h, u, edge_values)
subroutine, public p3m_interpolation(N, h, u, ppoly_E, ppoly_S, ppoly_coefficients)
integer function is_cubic_monotonic(ppoly_coefficients, k)
subroutine build_cubic_interpolant(h, k, ppoly_E, ppoly_S, ppoly_coefficients)
real, parameter h_neglect
subroutine, public p3m_boundary_extrapolation(N, h, u, ppoly_E, ppoly_S, ppoly_coefficients)