33 TYPE (type_coreprof
),
POINTER :: coreprof(:)
34 TYPE (type_coreimpur
),
POINTER :: coreimpur(:)
37 TYPE (type_param
) :: code_parameters
45 diag%ERROR_MESSAGE =
""
52 IF (diag%IERR .LT. 0) goto 112
56 IF (diag%IERR .LT. 0) goto 112
59 DO iimp = 1, param%NIMP
60 IF(trim(adjustl(param%PROFILE(iimp))).EQ.
"constant")
THEN
62 IF (diag%IERR .LT. 0) goto 112
65 IF(trim(adjustl(param%PROFILE(iimp))).EQ.
"derived")
THEN
67 IF (diag%IERR .LT. 0) goto 112
70 IF(trim(adjustl(param%PROFILE(iimp))).EQ.
"coronal")
THEN
72 IF (diag%IERR .LT. 0) goto 112
77 112
ALLOCATE (coreimpur(1)%codeparam%codename(1))
78 ALLOCATE (coreimpur(1)%codeparam%codeversion(1))
79 ALLOCATE (coreimpur(1)%codeparam%output_diag(1))
81 coreimpur(1)%codeparam%codename =
'IMPURITY MANIPULATOR'
82 coreimpur(1)%codeparam%codeversion =
'IMPURITY MANIPULATOR_4.10b.10'
83 coreimpur(1)%codeparam%output_flag = diag%IERR
84 coreimpur(1)%codeparam%output_diag(1) =
"IMPURITY MANIPULATOR: "//trim(adjustl(diag%ERROR_MESSAGE))
101 TYPE(type_param
) :: code_parameters
103 TYPE(tree
) :: parameter_list
104 TYPE(element
),
POINTER :: temp_pointer
105 INTEGER(ITM_I4) :: nparam
106 CHARACTER(len = 132) :: parameter_value
107 CHARACTER(len = 264) :: code_param_name
108 CHARACTER(len = 6) :: cvalue(10)
109 REAL (R8) :: value(10)
114 LOGICAL :: imp_element(5) = .false.
116 INTEGER :: i, iimp, iz
118 CHARACTER(len = 132) :: prefix
121 diag%ERROR_MESSAGE =
" "
124 CALL euitm_xml_parse(code_parameters, nparam, parameter_list)
130 DO i = 1,
SIZE(imp_element)
131 temp_pointer => parameter_list%first
132 WRITE (code_param_name,
"(a19,i1,a19)")
"parameters/IMPURITY",i,
"/Define_impurity/zn"
134 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
135 IF (len(trim(parameter_value)).GE.1)
THEN
137 imp_element(i) = .true.
138 CALL scan_str2real(parameter_value, value ,nval)
139 max_z_imp = max(max_z_imp, int(value(1)))
147 diag%ERROR_MESSAGE = trim(adjustl(diag%ERROR_MESSAGE))//
" ASSIGN_PARAM: no impurities are defined."
148 diag%IERR = diag%IERR+1
155 DO i = 1,
SIZE(imp_element)
156 IF (imp_element(i).EQ. .true.)
THEN
158 WRITE (prefix,
"(a19,i1,a17)")
"parameters/IMPURITY",i,
"/Define_impurity/"
160 code_param_name = trim(adjustl(prefix))//
"amn"
161 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
162 IF (len(trim(parameter_value)).GE.1)
THEN
163 CALL scan_str2real(parameter_value, value ,nval)
164 param%AMN_IMP(iimp) = value(1)
167 code_param_name = trim(adjustl(prefix))//
"zn"
168 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
169 IF (len(trim(parameter_value)).GE.1)
THEN
170 CALL scan_str2real(parameter_value, value ,nval)
171 param%ZN_IMP(iimp) = value(1)
177 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/all_radially_constant/Densities"
178 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
179 IF (len(trim(parameter_value)).GE.1)
THEN
180 param%PROFILE(iimp) =
"constant"
181 param%ISTATE(iimp) =
"all"
182 CALL scan_str2real(parameter_value, value ,nval)
183 param%DENS(iimp,:) = value(:)
184 IF (nval.LT.param%ZN_IMP(iimp))
THEN
185 diag%ERROR_MESSAGE = trim(adjustl(diag%ERROR_MESSAGE))//
" you did not specify densities for all ionization states."
186 diag%IERR = diag%IERR+1
190 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/coronal_distribution/Total_Density"
191 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
192 IF (len(trim(parameter_value)).GE.1)
THEN
193 param%PROFILE(iimp) =
"coronal"
194 param%ISTATE(iimp) =
"all"
195 CALL scan_str2real(parameter_value, value ,nval)
196 param%DENS(iimp,1) = value(1)
200 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/all_proportional_to_source_profile/Fractions"
201 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
202 IF (len(trim(parameter_value)).GE.1)
THEN
203 param%PROFILE(iimp) =
"derived"
204 param%ISTATE(iimp) =
"all"
205 CALL scan_str2real(parameter_value, value ,nval)
206 param%FRA(iimp,:) = value(:)
207 IF (nval.LT.param%ZN_IMP(iimp))
THEN
208 diag%ERROR_MESSAGE = trim(adjustl(diag%ERROR_MESSAGE))//
" you did not specify fractions for all ionization states."
209 diag%IERR = diag%IERR+1
212 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/all_proportional_to_source_profile/Source_profile/ions/extrapolate_from/selected_ion/amn"
214 IF (len(trim(parameter_value)).GE.1)
THEN
215 param%PROF_SOURCE(iimp) =
"selected_ion"
216 CALL scan_str2real(parameter_value, value ,nval)
217 param%AMN_ION(iimp) = value(1)
218 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/all_proportional_to_source_profile/Source_profile/ions/extrapolate_from/selected_ion/zn"
220 IF (len(trim(parameter_value)).GE.1)
THEN
221 CALL scan_str2real(parameter_value, value ,nval)
222 param%ZN_ION(iimp) = value(1)
224 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/all_proportional_to_source_profile/Source_profile/ions/extrapolate_from/selected_ion/zion"
226 IF (len(trim(parameter_value)).GE.1)
THEN
227 CALL scan_str2real(parameter_value, value ,nval)
228 param%Z_ION(iimp) = value(1)
231 param%PROF_SOURCE(iimp) =
"ions_total"
234 code_param_name = trim(adjustl(prefix))//
"ionization_states/all/Profiles/all_proportional_to_source_profile/Source_profile/electrons/NOTE"
236 IF (len(trim(parameter_value)).GE.1)
THEN
237 param%PROF_SOURCE(iimp) =
"electrons"
243 code_param_name = trim(adjustl(prefix))//
"ionization_states/fully_stripped_state_only/Profile/radially_constant/Density"
244 CALL find_parameter(code_param_name, parameter_value, temp_pointer)
245 IF (len(trim(parameter_value)).GE.1)
THEN
246 param%PROFILE(iimp) =
"constant"
247 param%ISTATE(iimp) =
"fully_stipped"
248 CALL scan_str2real(parameter_value, value ,nval)
249 param%DENS(iimp,1) = value(1)
252 code_param_name = trim(adjustl(prefix))//
"ionization_states/fully_stripped_state_only/Profile/proportional_to_source_profile/Fraction"
254 IF (len(trim(parameter_value)).GE.1)
THEN
255 param%PROFILE(iimp) =
"derived"
256 param%ISTATE(iimp) =
"fully_stipped"
257 CALL scan_str2real(parameter_value, value ,nval)
258 param%FRA(iimp,1) = value(1)
260 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"
262 IF (len(trim(parameter_value)).GE.1)
THEN
263 param%PROF_SOURCE(iimp) =
"selected_ion"
264 CALL scan_str2real(parameter_value, value ,nval)
265 param%AMN_ION(iimp) = value(1)
266 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"
268 IF (len(trim(parameter_value)).GE.1)
THEN
269 CALL scan_str2real(parameter_value, value ,nval)
270 param%ZN_ION(iimp) = value(1)
272 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"
274 IF (len(trim(parameter_value)).GE.1)
THEN
275 CALL scan_str2real(parameter_value, value ,nval)
276 param%Z_ION(iimp) = value(1)
279 param%PROF_SOURCE(iimp) =
"ions_total"
282 code_param_name = trim(adjustl(prefix))//
"ionization_states/fully_stripped_state_only/Profile/proportional_to_source_profile/Source_profile/electrons/NOTE"
284 IF (len(trim(parameter_value)).GE.1)
THEN
285 param%PROF_SOURCE(iimp) =
"electrons"
290 IF (trim(adjustl(param%ISTATE(iimp))).EQ.
"all")
THEN
291 DO iz=1,int(param%ZN_IMP(iimp))
292 param%Z_IMP(iimp,iz) = iz
294 ELSE IF (trim(adjustl(param%ISTATE(iimp))).EQ.
"fully_stipped")
THEN
295 param%Z_IMP(iimp,1) = int(param%ZN_IMP(iimp))
315 use string_manipulation_tools
316 CHARACTER(len=264),
INTENT(in) :: mko_str
317 CHARACTER(len=132),
INTENT(out) :: mko_value
318 TYPE(element
),
POINTER :: mko_temp_pointer
319 TYPE(element
),
POINTER :: mko_found_element
320 TYPE(element
),
POINTER,
INTENT(in) :: mko_parameters_ptr
321 INTEGER :: mko_pos1 = 1, mko_pos2=10000, mko_n = 0, mko_i
325 CHARACTER(len=264) :: mko_word(30)
333 mko_temp_pointer => mko_parameters_ptr
336 mko_pos2 = index(mko_str(mko_pos1:),
"/")
337 IF (mko_pos2 == 0)
THEN
339 mko_word(mko_n) = mko_str(mko_pos1:)
343 mko_word(mko_n) = mko_str(mko_pos1:mko_pos1+mko_pos2-2)
344 mko_pos1 = mko_pos2+mko_pos1
352 IF(
ASSOCIATED(mko_found_element) .EQV. .false.)
THEN
356 IF ( mko_i == mko_n)
THEN
357 mko_value = char2str(mko_found_element%cvalue)
360 mko_temp_pointer => mko_found_element%child
369 use string_manipulation_tools
370 CHARACTER(len=264),
INTENT(in) :: mko_cname
371 CHARACTER(len=264) :: mko_tmp_cname
372 TYPE(element
),
POINTER,
INTENT(in) :: mko_ptr_to_element
373 TYPE(element
),
POINTER,
INTENT(out) :: mko_return_ptr
374 TYPE(element
),
POINTER :: mko_tmp_ptr
376 mko_tmp_ptr => mko_ptr_to_element
378 DO WHILE(
ASSOCIATED(mko_tmp_ptr) )
379 mko_tmp_cname = char2str(mko_tmp_ptr%cname)
380 IF ( mko_cname .EQ. mko_tmp_cname)
THEN
381 mko_return_ptr => mko_tmp_ptr
384 mko_tmp_ptr => mko_tmp_ptr%sibling
386 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_manipulator(COREPROF, 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)