-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwake.f90
63 lines (57 loc) · 2.2 KB
/
wake.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
!Copyright (c) 2009 Jelle Reichert <jellereichert@gmail.com>
! Riccardo Gori <goriccardo@gmail.com>
!Released under BSD license, see LICENSE
subroutine WakeGrid(Nelem, Xnode, Uscalar, DT, NWake, XWnode)
IMPLICIT NONE
real(kind=8), intent(IN) :: Uscalar
real(kind=8), intent(IN) :: DT
integer, intent(IN) :: Nelem, NWake
real(kind=8), dimension(Nelem,2), intent(IN) :: Xnode
real(kind=8), dimension(NWake,2), intent(OUT) :: XWnode
real(kind=8), dimension(Nelem,2) :: Cpoint
real(kind=8), dimension(2) :: Xhalf, Cversor
real(kind=8) :: DXW, Dist
integer :: i
!Determine direction of wake by cord direction
call collocation(Nelem, Xnode, Cpoint)
Xhalf = Cpoint(Nelem/2+1,:)
Cversor = (Xnode(1,:) - Xhalf)/dist(Xnode(1,:), Xhalf)
DXW = Uscalar * DT
do i = 1,NWake
XWnode(i,:) = Xnode(1,:) + (i)*DXW*Cversor
end do
end subroutine
SUBROUTINE Wake(Nelem, NWake, NTime, ITime, PhiTime, DPhiW)
IMPLICIT NONE
integer, intent(IN) :: Nelem, NWake, NTime, ITime
real(kind=8), dimension(Nelem,NTime), intent(IN) :: PHITime
real(kind=8), dimension(NWake,NTime) :: DPhiW
DPhiW(2:,ITime+1) = DPhiW(:NWake-1,ITime)
DPhiW(1,ITime+1) = PhiTime(1,ITime) - PhiTime(Nelem,ITime)
END SUBROUTINE
!Super cool matrix D*R*S. D is aka F
!R is the retard (delays) matrix
!S is the stupid matrix
!DRS is a 'temple' matrix [name by Robin & Martin (aka Riccardo)]
!WARNING: s complex variable must be already in rad/s
subroutine MatDRS(Nelem, NWake, D, s, DT, DRS)
IMPLICIT NONE
integer, intent(IN) :: Nelem, NWake
real(kind=8), dimension(Nelem,NWake), intent(IN) :: D
real(kind=8), intent(IN) :: DT
complex(kind=8), intent(IN) :: s
complex(kind=8) :: ss
complex(kind=8), dimension(NWake) :: Rvec
complex(kind=8), dimension(Nelem,Nelem), intent(OUT) :: DRS
real(KIND=8), parameter :: PI = 4.D0*datan(1.D0)
integer :: i
DRS(:,:) = dcmplx(0)
ss = s*DT
do i = 1,NWake
Rvec(i) = cdexp(-ss*dble(i))
end do
do i = 1,Nelem
DRS(i,1) = dot_product(D(i,:),Rvec)
DRS(i,Nelem) = -DRS(i,1)
end do
end subroutine