-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconveyorfixedpointx.pro
114 lines (94 loc) · 3.05 KB
/
conveyorfixedpointx.pro
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
110
111
112
;+
;NAME:
; conveyorfixedpoint.pro
;
; PURPOSE:
; Calculate the axial fixed point and the axial and transvers
;stiffness at that point
;
;CATEGORY:
; Mathematics
;
;CALLING SEQUENCE:
; fixedpt = conveyorfixedpoint(ap,np,nm,eta1,eta2,intensity,npts,$
; fr_filename=fr_filename,$
; fz_filename=fz_filename)
;
;INPUTS:
; ap: radius of particle
;
; np: index of refraction of partice
;
; nm: index of refraction of medium
;
; lambda: vacuum wavelength of trapping light
;
; eta1: axial wavevector of first bessel beam component
;
; eta2: axial wavevector of second bessel beam component
;
; int: in watts/um^2
;
; npts: number of points to calculate force along
;
;KEYWORDS:
; fr_filename: name of the file name to write the radial force
;profile
;
; fz_filename: name of the filename to write the axial force profile.
;
;OUTPUTS:
; fixedpt: [zroot,zstiff,rstiff] defining parameters of fixed point
;
;DEPENDENCY:
;
;MODIFICATION HISTORY:
; 2014/04/14 Written by David B. Ruffner, New York University
function conveyorfixedpoint, ap,np,nm,lambda,eta1,eta2,int=int,npts=npts,$
fr_filename=fr_filename,$
fz_filename=fz_filename
if n_elements(npts) eq 0 then npts = 100
if n_elements(int) eq 0 then int = 1.
print,eta1,eta2
;Calculate the axial forces on axis
forcesz = conveyoraxialforce(ap,np,nm,lambda,eta1,eta2,int=int,npts=npts)
if n_elements(fz_filename) ne 0 then write_gdf,forcesz,fz_filename
dforceszdz = deriv(forcesz[0,*],forcesz[3,*])
;Find the axial fixed point
sign1 = forcesz[3,0]
sign2 = forcesz[3,1]
print,sign1,sign2
count = 0
found = 1
while ~(sign1 gt 0 and sign2 le 0) and count lt npts-2 do begin $
print,string(13b),"searching for root...",count,format='(A,A,I,$)' & $
count+=1 & $
sign1 = forcesz[3,count] & $
sign2 = forcesz[3,count+1] & $
found = 0 & $
if sign1 gt 0 and sign2 le 0 then found=1
endwhile
;If you don't find any axial stable point then exit
if ~found then begin
return, [-1,0,0]
endif
stableroot2 = forcesz[0,count]-forcesz[3,count]/dforceszdz[count]
stableroot3 = forcesz[0,count+1]-forcesz[3,count+1]/dforceszdz[count+1]
stableroot = mean([stableroot2,stableroot2])
zstiffness = -mean([dforceszdz[count],dforceszdz[count+1]])
;Now Calculate the radial stiffness
;Let's go the size of a particle radius on either side
forcesx = conveyorxforce(stableroot,ap,np,nm,lambda,eta1,eta2,$
int=int,npts=npts)
forcesx[1,*] = -forcesx[1,*];For some reason transverse force is opposite what
;it should be. FIX ME
print,"printing key parameters"
print,stableroot,ap,np,nm,lambda,eta1,eta2,npts
if n_elements(fr_filename) ne 0 then write_gdf,forcesx,fr_filename
dforcesxdx = deriv(forcesx[0,*],forcesx[1,*])
rstiffness = -dforcesxdx[npts/2.+1]
print,"stable root", stableroot
print,"z stiffness ",zstiffness
print,"r stiffness ",rstiffness
return,[stableroot,zstiffness,rstiffness]
end