-
Notifications
You must be signed in to change notification settings - Fork 3
/
example_Functions.F90
110 lines (96 loc) · 3.55 KB
/
example_Functions.F90
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
! Reference:
! Guptasarma D. and Singh, 1997. New digital linear filters for Hankel J_0
! and J_1 tranforms. Geophysical Prospecting, 45, 745-762.
module example_Functions
! examples from (Guptasarma and Singh, 1997)
implicit none
public
integer, parameter :: myKind = kind(1.0d0)
real(kind = myKind), private :: c = 1.0d0, alpha = 1.0d0
contains
real(kind = myKind) function exampleFunc1(varName, var) result(func)
! equation (4) in (Guptasarma and Singh, 1997)
character(len = *), intent(in) :: varName
real(kind = myKind), intent(in) :: var
if(varName == "lambda") then
func = exp( - c*var)
else if(varName == 'r') then
func = 1.0d0/sqrt(c*c + var*var)
else
func = 0.0d0
end if
end function exampleFunc1
real(kind = myKind) function exampleFunc2(varName, var) result(func)
! equation (5) in (Guptasarma and Singh, 1997)
character(len = *), intent(in) :: varName
real(kind = myKind), intent(in) :: var
if(varName == "lambda") then
func = var*exp( - c*var*var)
else if(varName == 'r') then
func = 1.0d0/(2.0d0*c)*exp( - var*var/(4.0d0*c))
else
func = 0.0d0
end if
end function exampleFunc2
real(kind = myKind) function exampleFunc3(varName, var) result(func)
! equation (6) in (Guptasarma and Singh, 1997)
character(len = *), intent(in) :: varName
real(kind = myKind), intent(in) :: var
if(varName == "lambda") then
func = var*exp( - c*var)
else if(varName == 'r') then
func = c/sqrt((c*c + var*var)**3)
else
func = 0.0d0
end if
end function exampleFunc3
real(kind = myKind) function exampleFunc4(varName, var) result(func)
! equation (7) in (Guptasarma and Singh, 1997)
character(len = *), intent(in) :: varName
real(kind = myKind), intent(in) :: var
if(varName == "lambda") then
func = var*exp( - c*var) + alpha*var*var*exp( - c*var*var)
else if(varName == 'r') then
func = var/sqrt((c*c + var*var)**3) &
& + alpha*var*exp( - var*var/(4.0d0*c))/(4.0d0*c*c)
else
func = 0.0d0
end if
end function exampleFunc4
real(kind = myKind) function exampleFunc5(varName, var) result(func)
! equation (8) in (Guptasarma and Singh, 1997)
character(len = *), intent(in) :: varName
real(kind = myKind), intent(in) :: var
if(varName == "lambda") then
func = var*exp( - c*var)
else if(varName == 'r') then
func = var/sqrt((c*c + var*var)**3)
else
func = 0.0d0
end if
end function exampleFunc5
real(kind = myKind) function exampleFunc6(varName, var) result(func)
! equation (9) in (Guptasarma and Singh, 1997)
character(len = *), intent(in) :: varName
real(kind = myKind), intent(in) :: var
if(varName == "lambda") then
func = var*var*exp( - c*var*var)
else if(varName == 'r') then
func = var*exp( - var*var/(4.0d0*c))/(4.0d0*c*c)
else
func = 0.0d0
end if
end function exampleFunc6
real(kind = myKind) function exampleFunc7(varName, var) result(func)
! equation (10) in (Guptasarma and Singh, 1997)
character(len = *), intent(in) :: varName
real(kind = myKind), intent(in) :: var
if(varName == "lambda") then
func = exp( - c*var)
else if(varName == 'r') then
func = (sqrt(var*var + c*c) - c)/(var*sqrt(var*var + c*c))
else
func = 0.0d0
end if
end function exampleFunc7
end module example_Functions