forked from compxco/genray
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdxdphi.f
69 lines (60 loc) · 2.31 KB
/
dxdphi.f
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
c ********************** dxdphi **********************
c * ------ *
c * this function calculates the derivative of x *
c * (being (omega_pl_i/omega)**2 ) with respect to *
c * phi (i - type of particles) *
c ****************************************************
c
c------------------------------------------------------------------
c !
c input parameters !
c !
c z, r phi - coordinates of the point where the derivative is !
c calculated. !
c i = 1 - electrons, !
c > 1 - ions. !
c rho is in common /one/
c------------------------------------------------------------------
real*8 function dxdphi(z,r,phi,i)
c implicit double precision (a-h,o-z)
implicit none
include 'param.i'
include 'one.i'
c-----input
real*8 z,r,phi
integer i !number of plasma specie
c-----external
real*8 d_density_r_z_i_d_phi,dense,dvarddph
c-----locals
real*8 den
cSAP090206
c den=densrho(rho,i)
c write(*,*)'dxdphi before dense'
if (rho.gt.1.d0-1.d-10) then
c----------------------------------------------------------
c the point is outside LCFS
c---------------------------------------------------------------
cSAP090403
dxdphi=0.d0
if(n_wall.gt.1) then
c-----------------------------------------------------------------
c calculate density derivative using spline at RZ mesh
c-----------------------------------------------------
dxdphi=v(i)*d_density_r_z_i_d_phi(z,r,phi,i) !derivative from RZ spline
endif
else
c----------------------------------------------------------
c the point is inside LCFS
c---------------------------------------------------------------
den=dense(z,r,phi,i)
if(den.lt.0.d0)then
den=0.d0
write(*,*)'in dxdphi den.lt.0.0 rho,i',rho,i
endif
dxdphi=0.d0
dxdphi=v(i)*den*dvarddph(z,r,phi)
c write(*,*)'in dxdphi v(i),den,dvarddph(z,r,phi),dxdphi',
c & v(i),den,dvarddph(z,r,phi),dxdphi
endif
return
end