33 TYPE (type_coresource
) :: coresource_in
34 TYPE (type_coresource
) :: coresource_out
36 INTEGER :: nval1, nval2
38 INTEGER :: nrho1, nrho2
39 INTEGER :: nnucl1,inucl1
40 INTEGER :: nnucl2,inucl2
41 INTEGER :: nion1, iion1
42 INTEGER :: nion2, iion2
43 INTEGER :: nimp1, iimp1
44 INTEGER :: nimp2, iimp2
45 INTEGER,
ALLOCATABLE :: nzimp1(:)
46 INTEGER,
ALLOCATABLE :: nzimp2(:)
47 INTEGER :: izimp1,izimp2
48 INTEGER :: nneut1,ineut1
49 INTEGER :: nneut2,ineut2
50 INTEGER,
ALLOCATABLE :: ncomp1(:)
51 INTEGER,
ALLOCATABLE :: ncomp2(:)
52 INTEGER,
ALLOCATABLE :: ntype1(:)
53 INTEGER,
ALLOCATABLE :: ntype2(:)
55 REAL (R8),
ALLOCATABLE :: rho1(:), rho2(:)
56 REAL (R8),
ALLOCATABLE ::
fun(:)
57 REAL (R8) :: zmin1, zmin2
58 REAL (R8) :: zmax1, zmax2
62 nval2 =
SIZE(coresource_in%VALUES)
65 nrho1 =
SIZE(coresource_out%VALUES(1)%rho_tor)
68 ALLOCATE (rho1(nrho1))
70 rho1 = coresource_out%VALUES(1)%rho_tor
72 CALL
get_comp_dimensions(coresource_out%COMPOSITIONS, nnucl1, nion1, nimp1, nzimp1, nneut1, ntype1, ncomp1)
73 CALL
get_comp_dimensions(coresource_in%COMPOSITIONS, nnucl2, nion2, nimp2, nzimp2, nneut2, ntype2, ncomp2)
75 IF(.NOT.
ASSOCIATED(coresource_in%VALUES)) goto 10
80 coresource_out%VALUES(1)%j = 0.0_r8
81 coresource_out%VALUES(1)%sigma = 0.0_r8
82 coresource_out%VALUES(1)%Se%exp = 0.0_r8
83 coresource_out%VALUES(1)%Se%imp = 0.0_r8
84 coresource_out%VALUES(1)%Qe%exp = 0.0_r8
85 coresource_out%VALUES(1)%Qe%imp = 0.0_r8
86 coresource_out%VALUES(1)%Si%exp = 0.0_r8
87 coresource_out%VALUES(1)%Si%imp = 0.0_r8
88 coresource_out%VALUES(1)%Qi%exp = 0.0_r8
89 coresource_out%VALUES(1)%Qi%imp = 0.0_r8
90 coresource_out%VALUES(1)%Ui%exp = 0.0_r8
91 coresource_out%VALUES(1)%Ui%imp = 0.0_r8
93 coresource_out%VALUES(1)%Sz(iimp1)%exp = 0.0_r8
94 coresource_out%VALUES(1)%Sz(iimp1)%imp = 0.0_r8
95 coresource_out%VALUES(1)%Qz(iimp1)%exp = 0.0_r8
96 coresource_out%VALUES(1)%Qz(iimp1)%imp = 0.0_r8
103 loop_on_values:
DO ival = 1, nval2
104 nrho2 =
SIZE(coresource_in%VALUES(1)%rho_tor)
105 ALLOCATE (rho2(nrho2))
106 rho2 = coresource_in%VALUES(ival)%rho_tor
113 IF(
ASSOCIATED(coresource_in%VALUES(ival)%j))
THEN
114 CALL
l3interp(coresource_in%VALUES(ival)%j, rho2, nrho2, &
116 coresource_out%VALUES(1)%j = coresource_out%VALUES(1)%j +
fun
121 IF(
ASSOCIATED(coresource_in%VALUES(ival)%sigma))
THEN
122 CALL
l3interp(coresource_in%VALUES(ival)%sigma, rho2, nrho2, &
124 coresource_out%VALUES(1)%sigma = coresource_out%VALUES(1)%sigma +
fun
129 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Se%exp))
THEN
130 CALL
l3interp(coresource_in%VALUES(ival)%Se%exp, rho2, nrho2, &
132 coresource_out%VALUES(1)%Se%exp = coresource_out%VALUES(1)%Se%exp +
fun
136 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Se%imp))
THEN
137 CALL
l3interp(coresource_in%VALUES(ival)%Se%imp, rho2, nrho2, &
139 coresource_out%VALUES(1)%Se%imp = coresource_out%VALUES(1)%Se%imp +
fun
144 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Qe%exp))
THEN
145 CALL
l3interp(coresource_in%VALUES(ival)%Qe%exp, rho2, nrho2, &
147 coresource_out%VALUES(1)%Qe%exp = coresource_out%VALUES(1)%Qe%exp +
fun
151 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Qe%imp))
THEN
152 CALL
l3interp(coresource_in%VALUES(ival)%Qe%imp, rho2, nrho2, &
154 coresource_out%VALUES(1)%Qe%imp = coresource_out%VALUES(1)%Qe%imp +
fun
160 output_ions_loop:
DO iion1 = 1, nion1
161 inucl1 = coresource_out%COMPOSITIONS%IONS(iion1)%nucindex
162 input_ions_loop:
DO iion2 = 1, nion2
163 inucl2 = coresource_in%COMPOSITIONS%IONS(iion2)%nucindex
165 IF (inucl2.LE.0 .OR. inucl2.GT.
SIZE(coresource_in%COMPOSITIONS%NUCLEI)) goto 5
167 check_for_ions_consistency:
IF &
168 (abs(coresource_out%COMPOSITIONS%NUCLEI(inucl1)%amn - coresource_in%COMPOSITIONS%NUCLEI(inucl2)%amn) .LE. 0.25 .AND. &
169 abs(coresource_out%COMPOSITIONS%NUCLEI(inucl1)%zn - coresource_in%COMPOSITIONS%NUCLEI(inucl2)%zn ) .LE. 0.25 .AND. &
170 abs(coresource_out%COMPOSITIONS%IONS(iion1)%zion - coresource_in%COMPOSITIONS%IONS(iion2)%zion ) .LE. 0.25)
THEN
175 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Si%exp))
THEN
176 CALL
l3interp(coresource_in%VALUES(ival)%Si%exp(:,iion2), rho2, nrho2, &
178 coresource_out%VALUES(1)%Si%exp(:,iion1) = coresource_out%VALUES(1)%Si%exp(:,iion1) +
fun
181 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Si%imp))
THEN
182 CALL
l3interp(coresource_in%VALUES(ival)%Si%imp(:,iion2), rho2, nrho2, &
184 coresource_out%VALUES(1)%Si%imp(:,iion1) = coresource_out%VALUES(1)%Si%imp(:,iion1) +
fun
189 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Qi%exp))
THEN
190 CALL
l3interp(coresource_in%VALUES(ival)%Qi%exp(:,iion2), rho2, nrho2, &
192 coresource_out%VALUES(1)%Qi%exp(:,iion1) = coresource_out%VALUES(1)%Qi%exp(:,iion1) +
fun
195 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Qi%imp))
THEN
196 CALL
l3interp(coresource_in%VALUES(ival)%Qi%imp(:,iion2), rho2, nrho2, &
198 coresource_out%VALUES(1)%Qi%imp(:,iion1) = coresource_out%VALUES(1)%Qi%imp(:,iion1) +
fun
203 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Ui%exp))
THEN
204 CALL
l3interp(coresource_in%VALUES(ival)%Ui%exp(:,iion2), rho2, nrho2, &
206 coresource_out%VALUES(1)%Ui%exp(:,iion1) = coresource_out%VALUES(1)%Ui%exp(:,iion1) +
fun
209 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Ui%imp))
THEN
210 CALL
l3interp(coresource_in%VALUES(ival)%Ui%imp(:,iion2), rho2, nrho2, &
212 coresource_out%VALUES(1)%Ui%imp(:,iion1) = coresource_out%VALUES(1)%Ui%imp(:,iion1) +
fun
215 END IF check_for_ions_consistency
219 END DO input_ions_loop
220 END DO output_ions_loop
225 IF (nimp1*nimp2.LE.0) goto 8
226 output_impurity_loop:
DO iimp1 = 1, nimp1
227 inucl1 = coresource_out%COMPOSITIONS%IMPURITIES(iimp1)%nucindex
229 input_impurity_loop:
DO iimp2 = 1, nimp2
230 inucl2 = coresource_in%COMPOSITIONS%IMPURITIES(iimp2)%nucindex
232 IF (inucl2.LE.0 .OR. inucl2.GT.
SIZE(coresource_in%COMPOSITIONS%NUCLEI)) goto 7
234 check_for_nuclei_consistency:
IF &
235 (abs(coresource_out%COMPOSITIONS%NUCLEI(inucl1)%amn - coresource_in%COMPOSITIONS%NUCLEI(inucl2)%amn) .LE. 0.25 .AND. &
236 abs(coresource_out%COMPOSITIONS%NUCLEI(inucl1)%zn - coresource_in%COMPOSITIONS%NUCLEI(inucl2)%zn ) .LE. 0.25 )
THEN
238 output_ionization_state:
DO izimp1 = 1, nzimp1(iimp1)
239 input_ionization_state:
DO izimp2 = 1, nzimp2(iimp2)
241 zmin1 = coresource_out%COMPOSITIONS%IMPURITIES(iimp1)%zmin(izimp1)
242 zmax1 = coresource_out%COMPOSITIONS%IMPURITIES(iimp1)%zmax(izimp1)
243 zmin2 = coresource_in%COMPOSITIONS%IMPURITIES(iimp2)%zmin(izimp2)
244 zmax2 = coresource_in%COMPOSITIONS%IMPURITIES(iimp2)%zmax(izimp2)
246 check_for_ionization_state_consistency:
IF &
247 (abs((zmax1+zmin1)/2.0 - (zmax2+zmin2)/2.0).LE. 0.25)
THEN
249 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Sz).AND.iimp2.LE.
SIZE(coresource_in%VALUES(ival)%Sz))
THEN
251 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Sz(iimp2)%exp))
THEN
252 CALL
l3interp(coresource_in%VALUES(ival)%Sz(iimp2)%exp(:,izimp2), rho2, nrho2, &
254 coresource_out%VALUES(1)%Sz(iimp1)%exp(:,izimp1) = coresource_out%VALUES(1)%Sz(iimp1)%exp(:,izimp1) +
fun
257 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Sz(iimp2)%imp))
THEN
258 CALL
l3interp(coresource_in%VALUES(ival)%Sz(iimp2)%imp(:,izimp2), rho2, nrho2, &
260 coresource_out%VALUES(1)%Sz(iimp1)%imp(:,izimp1) = coresource_out%VALUES(1)%Sz(iimp1)%imp(:,izimp1) +
fun
264 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Qz).AND.iimp2.LE.
SIZE(coresource_in%VALUES(ival)%Qz))
THEN
266 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Qz(iimp2)%exp))
THEN
267 CALL
l3interp(coresource_in%VALUES(ival)%Qz(iimp2)%exp(:,izimp2), rho2, nrho2, &
269 coresource_out%VALUES(1)%Qz(iimp1)%exp(:,izimp1) = coresource_out%VALUES(1)%Qz(iimp1)%exp(:,izimp1) +
fun
272 IF(
ASSOCIATED(coresource_in%VALUES(ival)%Qz(iimp2)%imp))
THEN
273 CALL
l3interp(coresource_in%VALUES(ival)%Qz(iimp2)%imp(:,izimp2), rho2, nrho2, &
275 coresource_out%VALUES(1)%Qz(iimp1)%imp(:,izimp1) = coresource_out%VALUES(1)%Qz(iimp1)%imp(:,izimp1) +
fun
279 END IF check_for_ionization_state_consistency
281 END DO input_ionization_state
282 END DO output_ionization_state
284 END IF check_for_nuclei_consistency
288 ENDDO input_impurity_loop
289 ENDDO output_impurity_loop
291 8
IF(
ALLOCATED(rho2))
DEALLOCATE (rho2)
293 END DO loop_on_values
298 IF(
ALLOCATED (nzimp1))
DEALLOCATE (nzimp1)
299 IF(
ALLOCATED (ncomp1))
DEALLOCATE (ncomp1)
300 IF(
ALLOCATED (ntype1))
DEALLOCATE (ntype1)
301 IF(
ALLOCATED (nzimp2))
DEALLOCATE (nzimp2)
302 IF(
ALLOCATED (ncomp2))
DEALLOCATE (ncomp2)
303 IF(
ALLOCATED (ntype2))
DEALLOCATE (ntype2)
304 IF(
ALLOCATED (rho1))
DEALLOCATE (rho1)
305 IF(
ALLOCATED (
fun))
DEALLOCATE (
fun)
329 TYPE (type_coretransp
) :: coretransp_in
330 TYPE (type_coretransp
) :: coretransp_out
332 INTEGER :: nval2, ival
333 INTEGER :: nrho1, nrho2
334 INTEGER :: irho1, irho2
335 INTEGER :: nnucl1,inucl1
336 INTEGER :: nnucl2,inucl2
337 INTEGER :: nion1, iion1
338 INTEGER :: nion2, iion2
339 INTEGER :: nimp1, iimp1
340 INTEGER :: nimp2, iimp2
341 INTEGER,
ALLOCATABLE :: nzimp1(:)
342 INTEGER,
ALLOCATABLE :: nzimp2(:)
343 INTEGER :: izimp1,izimp2
344 INTEGER :: nneut1,ineut1
345 INTEGER :: nneut2,ineut2
346 INTEGER,
ALLOCATABLE :: ncomp1(:)
347 INTEGER,
ALLOCATABLE :: ncomp2(:)
348 INTEGER,
ALLOCATABLE :: ntype1(:)
349 INTEGER,
ALLOCATABLE :: ntype2(:)
351 REAL (R8),
ALLOCATABLE :: rho1(:), rho2(:)
352 REAL (R8),
ALLOCATABLE ::
fun(:)
353 REAL (R8) :: zmin1, zmin2
354 REAL (R8) :: zmax1, zmax2
356 INTEGER :: negative_diff
360 nval2 =
SIZE(coretransp_in%VALUES)
363 nrho1 =
SIZE(coretransp_out%VALUES(1)%rho_tor)
365 ALLOCATE (
fun(nrho1))
366 ALLOCATE (rho1(nrho1))
368 rho1 = coretransp_out%VALUES(1)%rho_tor
370 CALL
get_comp_dimensions(coretransp_out%COMPOSITIONS, nnucl1, nion1, nimp1, nzimp1, nneut1, ntype1, ncomp1)
371 CALL
get_comp_dimensions(coretransp_in%COMPOSITIONS, nnucl2, nion2, nimp2, nzimp2, nneut2, ntype2, ncomp2)
373 IF(.NOT.
ASSOCIATED(coretransp_in%VALUES)) goto 10
377 coretransp_out%VALUES(1)%sigma = 0.0_r8
378 coretransp_out%VALUES(1)%Ne_transp%diff_eff = 0.0_r8
379 coretransp_out%VALUES(1)%Ne_transp%vconv_eff = 0.0_r8
380 coretransp_out%VALUES(1)%Te_transp%diff_eff = 0.0_r8
381 coretransp_out%VALUES(1)%Te_transp%vconv_eff = 0.0_r8
382 coretransp_out%VALUES(1)%ni_transp%diff_eff = 0.0_r8
383 coretransp_out%VALUES(1)%ni_transp%vconv_eff = 0.0_r8
384 coretransp_out%VALUES(1)%Ti_transp%diff_eff = 0.0_r8
385 coretransp_out%VALUES(1)%Ti_transp%vconv_eff = 0.0_r8
386 coretransp_out%VALUES(1)%Vtor_transp%diff_eff = 0.0_r8
387 coretransp_out%VALUES(1)%Vtor_transp%vconv_eff = 0.0_r8
389 coretransp_out%VALUES(1)%Nz_transp(iimp1)%diff_eff = 0.0_r8
390 coretransp_out%VALUES(1)%Nz_transp(iimp1)%vconv_eff = 0.0_r8
391 coretransp_out%VALUES(1)%Tz_transp(iimp1)%diff_eff = 0.0_r8
392 coretransp_out%VALUES(1)%Tz_transp(iimp1)%vconv_eff = 0.0_r8
401 loop_on_values:
DO ival = 1, nval2
402 nrho2 =
SIZE(coretransp_in%VALUES(1)%rho_tor)
403 ALLOCATE (rho2(nrho2))
404 rho2 = coretransp_in%VALUES(ival)%rho_tor
409 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%sigma)) &
410 CALL
l3interp(coretransp_in%VALUES(ival)%sigma, rho2, nrho2, &
412 coretransp_out%VALUES(1)%sigma =
fun
416 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%Ne_transp%diff_eff))
THEN
418 CALL
l3interp(coretransp_in%VALUES(ival)%Ne_transp%diff_eff(:,icon), rho2, nrho2, &
420 coretransp_out%VALUES(1)%Ne_transp%diff_eff(:,icon) =
fun
424 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%Ne_transp%vconv_eff))
THEN
426 CALL
l3interp(coretransp_in%VALUES(ival)%Ne_transp%vconv_eff(:,icon), rho2, nrho2, &
428 coretransp_out%VALUES(1)%Ne_transp%vconv_eff(:,icon) =
fun
434 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%Te_transp%diff_eff))
THEN
435 CALL
l3interp(coretransp_in%VALUES(ival)%Te_transp%diff_eff, rho2, nrho2, &
437 coretransp_out%VALUES(1)%Te_transp%diff_eff =
fun
440 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%Te_transp%vconv_eff))
THEN
441 CALL
l3interp(coretransp_in%VALUES(ival)%Te_transp%vconv_eff, rho2, nrho2, &
443 coretransp_out%VALUES(1)%Te_transp%vconv_eff =
fun
450 output_ions_loop:
DO iion1 = 1, nion1
451 inucl1 = coretransp_out%COMPOSITIONS%IONS(iion1)%nucindex
453 input_ions_loop:
DO iion2 = 1, nion2
454 inucl2 = coretransp_in%COMPOSITIONS%IONS(iion2)%nucindex
456 IF (inucl2.LE.0 .OR. inucl2.GT.
SIZE(coretransp_in%COMPOSITIONS%NUCLEI)) goto 5
458 check_for_ions_consistency:
IF &
459 (abs(coretransp_out%COMPOSITIONS%NUCLEI(inucl1)%amn - coretransp_in%COMPOSITIONS%NUCLEI(inucl2)%amn) .LE. 0.25 .AND. &
460 abs(coretransp_out%COMPOSITIONS%NUCLEI(inucl1)%zn - coretransp_in%COMPOSITIONS%NUCLEI(inucl2)%zn ) .LE. 0.25 .AND. &
461 abs(coretransp_out%COMPOSITIONS%IONS(iion1)%zion - coretransp_in%COMPOSITIONS%IONS(iion2)%zion ) .LE. 0.25)
THEN
464 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%ni_transp%diff_eff))
THEN
466 CALL
l3interp(coretransp_in%VALUES(ival)%ni_transp%diff_eff(:,iion2,icon), rho2, nrho2, &
468 coretransp_out%VALUES(1)%ni_transp%diff_eff(:,iion1,icon) =
fun
472 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%ni_transp%vconv_eff))
THEN
474 CALL
l3interp(coretransp_in%VALUES(ival)%ni_transp%vconv_eff(:,iion2,icon), rho2, nrho2, &
476 coretransp_out%VALUES(1)%ni_transp%vconv_eff(:,iion1,icon) =
fun
482 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%ti_transp%diff_eff))
THEN
483 CALL
l3interp(coretransp_in%VALUES(ival)%ti_transp%diff_eff(:,iion2), rho2, nrho2, &
485 coretransp_out%VALUES(1)%ti_transp%diff_eff(:,iion1) =
fun
488 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%ti_transp%vconv_eff))
THEN
489 CALL
l3interp(coretransp_in%VALUES(ival)%ti_transp%vconv_eff(:,iion2), rho2, nrho2, &
491 coretransp_out%VALUES(1)%ti_transp%vconv_eff(:,iion1) =
fun
496 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%vtor_transp%diff_eff))
THEN
497 CALL
l3interp(coretransp_in%VALUES(ival)%vtor_transp%diff_eff(:,iion2), rho2, nrho2, &
499 coretransp_out%VALUES(1)%vtor_transp%diff_eff(:,iion1) =
fun
502 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%vtor_transp%vconv_eff))
THEN
503 CALL
l3interp(coretransp_in%VALUES(ival)%vtor_transp%vconv_eff(:,iion2), rho2, nrho2, &
505 coretransp_out%VALUES(1)%vtor_transp%vconv_eff(:,iion1) =
fun
509 END IF check_for_ions_consistency
513 END DO input_ions_loop
514 END DO output_ions_loop
520 IF (nimp1*nimp2.LE.0) goto 8
521 output_impurity_loop:
DO iimp1 = 1, nimp1
522 inucl1 = coretransp_out%COMPOSITIONS%IMPURITIES(iimp1)%nucindex
524 input_impurity_loop:
DO iimp2 = 1, nimp2
525 inucl2 = coretransp_in%COMPOSITIONS%IMPURITIES(iimp2)%nucindex
527 IF (inucl2.LE.0 .OR. inucl2.GT.
SIZE(coretransp_in%COMPOSITIONS%NUCLEI)) goto 7
529 check_for_impurity_consistency:
IF &
530 (abs(coretransp_out%COMPOSITIONS%NUCLEI(inucl1)%amn - coretransp_in%COMPOSITIONS%NUCLEI(inucl2)%amn) .LE. 0.25 .AND. &
531 abs(coretransp_out%COMPOSITIONS%NUCLEI(inucl1)%zn - coretransp_in%COMPOSITIONS%NUCLEI(inucl2)%zn ) .LE. 0.25 )
THEN
533 output_ionization_state:
DO izimp1 = 1, nzimp1(iimp1)
534 input_ionization_state:
DO izimp2 = 1, nzimp2(iimp2)
536 zmin1 = coretransp_out%COMPOSITIONS%IMPURITIES(iimp1)%zmin(izimp1)
537 zmax1 = coretransp_out%COMPOSITIONS%IMPURITIES(iimp1)%zmax(izimp1)
538 zmin2 = coretransp_in%COMPOSITIONS%IMPURITIES(iimp2)%zmin(izimp2)
539 zmax2 = coretransp_in%COMPOSITIONS%IMPURITIES(iimp2)%zmax(izimp2)
541 check_for_ionization_state_consistency:
IF &
542 (abs((zmax1+zmin1)/2.0 - (zmax2+zmin2)/2.0).LE. 0.25)
THEN
544 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%Nz_transp).AND.iimp2.LE.
SIZE(coretransp_in%VALUES(ival)%Nz_transp))
THEN
546 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%Nz_transp(iimp2)%diff_eff))
THEN
547 CALL
l3interp(coretransp_in%VALUES(ival)%Nz_transp(iimp2)%diff_eff(:,izimp2), rho2, nrho2, &
549 coretransp_out%VALUES(1)%Nz_transp(iimp1)%diff_eff(:,izimp1) =
fun
552 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%Nz_transp(iimp2)%vconv_eff))
THEN
553 CALL
l3interp(coretransp_in%VALUES(ival)%Nz_transp(iimp2)%vconv_eff(:,izimp2), rho2, nrho2, &
555 coretransp_out%VALUES(1)%Nz_transp(iimp1)%vconv_eff(:,izimp1) =
fun
559 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%Tz_transp).AND.iimp2.LE.
SIZE(coretransp_in%VALUES(ival)%Tz_transp))
THEN
561 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%Tz_transp(iimp2)%diff_eff))
THEN
562 CALL
l3interp(coretransp_in%VALUES(ival)%Tz_transp(iimp2)%diff_eff(:,izimp2), rho2, nrho2, &
564 coretransp_out%VALUES(1)%Tz_transp(iimp1)%diff_eff(:,izimp1) =
fun
567 IF(
ASSOCIATED(coretransp_in%VALUES(ival)%Tz_transp(iimp2)%vconv_eff))
THEN
568 CALL
l3interp(coretransp_in%VALUES(ival)%Tz_transp(iimp2)%vconv_eff(:,izimp2), rho2, nrho2, &
570 coretransp_out%VALUES(1)%Tz_transp(iimp1)%vconv_eff(:,izimp1) =
fun
573 END IF check_for_ionization_state_consistency
575 END DO input_ionization_state
576 END DO output_ionization_state
578 END IF check_for_impurity_consistency
582 END DO input_impurity_loop
583 END DO output_impurity_loop
586 8
IF(
ALLOCATED(rho2))
DEALLOCATE (rho2)
588 END DO loop_on_values
594 IF (negative_diff.NE.0)
THEN
596 IF(
ASSOCIATED(coretransp_out%VALUES(1)%ni_transp%diff_eff))
THEN
600 IF (coretransp_out%VALUES(1)%ni_transp%diff_eff(irho1,iion1,icon).LT.0.0_r8) &
601 coretransp_out%VALUES(1)%ni_transp%diff_eff(irho1,iion1,icon) = 0.0_r8
607 IF(
ASSOCIATED(coretransp_out%VALUES(1)%ne_transp%diff_eff))
THEN
610 IF (coretransp_out%VALUES(1)%ne_transp%diff_eff(irho1,icon).LT.0.0_r8) &
611 coretransp_out%VALUES(1)%ne_transp%diff_eff(irho1,icon) = 0.0_r8
616 IF(
ASSOCIATED(coretransp_out%VALUES(1)%ti_transp%diff_eff))
THEN
619 IF (coretransp_out%VALUES(1)%ti_transp%diff_eff(irho1,iion1).LT.0.0_r8) &
620 coretransp_out%VALUES(1)%ti_transp%diff_eff(irho1,iion1) = 0.0_r8
625 IF(
ASSOCIATED(coretransp_out%VALUES(1)%te_transp%diff_eff))
THEN
627 IF (coretransp_out%VALUES(1)%te_transp%diff_eff(irho1).LT.0.0_r8) &
628 coretransp_out%VALUES(1)%te_transp%diff_eff(irho1) = 0.0_r8
632 IF(
ASSOCIATED(coretransp_out%VALUES(1)%vtor_transp%diff_eff))
THEN
635 IF (coretransp_out%VALUES(1)%vtor_transp%diff_eff(irho1,iion1).LT.0.0_r8) &
636 coretransp_out%VALUES(1)%vtor_transp%diff_eff(irho1,iion1) = 0.0_r8
642 IF(
ASSOCIATED(coretransp_out%VALUES(1)%Nz_transp))
THEN
643 IF (
ASSOCIATED(coretransp_out%VALUES(1)%Nz_transp(iimp1)%diff_eff))
THEN
645 DO izimp1=1,nzimp1(iimp1)
646 IF (coretransp_out%VALUES(1)%Nz_transp(iimp1)%diff_eff(irho1,izimp1).LT.0.0_r8) &
647 coretransp_out%VALUES(1)%Nz_transp(iimp1)%diff_eff(irho1,izimp1) = 0.0_r8
653 IF(
ASSOCIATED(coretransp_out%VALUES(1)%Tz_transp))
THEN
654 IF (
ASSOCIATED(coretransp_out%VALUES(1)%Tz_transp(iimp1)%diff_eff))
THEN
656 DO izimp1=1,nzimp1(iimp1)
657 IF (coretransp_out%VALUES(1)%Tz_transp(iimp1)%diff_eff(irho1,izimp1).LT.0.0_r8) &
658 coretransp_out%VALUES(1)%Tz_transp(iimp1)%diff_eff(irho1,izimp1) = 0.0_r8
669 IF(
ALLOCATED (nzimp1))
DEALLOCATE (nzimp1)
670 IF(
ALLOCATED (ncomp1))
DEALLOCATE (ncomp1)
671 IF(
ALLOCATED (ntype1))
DEALLOCATE (ntype1)
672 IF(
ALLOCATED (nzimp2))
DEALLOCATE (nzimp2)
673 IF(
ALLOCATED (ncomp2))
DEALLOCATE (ncomp2)
674 IF(
ALLOCATED (ntype2))
DEALLOCATE (ntype2)
675 IF(
ALLOCATED (rho1))
DEALLOCATE (rho1)
676 IF(
ALLOCATED (
fun))
DEALLOCATE (
fun)
702 TYPE (type_coreprof
) :: coreprof_in
703 TYPE (type_coreprof
) :: coreprof_out
705 INTEGER :: nrho1, nrho2
706 INTEGER :: irho1, irho2
707 INTEGER :: nnucl1,inucl1
708 INTEGER :: nnucl2,inucl2
709 INTEGER :: nion1, iion1
710 INTEGER :: nion2, iion2
711 INTEGER :: nimp1, iimp1
712 INTEGER :: nimp2, iimp2
713 INTEGER,
ALLOCATABLE :: nzimp1(:)
714 INTEGER,
ALLOCATABLE :: nzimp2(:)
715 INTEGER :: izimp1,izimp2
716 INTEGER :: nneut1,ineut1
717 INTEGER :: nneut2,ineut2
718 INTEGER,
ALLOCATABLE :: ncomp1(:)
719 INTEGER,
ALLOCATABLE :: ncomp2(:)
720 INTEGER,
ALLOCATABLE :: ntype1(:)
721 INTEGER,
ALLOCATABLE :: ntype2(:)
723 REAL (R8),
ALLOCATABLE :: rho1(:), rho2(:),rho3(:)
724 REAL (R8) :: zmin1, zmin2
725 REAL (R8) :: zmax1, zmax2
727 INTEGER :: negative_diff
731 INTEGER,
PARAMETER :: calculate_derivatives_here = 1
733 REAL (R8),
ALLOCATABLE :: y(:), dy(:)
739 nrho1 =
SIZE(coreprof_out%rho_tor)
740 nrho2 =
SIZE(coreprof_in%rho_tor)
742 ALLOCATE (rho1(nrho1))
743 ALLOCATE (rho2(nrho2))
744 ALLOCATE (rho3(nrho1))
749 rho1 = coreprof_out%rho_tor*coreprof_out%rho_tor
750 rho2 = coreprof_in%rho_tor*coreprof_in%rho_tor
751 rho3 = coreprof_out%rho_tor
753 CALL
get_comp_dimensions(coreprof_out%COMPOSITIONS, nnucl1, nion1, nimp1, nzimp1, nneut1, ntype1, ncomp1)
754 CALL
get_comp_dimensions(coreprof_in%COMPOSITIONS, nnucl2, nion2, nimp2, nzimp2, nneut2, ntype2, ncomp2)
760 coreprof_out%psi%value = 0.0_r8
761 coreprof_out%psi%ddrho = 0.0_r8
762 coreprof_out%ne%value = 0.0_r8
763 coreprof_out%ne%ddrho = 0.0_r8
764 coreprof_out%ne%flux%flux_dv = 0.0_r8
765 coreprof_out%te%value = 0.0_r8
766 coreprof_out%te%ddrho = 0.0_r8
767 coreprof_out%te%flux%flux_dv = 0.0_r8
768 coreprof_out%ni%value = 0.0_r8
769 coreprof_out%ni%ddrho = 0.0_r8
770 coreprof_out%ni%flux%flux_dv = 0.0_r8
771 coreprof_out%ti%value = 0.0_r8
772 coreprof_out%ti%ddrho = 0.0_r8
773 coreprof_out%ti%flux%flux_dv = 0.0_r8
774 coreprof_out%profiles1d%wtor%value = 0.0_r8
775 coreprof_out%vtor%value = 0.0_r8
776 coreprof_out%vtor%ddrho = 0.0_r8
777 coreprof_out%vtor%flux%flux_dv = 0.0_r8
778 coreprof_out%profiles1d%q%value = 0.0_r8
779 coreprof_out%profiles1d%zeff%value = 1.0_r8
780 coreprof_out%profiles1d%jtot%value = 0.0_r8
781 coreprof_out%profiles1d%jphi%value = 0.0_r8
782 coreprof_out%profiles1d%bpol%value = 0.0_r8
783 coreprof_out%profiles1d%eparallel%value = 0.0_r8
784 coreprof_out%psi%sigma_par%value = 0.0_r8
791 IF (
ASSOCIATED(coreprof_in%psi%value)) &
792 CALL
l3interp(coreprof_in%psi%value, rho2, nrho2, &
793 coreprof_out%psi%value, rho1, nrho1)
794 IF (
ASSOCIATED(coreprof_in%psi%ddrho)) &
795 CALL
l3interp(coreprof_in%psi%ddrho, rho2, nrho2, &
796 coreprof_out%psi%ddrho, rho1, nrho1)
797 IF (
ASSOCIATED(coreprof_in%psi%sigma_par%value)) &
798 CALL
l3interp(coreprof_in%psi%sigma_par%value, rho2, nrho2, &
799 coreprof_out%psi%sigma_par%value, rho1, nrho1)
800 IF (
ASSOCIATED(coreprof_in%ne%value)) &
801 CALL
l3interp(coreprof_in%ne%value, rho2, nrho2, &
802 coreprof_out%ne%value, rho1, nrho1)
803 IF (
ASSOCIATED(coreprof_in%ne%ddrho)) &
804 CALL
l3interp(coreprof_in%ne%ddrho, rho2, nrho2, &
805 coreprof_out%ne%ddrho, rho1, nrho1)
806 IF (
ASSOCIATED(coreprof_in%ne%flux%flux_dv)) &
807 CALL
l3interp(coreprof_in%ne%flux%flux_dv, rho2, nrho2, &
808 coreprof_out%ne%flux%flux_dv, rho1, nrho1)
809 IF (
ASSOCIATED(coreprof_in%te%value)) &
810 CALL
l3interp(coreprof_in%te%value, rho2, nrho2, &
811 coreprof_out%te%value, rho1, nrho1)
812 IF (
ASSOCIATED(coreprof_in%te%ddrho)) &
813 CALL
l3interp(coreprof_in%te%ddrho, rho2, nrho2, &
814 coreprof_out%te%ddrho, rho1, nrho1)
815 IF (
ASSOCIATED(coreprof_in%te%flux%flux_dv)) &
816 CALL
l3interp(coreprof_in%te%flux%flux_dv, rho2, nrho2, &
817 coreprof_out%te%flux%flux_dv, rho1, nrho1)
819 IF (
ASSOCIATED(coreprof_in%profiles1d%q%value)) &
820 CALL
l3interp(coreprof_in%profiles1d%q%value, rho2, nrho2, &
821 coreprof_out%profiles1d%q%value, rho1, nrho1)
822 IF (
ASSOCIATED(coreprof_in%profiles1d%zeff%value)) &
823 CALL
l3interp(coreprof_in%profiles1d%zeff%value, rho2, nrho2, &
824 coreprof_out%profiles1d%zeff%value, rho1, nrho1)
825 IF (
ASSOCIATED(coreprof_in%profiles1d%jtot%value)) &
826 CALL
l3interp(coreprof_in%profiles1d%jtot%value, rho2, nrho2, &
827 coreprof_out%profiles1d%jtot%value, rho1, nrho1)
828 IF (
ASSOCIATED(coreprof_in%profiles1d%jni%value)) &
829 CALL
l3interp(coreprof_in%profiles1d%jni%value, rho2, nrho2, &
830 coreprof_out%profiles1d%jni%value, rho1, nrho1)
831 IF (
ASSOCIATED(coreprof_in%profiles1d%joh%value)) &
832 CALL
l3interp(coreprof_in%profiles1d%joh%value, rho2, nrho2, &
833 coreprof_out%profiles1d%joh%value, rho1, nrho1)
834 IF (
ASSOCIATED(coreprof_in%profiles1d%vloop%value)) &
835 CALL
l3interp(coreprof_in%profiles1d%vloop%value, rho2, nrho2, &
836 coreprof_out%profiles1d%vloop%value, rho1, nrho1)
837 IF (
ASSOCIATED(coreprof_in%profiles1d%jphi%value)) &
838 CALL
l3interp(coreprof_in%profiles1d%jphi%value, rho2, nrho2, &
839 coreprof_out%profiles1d%jphi%value, rho1, nrho1)
840 IF (
ASSOCIATED(coreprof_in%profiles1d%pe%value)) &
841 CALL
l3interp(coreprof_in%profiles1d%pe%value, rho2, nrho2, &
842 coreprof_out%profiles1d%pe%value, rho1, nrho1)
843 IF (
ASSOCIATED(coreprof_in%profiles1d%pi_tot%value)) &
844 CALL
l3interp(coreprof_in%profiles1d%pi_tot%value, rho2, nrho2, &
845 coreprof_out%profiles1d%pi_tot%value, rho1, nrho1)
846 IF (
ASSOCIATED(coreprof_in%profiles1d%bpol%value)) &
847 CALL
l3interp(coreprof_in%profiles1d%bpol%value, rho2, nrho2, &
848 coreprof_out%profiles1d%bpol%value, rho1, nrho1)
849 IF (
ASSOCIATED(coreprof_in%profiles1d%eparallel%value)) &
850 CALL
l3interp(coreprof_in%profiles1d%eparallel%value, rho2, nrho2, &
851 coreprof_out%profiles1d%eparallel%value, rho1, nrho1)
855 output_ions_loop:
DO iion1 = 1, nion1
856 inucl1 = coreprof_out%COMPOSITIONS%IONS(iion1)%nucindex
857 input_ions_loop:
DO iion2 = 1, nion2
858 inucl2 = coreprof_in%COMPOSITIONS%IONS(iion2)%nucindex
860 IF (inucl2.LE.0 .OR. inucl2.GT.
SIZE(coreprof_in%COMPOSITIONS%NUCLEI)) goto 5
862 check_for_ions_consistency:
IF &
863 (abs(coreprof_out%COMPOSITIONS%NUCLEI(inucl1)%amn - coreprof_in%COMPOSITIONS%NUCLEI(inucl2)%amn) .LE. 0.25 .AND. &
864 abs(coreprof_out%COMPOSITIONS%NUCLEI(inucl1)%zn - coreprof_in%COMPOSITIONS%NUCLEI(inucl2)%zn ) .LE. 0.25 .AND. &
865 abs(coreprof_out%COMPOSITIONS%IONS(iion1)%zion - coreprof_in%COMPOSITIONS%IONS(iion2)%zion ) .LE. 0.25)
THEN
867 IF (
ASSOCIATED(coreprof_in%ni%value)) &
868 CALL
l3interp(coreprof_in%ni%value(:,iion2), rho2, nrho2, &
869 coreprof_out%ni%value(:,iion1), rho1, nrho1)
870 IF (
ASSOCIATED(coreprof_in%ni%ddrho)) &
871 CALL
l3interp(coreprof_in%ni%ddrho(:,iion2), rho2, nrho2, &
872 coreprof_out%ni%ddrho(:,iion1), rho1, nrho1)
873 IF (
ASSOCIATED(coreprof_in%ni%flux%flux_dv)) &
874 CALL
l3interp(coreprof_in%ni%flux%flux_dv(:,iion2), rho2, nrho2, &
875 coreprof_out%ni%flux%flux_dv(:,iion1), rho1, nrho1)
877 IF (
ASSOCIATED(coreprof_in%ti%value)) &
878 CALL
l3interp(coreprof_in%ti%value(:,iion2), rho2, nrho2, &
879 coreprof_out%ti%value(:,iion1), rho1, nrho1)
880 IF (
ASSOCIATED(coreprof_in%ti%ddrho)) &
881 CALL
l3interp(coreprof_in%ti%ddrho(:,iion2), rho2, nrho2, &
882 coreprof_out%ti%ddrho(:,iion1), rho1, nrho1)
883 IF (
ASSOCIATED(coreprof_in%ti%flux%flux_dv)) &
884 CALL
l3interp(coreprof_in%ti%flux%flux_dv(:,iion2), rho2, nrho2, &
885 coreprof_out%ti%flux%flux_dv(:,iion1), rho1, nrho1)
887 IF (
ASSOCIATED(coreprof_in%profiles1d%pi%value)) &
888 CALL
l3interp(coreprof_in%profiles1d%pi%value(:,iion2), rho2, nrho2, &
889 coreprof_out%profiles1d%pi%value(:,iion1), rho1, nrho1)
891 IF (
ASSOCIATED(coreprof_in%vtor%value)) &
892 CALL
l3interp(coreprof_in%vtor%value(:,iion2), rho2, nrho2, &
893 coreprof_out%vtor%value(:,iion1), rho1, nrho1)
894 IF (
ASSOCIATED(coreprof_in%vtor%ddrho)) &
895 CALL
l3interp(coreprof_in%vtor%ddrho(:,iion2), rho2, nrho2, &
896 coreprof_out%vtor%ddrho(:,iion1), rho1, nrho1)
897 IF (
ASSOCIATED(coreprof_in%vtor%flux%flux_dv)) &
898 CALL
l3interp(coreprof_in%vtor%flux%flux_dv(:,iion2), rho2, nrho2, &
899 coreprof_out%vtor%flux%flux_dv(:,iion1), rho1, nrho1)
901 IF (
ASSOCIATED(coreprof_in%profiles1d%wtor%value)) &
902 CALL
l3interp(coreprof_in%profiles1d%wtor%value(:,iion2), rho2, nrho2, &
903 coreprof_out%profiles1d%wtor%value(:,iion1), rho1, nrho1)
906 END IF check_for_ions_consistency
910 END DO input_ions_loop
911 END DO output_ions_loop
916 IF (calculate_derivatives_here.EQ.1)
THEN
919 y = coreprof_out%ne%value
921 coreprof_out%ne%ddrho = dy*2.0*rho3
923 y = coreprof_out%te%value
925 coreprof_out%te%ddrho = dy*2.0*rho3
929 y = coreprof_out%ni%value(:,iion1)
931 coreprof_out%ni%ddrho(:,iion1) = dy*2.0*rho3
933 y = coreprof_out%ti%value(:,iion1)
935 coreprof_out%ti%ddrho(:,iion1) = dy*2.0*rho3
944 IF(
ALLOCATED (nzimp1))
DEALLOCATE (nzimp1)
945 IF(
ALLOCATED (ncomp1))
DEALLOCATE (ncomp1)
946 IF(
ALLOCATED (ntype1))
DEALLOCATE (ntype1)
947 IF(
ALLOCATED (nzimp2))
DEALLOCATE (nzimp2)
948 IF(
ALLOCATED (ncomp2))
DEALLOCATE (ncomp2)
949 IF(
ALLOCATED (ntype2))
DEALLOCATE (ntype2)
950 IF(
ALLOCATED (rho1))
DEALLOCATE (rho1)
951 IF(
ALLOCATED (rho2))
DEALLOCATE (rho2)
952 IF(
ALLOCATED (rho3))
DEALLOCATE (rho3)
955 IF(
ALLOCATED (y))
DEALLOCATE (y)
956 IF(
ALLOCATED (dy))
DEALLOCATE (dy)
980 TYPE (type_coreimpur
) :: coreimpur_in
981 TYPE (type_coreimpur
) :: coreimpur_out
983 INTEGER :: nrho1, nrho2
984 INTEGER :: irho1, irho2
985 INTEGER :: nnucl1,inucl1
986 INTEGER :: nnucl2,inucl2
987 INTEGER :: nion1, iion1
988 INTEGER :: nion2, iion2
989 INTEGER :: nimp1, iimp1
990 INTEGER :: nimp2, iimp2
991 INTEGER,
ALLOCATABLE :: nzimp1(:)
992 INTEGER,
ALLOCATABLE :: nzimp2(:)
993 INTEGER :: izimp1,izimp2
994 INTEGER :: nneut1,ineut1
995 INTEGER :: nneut2,ineut2
996 INTEGER,
ALLOCATABLE :: ncomp1(:)
997 INTEGER,
ALLOCATABLE :: ncomp2(:)
998 INTEGER,
ALLOCATABLE :: ntype1(:)
999 INTEGER,
ALLOCATABLE :: ntype2(:)
1001 REAL (R8),
ALLOCATABLE :: rho1(:), rho2(:)
1002 REAL (R8) :: zmin1, zmin2
1003 REAL (R8) :: zmax1, zmax2
1009 nrho1 =
SIZE(coreimpur_out%rho_tor)
1010 nrho2 =
SIZE(coreimpur_in%rho_tor)
1012 ALLOCATE (rho1(nrho1))
1013 ALLOCATE (rho2(nrho2))
1015 rho1 = coreimpur_out%rho_tor
1016 rho2 = coreimpur_in%rho_tor
1018 CALL
get_comp_dimensions(coreimpur_out%COMPOSITIONS, nnucl1, nion1, nimp1, nzimp1, nneut1, ntype1, ncomp1)
1019 CALL
get_comp_dimensions(coreimpur_in%COMPOSITIONS, nnucl2, nion2, nimp2, nzimp2, nneut2, ntype2, ncomp2)
1024 IF (nimp1*nimp2.LE.0) goto 8
1025 output_impurity_loop:
DO iimp1 = 1, nimp1
1026 inucl1 = coreimpur_out%COMPOSITIONS%IMPURITIES(iimp1)%nucindex
1029 coreimpur_out%IMPURITY(iimp1)%nz = 0.0_r8
1030 coreimpur_out%IMPURITY(iimp1)%flux%flux_dv = 0.0_r8
1032 input_impurity_loop:
DO iimp2 = 1, nimp2
1033 inucl2 = coreimpur_in%COMPOSITIONS%IMPURITIES(iimp2)%nucindex
1035 IF (inucl2.LE.0 .OR. inucl2.GT.
SIZE(coreimpur_in%COMPOSITIONS%NUCLEI)) goto 7
1037 check_impurity_consistency:
IF &
1038 (abs(coreimpur_out%COMPOSITIONS%NUCLEI(inucl1)%amn - coreimpur_in%COMPOSITIONS%NUCLEI(inucl2)%amn) .LE. 0.25 .AND. &
1039 abs(coreimpur_out%COMPOSITIONS%NUCLEI(inucl1)%zn - coreimpur_in%COMPOSITIONS%NUCLEI(inucl2)%zn ) .LE. 0.25 )
THEN
1041 output_ionzation_state:
DO izimp1 = 1, nzimp1(iimp1)
1042 input_ionzation_state:
DO izimp2 = 1, nzimp2(iimp2)
1044 zmin1 = coreimpur_out%COMPOSITIONS%IMPURITIES(iimp1)%zmin(izimp1)
1045 zmax1 = coreimpur_out%COMPOSITIONS%IMPURITIES(iimp1)%zmax(izimp1)
1046 zmin2 = coreimpur_in%COMPOSITIONS%IMPURITIES(iimp2)%zmin(izimp2)
1047 zmax2 = coreimpur_in%COMPOSITIONS%IMPURITIES(iimp2)%zmax(izimp2)
1049 check_ionzation_state_consistency: if&
1050 (abs((zmax1+zmin1)/2.0 - (zmax2+zmin2)/2.0).LE. 0.25)
THEN
1052 IF(
ASSOCIATED(coreimpur_in%IMPURITY(iimp2)%nz)) &
1053 CALL
l3interp(coreimpur_in%IMPURITY(iimp2)%nz(:,izimp2), rho2, nrho2, &
1054 coreimpur_out%IMPURITY(iimp1)%nz(:,izimp1), rho1, nrho1)
1055 IF(
ASSOCIATED(coreimpur_in%IMPURITY(iimp2)%flux%flux_dv)) &
1056 CALL
l3interp(coreimpur_in%IMPURITY(iimp2)%flux%flux_dv(:,izimp2), rho2, nrho2, &
1057 coreimpur_out%IMPURITY(iimp1)%flux%flux_dv(:,izimp1), rho1, nrho1)
1059 IF(
ASSOCIATED(coreimpur_in%IMPURITY(iimp2)%tz)) &
1060 CALL
l3interp(coreimpur_in%IMPURITY(iimp2)%tz(:,izimp2), rho2, nrho2, &
1061 coreimpur_out%IMPURITY(iimp1)%tz(:,izimp1), rho1, nrho1)
1063 IF(
ASSOCIATED(coreimpur_in%IMPURITY(iimp2)%z)) &
1064 CALL
l3interp(coreimpur_in%IMPURITY(iimp2)%z(:,izimp2), rho2, nrho2, &
1065 coreimpur_out%IMPURITY(iimp1)%z(:,izimp1), rho1, nrho1)
1067 IF(
ASSOCIATED(coreimpur_in%IMPURITY(iimp2)%zsq)) &
1068 CALL
l3interp(coreimpur_in%IMPURITY(iimp2)%zsq(:,izimp2), rho2, nrho2, &
1069 coreimpur_out%IMPURITY(iimp1)%zsq(:,izimp1), rho1, nrho1)
1071 IF(
ASSOCIATED(coreimpur_in%IMPURITY(iimp2)%diagnostic%radiation%line_rad%profile)) &
1072 CALL
l3interp(coreimpur_in%IMPURITY(iimp2)%diagnostic%radiation%line_rad%profile(:,izimp2), rho2, nrho2, &
1073 coreimpur_out%IMPURITY(iimp1)%diagnostic%radiation%line_rad%profile(:,izimp1), rho1, nrho1)
1074 IF(
ASSOCIATED(coreimpur_in%IMPURITY(iimp2)%diagnostic%radiation%brem_radrec%profile)) &
1075 CALL
l3interp(coreimpur_in%IMPURITY(iimp2)%diagnostic%radiation%brem_radrec%profile(:,izimp2), rho2, nrho2, &
1076 coreimpur_out%IMPURITY(iimp1)%diagnostic%radiation%brem_radrec%profile(:,izimp1), rho1, nrho1)
1077 IF(
ASSOCIATED(coreimpur_in%IMPURITY(iimp2)%diagnostic%radiation%sum%profile)) &
1078 CALL
l3interp(coreimpur_in%IMPURITY(iimp2)%diagnostic%radiation%sum%profile(:,izimp2), rho2, nrho2, &
1079 coreimpur_out%IMPURITY(iimp1)%diagnostic%radiation%sum%profile(:,izimp1), rho1, nrho1)
1080 END IF check_ionzation_state_consistency
1082 END DO input_ionzation_state
1083 END DO output_ionzation_state
1085 ENDIF check_impurity_consistency
1089 END DO input_impurity_loop
1090 END DO output_impurity_loop
1099 8
IF(
ALLOCATED(nzimp1))
DEALLOCATE (nzimp1)
1100 IF(
ALLOCATED(ncomp1))
DEALLOCATE (ncomp1)
1101 IF(
ALLOCATED(ntype1))
DEALLOCATE (ntype1)
1102 IF(
ALLOCATED(nzimp2))
DEALLOCATE (nzimp2)
1103 IF(
ALLOCATED(ncomp2))
DEALLOCATE (ncomp2)
1104 IF(
ALLOCATED(ntype2))
DEALLOCATE (ntype2)
1106 IF(
ALLOCATED(rho1))
DEALLOCATE (rho1)
1107 IF(
ALLOCATED(rho2))
DEALLOCATE (rho2)
1133 TYPE (type_coreneutrals
) :: coreneutrals_in
1134 TYPE (type_coreneutrals
) :: coreneutrals_out
1136 INTEGER :: nrho1, nrho2
1137 INTEGER :: irho1, irho2
1138 INTEGER :: nnucl1,inucl1
1139 INTEGER :: nnucl2,inucl2
1144 INTEGER,
ALLOCATABLE :: nzimp1(:)
1145 INTEGER,
ALLOCATABLE :: nzimp2(:)
1146 INTEGER :: nneut1,ineut1
1147 INTEGER :: nneut2,ineut2
1148 INTEGER,
ALLOCATABLE :: ncomp1(:)
1149 INTEGER,
ALLOCATABLE :: ncomp2(:)
1150 INTEGER,
ALLOCATABLE :: ntype1(:)
1151 INTEGER,
ALLOCATABLE :: ntype2(:)
1152 INTEGER :: itype1,icomp1
1153 INTEGER :: itype2,icomp2
1155 REAL (R8),
ALLOCATABLE :: rho1(:), rho2(:)
1161 nrho1 =
SIZE(coreneutrals_out%rho_tor)
1162 nrho2 =
SIZE(coreneutrals_in%rho_tor)
1164 ALLOCATE (rho1(nrho1))
1165 ALLOCATE (rho2(nrho2))
1167 rho1 = coreneutrals_out%rho_tor
1168 rho2 = coreneutrals_in%rho_tor
1170 CALL
get_comp_dimensions(coreneutrals_out%COMPOSITIONS, nnucl1, nion1, nimp1, nzimp1, nneut1, ntype1, ncomp1)
1171 CALL
get_comp_dimensions(coreneutrals_in%COMPOSITIONS, nnucl2, nion2, nimp2, nzimp2, nneut2, ntype2, ncomp2)
1178 DO ineut1 = 1, nneut1
1179 DO icomp1 = 1, ncomp1(ineut1)
1180 inucl1 = coreneutrals_out%COMPOSITIONS%NEUTRALSCOMP(ineut1)%NEUTCOMP(icomp1)%nucindex
1182 DO ineut2 = 1, nneut2
1183 DO icomp2 = 1, ncomp2(ineut2)
1184 inucl2 = coreneutrals_in%COMPOSITIONS%NEUTRALSCOMP(ineut2)%NEUTCOMP(icomp2)%nucindex
1186 IF (inucl2.LE.0 .OR. inucl2.GT.
SIZE(coreneutrals_in%COMPOSITIONS%NUCLEI)) goto 7
1189 IF (abs(coreneutrals_out%COMPOSITIONS%NUCLEI(inucl1)%amn - coreneutrals_in%COMPOSITIONS%NUCLEI(inucl2)%amn) .LE. 0.25 .AND. &
1190 abs(coreneutrals_out%COMPOSITIONS%NUCLEI(inucl1)%zn - coreneutrals_in%COMPOSITIONS%NUCLEI(inucl2)%zn ) .LE. 0.25 .AND. &
1191 (coreneutrals_out%COMPOSITIONS%NEUTRALSCOMP(ineut1)%NEUTCOMP(icomp1)%multiplicity .EQ. &
1192 coreneutrals_in%COMPOSITIONS%NEUTRALSCOMP(ineut2)%NEUTCOMP(icomp2)%multiplicity) )
THEN
1194 DO itype1 = 1, ntype1(ineut1)
1195 coreneutrals_out%PROFILES(ineut1)%neutraltype(itype1)%n0%value(:) = 0.0_r8
1196 coreneutrals_out%PROFILES(ineut1)%neutraltype(itype1)%t0%value(:) = 0.0_r8
1197 coreneutrals_out%PROFILES(ineut1)%neutraltype(itype1)%v0%toroidal%value(:) = 0.0_r8
1198 coreneutrals_out%PROFILES(ineut1)%neutraltype(itype1)%v0%poloidal%value(:) = 0.0_r8
1199 coreneutrals_out%PROFILES(ineut1)%neutraltype(itype1)%v0%radial%value(:) = 0.0_r8
1202 DO itype2 = 1, ntype2(ineut2)
1204 IF (coreneutrals_in%COMPOSITIONS%NEUTRALSCOMP(ineut2)%TYPE(itype2)%flag .EQ. &
1205 coreneutrals_out%COMPOSITIONS%NEUTRALSCOMP(ineut1)%TYPE(itype1)%flag )
THEN
1207 CALL
l3interp(coreneutrals_in%PROFILES(ineut2)%neutraltype(itype2)%n0%value(:), rho2, nrho2,&
1208 coreneutrals_out%PROFILES(ineut1)%neutraltype(itype1)%n0%value(:), rho1, nrho1)
1210 CALL
l3interp(coreneutrals_in%PROFILES(ineut2)%neutraltype(itype2)%t0%value(:), rho2, nrho2,&
1211 coreneutrals_out%PROFILES(ineut1)%neutraltype(itype1)%t0%value(:), rho1, nrho1)
1213 CALL
l3interp(coreneutrals_in%PROFILES(ineut2)%neutraltype(itype2)%v0%toroidal%value(:), rho2, nrho2,&
1214 coreneutrals_out%PROFILES(ineut1)%neutraltype(itype1)%v0%toroidal%value(:), rho1, nrho1)
1216 CALL
l3interp(coreneutrals_in%PROFILES(ineut2)%neutraltype(itype2)%v0%poloidal%value(:), rho2, nrho2,&
1217 coreneutrals_out%PROFILES(ineut1)%neutraltype(itype1)%v0%poloidal%value(:), rho1, nrho1)
1219 CALL
l3interp(coreneutrals_in%PROFILES(ineut2)%neutraltype(itype2)%v0%radial%value(:), rho2, nrho2,&
1220 coreneutrals_out%PROFILES(ineut1)%neutraltype(itype1)%v0%radial%value(:), rho1, nrho1)
1238 IF(
ALLOCATED(nzimp1))
DEALLOCATE (nzimp1)
1239 IF(
ALLOCATED(ncomp1))
DEALLOCATE (ncomp1)
1240 IF(
ALLOCATED(ntype1))
DEALLOCATE (ntype1)
1241 IF(
ALLOCATED(nzimp2))
DEALLOCATE (nzimp2)
1242 IF(
ALLOCATED(ncomp2))
DEALLOCATE (ncomp2)
1243 IF(
ALLOCATED(ntype2))
DEALLOCATE (ntype2)
1244 IF(
ALLOCATED(rho1))
DEALLOCATE (rho1)
1245 IF(
ALLOCATED(rho2))
DEALLOCATE (rho2)
1271 TYPE (type_neoclassic
) :: neoclassic_in
1272 TYPE (type_neoclassic
) :: neoclassic_out
1274 INTEGER :: nrho1, nrho2
1275 INTEGER :: irho1, irho2
1276 INTEGER :: nnucl1,inucl1
1277 INTEGER :: nnucl2,inucl2
1278 INTEGER :: nion1, iion1
1279 INTEGER :: nion2, iion2
1280 INTEGER :: nimp1, iimp1
1281 INTEGER :: nimp2, iimp2
1282 INTEGER,
ALLOCATABLE :: nzimp1(:)
1283 INTEGER,
ALLOCATABLE :: nzimp2(:)
1284 INTEGER :: izimp1,izimp2
1285 INTEGER :: nneut1,ineut1
1286 INTEGER :: nneut2,ineut2
1287 INTEGER,
ALLOCATABLE :: ncomp1(:)
1288 INTEGER,
ALLOCATABLE :: ncomp2(:)
1289 INTEGER,
ALLOCATABLE :: ntype1(:)
1290 INTEGER,
ALLOCATABLE :: ntype2(:)
1292 REAL (R8),
ALLOCATABLE :: rho1(:), rho2(:)
1293 REAL (R8) :: zmin1, zmin2
1294 REAL (R8) :: zmax1, zmax2
1300 nrho1 =
SIZE(neoclassic_out%rho_tor)
1301 nrho2 =
SIZE(neoclassic_in%rho_tor)
1303 ALLOCATE (rho1(nrho1))
1304 ALLOCATE (rho2(nrho2))
1306 rho1 = neoclassic_out%rho_tor
1307 rho2 = neoclassic_in%rho_tor
1309 CALL
get_comp_dimensions(neoclassic_out%COMPOSITIONS, nnucl1, nion1, nimp1, nzimp1, nneut1, ntype1, ncomp1)
1310 CALL
get_comp_dimensions(neoclassic_in%COMPOSITIONS, nnucl2, nion2, nimp2, nzimp2, nneut2, ntype2, ncomp2)
1315 neoclassic_out%sigma = 0.0_r8
1316 neoclassic_out%jboot = 0.0_r8
1317 neoclassic_out%er = 0.0_r8
1318 neoclassic_out%vpol = 0.0_r8
1319 neoclassic_out%Ne_neo%diff_eff = 0.0_r8
1320 neoclassic_out%Ne_neo%vconv_eff = 0.0_r8
1321 neoclassic_out%Te_neo%diff_eff = 0.0_r8
1322 neoclassic_out%Te_neo%vconv_eff = 0.0_r8
1323 neoclassic_out%Mtor_neo%diff_eff = 0.0_r8
1324 neoclassic_out%Mtor_neo%vconv_eff = 0.0_r8
1329 IF(
ASSOCIATED(neoclassic_in%sigma)) &
1330 CALL
l3interp(neoclassic_in%sigma, rho2, nrho2, &
1331 neoclassic_out%sigma, rho1, nrho1)
1334 IF(
ASSOCIATED(neoclassic_in%jboot)) &
1335 CALL
l3interp(neoclassic_in%jboot, rho2, nrho2, &
1336 neoclassic_out%jboot, rho1, nrho1)
1339 IF(
ASSOCIATED(neoclassic_in%er)) &
1340 CALL
l3interp(neoclassic_in%er, rho2, nrho2, &
1341 neoclassic_out%er, rho1, nrho1)
1344 IF(
ASSOCIATED(neoclassic_in%vpol)) &
1345 CALL
l3interp(neoclassic_in%vpol, rho2, nrho2, &
1346 neoclassic_out%vpol, rho1, nrho1)
1349 IF(
ASSOCIATED(neoclassic_in%Ne_neo%diff_eff)) &
1350 CALL
l3interp(neoclassic_in%Ne_neo%diff_eff, rho2, nrho2, &
1351 neoclassic_out%Ne_neo%diff_eff, rho1, nrho1)
1352 IF(
ASSOCIATED(neoclassic_in%Ne_neo%vconv_eff)) &
1353 CALL
l3interp(neoclassic_in%Ne_neo%vconv_eff, rho2, nrho2, &
1354 neoclassic_out%Ne_neo%vconv_eff, rho1, nrho1)
1357 IF(
ASSOCIATED(neoclassic_in%Te_neo%diff_eff)) &
1358 CALL
l3interp(neoclassic_in%Te_neo%diff_eff, rho2, nrho2, &
1359 neoclassic_out%Te_neo%diff_eff, rho1, nrho1)
1360 IF(
ASSOCIATED(neoclassic_in%Te_neo%vconv_eff)) &
1361 CALL
l3interp(neoclassic_in%Te_neo%vconv_eff, rho2, nrho2, &
1362 neoclassic_out%Te_neo%vconv_eff, rho1, nrho1)
1364 IF(
ASSOCIATED(neoclassic_in%mtor_neo%diff_eff)) &
1365 CALL
l3interp(neoclassic_in%mtor_neo%diff_eff, rho2, nrho2, &
1366 neoclassic_out%mtor_neo%diff_eff, rho1, nrho1)
1367 IF(
ASSOCIATED(neoclassic_in%mtor_neo%vconv_eff)) &
1368 CALL
l3interp(neoclassic_in%mtor_neo%vconv_eff, rho2, nrho2, &
1369 neoclassic_out%mtor_neo%vconv_eff, rho1, nrho1)
1374 neoclassic_out%ni_neo%diff_eff = 0.0_r8
1375 neoclassic_out%ni_neo%vconv_eff = 0.0_r8
1376 neoclassic_out%Ti_neo%diff_eff = 0.0_r8
1377 neoclassic_out%Ti_neo%vconv_eff = 0.0_r8
1381 output_ion_loop:
DO iion1 = 1, nion1
1382 inucl1 = neoclassic_out%COMPOSITIONS%IONS(iion1)%nucindex
1383 input_ion_loop:
DO iion2 = 1, nion2
1384 inucl2 = neoclassic_in%COMPOSITIONS%IONS(iion2)%nucindex
1386 IF (inucl2.LE.0 .OR. inucl2.GT.
SIZE(neoclassic_in%COMPOSITIONS%NUCLEI)) goto 5
1388 check_for_ions_consistency:
IF &
1389 (abs(neoclassic_out%COMPOSITIONS%NUCLEI(inucl1)%amn - neoclassic_in%COMPOSITIONS%NUCLEI(inucl2)%amn) .LE. 0.25 .AND. &
1390 abs(neoclassic_out%COMPOSITIONS%NUCLEI(inucl1)%zn - neoclassic_in%COMPOSITIONS%NUCLEI(inucl2)%zn ) .LE. 0.25 .AND. &
1391 abs(neoclassic_out%COMPOSITIONS%IONS(iion1)%zion - neoclassic_in%COMPOSITIONS%IONS(iion2)%zion ) .LE. 0.25)
THEN
1393 IF(
ASSOCIATED(neoclassic_in%ni_neo%diff_eff)) &
1394 CALL
l3interp(neoclassic_in%ni_neo%diff_eff(:,iion2), rho2, nrho2, &
1395 neoclassic_out%ni_neo%diff_eff(:,iion1), rho1, nrho1)
1396 IF(
ASSOCIATED(neoclassic_in%ni_neo%vconv_eff)) &
1397 CALL
l3interp(neoclassic_in%ni_neo%vconv_eff(:,iion2), rho2, nrho2, &
1398 neoclassic_out%ni_neo%vconv_eff(:,iion1), rho1, nrho1)
1401 IF(
ASSOCIATED(neoclassic_in%ti_neo%diff_eff)) &
1402 CALL
l3interp(neoclassic_in%ti_neo%diff_eff(:,iion2), rho2, nrho2, &
1403 neoclassic_out%ti_neo%diff_eff(:,iion1), rho1, nrho1)
1404 IF(
ASSOCIATED(neoclassic_in%ti_neo%vconv_eff)) &
1405 CALL
l3interp(neoclassic_in%ti_neo%vconv_eff(:,iion2), rho2, nrho2, &
1406 neoclassic_out%ti_neo%vconv_eff(:,iion1), rho1, nrho1)
1408 END IF check_for_ions_consistency
1412 END DO input_ion_loop
1413 END DO output_ion_loop
1419 IF (nimp1*nimp2.LE.0) goto 8
1420 output_impurity_loop:
DO iimp1 = 1, nimp1
1421 inucl1 = neoclassic_out%COMPOSITIONS%IMPURITIES(iimp1)%nucindex
1423 neoclassic_out%Nz_neo(iimp1)%diff_eff = 0.0_r8
1424 neoclassic_out%Nz_neo(iimp1)%vconv_eff = 0.0_r8
1425 neoclassic_out%Tz_neo(iimp1)%diff_eff = 0.0_r8
1426 neoclassic_out%Tz_neo(iimp1)%vconv_eff = 0.0_r8
1428 input_impurity_loop:
DO iimp2 = 1, nimp2
1429 inucl2 = neoclassic_in%COMPOSITIONS%IMPURITIES(iimp2)%nucindex
1431 IF (inucl2.LE.0 .OR. inucl2.GT.
SIZE(neoclassic_in%COMPOSITIONS%NUCLEI)) goto 7
1433 check_for_impurity_consistency:
IF &
1434 (abs(neoclassic_out%COMPOSITIONS%NUCLEI(inucl1)%amn - neoclassic_in%COMPOSITIONS%NUCLEI(inucl2)%amn) .LE. 0.25 .AND. &
1435 abs(neoclassic_out%COMPOSITIONS%NUCLEI(inucl1)%zn - neoclassic_in%COMPOSITIONS%NUCLEI(inucl2)%zn ) .LE. 0.25 )
THEN
1437 output_ionization_states:
DO izimp1 = 1, nzimp1(iimp1)
1438 input_ionization_states:
DO izimp2 = 1, nzimp2(iimp2)
1440 zmin1 = neoclassic_out%COMPOSITIONS%IMPURITIES(iimp1)%zmin(izimp1)
1441 zmax1 = neoclassic_out%COMPOSITIONS%IMPURITIES(iimp1)%zmax(izimp1)
1442 zmin2 = neoclassic_in%COMPOSITIONS%IMPURITIES(iimp2)%zmin(izimp2)
1443 zmax2 = neoclassic_in%COMPOSITIONS%IMPURITIES(iimp2)%zmax(izimp2)
1445 IF(abs((zmax1+zmin1)/2.0 - (zmax2+zmin2)/2.0).LE. 0.25)
THEN
1447 IF(
ASSOCIATED(neoclassic_in%Nz_neo))
THEN
1448 IF(
ASSOCIATED(neoclassic_in%Nz_neo(iimp2)%diff_eff)) &
1449 CALL
l3interp(neoclassic_in%Nz_neo(iimp2)%diff_eff(:,izimp2), rho2, nrho2, &
1450 neoclassic_out%Nz_neo(iimp1)%diff_eff(:,izimp1), rho1, nrho1)
1451 IF(
ASSOCIATED(neoclassic_in%Nz_neo(iimp2)%vconv_eff)) &
1452 CALL
l3interp(neoclassic_in%Nz_neo(iimp2)%vconv_eff(:,izimp2), rho2, nrho2, &
1453 neoclassic_out%Nz_neo(iimp1)%vconv_eff(:,izimp1), rho1, nrho1)
1456 IF(
ASSOCIATED(neoclassic_in%Tz_neo))
THEN
1457 IF(
ASSOCIATED(neoclassic_in%Tz_neo(iimp2)%diff_eff)) &
1458 CALL
l3interp(neoclassic_in%Tz_neo(iimp2)%diff_eff(:,izimp2), rho2, nrho2, &
1459 neoclassic_out%Tz_neo(iimp1)%diff_eff(:,izimp1), rho1, nrho1)
1460 IF(
ASSOCIATED(neoclassic_in%Tz_neo(iimp2)%vconv_eff)) &
1461 CALL
l3interp(neoclassic_in%Tz_neo(iimp2)%vconv_eff(:,izimp2), rho2, nrho2, &
1462 neoclassic_out%Tz_neo(iimp1)%vconv_eff(:,izimp1), rho1, nrho1)
1466 END DO input_ionization_states
1467 END DO output_ionization_states
1469 END IF check_for_impurity_consistency
1473 END DO input_impurity_loop
1474 END DO output_impurity_loop
1480 8
IF(
ALLOCATED(nzimp1))
DEALLOCATE (nzimp1)
1481 IF(
ALLOCATED(ncomp1))
DEALLOCATE (ncomp1)
1482 IF(
ALLOCATED(ntype1))
DEALLOCATE (ntype1)
1483 IF(
ALLOCATED(nzimp2))
DEALLOCATE (nzimp2)
1484 IF(
ALLOCATED(ncomp2))
DEALLOCATE (ncomp2)
1485 IF(
ALLOCATED(ntype2))
DEALLOCATE (ntype2)
1486 IF(
ALLOCATED(rho1))
DEALLOCATE (rho1)
1487 IF(
ALLOCATED(rho2))
DEALLOCATE (rho2)
1525 REAL (R8) :: x(n), &
1528 REAL (R8) :: h(n),dy2(n)
1537 dy1(i)=((y(i+1)-y(i))*h(i-1)/h(i)+(y(i)-y(i-1))*h(i)/h(i-1)) &
1546 ddy = 2.e0_r8*((y(1)-y(2))/h(1)+(y(3)-y(2))/h(2))/(h(2)+h(1))
1547 dy1(1) = dy1(2)-ddy*h(1)
1548 ddy = 2.e0_r8*((y(n-2)-y(n-1))/h(n-2)+(y(n)-y(n-1))/h(n-1))/(h(n-1)+h(n-2))
1549 dy1(n) = dy1(n-1)+ddy*h(n-1)
1566 TYPE (type_coredelta
) :: coredelta_in
1567 TYPE (type_coredelta
) :: coredelta_out
1569 INTEGER :: nval1, nval2
1571 INTEGER :: nrho1, nrho2
1572 INTEGER :: irho1, irho2
1573 INTEGER :: nnucl1,inucl1
1574 INTEGER :: nnucl2,inucl2
1575 INTEGER :: nion1, iion1
1576 INTEGER :: nion2, iion2
1577 INTEGER :: nimp1, iimp1
1578 INTEGER :: nimp2, iimp2
1579 INTEGER,
ALLOCATABLE :: nzimp1(:)
1580 INTEGER,
ALLOCATABLE :: nzimp2(:)
1581 INTEGER :: izimp1,izimp2
1582 INTEGER :: nneut1,ineut1
1583 INTEGER :: nneut2,ineut2
1584 INTEGER,
ALLOCATABLE :: ncomp1(:)
1585 INTEGER,
ALLOCATABLE :: ncomp2(:)
1586 INTEGER,
ALLOCATABLE :: ntype1(:)
1587 INTEGER,
ALLOCATABLE :: ntype2(:)
1589 REAL (R8),
ALLOCATABLE ::
fun(:)
1590 REAL (R8),
ALLOCATABLE :: rho1(:), rho2(:)
1591 REAL (R8) :: zmin1, zmin2
1592 REAL (R8) :: zmax1, zmax2
1596 nval2 =
SIZE(coredelta_in%VALUES)
1599 nrho1 =
SIZE(coredelta_out%VALUES(1)%rho_tor)
1601 ALLOCATE (
fun(nrho1))
1602 ALLOCATE (rho1(nrho1))
1604 rho1 = coredelta_out%VALUES(1)%rho_tor
1606 CALL
get_comp_dimensions(coredelta_out%COMPOSITIONS, nnucl1, nion1, nimp1, nzimp1, nneut1, ntype1, ncomp1)
1607 CALL
get_comp_dimensions(coredelta_in%COMPOSITIONS, nnucl2, nion2, nimp2, nzimp2, nneut2, ntype2, ncomp2)
1609 IF(.NOT.
ASSOCIATED(coredelta_in%VALUES)) goto 10
1613 coredelta_out%VALUES(1)%delta_psi = 0.0_r8
1614 coredelta_out%VALUES(1)%delta_te = 0.0_r8
1615 coredelta_out%VALUES(1)%delta_ti = 0.0_r8
1616 coredelta_out%VALUES(1)%delta_ne = 0.0_r8
1617 coredelta_out%VALUES(1)%delta_ni = 0.0_r8
1618 coredelta_out%VALUES(1)%delta_vtor = 0.0_r8
1619 IF (nimp1.GE.1)
THEN
1621 coredelta_out%VALUES(1)%IMPURITY(iimp1)%delta_nz = 0.0_r8
1622 coredelta_out%VALUES(1)%IMPURITY(iimp1)%delta_tz = 0.0_r8
1627 loop_on_values:
DO ival = 1, nval2
1628 nrho2 =
SIZE(coredelta_in%VALUES(ival)%rho_tor)
1629 ALLOCATE (rho2(nrho2))
1630 rho2 = coredelta_in%VALUES(ival)%rho_tor
1636 IF(
ASSOCIATED(coredelta_in%VALUES(ival)%delta_psi))
THEN
1637 CALL
l3interp(coredelta_in%VALUES(ival)%delta_psi, rho2, nrho2, &
1639 coredelta_out%VALUES(1)%delta_psi = coredelta_out%VALUES(1)%delta_psi +
fun
1644 IF(
ASSOCIATED(coredelta_in%VALUES(ival)%delta_te))
THEN
1645 CALL
l3interp(coredelta_in%VALUES(ival)%delta_te, rho2, nrho2, &
1647 coredelta_out%VALUES(1)%delta_te = coredelta_out%VALUES(1)%delta_te +
fun
1652 IF(
ASSOCIATED(coredelta_in%VALUES(ival)%delta_ne))
THEN
1653 CALL
l3interp(coredelta_in%VALUES(ival)%delta_ne, rho2, nrho2, &
1655 coredelta_out%VALUES(1)%delta_ne = coredelta_out%VALUES(1)%delta_ne +
fun
1661 output_ion_loop:
DO iion1 = 1, nion1
1662 inucl1 = coredelta_out%COMPOSITIONS%IONS(iion1)%nucindex
1663 input_ion_loop:
DO iion2 = 1, nion2
1664 inucl2 = coredelta_in%COMPOSITIONS%IONS(iion2)%nucindex
1666 IF (inucl2.LE.0 .OR. inucl2.GT.
SIZE(coredelta_in%COMPOSITIONS%NUCLEI)) goto 5
1668 check_for_ions_consistency:
IF &
1669 (abs(coredelta_out%COMPOSITIONS%NUCLEI(inucl1)%amn - coredelta_in%COMPOSITIONS%NUCLEI(inucl2)%amn) .LE. 0.25 .AND. &
1670 abs(coredelta_out%COMPOSITIONS%NUCLEI(inucl1)%zn - coredelta_in%COMPOSITIONS%NUCLEI(inucl2)%zn ) .LE. 0.25 .AND. &
1671 abs(coredelta_out%COMPOSITIONS%IONS(iion1)%zion - coredelta_in%COMPOSITIONS%IONS(iion2)%zion ) .LE. 0.25)
THEN
1674 IF(
ASSOCIATED(coredelta_in%VALUES(ival)%delta_ni))
THEN
1675 CALL
l3interp(coredelta_in%VALUES(ival)%delta_ni(:,iion2), rho2, nrho2, &
1677 coredelta_out%VALUES(1)%delta_ni(:,iion1) = coredelta_out%VALUES(1)%delta_ni(:,iion1) +
fun
1682 IF(
ASSOCIATED(coredelta_in%VALUES(ival)%delta_ti))
THEN
1683 CALL
l3interp(coredelta_in%VALUES(ival)%delta_ti(:,iion2), rho2, nrho2, &
1685 coredelta_out%VALUES(1)%delta_ti(:,iion1) = coredelta_out%VALUES(1)%delta_ti(:,iion1) +
fun
1689 IF(
ASSOCIATED(coredelta_in%VALUES(ival)%delta_vtor))
THEN
1690 CALL
l3interp(coredelta_in%VALUES(ival)%delta_vtor(:,iion2),rho2, nrho2, &
1692 coredelta_out%VALUES(1)%delta_vtor(:,iion1) = coredelta_out%VALUES(1)%delta_vtor(:,iion1) +
fun
1694 END IF check_for_ions_consistency
1699 END DO input_ion_loop
1700 END DO output_ion_loop
1706 IF (nimp1*nimp2.LE.0) goto 8
1707 output_impurity_loop:
DO iimp1 = 1, nimp1
1708 inucl1 = coredelta_out%COMPOSITIONS%IMPURITIES(iimp1)%nucindex
1710 input_impurity_loop:
DO iimp2 = 1, nimp2
1711 inucl2 = coredelta_in%COMPOSITIONS%IMPURITIES(iimp2)%nucindex
1713 IF (inucl2.LE.0 .OR. inucl2.GT.
SIZE(coredelta_in%COMPOSITIONS%NUCLEI)) goto 7
1715 check_for_impurity_consistency:
IF &
1716 (abs(coredelta_out%COMPOSITIONS%NUCLEI(inucl1)%amn - coredelta_in%COMPOSITIONS%NUCLEI(inucl2)%amn) .LE. 0.25 .AND. &
1717 abs(coredelta_out%COMPOSITIONS%NUCLEI(inucl1)%zn - coredelta_in%COMPOSITIONS%NUCLEI(inucl2)%zn ) .LE. 0.25 )
THEN
1719 output_ionization_states:
DO izimp1 = 1, nzimp1(iimp1)
1720 input_ionization_states:
DO izimp2 = 1, nzimp2(iimp2)
1722 zmin1 = coredelta_out%COMPOSITIONS%IMPURITIES(iimp1)%zmin(izimp1)
1723 zmax1 = coredelta_out%COMPOSITIONS%IMPURITIES(iimp1)%zmax(izimp1)
1724 zmin2 = coredelta_in%COMPOSITIONS%IMPURITIES(iimp2)%zmin(izimp2)
1725 zmax2 = coredelta_in%COMPOSITIONS%IMPURITIES(iimp2)%zmax(izimp2)
1727 IF(abs((zmax1+zmin1)/2.0 - (zmax2+zmin2)/2.0).LE. 0.25)
THEN
1728 IF(
ASSOCIATED(coredelta_in%VALUES(ival)%IMPURITY))
THEN
1731 IF(
ASSOCIATED(coredelta_in%VALUES(ival)%IMPURITY(iimp2)%delta_nz))
THEN
1732 CALL
l3interp(coredelta_in%VALUES(ival)%IMPURITY(iimp2)%delta_nz(:,izimp2), rho2, nrho2, &
1734 coredelta_out%VALUES(1)%IMPURITY(iimp1)%delta_nz(:,izimp1) = coredelta_out%VALUES(1)%IMPURITY(iimp1)%delta_nz(:,izimp1) +
fun
1738 IF(
ASSOCIATED(coredelta_in%VALUES(ival)%IMPURITY(iimp2)%delta_tz))
THEN
1739 CALL
l3interp(coredelta_in%VALUES(ival)%IMPURITY(iimp2)%delta_tz(:,izimp2), rho2, nrho2, &
1741 coredelta_out%VALUES(1)%IMPURITY(iimp1)%delta_tz(:,izimp1) = coredelta_out%VALUES(1)%IMPURITY(iimp1)%delta_tz(:,izimp1) +
fun
1746 END DO input_ionization_states
1747 END DO output_ionization_states
1749 END IF check_for_impurity_consistency
1753 END DO input_impurity_loop
1754 END DO output_impurity_loop
1756 8
IF(
ALLOCATED(rho2))
DEALLOCATE (rho2)
1758 ENDDO loop_on_values
1764 IF(
ALLOCATED(nzimp1))
DEALLOCATE (nzimp1)
1765 IF(
ALLOCATED(ncomp1))
DEALLOCATE (ncomp1)
1766 IF(
ALLOCATED(ntype1))
DEALLOCATE (ntype1)
1767 IF(
ALLOCATED(nzimp2))
DEALLOCATE (nzimp2)
1768 IF(
ALLOCATED(ncomp2))
DEALLOCATE (ncomp2)
1769 IF(
ALLOCATED(ntype2))
DEALLOCATE (ntype2)
1770 IF(
ALLOCATED(rho1))
DEALLOCATE (rho1)
1771 IF(
ALLOCATED(
fun))
DEALLOCATE (
fun)
1794 TYPE (type_corefast
) :: corefast_in
1795 TYPE (type_corefast
) :: corefast_out
1797 INTEGER :: nval2, ival
1798 INTEGER :: nrho1, nrho2
1799 INTEGER :: irho1, irho2
1800 INTEGER :: nnucl1,inucl1
1801 INTEGER :: nnucl2,inucl2
1802 INTEGER :: nion1, iion1
1803 INTEGER :: nion2, iion2
1804 INTEGER :: nimp1, iimp1
1805 INTEGER :: nimp2, iimp2
1806 INTEGER,
ALLOCATABLE :: nzimp1(:)
1807 INTEGER,
ALLOCATABLE :: nzimp2(:)
1808 INTEGER :: izimp1,izimp2
1809 INTEGER :: nneut1,ineut1
1810 INTEGER :: nneut2,ineut2
1811 INTEGER,
ALLOCATABLE :: ncomp1(:)
1812 INTEGER,
ALLOCATABLE :: ncomp2(:)
1813 INTEGER,
ALLOCATABLE :: ntype1(:)
1814 INTEGER,
ALLOCATABLE :: ntype2(:)
1816 REAL (R8),
ALLOCATABLE ::
fun(:)
1817 REAL (R8),
ALLOCATABLE :: rho1(:), rho2(:)
1818 REAL (R8) :: zmin1, zmin2
1819 REAL (R8) :: zmax1, zmax2
1824 nval2 =
SIZE(corefast_in%VALUES)
1826 nrho1 =
SIZE(corefast_out%VALUES(1)%rho_tor)
1828 ALLOCATE (
fun(nrho1))
1829 ALLOCATE (rho1(nrho1))
1831 rho1 = corefast_out%VALUES(1)%rho_tor
1833 CALL
get_comp_dimensions(corefast_out%COMPOSITIONS, nnucl1, nion1, nimp1, nzimp1, nneut1, ntype1, ncomp1)
1834 CALL
get_comp_dimensions(corefast_in%COMPOSITIONS, nnucl2, nion2, nimp2, nzimp2, nneut2, ntype2, ncomp2)
1837 IF(.NOT.
ASSOCIATED(corefast_in%VALUES)) goto 10
1840 corefast_out%values(1)%psi(:) = 0.0_r8
1841 corefast_out%values(1)%volume(:) = 0.0_r8
1842 corefast_out%values(1)%area(:) = 0.0_r8
1843 corefast_out%values(1)%j(:) = 0.0_r8
1844 corefast_out%values(1)%sigma(:) = 0.0_r8
1845 corefast_out%values(1)%ni(:,:) = 0.0_r8
1846 corefast_out%values(1)%ne(:) = 0.0_r8
1847 corefast_out%values(1)%nz(:,:) = 0.0_r8
1848 corefast_out%values(1)%pi(:,:) = 0.0_r8
1849 corefast_out%values(1)%pe(:) = 0.0_r8
1850 corefast_out%values(1)%pz(:,:) = 0.0_r8
1851 corefast_out%values(1)%pi_para(:,:) = 0.0_r8
1852 corefast_out%values(1)%pe_para(:) = 0.0_r8
1853 corefast_out%values(1)%pz_para(:,:) = 0.0_r8
1854 corefast_out%values(1)%ui(:,:) = 0.0_r8
1855 corefast_out%values(1)%uz(:,:) = 0.0_r8
1859 loop_on_values:
DO ival = 1, nval2
1860 nrho2 =
SIZE(corefast_in%VALUES(ival)%rho_tor)
1861 ALLOCATE (rho2(nrho2))
1862 rho2 = corefast_in%VALUES(ival)%rho_tor
1865 IF (ival .EQ. 1)
THEN
1866 IF (
ASSOCIATED(corefast_in%values(ival)%psi)) &
1867 CALL
l3interp(corefast_in%values(ival)%psi, rho2, nrho2, &
1868 corefast_out%values(1)%psi, rho1, nrho1)
1870 IF (
ASSOCIATED(corefast_in%values(ival)%volume)) &
1871 CALL
l3interp(corefast_in%values(ival)%volume, rho2, nrho2, &
1872 corefast_out%values(1)%volume, rho1, nrho1)
1874 IF (
ASSOCIATED(corefast_in%values(ival)%area)) &
1875 CALL
l3interp(corefast_in%values(ival)%area, rho2, nrho2, &
1876 corefast_out%values(1)%area, rho1, nrho1)
1880 IF (
ASSOCIATED(corefast_in%values(ival)%j))
THEN
1881 CALL
l3interp(corefast_in%values(ival)%j, rho2, nrho2, &
1883 corefast_out%values(1)%j = corefast_out%values(1)%j +
fun
1886 IF (
ASSOCIATED(corefast_in%values(ival)%sigma))
THEN
1887 CALL
l3interp(corefast_in%values(ival)%sigma, rho2, nrho2, &
1889 corefast_out%values(1)%sigma = corefast_out%values(1)%sigma +
fun
1892 IF (
ASSOCIATED(corefast_in%values(ival)%ne))
THEN
1893 CALL
l3interp(corefast_in%values(ival)%ne, rho2, nrho2, &
1895 corefast_out%values(1)%ne = corefast_out%values(1)%ne +
fun
1898 IF (
ASSOCIATED(corefast_in%values(ival)%pe))
THEN
1899 CALL
l3interp(corefast_in%values(ival)%pe, rho2, nrho2, &
1901 corefast_out%values(1)%pe = corefast_out%values(1)%pe +
fun
1904 IF (
ASSOCIATED(corefast_in%values(ival)%pe_para))
THEN
1905 CALL
l3interp(corefast_in%values(ival)%pe_para, rho2, nrho2, &
1907 corefast_out%values(1)%pe_para = corefast_out%values(1)%pe_para +
fun
1912 output_ions_loop:
DO iion1 = 1, nion1
1913 inucl1 = corefast_out%COMPOSITIONS%IONS(iion1)%nucindex
1914 input_ions_loop:
DO iion2 = 1, nion2
1915 inucl2 = corefast_in%COMPOSITIONS%IONS(iion2)%nucindex
1917 IF (inucl2.LE.0 .OR. inucl2.GT.
SIZE(corefast_in%COMPOSITIONS%NUCLEI)) goto 5
1919 check_for_ions_consistency:
IF &
1920 (abs(corefast_out%COMPOSITIONS%NUCLEI(inucl1)%amn - corefast_in%COMPOSITIONS%NUCLEI(inucl2)%amn) .LE. 0.25 .AND. &
1921 abs(corefast_out%COMPOSITIONS%NUCLEI(inucl1)%zn - corefast_in%COMPOSITIONS%NUCLEI(inucl2)%zn ) .LE. 0.25 .AND. &
1922 abs(corefast_out%COMPOSITIONS%IONS(iion1)%zion - corefast_in%COMPOSITIONS%IONS(iion2)%zion ) .LE. 0.25)
THEN
1924 IF (
ASSOCIATED(corefast_in%values(ival)%ni))
THEN
1925 CALL
l3interp(corefast_in%values(ival)%ni(:,iion2), rho2, nrho2, &
1927 corefast_out%values(1)%ni(:,iion1) = corefast_out%values(1)%ni(:,iion1) +
fun
1930 IF (
ASSOCIATED(corefast_in%values(ival)%pi))
THEN
1931 CALL
l3interp(corefast_in%values(ival)%pi(:,iion2), rho2, nrho2, &
1933 corefast_out%values(1)%pi(:,iion1) = corefast_out%values(1)%pi(:,iion1) +
fun
1936 IF (
ASSOCIATED(corefast_in%values(ival)%pi_para))
THEN
1937 CALL
l3interp(corefast_in%values(ival)%pi_para(:,iion2), rho2, nrho2, &
1939 corefast_out%values(1)%pi_para(:,iion1) = corefast_out%values(1)%pi_para(:,iion1) +
fun
1942 IF (
ASSOCIATED(corefast_in%values(ival)%ui))
THEN
1943 call
l3interp(corefast_in%values(ival)%ui(:,iion2), rho2, nrho2, &
1945 corefast_out%values(1)%ui(:,iion1) = corefast_out%values(1)%ui(:,iion1) +
fun
1948 END IF check_for_ions_consistency
1952 END DO input_ions_loop
1953 END DO output_ions_loop
1955 8
IF(
ALLOCATED(rho2))
DEALLOCATE (rho2)
1957 END DO loop_on_values
1963 10
IF(
ALLOCATED (nzimp1))
DEALLOCATE (nzimp1)
1964 IF(
ALLOCATED (ncomp1))
DEALLOCATE (ncomp1)
1965 IF(
ALLOCATED (ntype1))
DEALLOCATE (ntype1)
1966 IF(
ALLOCATED (nzimp2))
DEALLOCATE (nzimp2)
1967 IF(
ALLOCATED (ncomp2))
DEALLOCATE (ncomp2)
1968 IF(
ALLOCATED (ntype2))
DEALLOCATE (ntype2)
1969 IF(
ALLOCATED (rho1))
DEALLOCATE (rho1)
1970 IF(
ALLOCATED (rho2))
DEALLOCATE (rho2)
subroutine interpolate_fast(COREFAST_IN, COREFAST_OUT)
subroutine get_comp_dimensions(COMPOSITIONS, NNUCL, NION, NIMP, NZIMP, NNEUT, NTYPE, NCOMP)
subroutine interpolate_prof(COREPROF_IN, COREPROF_OUT)
subroutine interpolate_transp(CORETRANSP_IN, CORETRANSP_OUT, NEGATIVE_DIFF)
subroutine l3interp(y_in, x_in, nr_in, y_out, x_out, nr_out)
subroutine interpolate_neoclassic(NEOCLASSIC_IN, NEOCLASSIC_OUT)
subroutine interpolate_delta(COREDELTA_IN, COREDELTA_OUT)
This module contains routines for allocation/deallocation if CPOs used in ETS.
subroutine derivn_start(N, X, Y, DY1)
These subroutines calculate first and second derivatives, DY1 and DY2, of function Y respect to argum...
subroutine interpolate_source(CORESOURCE_IN, CORESOURCE_OUT)
subroutine interpolate_neutrals(CORENEUTRALS_IN, CORENEUTRALS_OUT)
subroutine interpolate_impur(COREIMPUR_IN, COREIMPUR_OUT)