ETS  \$Id: Doxyfile 2162 2020-02-26 14:16:09Z g2dpc $
 All Classes Files Functions Variables Pages
profile_check.f90
Go to the documentation of this file.
1 PROGRAM profile_check
2 
3  USE itm_types
4  USE itm_constants
5  USE euitm_schemas
6 
7  IMPLICIT NONE
8 
9  TYPE (type_equilibrium), pointer :: eq(:)
10  TYPE (type_coreprof), pointer :: coreprof(:)
11  TYPE (type_coretransp), pointer :: coretransp(:)
12 
13  interface
14  subroutine etaigb(eq, coreprof, coretransp)
15  use euitm_schemas
16  type (type_equilibrium), pointer :: eq(:)
17  type (type_coreprof), pointer :: coreprof(:)
18  type (type_coretransp), pointer :: coretransp(:)
19  end subroutine etaigb
20  end interface
21 
22  INTEGER(ITM_I4) :: i
23  INTEGER(ITM_I4) :: nrho_prof = 20, nion = 1, npsi_eq = 32, neta_eq = 64
24 
25  REAL(r8) :: pi=itm_pi
26  REAL(r8) :: tpi=2.0_r8*itm_pi
27 
28  REAL(r8) :: mu_0 = itm_mu0
29  REAL(r8) :: kb=itm_ev
30  REAL(r8) :: ee=itm_qe
31  REAL(r8) :: cc=1.0_r8, lcoul=14.0_r8
32 
33  REAL(r8) :: me=itm_me
34  REAL(r8) :: md=(1875.612793_r8/0.510998910_r8)*itm_me
35 
36  REAL(R8), DIMENSION(:), POINTER :: eta,ra,psi,qq,jphi
37 
38 !... set up CPOs
39 
40  allocate(eq(1))
41  allocate(coreprof(1))
42 
43 !... load profiles
44 
45  ALLOCATE(coreprof(1)%rho_tor_norm(nrho_prof))
46  ALLOCATE(coreprof(1)%rho_tor(nrho_prof))
47  ALLOCATE(coreprof(1)%psi%value(nrho_prof))
48  ALLOCATE(coreprof(1)%drho_dt(nrho_prof))
49 
50  ALLOCATE(coreprof(1)%ne%value(nrho_prof))
51  ALLOCATE(coreprof(1)%te%value(nrho_prof))
52  ALLOCATE(coreprof(1)%ni%value(nrho_prof,nion))
53  ALLOCATE(coreprof(1)%ti%value(nrho_prof,nion))
54 
55  ALLOCATE(coreprof(1)%profiles1d%q%value(nrho_prof))
56  ALLOCATE(coreprof(1)%profiles1d%zeff%value(nrho_prof))
57  ALLOCATE(coreprof(1)%profiles1d%wtor%value(nrho_prof,nion))
58  ALLOCATE(coreprof(1)%profiles1d%pe%value(nrho_prof))
59  ALLOCATE(coreprof(1)%profiles1d%pi%value(nrho_prof,nion))
60  ALLOCATE(coreprof(1)%profiles1d%pr_th%value(nrho_prof))
61  ALLOCATE(coreprof(1)%profiles1d%jtot%value(nrho_prof))
62  ALLOCATE(coreprof(1)%profiles1d%jni%value(nrho_prof))
63  ALLOCATE(coreprof(1)%profiles1d%joh%value(nrho_prof))
64  ALLOCATE(coreprof(1)%profiles1d%qoh%value(nrho_prof))
65  ALLOCATE(coreprof(1)%profiles1d%sigmapar%value(nrho_prof))
66 
67 !... set the global parameters
68 
69  coreprof(1)%toroid_field%b0 = 2.0_r8
70  coreprof(1)%toroid_field%r0 = 1.65_r8
71 
72  eq(1)%global_param%toroid_field%b0 = coreprof(1)%toroid_field%b0
73  eq(1)%global_param%toroid_field%r0 = coreprof(1)%toroid_field%r0
74 
75  eq(1)%eqgeometry%geom_axis%r = coreprof(1)%toroid_field%r0
76  eq(1)%eqgeometry%geom_axis%z = 0._r8
77  eq(1)%eqgeometry%a_minor = 0.5_r8
78  eq(1)%eqgeometry%elongation = 1.0_r8
79  eq(1)%eqgeometry%tria_upper = 0._r8
80  eq(1)%eqgeometry%tria_lower = 0._r8
81 
82  coreprof(1)%globalparam%vloop = 0._r8
83 
84 !... load equil
85 
86  ALLOCATE(eq(1)%coord_sys%grid%dim1(npsi_eq))
87  eq(1)%coord_sys%grid%dim1 = &
88  (/ ((1.0_r8/npsi_eq)*REAL(i-1),i=1,npsi_eq) /)
89 
90  ALLOCATE(eq(1)%profiles_1d%psi(npsi_eq))
91  ALLOCATE(eq(1)%profiles_1d%rho_tor(npsi_eq))
92  ALLOCATE(eq(1)%profiles_1d%rho_vol(npsi_eq))
93  ALLOCATE(eq(1)%profiles_1d%pressure(npsi_eq))
94  ALLOCATE(eq(1)%profiles_1d%jparallel(npsi_eq))
95  ALLOCATE(eq(1)%profiles_1d%jphi(npsi_eq))
96  ALLOCATE(eq(1)%profiles_1d%pprime(npsi_eq))
97  ALLOCATE(eq(1)%profiles_1d%ffprime(npsi_eq))
98  ALLOCATE(eq(1)%profiles_1d%F_dia(npsi_eq))
99  ALLOCATE(eq(1)%profiles_1d%q(npsi_eq))
100 
101  eq(1)%profiles_1d%psi=0._r8
102  eq(1)%profiles_1d%rho_tor=0._r8
103  eq(1)%profiles_1d%rho_vol=0._r8
104  eq(1)%profiles_1d%jphi=0._r8
105  eq(1)%profiles_1d%jparallel=0._r8
106  eq(1)%profiles_1d%pressure=0._r8
107  eq(1)%profiles_1d%q=0._r8
108  eq(1)%profiles_1d%pprime=0._r8
109  eq(1)%profiles_1d%ffprime=0._r8
110  eq(1)%profiles_1d%F_dia=0._r8
111 
112 !... set plasma boundary
113 
114  ALLOCATE(eq(1)%coord_sys%grid%dim2(neta_eq))
115  ALLOCATE(eq(1)%eqgeometry%boundary(1))
116  ALLOCATE(eq(1)%eqgeometry%boundary(1)%r(neta_eq))
117  ALLOCATE(eq(1)%eqgeometry%boundary(1)%z(neta_eq))
118 
119  eta => eq(1)%coord_sys%grid%dim2
120 
121  eta=(/ ((2.0_r8*pi/neta_eq)*REAL(i-1),i=1,neta_eq) /)
122 
123  eq(1)%eqgeometry%boundary(1)%r = &
124  eq(1)%eqgeometry%geom_axis%r + &
125  eq(1)%eqgeometry%a_minor*cos(eta)
126  eq(1)%eqgeometry%boundary(1)%z = &
127  eq(1)%eqgeometry%geom_axis%z + &
128  eq(1)%eqgeometry%a_minor*sin(eta)
129 
130 !... set profiles
131 
132  coreprof(1)%rho_tor_norm=(/ ((1.0_r8/nrho_prof)*(i-0.5),i=1,nrho_prof) /)
133  coreprof(1)%rho_tor=coreprof(1)%rho_tor_norm*eq(1)%eqgeometry%a_minor
134 
135  ra => coreprof(1)%rho_tor_norm
136  psi => coreprof(1)%psi%value
137  qq => coreprof(1)%profiles1d%q%value
138  jphi => coreprof(1)%profiles1d%jtot%value
139 
140  coreprof(1)%ne%value=6.0e19_r8*exp(-3.0_r8*ra*ra/3.3_r8)
141  coreprof(1)%te%value=5.0e3_r8*exp(-8.0_r8*ra*ra/3.3_r8)
142  coreprof(1)%ni%value(:,1)=coreprof(1)%ne%value
143  coreprof(1)%ti%value(:,1)=coreprof(1)%te%value
144  coreprof(1)%profiles1d%zeff%value = 2.0_r8
145  coreprof(1)%profiles1d%q%value = 1.5_r8+2.5_r8*ra*ra
146  coreprof(1)%profiles1d%wtor%value=0.0_r8
147  coreprof(1)%time=0.0_r8
148 
149  coreprof(1)%profiles1d%pe%value=coreprof(1)%ne%value*kb*coreprof(1)%te%value
150  coreprof(1)%profiles1d%pi%value=coreprof(1)%ni%value*kb*coreprof(1)%ti%value
151  coreprof(1)%profiles1d%pr_th%value=coreprof(1)%profiles1d%pe%value &
152  + coreprof(1)%profiles1d%pi%value(:,1)
153 
154 !... set current and psi from q
155 
156  jphi = (2._r8*coreprof(1)%toroid_field%b0/ &
157  (mu_0*coreprof(1)%toroid_field%r0))*1.5_r8/(qq*qq)
158 
159  psi = (pi*coreprof(1)%toroid_field%b0* &
160  eq(1)%eqgeometry%a_minor*eq(1)%eqgeometry%a_minor/ &
161  (4.0_r8-1.5_r8)) * log(qq/1.5_r8)
162 
163  coreprof(1)%profiles1d%jni%value=0.0_r8
164  coreprof(1)%profiles1d%joh%value=coreprof(1)%profiles1d%jtot%value
165 
166 !... call transport routine
167 
168  CALL etaigb(eq, coreprof, coretransp)
169 
170 !... write profiles
171 
172  OPEN (10, file = 'prof.dat', form = 'formatted')
173  WRITE(10,*) ' i rho_tor ne Te Ti D chi_e chi_i'
174  DO i=1,nrho_prof
175  WRITE (10,100) i, &
176 !. WRITE (10,*) &
177  coreprof(1)%rho_tor(i), &
178  coreprof(1)%ne%value(i), &
179  coreprof(1)%te%value(i), &
180  coreprof(1)%ti%value(i,1), &
181  coretransp(1)%ne_transp%diff_eff(i,3), &
182  coretransp(1)%te_transp%diff_eff(i), &
183  coretransp(1)%ti_transp%diff_eff(i,1)
184 
185  END DO
186  CLOSE (10)
187 100 FORMAT (i3,7g11.3)
188 
189 !... done
190 
191  stop
192 END PROGRAM profile_check
subroutine md
Definition: SPAR.f:347
program profile_check
subroutine eq(pcequi, psicon, ncequi, nstep, ngrid,
Definition: Eq_m.f:310
subroutine etaigb(eq, coreprof, coretransp, code_parameters)
Definition: etaigb.F90:1