23 (coreprof, coresource, &
24 coresource1, coresource2, coresource3, &
25 coresource4, coresource5, coresource6, &
27 coresource_out, amix_src, code_parameters)
35 USE deallocate_structures
42 INTEGER,
PARAMETER :: num_source=7
46 TYPE (type_coreprof
),
POINTER :: coreprof(:)
47 TYPE (type_coresource
),
POINTER :: coresource(:)
49 TYPE (type_coresource
),
POINTER :: coresource1(:)
50 TYPE (type_coresource
),
POINTER :: coresource2(:)
51 TYPE (type_coresource
),
POINTER :: coresource3(:)
52 TYPE (type_coresource
),
POINTER :: coresource4(:)
53 TYPE (type_coresource
),
POINTER :: coresource5(:)
54 TYPE (type_coresource
),
POINTER :: coresource6(:)
55 TYPE (type_coresource
),
POINTER :: coresource7(:)
56 TYPE (type_coresource
),
POINTER :: coresource_out(:)
57 TYPE (type_coresource
),
POINTER :: coresource_arr(:)
58 TYPE (type_coresource
),
POINTER :: coresource_mix(:)
60 TYPE (type_param
) :: code_parameters
67 REAL (R8),
SAVE :: c_j_exp(num_source) = 0.0_r8
68 REAL (R8),
SAVE :: c_sigma(num_source) = 0.0_r8
69 REAL (R8),
SAVE :: c_se_exp(num_source) = 0.0_r8
70 REAL (R8),
SAVE :: c_se_imp(num_source) = 0.0_r8
71 REAL (R8),
SAVE :: c_si_exp(num_source) = 0.0_r8
72 REAL (R8),
SAVE :: c_si_imp(num_source) = 0.0_r8
73 REAL (R8),
SAVE :: c_sz_exp(num_source) = 0.0_r8
74 REAL (R8),
SAVE :: c_sz_imp(num_source) = 0.0_r8
75 REAL (R8),
SAVE :: c_qe_exp(num_source) = 0.0_r8
76 REAL (R8),
SAVE :: c_qe_imp(num_source) = 0.0_r8
77 REAL (R8),
SAVE :: c_qi_exp(num_source) = 0.0_r8
78 REAL (R8),
SAVE :: c_qi_imp(num_source) = 0.0_r8
79 REAL (R8),
SAVE :: c_qz_exp(num_source) = 0.0_r8
80 REAL (R8),
SAVE :: c_qz_imp(num_source) = 0.0_r8
81 REAL (R8),
SAVE :: c_ui_exp(num_source) = 0.0_r8
82 REAL (R8),
SAVE :: c_ui_imp(num_source) = 0.0_r8
84 REAL (R8),
ALLOCATABLE :: rho_tor(:)
88 INTEGER,
PARAMETER :: nslice = 1
93 INTEGER,
ALLOCATABLE :: nzimp(:)
94 INTEGER :: nneut, ineut
95 INTEGER,
ALLOCATABLE :: ncomp(:)
96 INTEGER,
ALLOCATABLE :: ntype(:)
99 INTEGER :: inum, ival, iarr
100 INTEGER :: return_status
109 IF (return_status /= 0)
THEN
110 WRITE(*,*)
'ERROR: Could not assign source multipliers.'
117 nrho =
SIZE(coreprof(1)%rho_tor)
118 ALLOCATE (rho_tor(nrho))
120 CALL
get_comp_dimensions(coreprof(1)%COMPOSITIONS, nnucl, nion, nimp, nzimp, nneut, ntype, ncomp)
125 CALL deallocate_cpo(coresource_out(1)%compositions)
126 CALL copy_cpo(coreprof(1)%compositions, coresource_out(1)%compositions)
129 rho_tor = coreprof(1)%rho_tor
130 coresource_out(1)%VALUES(1)%rho_tor = rho_tor
133 coresource_arr(inum)%VALUES(1)%rho_tor = coresource_out(1)%VALUES(1)%rho_tor
134 CALL deallocate_cpo(coresource_arr(inum)%compositions)
135 CALL copy_cpo(coresource_out(1)%compositions, coresource_arr(inum)%compositions)
151 DO inum=1, num_source
153 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%j) .AND. c_j_exp(inum).NE.0.0_r8) &
154 coresource_out(1)%VALUES(1)%j = coresource_out(1)%VALUES(1)%j + &
155 coresource_arr(inum)%VALUES(1)%j * c_j_exp(inum)
158 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%sigma) .AND. c_sigma(inum).NE.0.0_r8) &
159 coresource_out(1)%VALUES(1)%sigma = coresource_out(1)%VALUES(1)%sigma + &
160 c_sigma(inum) * coresource_arr(inum)%VALUES(1)%sigma
163 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Se%exp) .AND. c_se_exp(inum).NE.0.0_r8) &
164 coresource_out(1)%VALUES(1)%Se%exp = coresource_out(1)%VALUES(1)%Se%exp + &
165 c_se_exp(inum) * coresource_arr(inum)%VALUES(1)%Se%exp
166 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Se%imp) .AND. c_se_imp(inum).NE.0.0_r8) &
167 coresource_out(1)%VALUES(1)%Se%imp = coresource_out(1)%VALUES(1)%Se%imp + &
168 c_se_imp(inum) * coresource_arr(inum)%VALUES(1)%Se%imp
170 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Qe%exp) .AND. c_qe_exp(inum).NE.0.0_r8) &
171 coresource_out(1)%VALUES(1)%Qe%exp = coresource_out(1)%VALUES(1)%Qe%exp + &
172 c_qe_exp(inum) * coresource_arr(inum)%VALUES(1)%Qe%exp
173 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Qe%imp) .AND. c_qe_imp(inum).NE.0.0_r8) &
174 coresource_out(1)%VALUES(1)%Qe%imp = coresource_out(1)%VALUES(1)%Qe%imp + &
175 c_qe_imp(inum) * coresource_arr(inum)%VALUES(1)%Qe%imp
179 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Si%exp) .AND. c_si_exp(inum).NE.0.0_r8) &
180 coresource_out(1)%VALUES(1)%Si%exp = coresource_out(1)%VALUES(1)%Si%exp + &
181 c_si_exp(inum) * coresource_arr(inum)%VALUES(1)%Si%exp
182 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Si%imp) .AND. c_si_imp(inum).NE.0.0_r8) &
183 coresource_out(1)%VALUES(1)%Si%imp = coresource_out(1)%VALUES(1)%Si%imp + &
184 c_si_imp(inum) * coresource_arr(inum)%VALUES(1)%Si%imp
187 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Qi%exp) .AND. c_qi_exp(inum).NE.0.0_r8) &
188 coresource_out(1)%VALUES(1)%Qi%exp = coresource_out(1)%VALUES(1)%Qi%exp + &
189 c_qi_exp(inum) * coresource_arr(inum)%VALUES(1)%Qi%exp
190 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Qi%imp) .AND. c_qi_imp(inum).NE.0.0_r8) &
191 coresource_out(1)%VALUES(1)%Qi%imp = coresource_out(1)%VALUES(1)%Qi%imp + &
192 c_qi_imp(inum) * coresource_arr(inum)%VALUES(1)%Qi%imp
195 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Ui%exp) .AND. c_ui_exp(inum).NE.0.0_r8) &
196 coresource_out(1)%VALUES(1)%Ui%exp = coresource_out(1)%VALUES(1)%Ui%exp + &
197 c_ui_exp(inum) * coresource_arr(inum)%VALUES(1)%Ui%exp
198 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Ui%imp) .AND. c_ui_imp(inum).NE.0.0_r8) &
199 coresource_out(1)%VALUES(1)%Ui%imp = coresource_out(1)%VALUES(1)%Ui%imp + &
200 c_ui_imp(inum) * coresource_arr(inum)%VALUES(1)%Ui%imp
205 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Sz(iimp)%exp) .AND. c_sz_exp(inum).NE.0.0_r8) &
206 coresource_out(1)%VALUES(1)%Sz(iimp)%exp = coresource_out(1)%VALUES(1)%Sz(iimp)%exp + &
207 c_sz_exp(inum) * coresource_arr(inum)%VALUES(1)%Sz(iimp)%exp
208 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Sz(iimp)%imp) .AND. c_sz_imp(inum).NE.0.0_r8) &
209 coresource_out(1)%VALUES(1)%Sz(iimp)%imp = coresource_out(1)%VALUES(1)%Sz(iimp)%imp + &
210 c_sz_imp(inum) * coresource_arr(inum)%VALUES(1)%Sz(iimp)%imp
212 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Qz(iimp)%exp) .AND. c_qz_exp(inum).NE.0.0_r8) &
213 coresource_out(1)%VALUES(1)%Qz(iimp)%exp = coresource_out(1)%VALUES(1)%Qz(iimp)%exp + &
214 c_qz_exp(inum) * coresource_arr(inum)%VALUES(1)%Qz(iimp)%exp
215 IF (
ASSOCIATED(coresource_arr(inum)%VALUES(1)%Qz(iimp)%imp) .AND. c_qz_imp(inum).NE.0.0_r8) &
216 coresource_out(1)%VALUES(1)%Qz(iimp)%imp = coresource_out(1)%VALUES(1)%Qz(iimp)%imp + &
217 c_qz_imp(inum) * coresource_arr(inum)%VALUES(1)%Qz(iimp)%imp
226 CALL deallocate_cpo(coresource_mix(1)%VALUES(1)%rho_tor)
227 CALL copy_cpo(coresource_out(1)%VALUES(1)%rho_tor, coresource_mix(1)%VALUES(1)%rho_tor)
228 CALL deallocate_cpo(coresource_mix(1)%compositions)
229 CALL copy_cpo(coresource_out(1)%compositions, coresource_mix(1)%compositions)
233 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%j)) &
234 coresource_out(1)%VALUES(1)%j = coresource_out(1)%VALUES(1)%j * amix_src + &
235 coresource_mix(1)%VALUES(1)%J * (1.0_r8 - amix_src)
238 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%sigma)) &
239 coresource_out(1)%VALUES(1)%sigma = coresource_out(1)%VALUES(1)%sigma * amix_src + &
240 coresource_mix(1)%VALUES(1)%sigma * (1.0_r8 - amix_src)
243 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Si%exp)) &
244 coresource_out(1)%VALUES(1)%Si%exp = coresource_out(1)%VALUES(1)%Si%exp * amix_src + &
245 coresource_mix(1)%VALUES(1)%Si%exp * (1.0_r8 - amix_src)
246 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Si%imp)) &
247 coresource_out(1)%VALUES(1)%Si%imp = coresource_out(1)%VALUES(1)%Si%imp * amix_src + &
248 coresource_mix(1)%VALUES(1)%Si%imp * (1.0_r8 - amix_src)
250 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Se%exp)) &
251 coresource_out(1)%VALUES(1)%Se%exp = coresource_out(1)%VALUES(1)%Se%exp * amix_src + &
252 coresource_mix(1)%VALUES(1)%Se%exp * (1.0_r8 - amix_src)
253 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Se%imp)) &
254 coresource_out(1)%VALUES(1)%Se%imp = coresource_out(1)%VALUES(1)%Se%imp * amix_src + &
255 coresource_mix(1)%VALUES(1)%Se%imp * (1.0_r8 - amix_src)
257 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Qi%exp)) &
258 coresource_out(1)%VALUES(1)%Qi%exp = coresource_out(1)%VALUES(1)%Qi%exp * amix_src + &
259 coresource_mix(1)%VALUES(1)%Qi%exp * (1.0_r8 - amix_src)
260 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Qi%imp)) &
261 coresource_out(1)%VALUES(1)%Qi%imp = coresource_out(1)%VALUES(1)%Qi%imp * amix_src + &
262 coresource_mix(1)%VALUES(1)%Qi%imp * (1.0_r8 - amix_src)
264 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Qe%exp)) &
265 coresource_out(1)%VALUES(1)%Qe%exp = coresource_out(1)%VALUES(1)%Qe%exp * amix_src + &
266 coresource_mix(1)%VALUES(1)%Qe%exp * (1.0_r8 - amix_src)
267 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Qe%imp)) &
268 coresource_out(1)%VALUES(1)%Qe%imp = coresource_out(1)%VALUES(1)%Qe%imp * amix_src + &
269 coresource_mix(1)%VALUES(1)%Qe%imp * (1.0_r8 - amix_src)
271 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Ui%exp)) &
272 coresource_out(1)%VALUES(1)%Ui%exp = coresource_out(1)%VALUES(1)%Ui%exp * amix_src + &
273 coresource_mix(1)%VALUES(1)%Ui%exp * (1.0_r8 - amix_src)
274 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Ui%imp)) &
275 coresource_out(1)%VALUES(1)%Ui%imp = coresource_out(1)%VALUES(1)%Ui%imp * amix_src + &
276 coresource_mix(1)%VALUES(1)%Ui%imp * (1.0_r8 - amix_src)
280 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Sz(iimp)%exp)) &
281 coresource_out(1)%VALUES(1)%Sz(iimp)%exp = coresource_out(1)%VALUES(1)%Sz(iimp)%exp * amix_src + &
282 coresource_mix(1)%VALUES(1)%Sz(iimp)%exp * (1.0_r8 - amix_src)
283 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Sz(iimp)%imp)) &
284 coresource_out(1)%VALUES(1)%Sz(iimp)%imp = coresource_out(1)%VALUES(1)%Sz(iimp)%imp * amix_src + &
285 coresource_mix(1)%VALUES(1)%Sz(iimp)%imp * (1.0_r8 - amix_src)
288 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Qz(iimp)%exp)) &
289 coresource_out(1)%VALUES(1)%Qz(iimp)%exp = coresource_out(1)%VALUES(1)%Qz(iimp)%exp * amix_src + &
290 coresource_mix(1)%VALUES(1)%Qz(iimp)%exp * (1.0_r8 - amix_src)
291 IF (
ASSOCIATED(coresource_mix(1)%VALUES(1)%Qz(iimp)%imp)) &
292 coresource_out(1)%VALUES(1)%Qz(iimp)%imp = coresource_out(1)%VALUES(1)%Qz(iimp)%imp * amix_src + &
293 coresource_mix(1)%VALUES(1)%Qz(iimp)%imp * (1.0_r8 - amix_src)
299 IF(
ALLOCATED(rho_tor))
DEALLOCATE ( rho_tor )
300 IF(
ALLOCATED(nzimp))
DEALLOCATE ( nzimp )
301 IF(
ALLOCATED(ncomp))
DEALLOCATE ( ncomp )
302 IF(
ALLOCATED(ntype))
DEALLOCATE ( ntype )
303 CALL deallocate_cpo(coresource_arr)
304 CALL deallocate_cpo(coresource_mix)
309 ALLOCATE (coresource_out(1)%VALUES(1)%sourceid%id(1))
310 ALLOCATE (coresource_out(1)%VALUES(1)%sourceid%description(1))
311 coresource_out(1)%VALUES(1)%sourceid%id =
'combined'
312 coresource_out(1)%VALUES(1)%sourceid%flag = 30
313 coresource_out(1)%VALUES(1)%sourceid%description =
'Combined source'
319 ALLOCATE (coresource_arr(num_source))
320 CALL copy_cpo(coresource1(1), coresource_arr(1))
321 CALL copy_cpo(coresource2(1), coresource_arr(2))
322 CALL copy_cpo(coresource3(1), coresource_arr(3))
323 CALL copy_cpo(coresource4(1), coresource_arr(4))
324 CALL copy_cpo(coresource5(1), coresource_arr(5))
325 CALL copy_cpo(coresource6(1), coresource_arr(6))
326 CALL copy_cpo(coresource7(1), coresource_arr(7))
329 DO inum = 1, num_source
330 iarr = iarr +
SIZE(coresource_arr(inum)%VALUES)
332 ALLOCATE (coresource_mix(1))
333 ALLOCATE (coresource_mix(1)%VALUES(iarr))
335 CALL copy_cpo(coresource_out(1)%VALUES(1), coresource_mix(1)%VALUES(1))
336 CALL deallocate_cpo(coresource_out(1)%VALUES)
337 ALLOCATE (coresource_out(1)%VALUES(iarr))
338 CALL copy_cpo(coresource_mix(1)%VALUES(1), coresource_out(1)%VALUES(1))
342 DO inum = 1, num_source
343 DO iarr = 1,
SIZE(coresource_arr(inum)%VALUES)
344 CALL copy_cpo(coresource_arr(inum)%VALUES(iarr), coresource_out(1)%VALUES(ival))
345 IF (.NOT.
ASSOCIATED(coresource_out(1)%VALUES(ival)%sourceid%id))
THEN
346 ALLOCATE (coresource_out(1)%VALUES(ival)%sourceid%id(1))
347 coresource_out(1)%VALUES(ival)%sourceid%id =
'unspecified'
348 coresource_out(1)%VALUES(ival)%sourceid%flag = 0
349 IF (.NOT.
ASSOCIATED(coresource_out(1)%VALUES(ival)%sourceid%description))
THEN
350 ALLOCATE(coresource_out(1)%VALUES(ival)%sourceid%description(1))
351 coresource_out(1)%VALUES(ival)%sourceid%description =
'Unspecified source type'
358 CALL deallocate_cpo(coresource_arr)
359 CALL deallocate_cpo(coresource_mix)
392 TYPE(type_param
) :: codeparameters
393 INTEGER(ITM_I4) :: return_status
395 CHARACTER(len = 132) :: prefix
418 prefix =
'parameters/CURRENT/jni'
420 prefix =
'parameters/CURRENT/conductivity'
422 prefix =
'parameters/NE/explicit_source'
424 prefix =
'parameters/NE/implicit_source'
426 prefix =
'parameters/NI/explicit_source'
428 prefix =
'parameters/NI/implicit_source'
430 prefix =
'parameters/NZ/explicit_source'
432 prefix =
'parameters/NZ/implicit_source'
434 prefix =
'parameters/TE/explicit_source'
436 prefix =
'parameters/TE/implicit_source'
438 prefix =
'parameters/TI/explicit_source'
440 prefix =
'parameters/TI/implicit_source'
442 prefix =
'parameters/TZ/explicit_source'
444 prefix =
'parameters/TZ/implicit_source'
446 prefix =
'parameters/VTOR/explicit_source'
448 prefix =
'parameters/VTOR/implicit_source'
469 TYPE(type_param
) :: codeparameters
470 INTEGER(ITM_I4) :: return_status
472 CHARACTER(len = 132) :: prefix
473 CHARACTER(len = 132) :: multiplier_path(num_source)
474 CHARACTER(len = 132) :: parameter_value
475 REAL(R8) :: multipliers(num_source)
478 TYPE(element
),
POINTER :: temp_pointer
479 TYPE(tree
) :: parameter_list
481 INTEGER(ITM_I4) :: i_src, nval
482 INTEGER(ITM_I4) :: nparm
484 multiplier_path(1) = trim(adjustl(prefix))//
"/from_input_CPOs/Multipliers_for_contributions_from/Data_Base"
485 multiplier_path(2) = trim(adjustl(prefix))//
"/from_input_CPOs/Multipliers_for_contributions_from/Gaussian"
486 multiplier_path(3) = trim(adjustl(prefix))//
"/from_input_CPOs/Multipliers_for_contributions_from/Synchrotron"
487 multiplier_path(4) = trim(adjustl(prefix))//
"/from_input_CPOs/Multipliers_for_contributions_from/HCD"
488 multiplier_path(5) = trim(adjustl(prefix))//
"/from_input_CPOs/Multipliers_for_contributions_from/Neutrals"
489 multiplier_path(6) = trim(adjustl(prefix))//
"/from_input_CPOs/Multipliers_for_contributions_from/Impurity"
490 multiplier_path(7) = trim(adjustl(prefix))//
"/from_input_CPOs/Multipliers_for_contributions_from/Neoclassical"
493 CALL euitm_xml_parse(codeparameters, nparm, parameter_list)
495 DO i_src = 1, num_source
496 temp_pointer => parameter_list%first
497 CALL find_parameter(multiplier_path(i_src), parameter_value, temp_pointer)
498 IF (len(trim(parameter_value)).GE.1)
THEN
499 CALL scan_str2real(parameter_value, value ,nval)
500 multipliers(i_src) = value(1)
505 CALL destroy_xml_tree(parameter_list)
subroutine get_comp_dimensions(COMPOSITIONS, NNUCL, NION, NIMP, NZIMP, NNEUT, NTYPE, NCOMP)
This module contains routines for allocation/deallocation if CPOs used in ETS.
subroutine allocate_coresource_cpo(NSLICE, NRHO, NNUCL, NION, NIMP, NZIMP, NNEUT, NTYPE, NCOMP, CORESOURCE)
This routine allocates CORESOURCE CPO.
subroutine interpolate_source(CORESOURCE_IN, CORESOURCE_OUT)
subroutine assign_combiner_parameters(codeparameters, return_status)
subroutine assign_multipliers(prefix, codeparameters, return_status, multipliers)
subroutine combine_sources(COREPROF, CORESOURCE, CORESOURCE1, CORESOURCE2, CORESOURCE3, CORESOURCE4, CORESOURCE5, CORESOURCE6, CORESOURCE7, CORESOURCE_OUT, AMIX_SRC, code_parameters)