-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabsorb.f90
52 lines (42 loc) · 1.76 KB
/
absorb.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
!
! absorb potential , from right sides [ ]
!
double precision function fun_absorb_rightside(xgrid)
use global
implicit none
real(kind=k1),intent(in):: xgrid
real(kind=k1) :: capot
if(xgrid<=absorb%r_right)then
capot=0.d0
!elseif(absorb1%grid(i)>=absorb1%r_left-absorb1%ramp.and.absorb1%grid(i)<absorb1%r_left)then
! capot=absorb1%strength*(1.d0-dcos(abs(absorb1%grid(i)-absorb1%r_left)/absorb1%ramp*pi))/2.d0
elseif(xgrid>absorb%r_right.and.xgrid<=absorb%r_right+absorb%ramp)then
capot=absorb%strength*(1.d0-dcos(abs(xgrid-absorb%r_right)/absorb%ramp*pi))/2.d0
elseif(xgrid>absorb%r_right+absorb%ramp)then
capot=absorb%strength
endif
capot=-capot
fun_absorb_rightside = capot
return
end function fun_absorb_rightside
!
! absorb potential , from two sides [ ]
!
double precision function fun_absorb_twoside(xgrid)
use global
implicit none
real(kind=k1),intent(in):: xgrid
real(kind=k1) :: capot
if(xgrid>=absorb%r_left.and.xgrid<=absorb%r_right)then
capot=0.d0
elseif(xgrid>=absorb%r_left-absorb%ramp.and.xgrid<absorb%r_left)then
capot=absorb%strength*(1.d0-dcos(abs(xgrid-absorb%r_left)/absorb%ramp*pi))/2.d0
elseif(xgrid>absorb%r_right.and.xgrid<=absorb%r_right+absorb%ramp)then
capot=absorb%strength*(1.d0-dcos(abs(xgrid-absorb%r_right)/absorb%ramp*pi))/2.d0
elseif(xgrid<absorb%r_left-absorb%ramp.or.xgrid>absorb%r_right+absorb%ramp)then
capot=absorb%strength
endif
capot=-capot
fun_absorb_twoside = capot
return
end function fun_absorb_twoside