diff options
Diffstat (limited to 'src/derivs2.F90')
-rw-r--r-- | src/derivs2.F90 | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/derivs2.F90 b/src/derivs2.F90 new file mode 100644 index 0000000..4ca51bf --- /dev/null +++ b/src/derivs2.F90 @@ -0,0 +1,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 |