16 SUBROUTINE impurity_ets (EQUILIBRIUM_ITER, COREPROF_ITER, CORETRANSP_ITER, &
17 coreimpur_old, coreimpur_iter, coreneutrals_iter, &
18 coresource_iter, coresource_new, coreimpur_new, &
19 control_integer, control_double)
41 USE deallocate_structures
56 TYPE (type_equilibrium
),
POINTER :: equilibrium_iter(:)
57 TYPE (type_coreprof
),
POINTER :: coreprof_iter(:)
58 TYPE (type_coretransp
),
POINTER :: coretransp_iter(:)
59 TYPE (type_coreimpur
),
POINTER :: coreimpur_old(:)
60 TYPE (type_coreimpur
),
POINTER :: coreimpur_iter(:)
61 TYPE (type_coreimpur
),
POINTER :: coreimpur_new(:)
62 TYPE (type_coreneutrals
),
POINTER :: coreneutrals_iter(:)
63 TYPE (type_coresource
),
POINTER :: coresource_iter(:)
64 TYPE (type_coresource
),
POINTER :: coresource_new(:)
74 INTEGER,
ALLOCATABLE :: nzimp(:)
75 INTEGER,
ALLOCATABLE :: nz_bnd_type(:)
77 INTEGER,
ALLOCATABLE :: ntype(:)
78 INTEGER,
ALLOCATABLE :: ncomp(:)
79 INTEGER,
PARAMETER :: nocur = 1
84 INTEGER :: irho, iimp, izimp
85 INTEGER :: ineut, itype, icomp
91 REAL (R8) :: b0, b0prime
93 REAL (R8),
ALLOCATABLE :: rho(:)
94 REAL (R8),
ALLOCATABLE :: vol(:)
95 REAL (R8),
ALLOCATABLE :: vpr(:)
96 REAL (R8),
ALLOCATABLE :: vprm(:)
97 REAL (R8),
ALLOCATABLE :: g3(:)
98 REAL (R8),
ALLOCATABLE :: ne(:)
99 REAL (R8),
ALLOCATABLE :: te(:)
100 REAL (R8),
ALLOCATABLE :: dnz1(:,:)
101 REAL (R8),
ALLOCATABLE ::
flux(:,:)
102 REAL (R8),
ALLOCATABLE :: flux_inter(:,:)
103 REAL (R8),
ALLOCATABLE :: nz1(:,:)
104 REAL (R8),
ALLOCATABLE :: nzm1(:,:)
106 REAL (R8),
ALLOCATABLE :: tti(:)
108 REAL (R8),
ALLOCATABLE :: diff(:,:)
109 REAL (R8),
ALLOCATABLE :: vcon(:,:)
110 REAL (R8),
ALLOCATABLE :: imp_radiation(:,:)
111 REAL (R8),
ALLOCATABLE :: nzsource(:,:)
112 REAL (R8),
ALLOCATABLE :: nz_bnd(:,:)
113 REAL (R8),
ALLOCATABLE :: aneut(:)
116 REAL (R8),
ALLOCATABLE :: lin_rad1(:,:)
117 REAL (R8),
ALLOCATABLE :: brem_rad1(:,:)
118 REAL (R8),
ALLOCATABLE :: lin_rad(:)
119 REAL (R8),
ALLOCATABLE :: brem_rad(:)
120 REAL (R8),
ALLOCATABLE :: jon_en1(:,:)
121 REAL (R8),
ALLOCATABLE :: jon_en(:)
122 REAL (R8),
ALLOCATABLE :: rec_los1(:,:)
123 REAL (R8),
ALLOCATABLE :: rec_los(:)
124 REAL (R8),
ALLOCATABLE :: qrad(:)
125 REAL (R8),
ALLOCATABLE :: se_exp(:)
127 REAL (R8),
ALLOCATABLE ::
fun(:)
128 REAL (R8),
ALLOCATABLE :: fun_in(:)
129 REAL (R8),
ALLOCATABLE :: fun_out(:)
131 INTEGER,
INTENT(IN) :: control_integer(2)
132 REAL (R8),
INTENT(IN) :: control_double(5)
135 LOGICAL,
SAVE :: first = .true.
137 REAL (R8),
ALLOCATABLE ::r_lin_int(:)
138 REAL (R8),
ALLOCATABLE ::r_lin_int1(:,:)
139 REAL (R8),
ALLOCATABLE ::r_brem_int(:)
140 REAL (R8),
ALLOCATABLE ::r_brem_int1(:,:)
141 REAL (R8),
ALLOCATABLE ::r_sum_int(:)
142 REAL (R8),
ALLOCATABLE ::r_sum_int1(:,:)
143 REAL (R8),
ALLOCATABLE ::e_jon_int(:)
144 REAL (R8),
ALLOCATABLE ::e_jon_int1(:,:)
145 REAL (R8),
ALLOCATABLE ::e_rec_int(:)
146 REAL (R8),
ALLOCATABLE ::e_rec_int1(:,:)
147 REAL (R8),
ALLOCATABLE ::e_sum_int(:)
148 REAL (R8),
ALLOCATABLE ::e_sum_int1(:,:)
149 REAL (R8),
ALLOCATABLE ::sum_lin_int(:)
150 REAL (R8),
ALLOCATABLE ::sum_brem_int(:)
151 REAL (R8),
ALLOCATABLE ::sum_rad_int(:)
152 REAL (R8),
ALLOCATABLE ::sum_jon_int(:)
153 REAL (R8),
ALLOCATABLE ::sum_rec_int(:)
154 REAL (R8),
ALLOCATABLE ::sum_los_int(:)
159 TYPE (amns_handle_type
),
SAVE :: amns
160 TYPE (amns_handle_rx_type
),
ALLOCATABLE,
SAVE :: &
161 amns_ei(:,:), amns_eip(:,:),amns_rc(:,:), amns_lr(:,:), amns_br(:,:)
162 TYPE (amns_version_type
) :: amns_database
163 TYPE (amns_reaction_type
) :: ei_rx, eip_rx, rc_rx, lr_rx, br_rx
164 TYPE (amns_reactants_type
) :: species
165 TYPE (amns_query_type
) :: query
166 TYPE (amns_answer_type
) :: answer
167 TYPE (amns_set_type
) :: set
169 type (amns_version_type
) :: version
170 REAL (R8) :: zn_imp, am_imp
172 CHARACTER (len=80) :: format
176 WRITE (*,*)
'===========> IMPURITY started'
180 neq =
SIZE (equilibrium_iter(1)%profiles_1d%rho_tor )
181 nrho =
SIZE (coreimpur_iter(1)%rho_tor)
183 CALL
get_comp_dimensions(coreimpur_old(1)%COMPOSITIONS, nnucl, nion, nimp, nzimp, nneut, ntype, ncomp)
185 max_nzimp = maxval(nzimp)
192 ALLOCATE (coreimpur_new(1))
193 CALL copy_cpo(coreimpur_iter(1), coreimpur_new(1))
198 CALL deallocate_cpo(coresource_new(1)%COMPOSITIONS)
199 CALL copy_cpo(coreimpur_iter(1)%COMPOSITIONS, coresource_new(1)%COMPOSITIONS)
201 coreimpur_new(1)%datainfo%cocos = 13
202 coresource_new(1)%datainfo%cocos = 13
204 coreimpur_new(1)%time = coreprof_iter(1)%time
205 coresource_new(1)%time = coreprof_iter(1)%time
207 coreimpur_new(1)%rho_tor = coreprof_iter(1)%rho_tor
208 coresource_new(1)%VALUES(1)%rho_tor = coreprof_iter(1)%rho_tor
210 coreimpur_new(1)%rho_tor_norm = coreprof_iter(1)%rho_tor/coreprof_iter(1)%rho_tor(nrho)
211 coresource_new(1)%VALUES(1)%rho_tor_norm = coreprof_iter(1)%rho_tor/coreprof_iter(1)%rho_tor(nrho)
214 coreimpur_new(1)%diagnosticsum%radiation%line_rad%profile = 0.0_r8
215 coreimpur_new(1)%diagnosticsum%radiation%brem_radrec%profile = 0.0_r8
216 coreimpur_new(1)%diagnosticsum%radiation%sum%profile = 0.0_r8
217 coreimpur_new(1)%diagnosticsum%energy%ionization%profile = 0.0_r8
218 coreimpur_new(1)%diagnosticsum%energy%recombin%profile = 0.0_r8
219 coreimpur_new(1)%diagnosticsum%energy%sum%profile = 0.0_r8
225 WRITE(*,*)
'ITM AMNSPROTO data used (via UAL)'
226 ALLOCATE(amns_ei(0:max_nzimp, nimp), amns_rc(0:max_nzimp, nimp), &
227 amns_eip(0:max_nzimp,nimp), amns_lr(0:max_nzimp, nimp), &
228 amns_br(0:max_nzimp, nimp))
231 CALL itm_amns_setup(amns, version)
232 query%string =
'version'
233 CALL itm_amns_query(amns,query,answer)
234 WRITE(*,*)
'AMNS data base version = ',trim(answer%string)
236 eip_rx%string =
'EIP'
240 FORMAT =
'(''ZN = '',f5.2,'', IS = '',i2,'', RX = '',a,'', SRC = '',a)'
241 query%string =
'source'
245 zn_imp = coreimpur_old(1)%compositions%nuclei(coreimpur_old(1)%compositions%IMPURITIES(iimp)%nucindex)%zn
246 am_imp = coreimpur_old(1)%compositions%nuclei(coreimpur_old(1)%compositions%IMPURITIES(iimp)%nucindex)%amn
248 DO izimp=0, nzimp(iimp)-1
250 allocate(species%components(4))
251 species%components = &
252 (/ amns_reactant_type(zn_imp, izimp, am_imp, 0), &
253 amns_reactant_type(0, -1, 0, 0), &
254 amns_reactant_type(zn_imp, izimp+1, am_imp, 1), &
255 amns_reactant_type(0, -1, 0, 1) &
257 CALL itm_amns_setup_table(amns, ei_rx, species, amns_ei(izimp, iimp))
258 deallocate(species%components)
262 allocate(species%components(2))
263 species%components = &
264 (/ amns_reactant_type(zn_imp, izimp, am_imp, 0), &
265 amns_reactant_type(zn_imp, izimp, am_imp, 1) &
267 CALL itm_amns_setup_table(amns, lr_rx, species, amns_lr(izimp, iimp))
268 deallocate(species%components)
272 DO izimp=1, nzimp(iimp)
274 allocate(species%components(4))
275 species%components = &
276 (/ amns_reactant_type(zn_imp, izimp, am_imp, 0), &
277 amns_reactant_type(0, -1, 0, 0), &
278 amns_reactant_type(zn_imp, izimp-1, am_imp, 1), &
279 amns_reactant_type(0, -1, 0, 1) &
281 CALL itm_amns_setup_table(amns, rc_rx, species, amns_rc(izimp, iimp))
282 deallocate(species%components)
286 allocate(species%components(2))
287 species%components = &
288 (/ amns_reactant_type(zn_imp, izimp, am_imp, 0), &
289 amns_reactant_type(zn_imp, izimp, am_imp, 1) &
291 CALL itm_amns_setup_table(amns, br_rx, species, amns_br(izimp, iimp))
292 deallocate(species%components)
296 DO izimp=0,nzimp(iimp)
298 allocate(species%components(2))
299 species%components = &
300 (/ amns_reactant_type(zn_imp, izimp, am_imp, 0), &
301 amns_reactant_type(zn_imp, izimp, am_imp, 1) &
303 CALL itm_amns_setup_table(amns, eip_rx, species, amns_eip(izimp, iimp))
304 deallocate(species%components)
310 WRITE(*,*)
'Roman Zagorski AMNS data used'
322 ALLOCATE (vprm(nrho))
326 ALLOCATE (fun_out(nrho))
327 ALLOCATE (qrad(nrho))
330 ALLOCATE (lin_rad(nrho))
331 ALLOCATE (brem_rad(nrho))
332 ALLOCATE (jon_en(nrho))
333 ALLOCATE (rec_los(nrho))
334 ALLOCATE (r_lin_int(nrho))
335 ALLOCATE (r_brem_int(nrho))
336 ALLOCATE (r_sum_int(nrho))
337 ALLOCATE (e_jon_int(nrho))
338 ALLOCATE (e_rec_int(nrho))
339 ALLOCATE (e_sum_int(nrho))
340 ALLOCATE (sum_lin_int(nrho))
341 ALLOCATE (sum_brem_int(nrho))
342 ALLOCATE (sum_rad_int(nrho))
343 ALLOCATE (sum_jon_int(nrho))
344 ALLOCATE (sum_rec_int(nrho))
345 ALLOCATE (sum_los_int(nrho))
346 ALLOCATE (se_exp(nrho))
352 b0 = coreprof_iter(1)%toroid_field%b0
353 r0 = coreprof_iter(1)%toroid_field%r0
354 ne = coreprof_iter(1)%ne%value
355 te = coreprof_iter(1)%te%value
356 rho = coreprof_iter(1)%rho_tor
364 tti(irho)= tti(irho)+coreprof_iter(1)%TI%VALUE(irho,iion)
372 CALL
l3interp(equilibrium_iter(1)%profiles_1d%volume, equilibrium_iter(1)%profiles_1d%rho_tor, neq, &
374 CALL
l3deriv(equilibrium_iter(1)%profiles_1d%volume, equilibrium_iter(1)%profiles_1d%rho_tor, neq, &
376 CALL
l3deriv(equilibrium_iter(1)%profiles_1d%volume, equilibrium_iter(1)%profiles_1d%rho_tor, neq, &
378 CALL
l3interp(equilibrium_iter(1)%profiles_1d%gm3, equilibrium_iter(1)%profiles_1d%rho_tor, neq, &
385 nzimp2 = nzimp(iimp)+2
387 ALLOCATE (aneut(nneut))
388 ALLOCATE (nz1(nrho,nzimp2))
389 ALLOCATE (nzm1(nrho,nzimp2))
390 ALLOCATE (diff(nrho,nzimp2))
391 ALLOCATE (vcon(nrho,nzimp2))
392 ALLOCATE (dnz1(nrho,nzimp2))
393 ALLOCATE (
flux(nrho,nzimp2))
394 ALLOCATE (flux_inter(nrho,nzimp2))
395 ALLOCATE (imp_radiation(nrho,nzimp2))
396 ALLOCATE (nz_bnd(3,nzimp2))
397 ALLOCATE (nz_bnd_type(nzimp2))
398 ALLOCATE (nzsource(nrho,nzimp2))
401 ALLOCATE (lin_rad1(nrho,nzimp2))
402 ALLOCATE (brem_rad1(nrho,nzimp2))
403 ALLOCATE (jon_en1(nrho,nzimp2))
404 ALLOCATE (rec_los1(nrho,nzimp2))
405 ALLOCATE (r_lin_int1(nrho,nzimp2))
406 ALLOCATE (r_brem_int1(nrho,nzimp2))
407 ALLOCATE (r_sum_int1(nrho,nzimp2))
408 ALLOCATE (e_jon_int1(nrho,nzimp2))
409 ALLOCATE (e_rec_int1(nrho,nzimp2))
410 ALLOCATE (e_sum_int1(nrho,nzimp2))
420 imp_radiation = 0.0_r8
428 ALLOCATE (fun_in(
SIZE(coreimpur_iter(1)%rho_tor)))
429 nrho_tr =
SIZE(coretransp_iter(1)%VALUES(1)%rho_tor)
430 nrho_sr =
SIZE(coresource_iter(1)%VALUES(1)%rho_tor)
433 DO izimp=1,nzimp(iimp)
436 fun_in = coreimpur_iter(1)%IMPURITY(iimp)%NZ(:,izimp)
437 CALL
l3interp(fun_in, coreimpur_iter(1)%rho_tor, nrho, fun_out, rho, nrho)
438 nz1(:,izimp+1) = fun_out
439 fun_in = coreimpur_old(1)%IMPURITY(iimp)%NZ(:,izimp)
440 CALL
l3interp(fun_in, coreimpur_iter(1)%rho_tor, nrho, fun_out, rho, nrho)
441 nzm1(:,izimp+1) = fun_out
442 CALL
l3interp(coretransp_iter(1)%VALUES(1)%nz_transp(iimp)%diff_eff(:,izimp), coretransp_iter(1)%VALUES(1)%rho_tor, nrho_tr, fun_out, rho, nrho)
443 diff(:,izimp+1) = fun_out
444 CALL
l3interp(coretransp_iter(1)%VALUES(1)%nz_transp(iimp)%vconv_eff(:,izimp), coretransp_iter(1)%VALUES(1)%rho_tor, nrho_tr, fun_out, rho, nrho)
445 vcon(:,izimp+1) = fun_out
446 CALL
l3interp(coresource_iter(1)%VALUES(1)%sz(iimp)%exp(:,izimp), coresource_iter(1)%VALUES(1)%rho_tor, nrho_sr, fun_out, rho, nrho)
448 nzsource(:,izimp+1) = fun_out
449 nz_bnd(1,izimp+1) = coreimpur_iter(1)%IMPURITY(iimp)%BOUNDARY%VALUE(1,izimp)
450 nz_bnd_type(izimp+1)= coreimpur_iter(1)%IMPURITY(iimp)%BOUNDARY%TYPE(izimp)
466 ALLOCATE (fun_in(
SIZE(coreneutrals_iter(1)%rho_tor)))
469 aneut(ineut) = coreimpur_iter(1)%compositions%nuclei(coreimpur_old(1)%compositions%neutralscomp(ineut)%neutcomp(1)%nucindex)%amn
471 IF (coreimpur_iter(1)%compositions%nuclei(coreimpur_old(1)%compositions%IMPURITIES(iimp)%nucindex)%amn.EQ. &
474 DO itype = 1, ntype(ineut)
475 fun_in = coreneutrals_iter(1)%PROFILES(ineut)%NEUTRALTYPE(itype)%n0%value
476 CALL
l3interp(fun_in, coreneutrals_iter(1)%rho_tor,
SIZE(coreneutrals_iter(1)%rho_tor), fun_out, rho, nrho)
477 nz1(:,1) = nz1(:,1) + fun_out(:)
494 CALL
impurity_one(te, ne, nz1, nzm1, vpr, vprm, r0, b0, b0prime, diff,
flux, flux_inter, rho, &
495 vcon, nrho, nzimp2, nzsource, nz_bnd, nz_bnd_type, &
496 control_double, control_integer, g3, imp_radiation, se_exp, max_nzimp, &
497 amns_ei(:,iimp), amns_rc(:,iimp), amns_lr(:,iimp), amns_br(:,iimp), &
498 amns_eip(:,iimp), lin_rad1,brem_rad1,jon_en1,rec_los1)
502 CALL
impurity_one(te, ne, nz1, nzm1, vpr, vprm, r0, b0, b0prime, diff,
flux, flux_inter, rho, &
503 vcon, nrho, nzimp2, nzsource, nz_bnd, nz_bnd_type, &
504 control_double, control_integer, g3, imp_radiation, se_exp, max_nzimp)
506 write(*,*)
'after impurity one',
'NZIMP(IIMP)=' ,nzimp(iimp)
510 lin_rad(irho) = 0.0_r8
511 brem_rad(irho) = 0.0_r8
512 jon_en(irho) = 0.0_r8
513 rec_los(irho) = 0.0_r8
516 DO izimp = 1,nzimp(iimp)
517 IF (nz1(nrho,izimp+1).LE.1.0d-200) nz1(nrho,izimp+1) = 0._r8
522 DO izimp=1,nzimp(iimp)
523 qrad(irho) = qrad(irho) + imp_radiation(irho,izimp+1)
524 coreimpur_new(1)%IMPURITY(iimp)%NZ(irho,izimp) = nz1(irho,izimp+1)
525 coreimpur_new(1)%IMPURITY(iimp)%transp_coef%diff(irho,izimp) = diff(irho,izimp+1)
526 coreimpur_new(1)%IMPURITY(iimp)%transp_coef%vconv(irho,izimp) = vcon(irho,izimp+1)
527 coreimpur_new(1)%IMPURITY(iimp)%flux%flux_dv(irho,izimp) =
flux(irho,izimp+1)
528 coreimpur_new(1)%IMPURITY(iimp)%flux%flux_interp(irho,izimp) = flux_inter(irho,izimp+1)
529 coreimpur_new(1)%IMPURITY(iimp)%z(irho,izimp) = izimp
530 coreimpur_new(1)%IMPURITY(iimp)%zsq(irho,izimp) = izimp**2
532 coreimpur_new(1)%IMPURITY(iimp)%TZ(irho,izimp) = tti(irho)/nion
538 coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%line_rad%profile(irho,izimp) = lin_rad1(irho,izimp+1)
539 coreimpur_new(1)%IMPURITY(iimp)%diagnostic%radiation%brem_radrec%profile(irho,izimp) = brem_rad1(irho,izimp+1)
540 coreimpur_new(1)%IMPURITY(iimp)%diagnostic%radiation%sum%profile(irho,izimp) = lin_rad1(irho,izimp+1)+ brem_rad1(irho,izimp+1)
541 coreimpur_new(1)%impurity(iimp)%diagnostic%energy%ionization%profile(irho,izimp) = itm_ev*jon_en1(irho,izimp+1)
542 coreimpur_new(1)%impurity(iimp)%diagnostic%energy%recombin%profile(irho,izimp) = itm_ev*rec_los1(irho,izimp+1)
543 coreimpur_new(1)%impurity(iimp)%diagnostic%energy%sum%profile(irho,izimp) = itm_ev*(rec_los1(irho,izimp+1)+jon_en1(irho,izimp+1))
546 fun =vpr*(lin_rad1(irho,izimp+1)+ brem_rad1(irho,izimp+1))
548 coreimpur_new(1)%IMPURITY(iimp)%diagnostic%radiation%sum%integral(:,izimp) = fun_out(:)
551 lin_rad(irho) = lin_rad(irho) + lin_rad1(irho,izimp+1)
552 brem_rad(irho) = brem_rad(irho) + brem_rad1(irho,izimp+1)
553 jon_en(irho) = jon_en(irho) + jon_en1(irho,izimp+1)
554 rec_los(irho) = rec_los(irho) + rec_los1(irho,izimp+1)
569 DO izimp=1,nzimp(iimp)
570 r_lin_int1(1,izimp)=rho(1)*coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%line_rad%profile(1,izimp)
573 r_lin_int1(irho,izimp)=r_lin_int1(irho-1,izimp) + (vol(irho)-vol(irho-1))*0.5_r8 * &
574 (coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%line_rad%profile(irho,izimp)+ &
575 coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%line_rad%profile(irho-1,izimp))
578 coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%line_rad%integral(irho,izimp) = r_lin_int1(irho,izimp)
583 DO izimp=1,nzimp(iimp)
584 r_brem_int1(1,izimp)=rho(1)*coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%BREM_RADREC%profile(1,izimp)
587 r_brem_int1(irho,izimp)=r_brem_int1(irho-1,izimp) + (vol(irho)-vol(irho-1))*0.5_r8 * &
588 (coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%BREM_RADREC%profile(irho,izimp)+ &
589 coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%BREM_RADREC%profile(irho-1,izimp))
592 coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%BREM_RADREC%integral(irho,izimp) = r_brem_int1(irho,izimp)
597 DO izimp=1,nzimp(iimp)
598 r_sum_int1(1,izimp)=rho(1)*coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%SUM%profile(1,izimp)
601 r_sum_int1(irho,izimp)=r_sum_int1(irho-1,izimp) + (vol(irho)-vol(irho-1))*0.5_r8 * &
602 (coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%SUM%profile(irho,izimp)+ &
603 coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%SUM%profile(irho-1,izimp))
606 coreimpur_new(1)%impurity(iimp)%diagnostic%radiation%SUM%integral(irho,izimp) = r_sum_int1(irho,izimp)
611 DO izimp=1,nzimp(iimp)
612 e_jon_int1(1,izimp)=rho(1)*coreimpur_new(1)%impurity(iimp)%diagnostic%energy%ionization%profile(1,izimp)
615 e_jon_int1(irho,izimp)=e_jon_int1(irho-1,izimp) + (vol(irho)-vol(irho-1))*0.5_r8 * &
616 (coreimpur_new(1)%impurity(iimp)%diagnostic%energy%ionization%profile(irho,izimp)+ &
617 coreimpur_new(1)%impurity(iimp)%diagnostic%energy%ionization%profile(irho-1,izimp))
620 coreimpur_new(1)%impurity(iimp)%diagnostic%energy%ionization%integral(irho,izimp) = e_jon_int1(irho,izimp)
625 DO izimp=1,nzimp(iimp)
626 e_rec_int1(1,izimp)=rho(1)*coreimpur_new(1)%impurity(iimp)%diagnostic%energy%recombin%profile(1,izimp)
629 e_rec_int1(irho,izimp)=e_rec_int1(irho-1,izimp) + (vol(irho)-vol(irho-1))*0.5_r8 * &
630 (coreimpur_new(1)%impurity(iimp)%diagnostic%energy%recombin%profile(irho,izimp)+ &
631 coreimpur_new(1)%impurity(iimp)%diagnostic%energy%recombin%profile(irho-1,izimp))
634 coreimpur_new(1)%impurity(iimp)%diagnostic%energy%recombin%integral(irho,izimp) = e_rec_int1(irho,izimp)
639 DO izimp=1,nzimp(iimp)
640 e_sum_int1(1,izimp)=rho(1)*coreimpur_new(1)%impurity(iimp)%diagnostic%energy%sum%profile(1,izimp)
643 e_sum_int1(irho,izimp)=e_sum_int1(irho-1,izimp) + (vol(irho)-vol(irho-1))*0.5_r8 * &
644 (coreimpur_new(1)%impurity(iimp)%diagnostic%energy%sum%profile(irho,izimp)+ &
645 coreimpur_new(1)%impurity(iimp)%diagnostic%energy%sum%profile(irho-1,izimp))
648 coreimpur_new(1)%impurity(iimp)%diagnostic%energy%sum%integral(irho,izimp) = e_sum_int1(irho,izimp)
654 coreimpur_new(1)%DIAGNOSTIC%RADIATION%LINE_RAD%PROFILE(irho,iimp) = lin_rad(irho)
655 coreimpur_new(1)%DIAGNOSTIC%RADIATION%BREM_RADREC%PROFILE(irho,iimp) = brem_rad(irho)
656 coreimpur_new(1)%DIAGNOSTIC%RADIATION%SUM%PROFILE(irho,iimp) = lin_rad(irho) + brem_rad(irho)
657 coreimpur_new(1)%diagnostic%energy%ionization%profile(irho,iimp) = itm_ev*jon_en(irho)
658 coreimpur_new(1)%diagnostic%energy%recombin%profile(irho,iimp) = itm_ev*rec_los(irho)
659 coreimpur_new(1)%diagnostic%energy%sum%profile(irho,iimp) = itm_ev*(rec_los(irho) + jon_en(irho))
673 r_lin_int(1)=rho(1)*coreimpur_new(1)%diagnostic%radiation%line_rad%profile(1,iimp)
676 r_lin_int(irho)=r_lin_int(irho-1) + (vol(irho)-vol(irho-1))*0.5_r8 * &
677 (coreimpur_new(1)%diagnostic%radiation%line_rad%profile(irho,iimp)+ &
678 coreimpur_new(1)%diagnostic%radiation%line_rad%profile(irho-1,iimp))
681 coreimpur_new(1)%diagnostic%radiation%line_rad%integral(irho,iimp) = r_lin_int(irho)
684 r_brem_int(1)=rho(1)*coreimpur_new(1)%diagnostic%radiation%BREM_RADREC%profile(1,iimp)
687 r_brem_int(irho)=r_brem_int(irho-1) + (vol(irho)-vol(irho-1))*0.5_r8 * &
688 (coreimpur_new(1)%diagnostic%radiation%BREM_RADREC%profile(irho,iimp)+ &
689 coreimpur_new(1)%diagnostic%radiation%BREM_RADREC%profile(irho-1,iimp))
692 coreimpur_new(1)%diagnostic%radiation%BREM_RADREC%integral(irho,iimp) = r_brem_int(irho)
696 r_sum_int(1)=rho(1)*coreimpur_new(1)%diagnostic%radiation%SUM%profile(1,iimp)
699 r_sum_int(irho)=r_sum_int(irho-1) + (vol(irho)-vol(irho-1))*0.5_r8 * &
700 (coreimpur_new(1)%diagnostic%radiation%SUM%profile(irho,iimp) + &
701 coreimpur_new(1)%diagnostic%radiation%SUM%profile(irho-1,iimp))
704 coreimpur_new(1)%diagnostic%radiation%SUM%integral(irho,iimp) = r_sum_int(irho)
708 e_jon_int(1)=rho(1)*coreimpur_new(1)%diagnostic%energy%ionization%profile(1,iimp)
711 e_jon_int(irho)=e_jon_int(irho-1) + (vol(irho)-vol(irho-1))*0.5_r8 * &
712 (coreimpur_new(1)%diagnostic%energy%ionization%profile(irho,iimp) + &
713 coreimpur_new(1)%diagnostic%energy%ionization%profile(irho-1,iimp))
716 coreimpur_new(1)%diagnostic%energy%ionization%integral(irho,iimp) = e_jon_int(irho)
720 e_rec_int(1)=rho(1)*coreimpur_new(1)%diagnostic%energy%recombin%profile(1,iimp)
723 e_rec_int(irho)=e_rec_int(irho-1) + (vol(irho)-vol(irho-1))*0.5_r8 * &
724 (coreimpur_new(1)%diagnostic%energy%recombin%profile(irho,iimp) + &
725 coreimpur_new(1)%diagnostic%energy%recombin%profile(irho-1,iimp))
728 coreimpur_new(1)%diagnostic%energy%recombin%integral(irho,iimp) = e_rec_int(irho)
732 e_sum_int(1)=rho(1)*coreimpur_new(1)%diagnostic%energy%SUM%profile(1,iimp)
735 e_sum_int(irho)=e_sum_int(irho-1) + (vol(irho)-vol(irho-1))*0.5_r8 * &
736 (coreimpur_new(1)%diagnostic%energy%sum%profile(irho,iimp) + &
737 coreimpur_new(1)%diagnostic%energy%sum%profile(irho-1,iimp))
740 coreimpur_new(1)%diagnostic%energy%sum%integral(irho,iimp) = e_sum_int(irho)
747 coreimpur_new(1)%diagnosticsum%radiation%line_rad%profile(irho) = &
748 coreimpur_new(1)%diagnosticsum%radiation%line_rad%profile(irho) + &
749 coreimpur_new(1)%DIAGNOSTIC%RADIATION%LINE_RAD%PROFILE(irho,iimp)
751 coreimpur_new(1)%diagnosticsum%radiation%brem_radrec%profile(irho) = &
752 coreimpur_new(1)%diagnosticsum%radiation%brem_radrec%profile(irho) + &
753 coreimpur_new(1)%DIAGNOSTIC%RADIATION%brem_radrec%PROFILE(irho,iimp)
755 coreimpur_new(1)%diagnosticsum%radiation%sum%profile(irho) = &
756 coreimpur_new(1)%diagnosticsum%radiation%SUM%profile(irho) + &
757 coreimpur_new(1)%DIAGNOSTIC%RADIATION%LINE_RAD%PROFILE(irho,iimp) + &
758 coreimpur_new(1)%DIAGNOSTIC%RADIATION%brem_radrec%PROFILE(irho,iimp)
760 coreimpur_new(1)%diagnosticsum%energy%ionization%profile(irho) = &
761 coreimpur_new(1)%diagnosticsum%energy%ionization%profile(irho) + &
762 coreimpur_new(1)%diagnostic%energy%ionization%profile(irho,iimp)
764 coreimpur_new(1)%diagnosticsum%energy%recombin%profile(irho) = &
765 coreimpur_new(1)%diagnosticsum%energy%recombin%profile(irho) + &
766 coreimpur_new(1)%diagnostic%energy%recombin%profile(irho,iimp)
768 coreimpur_new(1)%diagnosticsum%energy%sum%profile(irho) = &
769 coreimpur_new(1)%diagnosticsum%energy%sum%profile(irho) + &
770 coreimpur_new(1)%diagnostic%energy%ionization%profile(irho,iimp) + &
771 coreimpur_new(1)%diagnostic%energy%recombin%profile(irho,iimp)
775 sum_brem_int = 0.0_r8
781 sum_lin_int(1) = rho(1)*coreimpur_new(1)%diagnosticsum%radiation%line_rad%profile(1)
782 sum_brem_int(1) = rho(1)*coreimpur_new(1)%diagnosticsum%radiation%brem_radrec%profile(1)
783 sum_rad_int(1) = rho(1)*coreimpur_new(1)%diagnosticsum%radiation%sum%profile(1)
784 sum_jon_int(1) = rho(1)*coreimpur_new(1)%diagnosticsum%energy%ionization%profile(1)
785 sum_rec_int(1) = rho(1)*coreimpur_new(1)%diagnosticsum%energy%recombin%profile(1)
786 sum_los_int(1) = rho(1)*coreimpur_new(1)%diagnosticsum%energy%sum%profile(1)
789 sum_lin_int(irho) = sum_lin_int(irho-1) + (vol(irho)-vol(irho-1))*0.5_r8 * &
790 (coreimpur_new(1)%diagnosticsum%radiation%line_rad%profile(irho) + &
791 coreimpur_new(1)%diagnosticsum%radiation%line_rad%profile(irho-1))
792 sum_brem_int(irho)= sum_brem_int(irho-1) + (vol(irho)-vol(irho-1))*0.5_r8 * &
793 (coreimpur_new(1)%diagnosticsum%radiation%brem_radrec%profile(irho) + &
794 coreimpur_new(1)%diagnosticsum%radiation%brem_radrec%profile(irho-1))
795 sum_rad_int(irho) = sum_rad_int(irho-1) + (vol(irho)-vol(irho-1))*0.5_r8 * &
796 (coreimpur_new(1)%diagnosticsum%radiation%sum%profile(irho) + &
797 coreimpur_new(1)%diagnosticsum%radiation%sum%profile(irho-1))
799 sum_jon_int(irho) = sum_jon_int(irho-1) + (vol(irho)-vol(irho-1))*0.5_r8 * &
800 (coreimpur_new(1)%diagnosticsum%energy%ionization%profile(irho) + &
801 coreimpur_new(1)%diagnosticsum%energy%ionization%profile(irho-1))
803 sum_rec_int(irho) = sum_rec_int(irho-1) + (vol(irho)-vol(irho-1))*0.5_r8 * &
804 (coreimpur_new(1)%diagnosticsum%energy%recombin%profile(irho) + &
805 coreimpur_new(1)%diagnosticsum%energy%recombin%profile(irho-1))
806 sum_los_int(irho) = sum_los_int(irho-1) + (vol(irho)-vol(irho-1))*0.5_r8 * &
807 (coreimpur_new(1)%diagnosticsum%energy%sum%profile(irho) + &
808 coreimpur_new(1)%diagnosticsum%energy%sum%profile(irho-1))
814 coreimpur_new(1)%diagnosticsum%radiation%line_rad%integral(irho) = &
815 coreimpur_new(1)%diagnosticsum%radiation%line_rad%integral(irho) + sum_lin_int(irho)
816 coreimpur_new(1)%diagnosticsum%radiation%brem_radrec%integral(irho) = &
817 coreimpur_new(1)%diagnosticsum%radiation%brem_radrec%integral(irho) + sum_brem_int(irho)
818 coreimpur_new(1)%diagnosticsum%radiation%sum%integral(irho) = &
819 coreimpur_new(1)%diagnosticsum%radiation%sum%integral(irho) + sum_rad_int(irho)
821 coreimpur_new(1)%diagnosticsum%energy%ionization%integral(irho) = &
822 coreimpur_new(1)%diagnosticsum%energy%ionization%integral(irho) + sum_jon_int(irho)
823 coreimpur_new(1)%diagnosticsum%energy%recombin%integral(irho) = &
824 coreimpur_new(1)%diagnosticsum%energy%recombin%integral(irho) + sum_rec_int(irho)
825 coreimpur_new(1)%diagnosticsum%energy%sum%integral(irho) = &
826 coreimpur_new(1)%diagnosticsum%energy%sum%integral(irho) + sum_los_int(irho)
829 coresource_new(1)%VALUES(1)%se%exp = se_exp
830 coresource_new(1)%VALUES(1)%qe%exp = - qrad
831 coresource_new(1)%VALUES(1)%rho_tor = rho
832 coresource_new(1)%VALUES(1)%rho_tor_norm = rho/rho(nrho)
843 DEALLOCATE (flux_inter)
844 DEALLOCATE (imp_radiation)
846 DEALLOCATE (nz_bnd_type)
847 DEALLOCATE (nzsource)
849 DEALLOCATE (lin_rad1)
850 DEALLOCATE (brem_rad1)
851 DEALLOCATE (r_lin_int1)
852 DEALLOCATE (r_brem_int1)
853 DEALLOCATE (r_sum_int1)
854 DEALLOCATE (e_jon_int1)
855 DEALLOCATE (e_rec_int1)
856 DEALLOCATE (e_sum_int1)
858 DEALLOCATE (rec_los1)
860 WRITE(*,*)
'END OF IMPURITY',iimp
865 DEALLOCATE (brem_rad)
868 DEALLOCATE (r_lin_int)
869 DEALLOCATE (r_brem_int)
870 DEALLOCATE (r_sum_int)
871 DEALLOCATE (e_jon_int)
872 DEALLOCATE (e_rec_int)
873 DEALLOCATE (e_sum_int)
874 DEALLOCATE (sum_lin_int)
875 DEALLOCATE (sum_brem_int)
876 DEALLOCATE (sum_rad_int)
877 DEALLOCATE (sum_jon_int)
878 DEALLOCATE (sum_rec_int)
879 DEALLOCATE (sum_los_int)
898 IF(
ALLOCATED(ntype))
DEALLOCATE (ntype)
900 ALLOCATE (coresource_new(1)%VALUES(1)%sourceid%id(1))
901 ALLOCATE (coresource_new(1)%VALUES(1)%sourceid%description(1))
902 coresource_new(1)%VALUES(1)%sourceid%id =
'impurity'
903 coresource_new(1)%VALUES(1)%sourceid%flag = 29
904 coresource_new(1)%VALUES(1)%sourceid%description =
'Impurity source'
907 WRITE (*,*)
'IMPURITY finished <==========='
913 entry impurity_finish
915 DO iimp = 1,
SIZE(amns_ei, dim=2)
916 DO izimp = 0,
SIZE(amns_ei, dim=1)-1
918 CALL itm_amns_finish_table(amns_ei(izimp, iimp))
922 DO iimp = 1,
SIZE(amns_rc, dim=2)
923 DO izimp = 0,
SIZE(amns_rc, dim=1)-1
925 CALL itm_amns_finish_table(amns_rc(izimp, iimp))
929 DO iimp = 1,
SIZE(amns_eip, dim=2)
930 DO izimp = 0,
SIZE(amns_eip, dim=1)-1
932 CALL itm_amns_finish_table(amns_eip(izimp, iimp))
936 DO iimp = 1,
SIZE(amns_lr, dim=2)
937 DO izimp = 0,
SIZE(amns_lr, dim=1)-1
939 CALL itm_amns_finish_table(amns_lr(izimp, iimp))
943 DO iimp = 1,
SIZE(amns_br, dim=2)
944 DO izimp = 0,
SIZE(amns_br, dim=1)-1
946 CALL itm_amns_finish_table(amns_br(izimp, iimp))
951 CALL itm_amns_finish(amns)
984 TYPE (type_coreimpur
),
POINTER :: coreimpur(:)
989 INTEGER,
ALLOCATABLE :: nzimp(:)
992 integer :: irho,izimp
994 REAL (R8),
ALLOCATABLE :: rho(:)
996 CHARACTER (33) :: filename
999 nrho =
SIZE (coreimpur(1)%rho_tor)
1000 nimp =
SIZE (coreimpur(1)%IMPURITY)
1001 ALLOCATE (nzimp(nimp))
1003 nzimp(iimp) =
SIZE (coreimpur(1)%IMPURITY(iimp)%nz, dim=2)
1007 ALLOCATE (rho(nrho))
1008 rho = coreimpur(1)%RHO_TOR
1011 WRITE(filename,
'(a,i1.1,a,i7.7,a)')
'eq_ets_data/OUTIM',iimp,
'/IMP',itime_out,
'.DAT'
1012 OPEN (unit=20, file=filename)
1013 loop_irho:
DO irho = 1, nrho
1014 WRITE (20,
'(101(1x,e14.7))') rho(irho), (coreimpur(1)%IMPURITY(iimp)%nz(irho,izimp), izimp=1,nzimp(iimp)), &
1015 (coreimpur(1)%impurity(iimp)%diagnostic%radiation%line_rad%profile(irho,izimp), izimp=1,nzimp(iimp)),&
1016 (coreimpur(1)%impurity(iimp)%diagnostic%radiation%line_rad%integral(irho,izimp), izimp=1,nzimp(iimp))
1032 SUBROUTINE integr2(N,X,Y,INTY) !AF 11.Oct.2011 - assumes that Y is zero f0r X.eq.0, just as INTEGR does too...
1045 REAL (R8) :: x(n), &
1049 inty(1)=y(1)*x(1)/2.e0_r8
1051 inty(i)=inty(i-1)+(y(i-1)+y(i))*(x(i)-x(i-1))/2.e0_r8
subroutine l3deriv(y_in, x_in, nr_in, dydx_out, x_out, nr_out)
subroutine get_comp_dimensions(COMPOSITIONS, NNUCL, NION, NIMP, NZIMP, NNEUT, NTYPE, NCOMP)
subroutine impurity_ets(EQUILIBRIUM_ITER, COREPROF_ITER, CORETRANSP_ITER, COREIMPUR_OLD, COREIMPUR_ITER, CORENEUTRALS_ITER, CORESOURCE_ITER, CORESOURCE_NEW, COREIMPUR_NEW, CONTROL_INTEGER, CONTROL_DOUBLE)
subroutine integr2(N, X, Y, INTY)
subroutine flux(psitok, rk, zk, nk)
subroutine impurity_one(TE, NE, NZ1, NZM1, VPR, VPRM, R0, BT, BTPRIME, DIFF, FLUX, FLUX_INTER, rho, VCONV, NRHO, SIMP2, NSOURCE, NZ_BND, NZ_BND_TYPE, control_double, CONTROL_INTEGER, G1, IMP_RADIATION, SE_EXP, max_nzimp)
subroutine l3interp(y_in, x_in, nr_in, y_out, x_out, nr_out)
This module contains routines for allocation/deallocation if CPOs used in ETS.
subroutine allocate_coresource_cpo(NSLICE, NRHO, NNUCL, NION, NIMP, NZIMP, NNEUT, NTYPE, NCOMP, CORESOURCE)
This routine allocates CORESOURCE CPO.
subroutine writeoutimpur(ITIME_OUT, COREIMPUR)