34 TYPE (type_coreprof
),
POINTER :: coreprof(:)
35 TYPE (type_coreimpur
),
POINTER :: coreimpur_in(:)
36 TYPE (type_coreimpur
),
POINTER :: coreimpur(:)
39 TYPE (type_param
) :: code_parameters
47 diag%ERROR_MESSAGE =
""
54 IF (diag%IERR .LT. 0) goto 112
57 CALL copy_cpo(coreimpur_in, coreimpur)
60 DO iimp = 1, min(param%NIMP,
SIZE(coreimpur(1)%IMPURITY))
61 IF(trim(adjustl(param%PROFILE(iimp))).EQ.
"constant")
THEN
62 coreimpur(1)%IMPURITY(iimp)%nz(:,:) =0.0_r8
64 IF (diag%IERR .LT. 0) goto 112
67 IF(trim(adjustl(param%PROFILE(iimp))).EQ.
"derived")
THEN
68 coreimpur(1)%IMPURITY(iimp)%nz(:,:) =0.0_r8
70 IF (diag%IERR .LT. 0) goto 112
73 IF(trim(adjustl(param%PROFILE(iimp))).EQ.
"coronal")
THEN
74 coreimpur(1)%IMPURITY(iimp)%nz(:,:) =0.0_r8
76 IF (diag%IERR .LT. 0) goto 112
81 112
ALLOCATE (coreimpur(1)%codeparam%codename(1))
82 ALLOCATE (coreimpur(1)%codeparam%codeversion(1))
83 ALLOCATE (coreimpur(1)%codeparam%output_diag(1))
85 coreimpur(1)%codeparam%codename =
'IMPURITY MANIPULATOR'
86 coreimpur(1)%codeparam%codeversion =
'IMPURITY MANIPULATOR_4.10b.10'
87 coreimpur(1)%codeparam%output_flag = diag%IERR
88 coreimpur(1)%codeparam%output_diag(1) =
"IMPURITY MANIPULATOR: "//trim(adjustl(diag%ERROR_MESSAGE))
105 TYPE(type_param
) :: code_parameters
107 TYPE(tree
) :: parameter_list
108 TYPE(element
),
POINTER :: temp_pointer
109 INTEGER(ITM_I4) :: nparam
110 CHARACTER(len = 132) :: parameter_value
111 CHARACTER(len = 264) :: code_param_name
112 CHARACTER(len = 6) :: cvalue(10)
113 REAL (R8) :: value(10)
118 LOGICAL :: imp_element(3) = .false.
120 INTEGER :: i, iimp, iz
122 CHARACTER(len = 132) :: prefix
125 diag%ERROR_MESSAGE =
" "
128 CALL euitm_xml_parse(code_parameters, nparam, parameter_list)
134 temp_pointer => parameter_list%first
135 code_param_name =
'parameters/IMPURITY1/Define_impurity/zn'
136 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
137 IF (len(trim(parameter_value)).GE.1)
THEN
139 imp_element(1) = .true.
140 CALL scan_str2real(parameter_value, value ,nval)
141 max_z_imp = max(max_z_imp, int(value(1)))
144 temp_pointer => parameter_list%first
145 code_param_name =
'parameters/IMPURITY2/Define_impurity/zn'
146 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
147 IF (len(trim(parameter_value)).GE.1)
THEN
149 imp_element(2) = .true.
150 CALL scan_str2real(parameter_value, value ,nval)
151 max_z_imp = max(max_z_imp, int(value(1)))
154 temp_pointer => parameter_list%first
155 code_param_name =
'parameters/IMPURITY3/Define_impurity/zn'
156 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
157 IF (len(trim(parameter_value)).GE.1)
THEN
159 imp_element(3) = .true.
160 CALL scan_str2real(parameter_value, value ,nval)
161 max_z_imp = max(max_z_imp, int(value(1)))
167 diag%ERROR_MESSAGE = trim(adjustl(diag%ERROR_MESSAGE))//
" ASSIGN_PARAM: no impurities are defined."
168 diag%IERR = diag%IERR+1
176 IF (imp_element(i).EQ. .true.)
THEN
178 WRITE (prefix,
"(a19,i1,a17)")
"parameters/IMPURITY",i,
"/Define_impurity/"
180 code_param_name = trim(adjustl(prefix))//
"amn"
181 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
182 IF (len(trim(parameter_value)).GE.1)
THEN
183 CALL scan_str2real(parameter_value, value ,nval)
184 param%AMN_IMP(iimp) = value(1)
187 code_param_name = trim(adjustl(prefix))//
"zn"
188 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
189 IF (len(trim(parameter_value)).GE.1)
THEN
190 CALL scan_str2real(parameter_value, value ,nval)
191 param%ZN_IMP(iimp) = value(1)
197 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/all_radially_constant/Densities"
198 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
199 IF (len(trim(parameter_value)).GE.1)
THEN
200 param%PROFILE(iimp) =
"constant"
201 param%ISTATE(iimp) =
"all"
202 CALL scan_str2real(parameter_value, value ,nval)
203 param%DENS(iimp,:) = value(:)
204 IF (nval.LT.param%ZN_IMP(iimp))
THEN
205 diag%ERROR_MESSAGE = trim(adjustl(diag%ERROR_MESSAGE))//
" you did not specify densities for all ionization states."
206 diag%IERR = diag%IERR+1
210 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/coronal_distribution/Total_Density"
211 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
212 IF (len(trim(parameter_value)).GE.1)
THEN
213 param%PROFILE(iimp) =
"coronal"
214 param%ISTATE(iimp) =
"all"
215 CALL scan_str2real(parameter_value, value ,nval)
216 param%DENS(iimp,1) = value(1)
220 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/all_proportional_to_source_profile/Fractions"
221 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
222 IF (len(trim(parameter_value)).GE.1)
THEN
223 param%PROFILE(iimp) =
"derived"
224 param%ISTATE(iimp) =
"all"
225 CALL scan_str2real(parameter_value, value ,nval)
226 param%FRA(iimp,:) = value(:)
227 IF (nval.LT.param%ZN_IMP(iimp))
THEN
228 diag%ERROR_MESSAGE = trim(adjustl(diag%ERROR_MESSAGE))//
" you did not specify fractions for all ionization states."
229 diag%IERR = diag%IERR+1
232 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/all_proportional_to_source_profile/Source_profile/ions/extrapolate_from/selected_ion/amn"
234 IF (len(trim(parameter_value)).GE.1)
THEN
235 param%PROF_SOURCE(iimp) =
"selected_ion"
236 CALL scan_str2real(parameter_value, value ,nval)
237 param%AMN_ION(iimp) = value(1)
238 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/all_proportional_to_source_profile/Source_profile/ions/extrapolate_from/selected_ion/zn"
240 IF (len(trim(parameter_value)).GE.1)
THEN
241 CALL scan_str2real(parameter_value, value ,nval)
242 param%ZN_ION(iimp) = value(1)
244 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/all_proportional_to_source_profile/Source_profile/ions/extrapolate_from/selected_ion/zion"
246 IF (len(trim(parameter_value)).GE.1)
THEN
247 CALL scan_str2real(parameter_value, value ,nval)
248 param%Z_ION(iimp) = value(1)
251 param%PROF_SOURCE(iimp) =
"ions_total"
254 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/all_proportional_to_source_profile/Source_profile/electrons/NOTE"
256 IF (len(trim(parameter_value)).GE.1)
THEN
257 param%PROF_SOURCE(iimp) =
"electrons"
263 code_param_name = trim(adjustl(prefix))//
"ionization_states/fully_stripped_state_only/Profile/radially_constant/Density"
264 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
265 IF (len(trim(parameter_value)).GE.1)
THEN
266 param%PROFILE(iimp) =
"constant"
267 param%ISTATE(iimp) =
"fully_stipped"
268 CALL scan_str2real(parameter_value, value ,nval)
269 param%DENS(iimp,1) = value(1)
272 code_param_name = trim(adjustl(prefix))//
"ionization_states/fully_stripped_state_only/Profile/proportional_to_source_profile/Fraction"
274 IF (len(trim(parameter_value)).GE.1)
THEN
275 param%PROFILE(iimp) =
"derived"
276 param%ISTATE(iimp) =
"fully_stipped"
277 CALL scan_str2real(parameter_value, value ,nval)
278 param%FRA(iimp,param%ZN_IMP(iimp)) = value(1)
280 code_param_name = trim(adjustl(prefix))//
"ionization_states/fully_stripped_state_only/Profile/proportional_to_source_profile/Source_profile/ions/extrapolate_from/selected_ion/amn"
282 IF (len(trim(parameter_value)).GE.1)
THEN
283 param%PROF_SOURCE(iimp) =
"selected_ion"
284 CALL scan_str2real(parameter_value, value ,nval)
285 param%AMN_ION(iimp) = value(1)
286 code_param_name = trim(adjustl(prefix))//
"ionization_states/fully_stripped_state_only/Profile/proportional_to_source_profile/Source_profile/ions/extrapolate_from/selected_ion/zn"
288 IF (len(trim(parameter_value)).GE.1)
THEN
289 CALL scan_str2real(parameter_value, value ,nval)
290 param%ZN_ION(iimp) = value(1)
292 code_param_name = trim(adjustl(prefix))//
"ionization_states/fully_stripped_state_only/Profile/proportional_to_source_profile/Source_profile/ions/extrapolate_from/selected_ion/zion"
294 IF (len(trim(parameter_value)).GE.1)
THEN
295 CALL scan_str2real(parameter_value, value ,nval)
296 param%Z_ION(iimp) = value(1)
299 param%PROF_SOURCE(iimp) =
"ions_total"
302 code_param_name = trim(adjustl(prefix))//
"ionization_states/fully_stripped_state_only/Profile/proportional_to_source_profile/Source_profile/electrons/NOTE"
304 IF (len(trim(parameter_value)).GE.1)
THEN
305 param%PROF_SOURCE(iimp) =
"electrons"
310 IF (trim(adjustl(param%ISTATE(iimp))).EQ.
"all")
THEN
311 DO iz=1,int(param%ZN_IMP(iimp))
312 param%Z_IMP(iimp,iz) = iz
314 ELSE IF (trim(adjustl(param%ISTATE(iimp))).EQ.
"fully_stipped")
THEN
315 param%Z_IMP(iimp,1) = int(param%ZN_IMP(iimp))
335 use string_manipulation_tools
336 CHARACTER(len=264),
INTENT(in) :: mko_str
337 CHARACTER(len=132),
INTENT(out) :: mko_value
338 TYPE(element
),
POINTER :: mko_temp_pointer
339 TYPE(element
),
POINTER :: mko_found_element
340 TYPE(element
),
POINTER,
INTENT(in) :: mko_parameters_ptr
341 INTEGER :: mko_pos1 = 1, mko_pos2=10000, mko_n = 0, mko_i
345 CHARACTER(len=264) :: mko_word(30)
353 mko_temp_pointer => mko_parameters_ptr
356 mko_pos2 = index(mko_str(mko_pos1:),
"/")
357 IF (mko_pos2 == 0)
THEN
359 mko_word(mko_n) = mko_str(mko_pos1:)
363 mko_word(mko_n) = mko_str(mko_pos1:mko_pos1+mko_pos2-2)
364 mko_pos1 = mko_pos2+mko_pos1
372 IF(
ASSOCIATED(mko_found_element) .EQV. .false.)
THEN
376 IF ( mko_i == mko_n)
THEN
377 mko_value = char2str(mko_found_element%cvalue)
380 mko_temp_pointer => mko_found_element%child
389 use string_manipulation_tools
390 CHARACTER(len=264),
INTENT(in) :: mko_cname
391 CHARACTER(len=264) :: mko_tmp_cname
392 TYPE(element
),
POINTER,
INTENT(in) :: mko_ptr_to_element
393 TYPE(element
),
POINTER,
INTENT(out) :: mko_return_ptr
394 TYPE(element
),
POINTER :: mko_tmp_ptr
396 mko_tmp_ptr => mko_ptr_to_element
398 DO WHILE(
ASSOCIATED(mko_tmp_ptr) )
399 mko_tmp_cname = char2str(mko_tmp_ptr%cname)
400 IF ( mko_cname .EQ. mko_tmp_cname)
THEN
401 mko_return_ptr => mko_tmp_ptr
404 mko_tmp_ptr => mko_tmp_ptr%sibling
406 mko_return_ptr => mko_tmp_ptr
subroutine assign_code_parameters(codeparameters, return_status)
subroutine find_element_test(mko_ptr_to_element, mko_return_ptr, mko_cname)
subroutine impurity_manipulator2(COREPROF, COREIMPUR_IN, COREIMPUR, code_parameters)
The module declares types of variables used in ETS (transport code)
subroutine find_parameter_test(mko_str, mko_value, mko_parameters_ptr)
subroutine allocate_manipulator_param(NIMP, MAX_Z_IMP, PARAM, DIAG)