374 integer,
intent(in) :: q
375 integer,
intent(in) :: local_buff_size, fd_number_in, fd_order_in
376 type(int_bounds_info),
optional,
intent(in) :: offset_s
377 real(wp),
allocatable,
dimension(:,:),
intent(inout) :: fd_coeff_s
378 real(wp),
dimension(-local_buff_size:q + local_buff_size),
intent(in) :: s_cc
386 if (
present(offset_s))
then
387 lb = -max(fd_number_in, offset_s%beg)
388 le = q + max(fd_number_in, offset_s%end)
391 le = q + fd_number_in
401 lb = max(lb, -local_buff_size + fd_number_in)
402 le = min(le, q + local_buff_size - fd_number_in)
405 if (fd_order_in == 1)
then
407 fd_coeff_s(-1, i) = 0._wp
408 fd_coeff_s(0, i) = -1._wp/(s_cc(i + 1) - s_cc(i))
409 fd_coeff_s(1, i) = -fd_coeff_s(0, i)
413 else if (fd_order_in == 2)
then
415 fd_coeff_s(-1, i) = -1._wp/(s_cc(i + 1) - s_cc(i - 1))
416 fd_coeff_s(0, i) = 0._wp
417 fd_coeff_s(1, i) = -fd_coeff_s(-1, i)
423 fd_coeff_s(-2, i) = 1._wp/(s_cc(i - 2) - 8._wp*s_cc(i - 1) - s_cc(i + 2) + 8._wp*s_cc(i + 1))
424 fd_coeff_s(-1, i) = -8._wp*fd_coeff_s(-2, i)
425 fd_coeff_s(0, i) = 0._wp
426 fd_coeff_s(1, i) = -fd_coeff_s(-1, i)
427 fd_coeff_s(2, i) = -fd_coeff_s(-2, i)
subroutine s_compute_finite_difference_coefficients(q, s_cc, fd_coeff_s, local_buff_size, fd_number_in, fd_order_in, offset_s)
Compute the centered finite-difference coefficients for first-order spatial derivatives in the s-coor...