1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
! $Header$
#ifndef TGR_INCLUDED
#include "cctk.h"
#include "cctk_Parameters.h"
module derivs2
implicit none
private
public get_2derivs
public get_2derivs2
contains
#endif
subroutine get_2derivs (a, f, pos, off, dx)
CCTK_REAL, intent(in) :: a(*)
CCTK_REAL, intent(out) :: f(2)
integer, intent(in) :: pos, off(2)
CCTK_REAL, intent(in) :: dx(2)
integer :: i
do i=1,2
f(i) = (a(pos+off(i)) - a(pos-off(i))) / (2*dx(i))
end do
end subroutine get_2derivs
subroutine get_2derivs2 (a, f, pos, off, dx)
CCTK_REAL, intent(in) :: a(*)
CCTK_REAL, intent(out) :: f(2,2)
integer, intent(in) :: pos, off(2)
CCTK_REAL, intent(in) :: dx(2)
integer :: i
do i=1,2
f(i,i) = (a(pos+off(i)) - 2*a(pos) + a(pos-off(i))) / dx(i)**2
end do
f(1,2) = ( a(pos-off(1)-off(2)) - a(pos+off(1)-off(2)) &
& - a(pos-off(1)+off(2)) + a(pos+off(1)+off(2))) / (4*dx(1)*dx(2))
f(2,1) = f(1,2)
end subroutine get_2derivs2
#ifndef TGR_INCLUDED
end module derivs2
#endif
|