-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvector_analysis.f90
More file actions
58 lines (48 loc) · 1.61 KB
/
vector_analysis.f90
File metadata and controls
58 lines (48 loc) · 1.61 KB
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
! Some very basic vector analysis operations using autodiff for vectors in the x-y plane
! grad, div, curl, del_squared
module vector_analysis
use AVD
implicit none
abstract interface
function f(p)
import
type(avd_d1) :: f
type(avd_d1), intent(in) :: p(3)
end function f
end interface
interface
module function grad(p, phi) result(r)
real(8) :: r(3)
real(8), intent(in) :: p(3)
procedure(f) :: phi
end function grad
module function div(p, phi)
real(8) :: div
real(8), intent(in) :: p(3)
procedure(f) :: phi
end function div
!module function del_squared(p, phi)
! real(8) :: del_squared
! real(8), intent(in) :: p(3)
! procedure(f) :: phi
!end function del_squared
!
!module function curl(p, phi)
! real(8) :: curl
! real(8), intent(in) :: p(3)
! procedure(f) :: phi
!end function curl
module function evaluate(p, phi)
real(8) :: evaluate
real(8), intent(in) :: p(3)
procedure(f) :: phi
end function evaluate
end interface
! Access the cross product as an operator so that the code reads better
interface operator(.cross.)
module pure function cross(a, b) result(r)
real(8), intent(in) :: a(3), b(3)
real(8) :: r(3)
end function cross
end interface
end module vector_analysis