18 (geometry,
profiles, transport, sources,
impurity,
evolution, control, hyper_diff, j_boun,ifail,failstring)
46 CHARACTER(LEN=500) :: failstring
68 REAL (R8),
DIMENSION(2) :: hyper_diff
79 if (
allocated(local_flux_ni_s4))
deallocate(local_flux_ni_s4)
80 if (
allocated(local_flux_ni_conv_s4))
deallocate(local_flux_ni_conv_s4)
81 ALLOCATE(local_flux_ni_s4(nion))
82 ALLOCATE(local_flux_ni_conv_s4(nion))
83 local_flux_ni_s4(:) = 0.0_r8
84 local_flux_ni_conv_s4(:) = 0.0_r8
91 if (ifail.lt.0)
return
97 (geometry,
profiles,transport,sources,
evolution,control,hyper_diff,ifail,failstring)
99 if (ifail.lt.0)
return
102 IF (control%QUASI_NEUT.GT.0.5) &
105 (geometry,
profiles,transport,sources,
evolution,control,hyper_diff,ifail,failstring)
107 if (ifail.lt.0)
return
113 if (ifail.lt.0)
return
119 (geometry,
profiles,transport,sources,
evolution,control,hyper_diff,ifail,failstring)
121 if (ifail.lt.0)
return
127 if (ifail.lt.0)
return
131 DEALLOCATE(local_flux_ni_s4)
132 DEALLOCATE(local_flux_ni_conv_s4)
222 INTEGER,
INTENT (INOUT) :: ifail
223 CHARACTER(LEN=500) :: failstring
237 INTEGER :: irho, nrho
240 REAL (R8) :: bt, btm, btprime
250 REAL (R8) :: psi_bnd(2,3)
251 INTEGER :: psi_bnd_type(2)
256 REAL (R8) :: curr_tor(
profiles%nrho)
257 REAL (R8) :: curr_par(
profiles%nrho)
258 REAL (R8) :: curr_ni_exp(
profiles%nrho)
259 REAL (R8) :: curr_ni_imp(
profiles%nrho)
262 REAL (R8) :: curr_tot, curr_ni
275 REAL (R8) :: amix, tau
279 INTEGER :: solver_type
292 REAL (R8) :: v(2), u(2), w(2)
296 INTEGER :: dy_from_solver
335 solver_type = control%SOLVER_TYPE
339 btprime = (bt-btm)/tau
345 psi_bnd_type(2) =
profiles%PSI_BND_TYPE
353 rho_loop4:
DO irho=1,nrho
354 rho(irho) = geometry%RHO(irho)
355 vpr(irho) = geometry%VPR(irho)
356 fdia(irho) = geometry%FDIA(irho)
357 g3(irho) = geometry%G3(irho)
365 sigma(irho) = transport%SIGMA(irho)
367 curr_tor(irho) =
profiles%CURR_TOR(irho)
368 curr_par(irho) =
profiles%CURR_PAR(irho)
370 curr_ni_exp(irho) = 0.e0_r8
371 curr_ni_imp(irho) = 0.e0_r8
373 curr_ni_exp(irho) = curr_ni_exp(irho) + sources%CURR_EXP(irho)
374 curr_ni_imp(irho) = curr_ni_imp(irho) + sources%CURR_IMP(irho)
376 fun1(irho) = sigma(irho)*itm_mu0*(rho(irho)/
fdia(irho))**2
377 fun2(irho) = vpr(irho)*g3(irho)/4.e0_r8/itm_pi**2
381 CALL
derivn(nrho,rho,fun1,dfun1)
391 rho_loop5:
DO irho=1,nrho
393 dy(irho) = dpsi(irho)
394 ym(irho) = psim(irho)
395 dym(irho)= dpsim(irho)
397 a(irho) = sigma(irho)
398 b(irho) = sigma(irho)
399 c(irho) = itm_mu0*bt*rho(irho)/
fdia(irho)**2
400 d(irho) = vpr(irho)/4.e0_r8/itm_pi**2*g3(irho)/
fdia(irho)
401 e(irho) = -fun1(irho)*btprime/2.e0_r8
402 IF (rho(irho).NE.0.e0_r8)
THEN
403 f(irho) = vpr(irho)/2.e0_r8/itm_pi/rho(irho)*curr_ni_exp(irho)
404 g(irho) = vpr(irho)/2.e0_r8/itm_pi/rho(irho)*curr_ni_imp(irho) &
405 + btprime/2.e0_r8*sigma(irho)*dfun1(irho)
407 f(irho) = 1.e0_r8/2.e0_r8/itm_pi*curr_ni_exp(irho)
408 g(irho) = 1.e0_r8/2.e0_r8/itm_pi*curr_ni_imp(irho) &
409 + btprime/2.e0_r8*sigma(irho)*dfun1(irho)
432 IF(psi_bnd_type(2).EQ.1)
THEN
439 IF(psi_bnd_type(2).EQ.2)
THEN
443 w(2) = - itm_mu0/fun2(nrho)*psi_bnd(2,1)
444 write(*,*)
'Current equivalent current for B.C. ', &
445 -(y(nrho)-y(nrho-1))/(rho(nrho)-rho(nrho-1))*fun2(nrho)/itm_mu0
450 IF(psi_bnd_type(2).EQ.3)
THEN
453 w(2) = tau*psi_bnd(2,1)+psim(nrho)
457 IF(psi_bnd_type(2).EQ.4)
THEN
466 IF(psi_bnd_type(2).EQ.0)
THEN
468 rho_loop6:
DO irho =1,nrho
469 IF (qsf(irho).NE.0.e0_r8)
THEN
470 dy(irho) = 2.e0_r8*itm_pi*bt*rho(irho)/qsf(irho)
471 fun3(irho) = 2.e0_r8*itm_pi*bt/qsf(irho)
475 CALL
integr(nrho,rho,fun3,y)
479 rho_loop7:
DO irho=1,nrho
501 solver%EQ_FLAG(ndim) = flag
505 solver%DERIVATIVE_FLAG(1) = 2
507 rho_loop8:
DO irho=1,nrho
509 solver%RHO(irho) = rho(irho)
511 solver%Y(ndim,irho) = y(irho)
512 solver%DY(ndim,irho) = dy(irho)
513 solver%YM(ndim,irho) = ym(irho)
515 solver%A(ndim,irho) = a(irho)
516 solver%B(ndim,irho) = b(irho)
517 solver%C(ndim,irho) = c(irho)
518 solver%D(ndim,irho) = d(irho)
519 solver%E(ndim,irho) = e(irho)
520 solver%F(ndim,irho) = f(irho)
521 solver%G(ndim,irho) = g(irho)
540 IF (any( isnan(
solver%y)))
then
541 failstring=
'Error in the current diffusion equeation: nans in the solution vector'
565 IF (psi_bnd_type(2).NE.0)
THEN
571 IF (fix_axis.EQ.1)
THEN
575 rho_loop9:
DO irho=1,nrho
576 IF (dy_from_solver.EQ.0)
THEN
578 dpc2(irho) = (c(irho)*((a(irho)*y(irho)-b(irho)*ym(irho))/h &
579 + g(irho)*y(irho) - f(irho)) + e(irho)*y(irho)) / d(irho)
581 fun7(irho) = c(irho)*((a(irho)*y(irho)-b(irho)*ym(irho))/h &
582 + g(irho)*y(irho) - f(irho))
583 IF (rho(irho).NE.0.e0_r8)
THEN
584 intfun7(irho) = intfun7(irho-1) &
585 + (fun7(irho-1)+fun7(irho))*(rho(irho)-rho(irho-1))/2.d0
588 IF(d(irho).NE.0.0_r8)
THEN
589 dy(irho) = intfun7(irho)/d(irho) + e(irho)/d(irho)*y(irho)
592 WRITE(*,*)
'Warning: DY(',irho,
') set to 0'
596 dy(irho) =
solver%DY(ndim,irho)
602 IF (dy_from_solver.EQ.0)
THEN
604 dy(nrho) =
solver%DY(ndim,nrho)
607 rho_loop10:
DO irho=1,nrho
608 fun4(irho) = fun2(irho)*dy(irho)
609 fun5(irho) = fun2(irho)*dy(irho)*rgeo*bt/
fdia(irho)
612 CALL
derivn(nrho, rho, fun4, dfun4)
613 CALL
derivn(nrho, rho, fun5, dfun5)
617 rho_loop11:
DO irho=1,nrho
619 if(rho(irho).ne.0.e0_r8)
then
620 qsf(irho) = 2.e0_r8*itm_pi*bt*rho(irho)/dy(irho)
622 IF(vpr(irho).NE.0.0_r8)
THEN
623 curr_tor(irho) = - 2.e0_r8*itm_pi*rgeo/itm_mu0/vpr(irho)*dfun4(irho)
624 curr_par(irho) = - 2.e0_r8*itm_pi/rgeo/itm_mu0/vpr(irho) &
625 *(
fdia(irho)/bt)**2*dfun5(irho)
631 if (j_boun.eq.1)
then
636 curr_tor(irho)=curr_tor(nrho-5)
637 curr_par(irho)=curr_par(nrho-5)
641 IF (psi(1).NE.0.0_r8) psi = psi - psi(1)
643 IF(rho(1).EQ.0.e0_r8)
THEN
644 IF (fix_axis.EQ.1)
THEN
645 CALL
f_axis(nrho, rho, qsf)
646 CALL
f_axis(nrho, rho, curr_par)
647 CALL
f_axis(nrho, rho, curr_tor)
659 IF (psi_bnd_type(2).EQ.0)
THEN
663 rho_loop12:
DO irho=1,nrho
664 fun7(irho) = 2.e0_r8*itm_pi*bt/qsf(irho)*rho(irho)
667 IF (rho(irho).NE.0.e0_r8)
THEN
669 psi(irho) = psi(irho-1) &
670 + (fun7(irho-1)+fun7(irho))*(rho(irho)-rho(irho-1))/2.d0
677 if (vpr(irho).ne.0.0d0)
then
684 IF(rho(1).EQ.0.e0_r8)
THEN
685 IF (fix_axis.EQ.1)
THEN
686 CALL
f_axis(nrho, rho, psi)
692 CALL
derivn(nrho,rho,psi,dpsi)
700 rho_loop13:
DO irho=1,nrho
701 if (sigma(irho).eq.0.0)
then
704 e_par(irho) = ( curr_par(irho) - curr_ni_exp(irho) &
705 - curr_ni_imp(irho)*y(irho) ) / sigma(irho)
707 qoh(irho) = sigma(irho)*e_par(irho)**2 * control%ohmic_heating_multiplier
712 fun7 = vpr * curr_par / 2.0e0_r8 / itm_pi * bt /
fdia**2
713 CALL
integr2(nrho, rho, fun7, intfun7)
714 curr_tot = intfun7(nrho) *
fdia(nrho)
715 fun7 = vpr * (curr_ni_exp + curr_ni_imp * psi) / 2.0e0_r8 / itm_pi * bt /
fdia**2
716 CALL
integr2(nrho, rho, fun7, intfun7)
717 curr_ni = intfun7(nrho) *
fdia(nrho)
720 CALL
integr2(nrho, rho, fun7, intfun7)
721 qoh_tot = intfun7(nrho)
724 WRITE (*,*)
'*******************'
725 WRITE (*,*)
'*******************'
726 WRITE (*,*)
'***** QOH =', qoh_tot/1.d6,
'[MW]'
727 WRITE (*,*)
'***** CURR =', curr_tot/1.d6,
'[MA]'
728 WRITE (*,*)
'***** CURR_NI =', curr_ni/1.d6,
'[MA]'
729 WRITE (*,*)
'***** F_NI =', curr_ni/curr_tot
730 WRITE (*,*)
'*******************'
731 WRITE (*,*)
'*******************'
746 profiles%JNI = curr_ni_exp + curr_ni_imp * psi
747 profiles%JOH = curr_par - curr_ni_exp - curr_ni_imp * psi
813 (geometry,
profiles,transport,sources,
evolution,control,hyper_diff,ifail,failstring)
830 INTEGER,
INTENT (INOUT) :: ifail
831 CHARACTER(LEN=500) :: failstring
845 INTEGER :: irho, nrho
846 INTEGER :: iion, nion
847 INTEGER :: imodel, nmodel
849 REAL (R8) :: bt, btm, btprime
859 REAL (R8) :: int_source(
profiles%nrho)
860 REAL (R8) :: flux_ni_conv(
profiles%nrho)
863 REAL (R8) :: diff_mod(transport%nrho,3)
864 REAL (R8) :: vconv_mod(transport%nrho,3)
870 REAL (R8) :: ni_bnd(2,3)
871 INTEGER :: ni_bnd_type(2)
875 REAL (R8) :: amix, tau
879 INTEGER :: solver_type
892 REAL (R8) :: v(2), u(2), w(2)
897 REAL (R8),
ALLOCATABLE :: local_int_source_s4(:)
898 REAL (R8) :: local_fun1_s4, local_intfun1_s4
902 REAL (R8),
DIMENSION(2) :: hyper_diff
903 REAL (R8) :: hyper_diff_exp
904 REAL (R8) :: hyper_diff_imp
905 REAL (R8) :: diff_hyper
907 REAL (R8),
parameter :: nine_diff_limit=1.0e4
912 hyper_diff_exp = hyper_diff(1)
913 hyper_diff_imp = hyper_diff(2)
922 ALLOCATE(local_int_source_s4(nion))
923 local_int_source_s4(:) = 0.0_r8
934 solver_type = control%SOLVER_TYPE
938 btprime = (bt-btm)/tau
941 rho_loop1:
DO irho=1,nrho
942 rho(irho) = geometry%RHO(irho)
943 vpr(irho) = geometry%VPR(irho)
945 g1(irho) = geometry%G1(irho)
953 ion_loop1:
DO iion=1,nion
976 ni_bnd_type(2) =
profiles%NI_BND_TYPE(iion)
977 ni_bnd(2,1) =
profiles%NI_BND(1,iion)
978 ni_bnd(2,2) =
profiles%NI_BND(2,iion)
979 ni_bnd(2,3) =
profiles%NI_BND(3,iion)
985 rho_loop2:
DO irho = 1,nrho
992 vconv(irho) = 0.e0_r8
994 model_loop1:
DO imodel = 1, nmodel
995 c1(imodel) = transport%C1(imodel)
997 diff_mod(irho,imodel) = transport%DIFF_NI(irho,iion,imodel)
998 vconv_mod(irho,imodel) = transport%VCONV_NI(irho,iion,imodel)
1000 diff(irho) = diff(irho) + diff_mod(irho,imodel)
1001 vconv(irho) = vconv(irho) + vconv_mod(irho,imodel)
1004 si_exp(irho) = 0.e0_r8
1005 si_imp(irho) = 0.e0_r8
1007 si_exp(irho) = si_exp(irho) + sources%SI_EXP(irho,iion)
1008 si_imp(irho) = si_imp(irho) + sources%SI_IMP(irho,iion)
1018 diff_hyper = hyper_diff_exp + hyper_diff_imp*maxval(diff)
1020 rho_loop3:
DO irho=1,nrho
1022 dy(irho) = dni(irho)
1023 ym(irho) = nim(irho)
1024 dym(irho) = dnim(irho)
1027 b(irho) = vprm(irho)
1030 d(irho) = vpr(irho)*g1(irho)*(diff(irho)+diff_hyper)
1032 e(irho) = vpr(irho)*g1(irho)*(vconv(irho)+diff_hyper*dnim(irho)/nim(irho)) &
1033 - btprime/2.e0_r8/bt*rho(irho)*vpr(irho)
1034 f(irho) = vpr(irho)*si_exp(irho)
1035 g(irho) = vpr(irho)*si_imp(irho)
1047 IF (solver_type.NE.4)
THEN
1052 IF ((diff(1)+diff_hyper).GT.1.0e-6)
THEN
1054 v(1) = -diff(1)-diff_hyper
1059 u(1) = vconv(1)+diff_hyper*dnim(1)/nim(1)
1065 IF(ni_bnd_type(2).EQ.1)
THEN
1072 IF(ni_bnd_type(2).EQ.2)
THEN
1079 IF(ni_bnd_type(2).EQ.3)
THEN
1086 IF(ni_bnd_type(2).EQ.4)
THEN
1089 v(2) = -vpr(nrho)*g1(nrho)*diff(nrho)
1090 u(2) = vpr(nrho)*g1(nrho)*vconv(nrho)
1095 IF(ni_bnd_type(2).EQ.5)
THEN
1104 IF(ni_bnd_type(2).EQ.0)
THEN
1106 CALL
derivn(nrho,rho,y,dy)
1110 rho_loop4:
DO irho=1,nrho
1128 solver%TYPE = solver_type
1129 solver%EQ_FLAG(ndim) = flag
1133 solver%DERIVATIVE_FLAG(1) = 0
1135 rho_loop5:
DO irho=1,nrho
1137 solver%RHO(irho) = rho(irho)
1139 solver%Y(ndim,irho) = y(irho)
1140 solver%DY(ndim,irho) = dy(irho)
1141 solver%YM(ndim,irho) = ym(irho)
1143 solver%A(ndim,irho) = a(irho)
1144 solver%B(ndim,irho) = b(irho)
1145 solver%C(ndim,irho) = c(irho)
1146 solver%D(ndim,irho) = d(irho)
1147 solver%E(ndim,irho) = e(irho)
1148 solver%F(ndim,irho) = f(irho)
1149 solver%G(ndim,irho) = g(irho)
1168 IF (any( isnan(
solver%y)))
then
1169 failstring=
'Error in the ion density equation, nans in the solution, stop'
1175 rho_loop6:
DO irho=1,nrho
1176 y(irho) =
solver%Y(ndim,irho)
1177 dy(irho) =
solver%DY(ndim,irho)
1180 IF(ni_bnd_type(2).EQ.0)
THEN
1182 CALL
derivn(nrho,rho,y,dy)
1187 rho_loop7:
DO irho=1,nrho
1201 dni(irho) = dy(irho)
1202 if (ni(irho).le.0.0)
then
1204 failstring=
'Error in the density equation: on-axis ion density is negative, stop'
1205 write(*,*)
'value of on-axis density for ion', iion,
'is', ni(1)
1206 write(*,*)
'check ni profile in the file err_tmp'
1207 open (22,file=
'err_tmp')
1209 write(22,*) irho_err, y(irho_err)
1215 write(*,*)
'warning, density for ion ',iion,
' and irho ',irho,
'is negative, set it to the value at the previous irho'
1217 dni(irho)=dni(irho-1)
1220 fun1(irho) = (vpr(irho)*si_exp(irho) &
1221 +vprm(irho)*nim(irho)/tau &
1222 -ni(irho)*vpr(irho)*(1.e0_r8/tau+si_imp(irho)))
1226 CALL
integr2(nrho,rho,fun1,intfun1)
1230 local_fun1_s4 = (si_exp(1) &
1232 -ni(1)*(1.e0_r8/tau+si_imp(1)))/g1(1)
1233 local_intfun1_s4 = local_fun1_s4*rho(1)/2.e0_r8
1237 rho_loop8:
DO irho=1,nrho
1238 int_source(irho) = intfun1(irho) &
1239 + btprime/2.e0_r8/bt*rho(irho)*vpr(irho)*ni(irho)
1240 flux(irho) = vpr(irho)*g1(irho)* &
1241 ( y(irho)*vconv(irho) - dy(irho)*diff(irho) )
1246 flux_ni_conv(irho) = 0.e0_r8
1248 model_loop2:
DO imodel = 1, nmodel
1249 flux_ni_conv(irho) = flux_ni_conv(irho) &
1250 + c1(imodel)*vpr(irho)*g1(irho) &
1251 *( y(irho)*vconv_mod(irho,imodel) &
1252 -dy(irho)*diff_mod(irho,imodel) )
1260 IF (ni_bnd_type(2).EQ.0)
THEN
1262 flux(irho) = int_source(irho)
1263 flux_ni_conv(irho) = 1.5e0_r8*int_source(irho)
1264 IF ((vpr(irho)*g1(irho).NE.0.0_r8).and.(dy(irho).ne.0.0_r8)) &
1265 diff(irho) = -
flux(irho) / dy(irho) / (vpr(irho)*g1(irho))
1266 if (abs(diff(irho)).ge.nine_diff_limit) &
1267 diff(irho)=sign(nine_diff_limit,diff(irho))
1268 vconv(irho) = 0.0_r8
1269 IF (diff(irho).LE.1.d-6 .AND. vpr(irho)*g1(irho) .NE. 0 )
THEN
1271 vconv(irho) = (
flux(irho) / (max(abs(vpr(irho)), 1.e-6)*g1(irho)) + dy(irho)*diff(irho)) /max(abs(y(irho)), 1.e-6)
1279 profiles%DNI(irho,iion) = dni(irho)
1280 profiles%DIFF_NI(irho,iion) = diff(irho)
1281 profiles%VCONV_NI(irho,iion) = vconv(irho)
1283 profiles%FLUX_NI_CONV(irho,iion) = flux_ni_conv(irho)
1285 profiles%SOURCE_NI(irho,iion) = si_exp(irho) - si_imp(irho) * ni(irho)
1286 profiles%INT_SOURCE_NI(irho,iion) = int_source(irho)
1291 fun1=
profiles%SOURCE_NI(:,iion)*vpr
1292 CALL
integr2(nrho,rho,fun1,intfun1)
1293 profiles%INT_SOURCE_NI(:,iion) = intfun1
1297 local_int_source_s4(iion) = local_intfun1_s4 &
1298 + btprime/2.e0_r8/bt*rho(1)*ni(1)/g1(1)
1299 local_flux_ni_s4(iion) = ( y(1)*vconv(1) - dy(1)*diff(1) )
1301 local_flux_ni_conv_s4(iion) = 0.e0_r8
1302 model_loop3:
DO imodel = 1, nmodel
1303 local_flux_ni_conv_s4(iion) = local_flux_ni_conv_s4(iion) &
1305 *( y(1)*vconv_mod(1,imodel) &
1306 -dy(1)*diff_mod(1,imodel) )
1313 local_flux_ni_s4(iion) = local_int_source_s4(iion)
1314 local_flux_ni_conv_s4(iion) = 1.5e0_r8*local_int_source_s4(iion)
1326 DEALLOCATE(local_int_source_s4)
1343 (geometry,
profiles,transport,sources,
evolution,control,hyper_diff,ifail,failstring)
1358 INTEGER,
INTENT (INOUT) :: ifail
1359 CHARACTER(LEN=500) :: failstring
1374 INTEGER :: irho, nrho
1375 INTEGER :: imodel, nmodel
1377 REAL (R8) :: bt, btm, btprime
1387 REAL (R8) :: int_source(
profiles%nrho)
1388 REAL (R8) :: flux_ne_conv(
profiles%nrho)
1391 REAL (R8) :: diff_mod(transport%nrho,3)
1392 REAL (R8) :: vconv_mod(transport%nrho,3)
1398 REAL (R8) :: ne_bnd(2,3)
1399 INTEGER :: ne_bnd_type(2)
1401 REAL (R8) :: amix, tau
1405 INTEGER :: solver_type
1418 REAL (R8) :: v(2), u(2), w(2)
1422 REAL (R8) :: local_int_source_s4
1423 REAL (R8) :: local_fun1_s4, local_intfun1_s4
1426 REAL (R8),
DIMENSION(2) :: hyper_diff
1427 REAL (R8) :: hyper_diff_exp
1428 REAL (R8) :: hyper_diff_imp
1429 REAL (R8) :: diff_hyper
1431 REAL (R8),
parameter :: nine_diff_limit=1.0e4
1436 hyper_diff_exp = hyper_diff(1)
1437 hyper_diff_imp = hyper_diff(2)
1453 solver_type = control%SOLVER_TYPE
1457 btprime = (bt-btm)/tau
1460 rho_loop1:
DO irho=1,nrho
1461 rho(irho) = geometry%RHO(irho)
1462 vpr(irho) = geometry%VPR(irho)
1464 g1(irho) = geometry%G1(irho)
1492 ne_bnd_type(2) =
profiles%NE_BND_TYPE
1500 rho_loop2:
DO irho = 1,nrho
1506 diff(irho) = 0.e0_r8
1507 vconv(irho) = 0.e0_r8
1509 model_loop1:
DO imodel = 1, nmodel
1510 c1(imodel) = transport%C1(imodel)
1512 diff_mod(irho,imodel) = transport%DIFF_NE(irho,imodel)
1513 vconv_mod(irho,imodel) = transport%VCONV_NE(irho,imodel)
1515 diff(irho) = diff(irho) + diff_mod(irho,imodel)
1516 vconv(irho) = vconv(irho) + vconv_mod(irho,imodel)
1519 se_exp(irho) = sources%SE_EXP(irho)
1520 se_imp(irho) = sources%SE_IMP(irho)
1530 diff_hyper = hyper_diff_exp + hyper_diff_imp*maxval(diff)
1532 rho_loop3:
DO irho=1,nrho
1534 dy(irho) = dne(irho)
1535 ym(irho) = nem(irho)
1536 dym(irho) = dnem(irho)
1539 b(irho) = vprm(irho)
1542 d(irho) = vpr(irho)*g1(irho)*(diff(irho)+diff_hyper)
1544 e(irho) = vpr(irho)*g1(irho)*(vconv(irho)+diff_hyper*dnem(irho)/nem(irho)) &
1545 - btprime/2.e0_r8/bt*rho(irho)*vpr(irho)
1546 f(irho) = vpr(irho)*se_exp(irho)
1547 g(irho) = vpr(irho)*se_imp(irho)
1559 IF (solver_type.NE.4)
THEN
1564 IF ((diff(1)+diff_hyper).GT.1.0e-6)
THEN
1566 v(1) = -diff(1)-diff_hyper
1571 u(1) = vconv(1)+diff_hyper*dnem(1)/nem(1)
1577 IF(ne_bnd_type(2).EQ.1)
THEN
1584 IF(ne_bnd_type(2).EQ.2)
THEN
1591 IF(ne_bnd_type(2).EQ.3)
THEN
1598 IF(ne_bnd_type(2).EQ.4)
THEN
1599 v(2) = -vpr(nrho)*g1(nrho)*diff(nrho)
1600 u(2) = vpr(nrho)*g1(nrho)*vconv(nrho)
1605 IF(ne_bnd_type(2).EQ.5)
THEN
1614 IF(ne_bnd_type(2).EQ.0)
THEN
1616 CALL
derivn(nrho,rho,y,dy)
1620 rho_loop4:
DO irho=1,nrho
1638 solver%TYPE = solver_type
1639 solver%EQ_FLAG(ndim) = flag
1643 solver%DERIVATIVE_FLAG(1) = 0
1645 rho_loop5:
DO irho=1,nrho
1647 solver%RHO(irho) = rho(irho)
1649 solver%Y(ndim,irho) = y(irho)
1650 solver%DY(ndim,irho) = dy(irho)
1651 solver%YM(ndim,irho) = ym(irho)
1653 solver%A(ndim,irho) = a(irho)
1654 solver%B(ndim,irho) = b(irho)
1655 solver%C(ndim,irho) = c(irho)
1656 solver%D(ndim,irho) = d(irho)
1657 solver%E(ndim,irho) = e(irho)
1658 solver%F(ndim,irho) = f(irho)
1659 solver%G(ndim,irho) = g(irho)
1678 IF (any( isnan(
solver%y)))
then
1679 failstring=
'Error in the electron density equation: nans in the solution, stop'
1685 rho_loop6:
DO irho=1,nrho
1686 y(irho) =
solver%Y(ndim,irho)
1687 dy(irho) =
solver%DY(ndim,irho)
1690 IF(ne_bnd_type(2).EQ.0)
THEN
1692 CALL
derivn(nrho,rho,y,dy)
1697 rho_loop7:
DO irho=1,nrho
1700 dne(irho) = dy(irho)
1701 if (ne(irho).le.0.0)
then
1703 failstring=
'Error in the density equation: on-axis electron density is negative, stop'
1704 write(*,*)
'value of on-axis electron density is', ne(1)
1705 write(*,*)
'check ne profile in the file err_tmp'
1706 open (22,file=
'err_tmp')
1708 write(22,*) irho_err, y(irho_err)
1714 write(*,*)
'warning, electron density for ', irho,
' is negative, set it to the value at the previous irho'
1716 dne(irho)=dne(irho-1)
1719 fun1(irho) = (vpr(irho)*se_exp(irho) + vprm(irho)*nem(irho)/tau &
1720 -ne(irho)*vpr(irho)*(1.e0_r8/tau+se_imp(irho)))
1723 CALL
integr2(nrho,rho,fun1,intfun1)
1726 local_fun1_s4 = (se_exp(1) + nem(1)/tau - ne(1)*(1.e0_r8/tau+se_imp(1)))/g1(1)
1727 local_intfun1_s4 = local_fun1_s4*rho(1)/2.e0_r8
1730 rho_loop8:
DO irho=1,nrho
1731 int_source(irho) = intfun1(irho) + btprime/2.e0_r8/bt*rho(irho)*vpr(irho)*ne(irho)
1732 flux(irho) = vpr(irho)*g1(irho)* ( y(irho)*vconv(irho) - dy(irho)*diff(irho) )
1737 flux_ne_conv(irho) = 0.e0_r8
1739 model_loop2:
DO imodel = 1, nmodel
1740 flux_ne_conv(irho) = flux_ne_conv(irho) + c1(imodel)*vpr(irho)*g1(irho) &
1741 *( y(irho)*vconv_mod(irho,imodel) &
1742 -dy(irho)*diff_mod(irho,imodel) )
1749 IF (ne_bnd_type(2).EQ.0)
THEN
1751 flux(irho) = int_source(irho)
1752 flux_ne_conv(irho) = 1.5e0_r8*int_source(irho)
1753 IF (vpr(irho)*g1(irho).NE.0.0_r8) &
1754 diff(irho) = -
flux(irho) / dy(irho) / (vpr(irho)*g1(irho))
1755 if (abs(diff(irho)).ge.nine_diff_limit) &
1756 diff(irho)=sign(nine_diff_limit,diff(irho))
1757 vconv(irho) = 0.0_r8
1758 IF (diff(irho).LE.1.d-6)
THEN
1760 vconv(irho) = (
flux(irho) / (max(abs(vpr(irho)), 1.e-6)*g1(irho)) + dy(irho)*diff(irho)) / y(irho)
1769 profiles%DIFF_NE(irho) = diff(irho)
1770 profiles%VCONV_NE(irho) = vconv(irho)
1772 profiles%FLUX_NE_CONV(irho) = flux_ne_conv(irho)
1774 profiles%SOURCE_NE(irho) = se_exp(irho) - se_imp(irho) * ne(irho)
1775 profiles%INT_SOURCE_NE(irho) = int_source(irho)
1781 CALL
integr2(nrho,rho,fun1,intfun1)
1782 profiles%INT_SOURCE_NE(:) = intfun1
1785 local_int_source_s4 = local_intfun1_s4 + btprime/2.e0_r8/bt*rho(1)*ne(1)/g1(1)
1786 local_flux_ne_s4 = ( y(1)*vconv(1) - dy(1)*diff(1) )
1788 local_flux_ne_conv_s4 = 0.e0_r8
1789 model_loop3:
DO imodel = 1, nmodel
1790 local_flux_ne_conv_s4 = local_flux_ne_conv_s4 + c1(imodel) &
1791 *( y(1)*vconv_mod(1,imodel) - dy(1)*diff_mod(1,imodel) )
1795 local_flux_ne_s4 = local_int_source_s4
1796 local_flux_ne_conv_s4 = 1.5e0_r8*local_int_source_s4
1860 INTEGER,
INTENT (INOUT) :: ifail
1861 CHARACTER(LEN=500) :: failstring
1873 INTEGER :: iion, nion
1874 INTEGER :: iimp, nimp
1875 INTEGER :: izimp,nzimp
1878 INTEGER :: irho, nrho
1897 REAL (R8) :: flux_ne(
profiles%nrho)
1898 REAL (R8) :: flux_ne_conv(
profiles%nrho)
1905 REAL (R8) :: ztot, ftot
1909 REAL (R8),
ALLOCATABLE :: local_int_source_s4(:)
1918 REAL(R8) :: flux_ni_tot(
profiles%nrho)
1919 REAL(R8) :: contrib_2_energy_flux_ni_tot(
profiles%nrho)
1922 REAL(R8) :: ion_fraction(
profiles%nion)
1923 REAL(R8) :: ni_qn, zion_av
1942 flux_ne_conv =
profiles%FLUX_NE_CONV
1948 flux_ni_conv =
profiles%FLUX_NI_CONV
1963 quasi_neutralty_condition:
IF (control%QUASI_NEUT.EQ.0)
THEN
1968 profiles%CONTRIB_2_ENERGY_FLUX_NE = 0.0_r8
1970 ion_contribution:
DO iion=1,nion
1973 profiles%CONTRIB_2_ENERGY_FLUX_NE(:) =
profiles%CONTRIB_2_ENERGY_FLUX_NE(:) &
1975 END DO ion_contribution
1977 impurity_contribution:
DO iimp=1,nimp
1978 impurity_charge_states:
DO izimp=1,nzimp
1981 END DO impurity_charge_states
1982 ENDDO impurity_contribution
1995 local_flux_ne_conv_s4 = 0.0_r8
1996 ion_loop3:
DO iion = 1, nion
1997 local_flux_ne_conv_s4 = local_flux_ne_conv_s4 +
profiles%ZION(iion)*local_flux_ni_conv_s4(iion)
2000 ELSE IF (control%QUASI_NEUT.EQ.1.OR.control%QUASI_NEUT.EQ.2)
THEN
2005 contrib_2_energy_flux_ni_tot =
profiles%CONTRIB_2_ENERGY_FLUX_NE
2008 subtract_predicted_ions:
DO iion=1,nion
2010 IF (
profiles%NI_BND_TYPE(iion).GT.0.5)
THEN
2012 flux_ni_tot(:) = flux_ni_tot(:) -
profiles%ZION(iion)*
profiles%FLUX_NI(:,iion)
2013 contrib_2_energy_flux_ni_tot(:) = contrib_2_energy_flux_ni_tot(:) -
profiles%ZION(iion)&
2014 *
profiles%CONTRIB_2_ENERGY_FLUX_NI(:,iion)
2016 ENDDO subtract_predicted_ions
2018 subtract_impurity:
DO iimp=1,nimp
2019 impurity_charge_states1:
DO izimp=1,nzimp
2020 ni_tot(:) = ni_tot(:) -
impurity%ZIMP(:,iimp,izimp)*
impurity%NZ(:,iimp,izimp)
2021 flux_ni_tot(:) = flux_ni_tot(:) -
impurity%ZIMP(:,iimp,izimp)*
impurity%FLUX_NZ(:,iimp,izimp)
2022 END DO impurity_charge_states1
2023 ENDDO subtract_impurity
2031 total_density_for_qn_ions:
DO iion = 1, nion
2032 IF (
profiles%NI_BND_TYPE(iion).EQ.0)
THEN
2033 ni_qn = ni_qn +
profiles%NI_BND(1,iion)
2034 nion_qn = nion_qn + 1
2036 END DO total_density_for_qn_ions
2037 ion_fraction(:) =
profiles%NI_BND(1,:)/ni_qn
2039 ion_gharge_density:
DO iion = 1, nion
2040 IF (
profiles%NI_BND_TYPE(iion).EQ.0)
THEN
2041 zion_av = zion_av + (ion_fraction(iion)*
profiles%ZION(iion))
2043 END DO ion_gharge_density
2046 proportional_to_boundary_value:
IF (control%QUASI_NEUT.EQ.1)
THEN
2048 IF (
profiles%NI_BND_TYPE(iion).EQ.0)
THEN
2049 profiles%NI(:,iion) = ni_tot(:) /zion_av*ion_fraction(iion)
2050 profiles%FLUX_NI(:,iion) = flux_ni_tot(:) /zion_av*ion_fraction(iion)
2051 profiles%CONTRIB_2_ENERGY_FLUX_NI(:,iion) = contrib_2_energy_flux_ni_tot(:)/zion_av*ion_fraction(iion)
2054 END IF proportional_to_boundary_value
2056 inversely_proportional_to_ion_gharge_density:
IF (control%QUASI_NEUT.EQ.2)
THEN
2058 IF (
profiles%NI_BND_TYPE(iion).EQ.0)
THEN
2061 profiles%CONTRIB_2_ENERGY_FLUX_NI(:,iion) = contrib_2_energy_flux_ni_tot(:)/nion_qn/
profiles%ZION(iion)
2064 END IF inversely_proportional_to_ion_gharge_density
2071 CALL
derivn(nrho, geometry%RHO, aux1, aux2)
2076 local_flux_ni_conv_s4 = 0.0_r8
2078 IF (
profiles%NI_BND_TYPE(iion).EQ.0)
THEN
2079 IF (control%QUASI_NEUT.EQ.1) &
2081 local_flux_ni_conv_s4 = local_flux_ne_conv_s4/zion_av*ion_fraction(iion)
2082 IF (control%QUASI_NEUT.EQ.2) &
2083 local_flux_ni_conv_s4 = local_flux_ne_conv_s4/nion/zion(iion)
2088 END IF quasi_neutralty_condition
2092 ion_contribution_2_zeff:
DO iion = 1, nion
2094 END DO ion_contribution_2_zeff
2095 impurity_contribution_2_zeff:
DO iimp = 1, nimp
2097 ni_z2(:) = ni_z2(:) +
impurity%ZIMP2(:,iimp,izimp)*
impurity%NZ(:,iimp,izimp)
2099 END DO impurity_contribution_2_zeff
2106 if (control%QUASI_NEUT.EQ.-1)
then
2108 if (ne(irho).le.0.0)
then
2110 failstring=
'Error in the density equation: on-axis electron density is negative, stop'
2111 write(*,*)
'value of on-axis electron density is', ne(1)
2112 write(*,*)
'check ne profile in the file err_tmp'
2113 open (22,file=
'err_tmp')
2115 write(22,*) irho_err, ne(irho_err)
2121 write(*,*)
'warning, electron density for ', irho,
' is negative, set it to the value at the previous irho'
2292 (geometry,
profiles,transport,sources,
evolution,control,hyper_diff,ifail,failstring)
2311 INTEGER,
INTENT (INOUT) :: ifail
2312 CHARACTER(LEN=500) :: failstring
2327 INTEGER :: irho, nrho
2328 INTEGER :: iion, nion
2331 REAL (R8) :: bt, btm, btprime
2343 REAL (R8) :: flux_ti(
profiles%nrho)
2344 REAL (R8) :: flux_ti_cond(
profiles%nrho)
2345 REAL (R8) :: flux_ti_conv(
profiles%nrho)
2346 REAL (R8) :: int_source(
profiles%nrho)
2347 REAL (R8) :: flux_ni(
profiles%nrho)
2358 REAL (R8) :: ti_bnd(2,3)
2359 INTEGER :: ti_bnd_type(2,
profiles%nion)
2366 REAL (R8) :: flux_te(
profiles%nrho)
2367 REAL (R8) :: flux_te_cond(
profiles%nrho)
2368 REAL (R8) :: flux_te_conv(
profiles%nrho)
2369 REAL (R8) :: flux_ne(
profiles%nrho)
2376 REAL (R8) :: te_bnd(2,3)
2377 INTEGER :: te_bnd_type(2)
2383 REAL (R8) :: amix, tau
2386 INTEGER :: idim, ndim
2387 INTEGER :: solver_type
2400 REAL (R8) :: v(2), u(2), w(2)
2405 real (r8),
parameter :: twothird = 2.0_r8/3.0_r8, &
2406 fivethird = 5.0_r8/3.0_r8
2411 REAL (R8),
DIMENSION(2) :: hyper_diff
2412 REAL (R8) :: hyper_diff_exp
2413 REAL (R8) :: hyper_diff_imp
2414 REAL (R8) :: diff_hyper
2417 REAL (R8),
parameter :: tite_diff_limit=1.0e4
2422 hyper_diff_exp = hyper_diff(1)
2423 hyper_diff_imp = hyper_diff(2)
2443 solver_type = control%SOLVER_TYPE
2447 btprime = (bt-btm)/tau
2450 rho_loop1:
DO irho=1,nrho
2451 rho(irho) = geometry%RHO(irho)
2452 vpr(irho) = geometry%VPR(irho)
2454 g1(irho) = geometry%G1(irho)
2457 CALL
derivn(nrho,rho,vpr,dvpr)
2465 vie = collisions%VIE
2470 solver%TYPE = solver_type
2474 solver%DERIVATIVE_FLAG(1) = 0
2476 rho_loop2:
DO irho=1,nrho
2477 solver%RHO(irho) = rho(irho)
2488 ion_loop1:
DO iion=1,nion
2511 ti_bnd_type(2,iion) =
profiles%TI_BND_TYPE(iion)
2512 ti_bnd(2,1) =
profiles%TI_BND(1,iion)
2513 ti_bnd(2,2) =
profiles%TI_BND(2,iion)
2514 ti_bnd(2,3) =
profiles%TI_BND(3,iion)
2519 rho_loop3:
DO irho = 1,nrho
2521 dti(irho) =
profiles%DTI(irho,iion)
2525 dni(irho) =
profiles%DNI(irho,iion)
2529 flux_ti(irho) =
profiles%FLUX_TI(irho,iion)
2530 flux_ti_cond(irho) =
profiles%FLUX_TI_COND(irho,iion)
2531 flux_ti_conv(irho) =
profiles%FLUX_TI_CONV(irho,iion)
2532 flux_ni(irho) =
profiles%FLUX_NI_CONV(irho,iion)
2534 diff_ti(irho) = transport%DIFF_TI(irho,iion)
2535 vconv_ti(irho) = transport%VCONV_TI(irho,iion)
2536 qgi(irho) = transport%QGI(irho,iion)
2538 qi_exp(irho) = sources%QI_EXP(irho,iion)
2539 qi_imp(irho) = sources%QI_IMP(irho,iion)
2541 vei(irho) = collisions%VEI(irho,iion)
2542 qei(irho) = collisions%QEI(irho,iion)
2543 vzi(irho) = collisions%VZI(irho,iion)
2544 qzi(irho) = collisions%QZI(irho,iion)
2546 ion_loop2:
DO zion = 1,nion
2548 vii(irho,zion) = collisions%VII(irho,iion,zion)
2561 diff_hyper = hyper_diff_exp + hyper_diff_imp*maxval(diff_ti)
2563 rho_loop4:
DO irho=nrho,1,-1
2565 dy(irho) = dti(irho)
2566 ym(irho) = tim(irho)
2567 dym(irho) = dtim(irho)
2569 a(irho) = 1.5e0_r8*vpr(irho)*ni(irho)
2571 if(vpr(irho).le.0.0_r8.and.irho.eq.1)
then
2575 b(irho) = 1.5e0_r8*vprm(irho)**fivethird/vpr(irho)**twothird*nim(irho)
2580 d(irho) = vpr(irho)*g1(irho)*ni(irho)*(diff_ti(irho)+diff_hyper)
2582 e(irho) = vpr(irho)*g1(irho)*ni(irho)*(vconv_ti(irho)+diff_hyper*dtim(irho)/tim(irho)) &
2584 - 1.5e0_r8*btprime/2.e0_r8/bt*rho(irho)*ni(irho)*vpr(irho)
2585 f(irho) = vpr(irho) &
2586 * (qi_exp(irho) + qei(irho) + qzi(irho) + qgi(irho))
2587 g(irho) = vpr(irho)*(qi_imp(irho) + vei(irho) + vzi(irho)) &
2588 - btprime/2.e0_r8/bt*rho(irho)*ni(irho)*dvpr(irho)
2602 IF (solver_type.NE.4)
THEN
2607 IF ((diff_ti(1)+diff_hyper).GT.1.0e-6)
THEN
2609 v(1) = -(diff_ti(1)+diff_hyper)*ni(1)
2611 v(1) = -1.0e-6*ni(1)
2614 u(1) = (vconv_ti(1)+diff_hyper*dtim(1)/tim(1))*ni(1)+local_flux_ni_conv_s4(iion)
2621 IF(ti_bnd_type(2,iion).EQ.1)
THEN
2628 IF(ti_bnd_type(2,iion).EQ.2)
THEN
2635 IF(ti_bnd_type(2,iion).EQ.3)
THEN
2642 IF(ti_bnd_type(2,iion).EQ.4)
THEN
2643 v(2) = -vpr(nrho)*g1(nrho)*diff_ti(nrho)*ni(nrho)
2644 u(2) = vpr(nrho)*g1(nrho)*vconv_ti(nrho)*ni(nrho)+flux_ni(nrho)
2649 IF(ti_bnd_type(2,iion).EQ.5)
THEN
2658 IF(ti_bnd_type(2,iion).EQ.0)
THEN
2660 CALL
derivn(nrho,rho,y,dy)
2664 rho_loop5:
DO irho=1,nrho
2682 solver%EQ_FLAG(iion) = flag
2684 rho_loop6:
DO irho=1,nrho
2685 solver%Y(iion,irho) = y(irho)
2686 solver%DY(iion,irho) = dy(irho)
2687 solver%YM(iion,irho) = ym(irho)
2689 solver%A(iion,irho) = a(irho)
2690 solver%B(iion,irho) = b(irho)
2691 solver%C(iion,irho) = c(irho)
2692 solver%D(iion,irho) = d(irho)
2693 solver%E(iion,irho) = e(irho)
2694 solver%F(iion,irho) = f(irho)
2695 solver%G(iion,irho) = g(irho)
2697 solver%CM1(ndim,iion,irho) = vie(irho)
2698 solver%CM1(iion,ndim,irho) = vie(irho)
2700 ion_loop3:
DO zion = 1,nion
2701 solver%CM1(iion,zion,irho) = vii(irho,zion)
2748 rho_loop7:
DO irho=1,nrho
2758 flux_ne(irho) =
profiles%FLUX_NE_CONV(irho)
2760 diff_te(irho) = transport%DIFF_TE(irho)
2761 vconv_te(irho) = transport%VCONV_TE(irho)
2763 ion_loop4:
DO iion = 1, nion
2764 qgi(irho) = qgi(irho) + transport%QGI(irho,iion)
2769 qe_exp(irho) = sources%QOH(irho) / itm_ev
2770 qe_imp(irho) = 0.e0_r8
2772 qe_exp(irho) = qe_exp(irho) + sources%QE_EXP(irho)
2773 qe_imp(irho) = qe_imp(irho) + sources%QE_IMP(irho)
2775 qie(irho) = collisions%QIE(irho)
2776 vie(irho) = collisions%VIE(irho)
2783 te_bnd_type(2) =
profiles%TE_BND_TYPE
2794 diff_hyper = hyper_diff_exp + hyper_diff_imp*maxval(diff_te)
2796 rho_loop8:
DO irho=nrho,1,-1
2798 dy(irho) = dte(irho)
2799 ym(irho) = tem(irho)
2800 dym(irho) = dtem(irho)
2802 a(irho) = 1.5e0_r8*vpr(irho)*ne(irho)
2804 if(vpr(irho).le.0.0_r8.and.irho.eq.1)
then
2808 b(irho) = 1.5e0_r8*vprm(irho)**fivethird/vpr(irho)**twothird*nem(irho)
2813 d(irho) = vpr(irho)*g1(irho)*ne(irho)*(diff_te(irho)+diff_hyper)
2815 e(irho) = vpr(irho)*g1(irho)*ne(irho)*(vconv_te(irho)+diff_hyper*dtem(irho)/tem(irho)) &
2817 - 1.5e0_r8*btprime/2.e0_r8/bt*rho(irho)*ne(irho)*vpr(irho)
2818 f(irho) = vpr(irho) * ( qe_exp(irho) + qie(irho) - qgi(irho) )
2819 g(irho) = vpr(irho) * (qe_imp(irho) + vie(irho)) &
2820 - btprime/2.e0_r8/bt*rho(irho)*ne(irho)*dvpr(irho)
2833 IF (solver_type.NE.4)
THEN
2838 IF ((diff_te(1)+diff_hyper).GT.1.0e-6)
THEN
2840 v(1) = -(diff_te(1)+diff_hyper)*ne(1)
2842 v(1) = -1.0e-6*ne(1)
2845 u(1) = (vconv_te(1)+diff_hyper*dtem(1)/tem(1))*ne(1)+local_flux_ne_conv_s4
2852 IF(te_bnd_type(2).EQ.1)
THEN
2859 IF(te_bnd_type(2).EQ.2)
THEN
2866 IF(te_bnd_type(2).EQ.3)
THEN
2873 IF(te_bnd_type(2).EQ.4)
THEN
2876 v(2) = -vpr(nrho)*g1(nrho)*diff_te(nrho)*ne(nrho)
2877 u(2) = vpr(nrho)*g1(nrho)*vconv_te(nrho)*ne(nrho)+flux_ne(nrho)
2882 IF(te_bnd_type(2).EQ.5)
THEN
2891 IF(te_bnd_type(2).EQ.0)
THEN
2893 CALL
derivn(nrho,rho,y,dy)
2897 rho_loop9:
DO irho=1,nrho
2915 solver%TYPE = solver_type
2916 solver%EQ_FLAG(ndim) = flag
2920 solver%DERIVATIVE_FLAG(1) = 0
2922 rho_loop10:
DO irho=1,nrho
2924 solver%RHO(irho) = rho(irho)
2926 solver%Y(ndim,irho) = y(irho)
2927 solver%DY(ndim,irho) = dy(irho)
2928 solver%YM(ndim,irho) = ym(irho)
2930 solver%A(ndim,irho) = a(irho)
2931 solver%B(ndim,irho) = b(irho)
2932 solver%C(ndim,irho) = c(irho)
2933 solver%D(ndim,irho) = d(irho)
2934 solver%E(ndim,irho) = e(irho)
2935 solver%F(ndim,irho) = f(irho)
2936 solver%G(ndim,irho) = g(irho)
2938 solver%CM1(ndim,ndim,irho) = 0.e0_r8
2957 IF (any( isnan(
solver%y)))
then
2958 failstring=
'Error in the temperature equation: nans in the solution, stop'
2968 ion_loop5:
DO iion = 1,nion
2971 ti_bnd_type(2,iion) =
profiles%TI_BND_TYPE(iion)
2972 ti_bnd(2,1) =
profiles%TI_BND(1,iion)
2973 ti_bnd(2,2) =
profiles%TI_BND(2,iion)
2974 ti_bnd(2,3) =
profiles%TI_BND(3,iion)
2977 rho_loop11:
DO irho=1,nrho
2984 flux_ti(irho) =
profiles%FLUX_TI(irho,iion)
2985 flux_ti_cond(irho) =
profiles%FLUX_TI_COND(irho,iion)
2986 flux_ti_conv(irho) =
profiles%FLUX_TI_CONV(irho,iion)
2987 flux_ni(irho) =
profiles%FLUX_NI_CONV(irho,iion)
2988 diff_ti(irho) = transport%DIFF_TI(irho,iion)
2989 vconv_ti(irho) = transport%VCONV_TI(irho,iion)
2990 qgi(irho) = transport%QGI(irho,iion)
2991 qi_exp(irho) = sources%QI_EXP(irho,iion)
2992 qi_imp(irho) = sources%QI_IMP(irho,iion)
2993 vei(irho) = collisions%VEI(irho,iion)
2994 qei(irho) = collisions%QEI(irho,iion)
2995 vzi(irho) = collisions%VZI(irho,iion)
2996 qzi(irho) = collisions%QZI(irho,iion)
2999 y(irho) =
solver%Y(iion,irho)
3000 dy(irho) =
solver%DY(iion,irho)
3002 IF(ti_bnd_type(2,iion).EQ.0)
THEN
3004 CALL
derivn(nrho,rho,y,dy)
3008 dti(irho) = dy(irho)
3009 if (ti(irho).lt.0.0)
then
3011 failstring=
'Error in the temperature equation: on-axis ion temperature is negative, stop'
3012 write(*,*)
'value of on-axis temperature for ion', iion,
'is', ti(1)
3013 write(*,*)
'check ti profile in the file err_tmp'
3014 open (22,file=
'err_tmp')
3016 write(22,*) irho_err,
solver%y(iion,irho_err)
3022 write(*,*)
'warning, temperatuire for ion ',iion,
' and irho ',irho,
'is negative, set it to the value at the previous irho'
3024 dti(irho)=dti(irho-1)
3027 IF (rho(irho).NE.0.e0_r8)
THEN
3028 fun1(irho) = vpr(irho)/rho(irho)* &
3029 ((1.5e0_r8*nim(irho)*tim(irho)/tau*(vprm(irho)/vpr(irho))**fivethird &
3030 + qi_exp(irho) + qei(irho) + qzi(irho) + qgi(irho)) &
3031 - (1.5e0_r8*ni(irho)/tau + qi_imp(irho) + vei(irho) + vzi(irho) &
3032 - btprime/2.e0_r8/bt*rho(irho)*ni(irho)*dvpr(irho)) * y(irho))
3034 fun1(irho) = ((1.5e0_r8*nim(irho)*tim(irho)/tau &
3035 + qi_exp(irho) + qei(irho) + qzi(irho) + qgi(irho)) &
3036 - (1.5e0_r8*ni(irho)/tau + qi_imp(irho) + vei(irho) + vzi(irho) &
3037 - btprime/2.e0_r8/bt*rho(irho)*ni(irho)*dvpr(irho)) * y(irho))
3041 CALL
integr(nrho,rho,fun1,intfun1)
3043 rho_loop12:
DO irho=1,nrho
3044 flux_ti_conv(irho) = y(irho)*flux_ni(irho)
3046 flux_ti_cond(irho) = vpr(irho)*g1(irho)*ni(irho) &
3047 * ( y(irho)*vconv_ti(irho) - dy(irho)*diff_ti(irho) )
3049 flux_ti(irho) = flux_ti_conv(irho) + flux_ti_cond(irho)
3051 int_source(irho) = intfun1(irho) &
3052 + y(irho) * 1.5e0_r8*btprime/2.e0_r8/bt*rho(irho)*ni(irho)*vpr(irho)
3058 IF (ti_bnd_type(2,iion).EQ.0)
THEN
3060 diff_ti(irho) = 1.d-6
3061 flux_ti(irho) = int_source(irho)
3062 flux_ti_cond(irho) = int_source(irho) - flux_ni(irho)*y(irho)
3064 IF ((vpr(irho)*g1(irho).NE.0.0_r8)) &
3066 diff_ti(irho) = - flux_ti_cond(irho) / sign(max(abs(dy(irho)),sqrt(epsilon(1.0))),dy(irho)) / (vpr(irho)*g1(irho)*ni(irho))
3068 if (abs(diff_ti(irho)).ge.tite_diff_limit) &
3069 diff_ti(irho)=sign(tite_diff_limit,diff_ti(irho))
3070 vconv_ti(irho) = 0.0_r8
3071 IF (diff_ti(irho).LE.1.d-6)
THEN
3072 diff_ti(irho) = 1.d-6
3073 vconv_ti(irho) = (flux_ti_cond(irho) / (max(abs(vpr(irho)), 1.e-6)*g1(irho)*ni(irho)) + dy(irho)*diff_ti(irho)) /max(abs(y(irho)), 1.e-6)
3081 profiles%DTI(irho,iion) = dti(irho)
3082 profiles%DIFF_TI(irho,iion) = diff_ti(irho)
3083 profiles%VCONV_TI(irho,iion) = vconv_ti(irho)
3084 profiles%FLUX_TI_CONV(irho,iion) = flux_ti_conv(irho)
3085 profiles%FLUX_TI_COND(irho,iion) = flux_ti_cond(irho)
3086 profiles%FLUX_TI(irho,iion) = flux_ti(irho)
3087 profiles%SOURCE_TI(irho,iion) = qi_exp(irho) + qei(irho) + qzi(irho) + qgi(irho) &
3088 - (qi_imp(irho) + vei(irho) + vzi(irho)) * ti(irho)
3089 profiles%INT_SOURCE_TI(irho,iion) = int_source(irho)
3094 fun1=
profiles%SOURCE_TI(:,iion)*vpr
3095 CALL
integr2(nrho,rho,fun1,intfun1)
3096 profiles%INT_SOURCE_TI(:,iion) = intfun1
3105 rho_loop13:
DO irho=1,nrho
3109 ion_loop6:
DO iion = 1, nion
3110 qgi(irho) = qgi(irho) + transport%QGI(irho,iion)
3114 y(irho) =
solver%Y(ndim,irho)
3115 dy(irho) =
solver%DY(ndim,irho)
3117 IF(te_bnd_type(2).EQ.0)
THEN
3119 CALL
derivn(nrho,rho,y,dy)
3123 dte(irho) = dy(irho)
3125 if (te(irho).lt.0.0)
then
3127 failstring=
'Error in the temperature equation: on-axis electron temperature is negative, stop'
3128 write(*,*)
'value of on-axis electron temperature is', te(1)
3129 write(*,*)
'check te profile in the file err_tmp'
3130 open (22,file=
'err_tmp')
3133 write(22,*) irho_err,
solver%y(ndim,irho_err)
3139 write(*,*)
'warning, electron temperatuire for irho ',irho,
'is negative, set it to the value at the previous irho'
3141 dte(irho)=dte(irho-1)
3145 IF (rho(irho).NE.0.e0_r8)
THEN
3146 fun2(irho) = vpr(irho)/rho(irho)* &
3147 ( 1.5e0_r8*nem(irho)*tem(irho)/tau*(vprm(irho)/vpr(irho))**fivethird &
3148 + qe_exp(irho) + qie(irho) - qgi(irho) &
3149 - y(irho) * ( 1.5e0_r8*ne(irho)/tau + qe_imp(irho) + vie(irho) &
3150 - btprime/2.e0_r8/bt*rho(irho)*ne(irho)*dvpr(irho)/vpr(irho) ) )
3152 fun2(irho) = ( 1.5e0_r8*nem(irho)*tem(irho)/tau &
3153 + qe_exp(irho) + qie(irho) - qgi(irho) &
3154 - y(irho) * ( 1.5e0_r8*ne(irho)/tau + qe_imp(irho) + vie(irho) &
3155 - btprime/2.e0_r8/bt*ne(irho)*dvpr(irho) ) )
3159 CALL
integr(nrho,rho,fun2,intfun2)
3161 rho_loop14:
DO irho=1,nrho
3162 flux_te_conv(irho) = y(irho)*flux_ne(irho)
3164 flux_te_cond(irho) = vpr(irho)*g1(irho)*ne(irho) &
3165 * ( y(irho)*vconv_te(irho) - dy(irho)*diff_te(irho) )
3167 flux_te(irho) = flux_te_conv(irho) + flux_te_cond(irho)
3169 int_source(irho) = intfun2(irho) &
3170 + y(irho) * 1.5e0_r8*btprime/2.e0_r8/bt*rho(irho)*ne(irho)*vpr(irho)
3175 IF (te_bnd_type(2).EQ.0)
THEN
3177 diff_te(irho) = 1.d-6
3178 flux_te(irho) = int_source(irho)
3180 flux_te_cond(irho) = int_source(irho) - flux_ne(irho)*y(irho)
3182 IF (vpr(irho)*g1(irho).NE.0.0_r8) &
3184 diff_te(irho) = - flux_te_cond(irho) / sign(max(abs(dy(irho)),sqrt(epsilon(1.0))),dy(irho)) / (vpr(irho)*g1(irho)*ne(irho))
3186 if (abs(diff_te(irho)).ge.tite_diff_limit) &
3187 diff_te(irho)=sign(tite_diff_limit,diff_te(irho))
3188 vconv_te(irho) = 0.0_r8
3189 IF (diff_te(irho).LE.1.d-6)
THEN
3190 diff_te(irho) = 1.d-6
3191 vconv_te(irho) = (flux_te_cond(irho) / (max(abs(vpr(irho)), 1.e-6)*g1(irho)*ne(irho)) + dy(irho)*diff_te(irho)) / y(irho)
3200 profiles%DIFF_TE(irho) = diff_te(irho)
3201 profiles%VCONV_TE(irho) = vconv_te(irho)
3202 profiles%FLUX_TE(irho) = flux_te(irho)
3203 profiles%FLUX_TE_CONV(irho) = flux_te_conv(irho)
3204 profiles%FLUX_TE_COND(irho) = flux_te_cond(irho)
3205 profiles%SOURCE_TE(irho) = qe_exp(irho) + qie(irho) - qgi(irho) &
3206 - (qe_imp(irho) + vie(irho)) * te(irho)
3207 profiles%INT_SOURCE_TE(irho) = int_source(irho)
3211 CALL
integr2(nrho,rho,fun1,intfun1)
3303 INTEGER,
INTENT (INOUT) :: ifail
3304 CHARACTER(LEN=500) :: failstring
3319 INTEGER :: irho, nrho
3320 INTEGER :: iion, nion
3326 REAL (R8) :: bt, btm, btprime
3339 REAL (R8) :: mtor_tot(
profiles%nrho)
3343 REAL (R8) :: flux_mtor(
profiles%nrho)
3344 REAL (R8) :: flux_mtor_conv(
profiles%nrho)
3345 REAL (R8) :: flux_mtor_cond(
profiles%nrho)
3346 REAL (R8) :: flux_mtor_tot(
profiles%nrho)
3347 REAL (R8) :: int_source(
profiles%nrho)
3348 REAL (R8) :: flux_ni(
profiles%nrho)
3350 REAL (R8) :: vtor_bnd(2,3)
3351 INTEGER :: vtor_bnd_type(2)
3364 REAL (R8) :: amix, tau
3367 INTEGER :: idim, ndim
3368 INTEGER :: solver_type
3376 REAL (R8) :: v(2), u(2), w(2)
3398 solver_type = control%SOLVER_TYPE
3402 btprime = (bt-btm)/tau
3404 rho_loop1:
DO irho=1,nrho
3405 rho(irho) = geometry%RHO(irho)
3406 vpr(irho) = geometry%VPR(irho)
3408 g1(irho) = geometry%G1(irho)
3409 g2(irho) = geometry%G2(irho)
3412 mtor_tot(irho) = 0.e0_r8
3413 flux_mtor_tot(irho) = 0.e0_r8
3424 solver%TYPE = solver_type
3428 solver%DERIVATIVE_FLAG(1) = 0
3436 ion_loop1:
DO iion=1,nion
3466 vtor_bnd_type(2) =
profiles%VTOR_BND_TYPE(iion)
3467 vtor_bnd(2,1) =
profiles%VTOR_BND(1,iion)
3468 vtor_bnd(2,2) =
profiles%VTOR_BND(2,iion)
3469 vtor_bnd(2,3) =
profiles%VTOR_BND(3,iion)
3474 rho_loop2:
DO irho = 1,nrho
3475 vtor(irho) =
profiles%VTOR(irho,iion)
3476 dvtor(irho) =
profiles%DVTOR(irho,iion)
3477 vtorm(irho) =
evolution%VTORM(irho,iion)
3478 dvtorm(irho) =
evolution%DVTORM(irho,iion)
3479 wtor(irho) =
profiles%WTOR(irho,iion)
3481 dni(irho) =
profiles%DNI(irho,iion)
3484 mtor(irho) =
profiles%MTOR(irho,iion)
3486 flux_mtor(irho) =
profiles%FLUX_MTOR(irho,iion)
3487 flux_ni(irho) =
profiles%FLUX_NI(irho,iion)
3489 diff(irho) = transport%DIFF_VTOR(irho,iion)
3490 vconv(irho) = transport%VCONV_VTOR(irho,iion)
3492 ui_exp(irho) = sources%UI_EXP(irho,iion)
3493 ui_imp(irho) = sources%UI_IMP(irho,iion)
3495 wzi(irho) = collisions%WZI(irho,iion)
3496 uzi(irho) = collisions%UZI(irho,iion)
3498 ion_loop2:
DO zion = 1,nion
3500 wii(irho,zion) = collisions%WII(irho,iion,zion)
3510 rho_loop3:
DO irho=1,nrho
3511 y(irho) = vtor(irho)
3512 dy(irho) = dvtor(irho)
3513 ym(irho) = vtorm(irho)
3514 dym(irho) = dvtorm(irho)
3516 a(irho) = vpr(irho)*g2(irho)*ni(irho)*mion
3517 b(irho) = vprm(irho)*g2m(irho)*nim(irho)*mion
3519 d(irho) = vpr(irho)*g1(irho)*ni(irho)*mion*diff(irho)*g2(irho)
3520 e(irho) = (vpr(irho)*g1(irho)*ni(irho)*vconv(irho) &
3522 - btprime/2.e0_r8/bt*rho(irho)*ni(irho)*vpr(irho)) &
3524 f(irho) = vpr(irho)*(ui_exp(irho) + uzi(irho))
3525 g(irho) = vpr(irho)*(ui_imp(irho) + wzi(irho))
3538 IF (solver_type.NE.4)
THEN
3542 IF (diff(1).GT.1.0e-6)
THEN
3543 v(1) = -diff(1)*ni(1)
3545 v(1) = -1.0e-6*ni(1)
3547 u(1) = vconv(1)*ni(1) &
3548 +local_flux_ni_s4(iion)
3554 IF(vtor_bnd_type(2).EQ.1)
THEN
3557 w(2) = vtor_bnd(2,1)
3561 IF(vtor_bnd_type(2).EQ.2)
THEN
3564 w(2) = -vtor_bnd(2,1)
3568 IF(vtor_bnd_type(2).EQ.3)
THEN
3570 u(2) = 1.e0_r8/vtor_bnd(2,1)
3575 IF(vtor_bnd_type(2).EQ.4)
THEN
3576 v(2) = -vpr(nrho)*g1(nrho)*g2(nrho)*diff(nrho)*ni(nrho)*mion
3577 u(2) = vpr(nrho)*g1(nrho)*g2(nrho)*vconv(nrho)*ni(nrho)*mion &
3578 +g2(nrho)*flux_ni(nrho)*mion
3579 w(2) = vtor_bnd(2,1)
3583 IF(vtor_bnd_type(2).EQ.5)
THEN
3584 v(2) = vtor_bnd(2,1)
3585 u(2) = vtor_bnd(2,2)
3586 w(2) = vtor_bnd(2,3)
3592 IF(vtor_bnd_type(2).EQ.0)
THEN
3594 CALL
derivn(nrho,rho,y,dy)
3598 rho_loop4:
DO irho=1,nrho
3616 solver%EQ_FLAG(idim) = flag
3618 rho_loop5:
DO irho=1,nrho
3619 solver%RHO(irho) = rho(irho)
3621 solver%Y(idim,irho) = y(irho)
3622 solver%DY(idim,irho) = dy(irho)
3623 solver%YM(idim,irho) = ym(irho)
3625 solver%A(idim,irho) = a(irho)
3626 solver%B(idim,irho) = b(irho)
3627 solver%C(idim,irho) = c(irho)
3628 solver%D(idim,irho) = d(irho)
3629 solver%E(idim,irho) = e(irho)
3630 solver%F(idim,irho) = f(irho)
3631 solver%G(idim,irho) = g(irho)
3633 solver%CM1(idim,idim,irho) = 0.e0_r8
3635 ion_loop3:
DO zion = 1,nion
3636 solver%CM1(iion,zion,irho)= wii(irho,zion)
3659 IF (any( isnan(
solver%y)))
then
3660 failstring=
'Error in the vtor equation: nans in the solution, stop'
3666 ion_loop4:
DO iion = 1,nion
3673 vtor_bnd_type(2) =
profiles%VTOR_BND_TYPE(iion)
3674 vtor_bnd(2,1) =
profiles%VTOR_BND(1,iion)
3675 vtor_bnd(2,2) =
profiles%VTOR_BND(2,iion)
3676 vtor_bnd(2,3) =
profiles%VTOR_BND(3,iion)
3679 rho_loop6:
DO irho=1,nrho
3682 vtor(irho) =
profiles%VTOR(irho,iion)
3683 vtorm(irho) =
evolution%VTORM(irho,iion)
3684 wtor(irho) =
profiles%WTOR(irho,iion)
3687 mtor(irho) =
profiles%MTOR(irho,iion)
3688 flux_mtor(irho) =
profiles%FLUX_MTOR(irho,iion)
3689 flux_ni(irho) =
profiles%FLUX_NI(irho,iion)
3690 diff(irho) = transport%DIFF_VTOR(irho,iion)
3691 vconv(irho) = transport%VCONV_VTOR(irho,iion)
3692 ui_exp(irho) = sources%UI_EXP(irho,iion)
3693 ui_imp(irho) = sources%UI_IMP(irho,iion)
3694 wzi(irho) = collisions%WZI(irho,iion)
3695 uzi(irho) = collisions%UZI(irho,iion)
3699 y(irho) =
solver%Y(idim,irho)
3700 dy(irho) =
solver%DY(idim,irho)
3702 IF(vtor_bnd_type(2).EQ.0)
THEN
3704 CALL
derivn(nrho,rho,y,dy)
3708 vtor(irho) = y(irho)
3709 dvtor(irho) = dy(irho)
3711 wtor(irho) = y(irho)/g2(irho)
3713 mtor(irho) = g2(irho)*ni(irho)*mion*y(irho)
3714 mtor_tot(irho) = mtor_tot(irho) + mtor(irho)
3716 IF (rho(irho).NE.0.e0_r8)
THEN
3717 fun1(irho) = vpr(irho)/rho(irho) * ( ui_exp(irho) + uzi(irho) &
3718 + ( wzi(irho) + g2(irho)*mion*ni(irho)/tau- ui_imp(irho)) * y(irho) )
3720 fun1(irho) = ( ui_exp(irho) + uzi(irho)+ ( wzi(irho) &
3721 + g2(irho)*mion*ni(irho)/tau- ui_imp(irho)) * y(irho) )
3725 CALL
integr(nrho,rho,fun1,intfun1)
3727 rho_loop7:
DO irho=1,nrho
3728 flux_mtor_conv(irho) = g2(irho)*mion*flux_ni(irho)*y(irho)
3730 flux_mtor_cond(irho) = vpr(irho)*g1(irho)*g2(irho)*mion*ni(irho) &
3731 * ( y(irho)*vconv(irho) - dy(irho)*diff(irho) )
3733 flux_mtor(irho) = flux_mtor_conv(irho) + flux_mtor_cond(irho)
3735 int_source(irho) = intfun1(irho) &
3736 + vpr(irho)*g2(irho)*btprime/2.e0_r8/bt*rho(irho)*mion*ni(irho)*y(irho)
3738 IF (vtor_bnd_type(2).EQ.0)
THEN
3741 flux_mtor(irho) = int_source(irho)
3743 flux_mtor_cond(irho)= int_source(irho) - g2(irho)*mion*flux_ni(irho)*y(irho)
3746 IF ((vpr(irho)*g1(irho)*g2(irho)*mion*ni(irho).NE.0.0_r8).and.(dy(irho).ne.0.0_r8)) &
3747 diff(irho) = - flux_mtor_cond(irho) / dy(irho) / (vpr(irho)*g1(irho)*g2(irho)*mion*ni(irho))
3748 vconv(irho) = 0.0_r8
3749 IF (diff(irho).LE.1.d-6)
THEN
3751 vconv(irho) = (flux_mtor_cond(irho) / (max(abs(vpr(irho)), 1.e-6)*g1(irho)*g2(irho)*mion*ni(irho)) + dy(irho)*diff(irho)) / max(abs(y(irho)), 1.e-6)
3756 flux_mtor_tot(irho) = flux_mtor_tot(irho) + flux_mtor(irho)
3761 profiles%VTOR(irho,iion) = vtor(irho)
3762 profiles%DVTOR(irho,iion) = dvtor(irho)
3766 profiles%MTOR(irho,iion) = mtor(irho)
3767 profiles%DIFF_VTOR(irho,iion) = diff(irho)
3768 profiles%VCONV_VTOR(irho,iion) = vconv(irho)
3769 profiles%FLUX_MTOR(irho,iion) = flux_mtor(irho)
3770 profiles%FLUX_MTOR_CONV(irho,iion) = flux_mtor_conv(irho)
3771 profiles%FLUX_MTOR_COND(irho,iion) = flux_mtor_cond(irho)
3772 profiles%SOURCE_MTOR(irho,iion) = ui_exp(irho) + uzi(irho) - (ui_imp(irho) + wzi(irho)) * vtor(irho)
3773 profiles%INT_SOURCE_MTOR(irho,iion) = int_source(irho)
3776 fun1=
profiles%SOURCE_MTOR(:,iion)*vpr
3777 CALL
integr2(nrho,rho,fun1,intfun1)
3778 profiles%INT_SOURCE_MTOR(:,iion) = intfun1
3785 rho_loop8:
DO irho=1,nrho
3786 profiles%MTOR_TOT(irho) = mtor_tot(irho)
3787 profiles%FLUX_MTOR_TOT(irho) = flux_mtor_tot(irho)
3870 REAL (R8) :: x(n), &
3873 REAL (R8) :: h(n),dy2(n)
3882 dy1(i)=((y(i+1)-y(i))*h(i-1)/h(i)+(y(i)-y(i-1))*h(i)/h(i-1)) &
3891 ddy = 2.e0_r8*((y(1)-y(2))/h(1)+(y(3)-y(2))/h(2))/(h(2)+h(1))
3892 dy1(1) = dy1(2)-ddy*h(1)
3893 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))
3894 dy1(n) = dy1(n-1)+ddy*h(n-1)
3929 REAL (R8) :: x(n), &
3933 inty(1)=y(1)*x(1)**2/2.e0_r8
3935 inty(i)=inty(i-1)+(y(i-1)*x(i-1)+y(i)*x(i))*(x(i)-x(i-1))/2.e0_r8
3944 SUBROUTINE integr2(N,X,Y,INTY) !AF 11.Oct.2011 - assumes that Y is zero f0r X.eq.0, just as INTEGR does too...
3957 REAL (R8) :: x(n), &
3961 inty(1)=y(1)*x(1)/2.e0_r8
3963 inty(i)=inty(i-1)+(y(i-1)+y(i))*(x(i)-x(i-1))/2.e0_r8
3989 REAL *8 h(n), r(n), f(n)
3996 f(1) = ((f(2)*r(4)/h(2)+f(4)*r(2)/h(3))*r(3) &
3997 -f(3)*(r(2)/h(2)+r(4)/h(3))*r(2)*r(4)/r(3)) &
4023 real(R8) r(n), f(n), d1, d2
4024 if(n.lt.3) stop
'n too small in F_par_AXIS'
4026 if(d1.le.0.0_r8) stop
'd1 <= 0 in F_par_AXIS'
4028 if(d2.le.0.0_r8) stop
'd2 <= 0 in F_par_AXIS'
4029 f(1)=f(2)-d1**2*(f(3)-f(2))/(d2**2+2*d1*d2)
subroutine solution_interface(SOLVER, ifail)
INTERFACE TO NUMERICAL SOLVER.
subroutine profiles(p0, rbphi, dp0, drbphi, a)
subroutine electron_density(GEOMETRY, PROFILES, TRANSPORT, SOURCES, EVOLUTION, CONTROL, HYPER_DIFF, ifail, failstring)
subroutine derivn(N, X, Y, DY1)
These subroutines calculate first and second derivatives, DY1 and DY2, of function Y respect to argum...
subroutine main_plasma
Main plasma.
subroutine f_axis(n, r, f)
This subroutine finds f(r_1=0) from f(r_2), f(r_3) and f(r_4)
subroutine temperatures
HEAT TRANSPORT EQUATIONS.
subroutine integr2(N, X, Y, INTY)
subroutine allocate_numerics(NDIM, NRHO, SOLVER, ifail)
subroutine flux(psitok, rk, zk, nk)
This routine calculates the collision frquencies and various exchange terms determined by collisions...
subroutine ion_density
PARTICLE TRANSPORT EQUATIONS.
subroutine rotation(GEOMETRY, PROFILES, TRANSPORT, SOURCES, EVOLUTION, CONTROL, ifail, failstring)
ROTATION TRANSPORT EQUATIONS.
subroutine current(GEOMETRY, PROFILES, TRANSPORT, SOURCES, EVOLUTION, CONTROL, j_boun, ifail, failstring)
CURRENT TRANSPORT EQUATION.
real(r8) function fdia(psi_n)
subroutine integr(N, X, Y, INTY)
This subroutine calculates integral of function Y(X)*X from X=0 until X=X(N)
subroutine deallocate_numerics(SOLVER, ifail)
Deallocate plasma profiles needed by the transport solver.
subroutine plasma_collisions(GEOMETRY, PROFILES, COLLISIONS, ifail)
subroutine quasi_neutrality(GEOMETRY, PROFILES, IMPURITY, CONTROL, ifail, failstring)
QUASI NEUTRALITY.
subroutine deallocate_collisionality(COLLISIONS, ifail)
Deallocate plasma profiles needed by the transport solver.
subroutine allocate_collisionality(NRHO, NION, COLLISIONS, ifail)
Allocate profiles of sources needed by the transport solver???
The module declares types of variables used in ETS (transport code)
subroutine evolution(T, R_in, R_out, El, Tr_l, Tr_U, Ip)
subroutine f_par_axis(n, r, f)
This subroutine finds f(r_1=0) from f(r_2), f(r_3) d/dr f(r_1)=0.