18 SUBROUTINE g_source (EQUILIBRIUM, COREPROF, CORESOURCE)
50 TYPE (type_equilibrium
),
POINTER :: equilibrium(:)
51 TYPE (type_coreprof
),
POINTER :: coreprof(:)
52 TYPE (type_coresource
),
POINTER :: coresource(:)
57 REAL(R8),
ALLOCATABLE :: amn(:)
58 REAL(R8),
ALLOCATABLE :: rho(:)
59 REAL(R8),
ALLOCATABLE :: vprime(:)
60 REAL(R8),
ALLOCATABLE :: vprime_eq(:)
61 REAL(R8),
ALLOCATABLE :: req(:)
62 REAL(R8),
ALLOCATABLE :: jni(:)
63 REAL(R8),
ALLOCATABLE :: qel(:)
64 REAL(R8),
ALLOCATABLE :: qion(:,:)
65 REAL(R8),
ALLOCATABLE :: sion(:,:)
66 REAL(R8),
ALLOCATABLE :: uion(:,:)
71 INTEGER,
PARAMETER :: nocur = 1
77 INTEGER,
ALLOCATABLE :: nzimp(:)
78 INTEGER :: nneut, ineut
79 INTEGER,
ALLOCATABLE :: ncomp(:)
80 INTEGER,
ALLOCATABLE :: ntype(:)
86 nrho =
SIZE (coreprof(1)%rho_tor, dim=1)
87 CALL
get_comp_dimensions(coreprof(1)%COMPOSITIONS, nnucl, nion, nimp, nzimp, nneut, ntype, ncomp)
95 ALLOCATE ( amn(nion) )
96 ALLOCATE ( rho(nrho) )
97 ALLOCATE ( vprime(nrho) )
98 ALLOCATE ( vprime_eq(neq) )
100 ALLOCATE ( jni(nrho) )
101 ALLOCATE ( qel(nrho) )
102 ALLOCATE ( qion(nrho,nion) )
103 ALLOCATE ( sion(nrho,nion) )
104 ALLOCATE ( uion(nrho,nion) )
109 time = coreprof(1)%time
111 amn = coreprof(1)%composition%amn
113 rho = coreprof(1)%rho_tor
115 req = equilibrium(1)%profiles_1d%rho_tor
117 CALL
l3deriv(equilibrium(1)%profiles_1d%volume, req, neq, &
120 r0 = equilibrium(1)%global_param%toroid_field%r0
122 CALL
interpolate(neq, req, vprime_eq, nrho, rho, vprime)
127 CALL
additional_source(amn, nrho, rho, r0, vprime, nion, qel, qion, sion, uion, jni)
132 coresource(1)%time = time
134 coresource(1)%VALUES(1)%rho_tor = rho
136 coresource(1)%VALUES(1)%j = jni
138 coresource(1)%VALUES(1)%qe%exp = qel
139 coresource(1)%VALUES(1)%qe%imp = 0.0e0_r8
141 coresource(1)%VALUES(1)%si%exp = sion
142 coresource(1)%VALUES(1)%si%imp = 0.0e0_r8
144 coresource(1)%VALUES(1)%qi%exp = qion
145 coresource(1)%VALUES(1)%qi%imp = 0.0e0_r8
147 coresource(1)%VALUES(1)%ui%exp = uion
148 coresource(1)%VALUES(1)%ui%imp = 0.0e0_r8
155 DEALLOCATE (vprime_eq)
183 SUBROUTINE additional_source (AMN, NRHO, RHO, R0, VPRIME, NION, QEL, QION, SION, UION, JNI)
198 INTEGER :: nrho, irho
203 REAL(R8) :: rho(nrho)
204 REAL(R8) :: vprime(nrho)
206 REAL(R8) :: amn(nion)
208 REAL(R8) :: jni(nrho)
209 REAL(R8) :: qel(nrho)
210 REAL(R8) :: qion(nrho,nion)
211 REAL(R8) :: sion(nrho,nion)
212 REAL(R8) :: uion(nrho,nion)
215 REAL(R8) :: gfun(nrho)
216 REAL(R8) :: a, c, w, intfun
225 REAL(R8) :: fwheat(1:nion+1)
226 REAL(R8) :: fract(1:nion+1)
227 REAL(R8) :: pheat(nrho)
250 LOGICAL,
SAVE :: first = .true.
251 INTEGER :: return_status
252 TYPE (type_param
) :: code_parameters
255 CALL fill_param(code_parameters,
'XML/source_dummy.xml',
'',
'XML/source_dummy.xsd')
260 IF (return_status /= 0)
THEN
261 WRITE(*,*)
'ERROR: Could not assign source multipliers.'
272 ftot = ftot + fract(i)
276 IF (ftot.NE.1.0_r8)
THEN
277 WRITE (6,*)
'Total contribution for the dummy source is not 1.0'
278 WRITE (6,*)
'Fractions will be renormalised'
287 c = fwheat(i)/2.35482_r8
290 gfun = 1.0_r8 / (2.0_r8*itm_pi)**0.5/ c &
291 * exp(-(rho-a)**2 / 2.0_r8 / c**2) &
294 CALL
integ(nrho, rho, gfun, intfun)
296 pheat = 1.0_r8 / (2.0_r8*itm_pi)**0.5/ c &
297 * exp(-(rho-a)**2 / 2.0_r8 / c**2) &
302 qion(irho,i) = pheat(irho)
304 ELSE IF (i.EQ.nion+1)
THEN
306 qel(irho) = pheat(irho)
319 IF (ami.EQ.amn(i))
THEN
322 c = fwpart/2.35482_r8
325 gfun = 1.0_r8 / (2.0_r8*itm_pi)**0.5/ c &
326 * exp(-(rho-a)**2 / 2.0_r8 / c**2) &
329 CALL
integ(nrho, rho, gfun, intfun)
331 si = 1.0_r8 / (2.0_r8*itm_pi)**0.5/ c &
332 * exp(-(rho-a)**2 / 2.0_r8 / c**2) &
336 sion(irho,i) = si(irho)
349 IF (amm.EQ.amn(i))
THEN
355 gfun = 1.0_r8 / (2.0_r8*itm_pi)**0.5/ c &
356 * exp(-(rho-a)**2 / 2.0_r8 / c**2) &
359 CALL
integ(nrho, rho, gfun, intfun)
361 ui = 1.0_r8 / (2.0_r8*itm_pi)**0.5/ c &
362 * exp(-(rho-a)**2 / 2.0_r8 / c**2) &
366 uion(irho,i) = ui(irho)
378 c = fwcurr/2.35482_r8
381 gfun(2:) = 1.0_r8 / (2.0_r8*itm_pi)**0.5/ c &
382 * exp(-(rho(2:)-a)**2 / 2.0_r8 / c**2) &
383 * vprime(2:) / 2.0_r8 / itm_pi / rho(2:)
385 IF (rho(1).EQ.0.0_r8) &
386 gfun(1) = 1.0_r8 / (2.0_r8*itm_pi)**0.5/ c &
387 * exp(-a**2 / 2.0_r8 / c**2) &
388 * 2.0_r8 * itm_pi * r0
390 CALL
integ(nrho, rho, gfun, intfun)
392 jni = 1.0_r8 / (2.0_r8*itm_pi)**0.5/ c &
393 * exp(-(rho-a)**2 / 2.0_r8 / c**2) &
430 TYPE(type_param
) :: codeparameters
431 INTEGER(ITM_I4) :: return_status
433 TYPE(tree
) :: parameter_list
434 TYPE(element
),
POINTER :: temp_pointer
435 INTEGER(ITM_I4) :: i, nparm, n_values
436 CHARACTER(len = 132) :: cname
444 WRITE(6,*)
'Calling euitm_xml_parse'
445 CALL euitm_xml_parse(codeparameters, nparm, parameter_list)
446 WRITE(6,*)
'Called euitm_xml_parse'
450 temp_pointer => parameter_list%first
453 cname = char2str(temp_pointer%cname)
459 temp_pointer => temp_pointer%child
464 temp_pointer => temp_pointer%child
468 IF (
ALLOCATED(temp_pointer%cvalue)) &
469 CALL char2num(temp_pointer%cvalue, wtot)
472 IF (
ALLOCATED(temp_pointer%cvalue)) &
473 CALL char2num(temp_pointer%cvalue, rheat)
476 IF (
ALLOCATED(temp_pointer%cvalue)) &
477 CALL scan_str2real(char2str(temp_pointer%cvalue), fract, n_data)
480 IF (
ALLOCATED(temp_pointer%cvalue)) &
481 CALL scan_str2real(char2str(temp_pointer%cvalue), fwheat, n_data)
486 temp_pointer => temp_pointer%child
490 IF (
ALLOCATED(temp_pointer%cvalue)) &
491 CALL char2num(temp_pointer%cvalue, ami)
494 IF (
ALLOCATED(temp_pointer%cvalue)) &
495 CALL char2num(temp_pointer%cvalue, stot)
498 IF (
ALLOCATED(temp_pointer%cvalue)) &
499 CALL char2num(temp_pointer%cvalue, rpart)
502 IF (
ALLOCATED(temp_pointer%cvalue)) &
503 CALL char2num(temp_pointer%cvalue, fwpart)
508 temp_pointer => temp_pointer%child
512 IF (
ALLOCATED(temp_pointer%cvalue)) &
513 CALL char2num(temp_pointer%cvalue, amm)
516 IF (
ALLOCATED(temp_pointer%cvalue)) &
517 CALL char2num(temp_pointer%cvalue, utot)
520 IF (
ALLOCATED(temp_pointer%cvalue)) &
521 CALL char2num(temp_pointer%cvalue, rmom)
524 IF (
ALLOCATED(temp_pointer%cvalue)) &
525 CALL char2num(temp_pointer%cvalue, fwmom)
530 temp_pointer => temp_pointer%child
534 IF (
ALLOCATED(temp_pointer%cvalue)) &
535 CALL char2num(temp_pointer%cvalue, jnitot)
538 IF (
ALLOCATED(temp_pointer%cvalue)) &
539 CALL char2num(temp_pointer%cvalue, rcurr)
542 IF (
ALLOCATED(temp_pointer%cvalue)) &
543 CALL char2num(temp_pointer%cvalue, fwcurr)
548 WRITE(*, *)
'ERROR: invalid parameter', cname
555 IF (
ASSOCIATED(temp_pointer%sibling))
THEN
556 temp_pointer => temp_pointer%sibling
559 IF (
ASSOCIATED(temp_pointer%parent, parameter_list%first )) &
561 IF (
ASSOCIATED(temp_pointer%parent))
THEN
562 temp_pointer => temp_pointer%parent
564 WRITE(*, *)
'ERROR: broken list.'
572 CALL destroy_xml_tree(parameter_list)
613 inty = inty + (y(i)+y(i-1))*(x(i)-x(i-1))/2.e0_r8
635 INTEGER :: i,ii,jj, ninput,nout
637 REAL (R8) :: rinput(ninput),finput(ninput)
639 REAL (R8) :: rout(nout),fout(nout)
640 REAL (R8) :: f(2),r,h1,h2,y1,y2,y3,a,b,c,z
645 IF(r.LE.rinput(2))
THEN
646 h1=rinput(2)-rinput(1)
647 h2=rinput(3)-rinput(2)
651 a=((y1-y2)*h2+(y3-y2)*h1)/h1/h2/(h1+h2)
652 b=((y3-y2)*h1*h1-(y1-y2)*h2*h2)/h1/h2/(h1+h2)
654 z=a*(r-rinput(2))**2+b*(r-rinput(2))+c
657 IF(r.GT.rinput(2).AND.r.LE.rinput(ninput-1))
THEN
659 IF(r.GT.rinput(ii-1).AND.r.LE.rinput(ii))
THEN
661 h1=rinput(ii-2+jj)-rinput(ii-3+jj)
662 h2=rinput(ii-1+jj)-rinput(ii-2+jj)
666 a=((y1-y2)*h2+(y3-y2)*h1)/h1/h2/(h1+h2)
667 b=((y3-y2)*h1*h1-(y1-y2)*h2*h2)/h1/h2/(h1+h2)
669 f(jj)=a*(r-rinput(ii-2+jj))**2+b*(r-rinput(ii-2+jj))+c
671 z=(f(1)*(rinput(ii)-r)+f(2)*(r-rinput(ii-1)))/ &
672 (rinput(ii)-rinput(ii-1))
677 IF(r.GE.rinput(ninput-1))
THEN
678 h1=rinput(ninput-1)-rinput(ninput-2)
679 h2=rinput(ninput)-rinput(ninput-1)
683 a=((y1-y2)*h2+(y3-y2)*h1)/h1/h2/(h1+h2)
684 b=((y3-y2)*h1*h1-(y1-y2)*h2*h2)/h1/h2/(h1+h2)
686 z=a*(r-rinput(ninput-1))**2+b*(r-rinput(ninput-1))+c
693 IF(rinput(1).EQ.rout(1))
THEN
694 IF(finput(1).NE.fout(1))
THEN
695 WRITE(*,*)
'INTERPOLATION corrected for ',rinput(1),finput(1),fout(1)
subroutine l3deriv(y_in, x_in, nr_in, dydx_out, x_out, nr_out)
subroutine additional_source(AMN, ZN, ZION, NRHO, RHO, R0, VPRIME, NION, QEL, QION, SEL, SION, UION, JNI, code_parameters)
subroutine g_source(EQUILIBRIUM, COREPROF, CORESOURCE)
subroutine get_comp_dimensions(COMPOSITIONS, NNUCL, NION, NIMP, NZIMP, NNEUT, NTYPE, NCOMP)
subroutine integ(N, X, Y, INTY)
This module contains routines for allocation/deallocation if CPOs used in ETS.
Module provides the dummy source to the ETS.
subroutine allocate_coresource_cpo(NSLICE, NRHO, NNUCL, NION, NIMP, NZIMP, NNEUT, NTYPE, NCOMP, CORESOURCE)
This routine allocates CORESOURCE CPO.
subroutine assign_dummy_sources(codeparameters, return_status)