78 integer,
parameter :: DP=selected_real_kind(13)
81 real(DP),
intent(in) :: B(0:n)
83 integer,
intent(in) :: N
85 real(DP),
intent(in) :: X
91 eiram_fit=eiram_fit*x+b(i)
110 integer,
parameter,
public ::
eiram_dp = selected_real_kind(13)
131 logical,
parameter ::
debug = .false.
151 real(EIRAM_DP),
allocatable :: creac(:,:)
153 real(EIRAM_DP) :: x1min
155 real(EIRAM_DP) :: x1max
157 real(EIRAM_DP) :: x2min
159 real(EIRAM_DP) :: x2max
161 character(UNITS_LENGTH) :: x1units =
""
163 character(UNITS_LENGTH) :: x2units =
""
165 character(UNITS_LENGTH) :: yunits =
""
167 character(QUANTITY_LENGTH) :: x1quantity =
""
169 character(QUANTITY_LENGTH) :: x2quantity =
""
171 character(QUANTITY_LENGTH) :: yquantity =
""
173 character(REACTION_LENGTH) :: reaction =
""
175 character(DESCRIPTION_LENGTH) :: description =
""
177 character(EIRAM_FILE_NAME_LENGTH) :: file =
""
179 character(EIRAM_TYPE_LENGTH) ::
TYPE =
""
181 character(EIRAM_INDEX_LENGTH) :: index =
""
205 subroutine eiram_load(filePath, fileName, err)
207 character(*),
intent(in) :: filePath
209 character(*),
intent(in) :: fileName
211 integer,
intent(out) :: err
213 logical :: fileExists,isLaTeX
215 integer :: nData, nOldData
217 integer :: l,nDataMax
218 integer,
parameter :: UNIT = 20
219 character(MAX_LINE_LENGTH) :: line
220 character(*),
parameter :: BEGIN_DATA_MARK =
"##BEGIN DATA HERE##"
223 character(*),
parameter :: LATEX_MARK =
"begin{document}"
228 if(
debug) print *,
"open file ",trim(filename)
230 inquire(file=trim(filepath)//trim(filename),exist=fileexists,iostat=err)
231 if(.not.fileexists .or. err /= 0)
then
233 write(
eiram_unit, *)
"ERROR in eiram_load: input file ", &
234 trim(filepath)//trim(filename),
" is not found"
244 ndatamax = countlinescontaining(trim(filepath)//trim(filename),
"Reaction", err)
246 write(
eiram_unit, *)
"ERROR in eiram_load while counting lines, err ", err
251 allocate(reactions_(ndatamax+nolddata),stat=err)
253 write(
eiram_unit, *)
"ERROR in eiram_load while allocating temporary array, ",&
254 "nData",ndatamax+nolddata
259 open(unit, iostat=err, file=trim(filepath)//trim(filename), status=
'old', action=
'read')
261 write(
eiram_unit, *)
"ERROR in eiram_load while reading "//trim(filepath)//trim(filename)
273 read(unit,
'(A)', iostat=err,end=1000) line
275 if(err /= 0)
goto 1300
277 if(index(line,latex_mark) > 0) islatex=.true.
279 if(index(line, begin_data_mark) > 0)
then
280 if(
debug) print *,
"found BEGIN_DATA_MARK in line ", l
287 call eiram_read_latex(reactions_,filename,unit,l,ndata,*1300,*1303,*1304)
289 call eiram_read_txt(reactions_,filename,unit,l,ndata,*1300,*1303,*1304)
292 if(
debug) print *,
"EOF in", l
297 reactions_(ndata+1:ndata+nolddata) =
reactions(1:nolddata)
300 write(
eiram_unit, *)
"ERROR in eiram_load: cannot re-allocate memory ", err
307 allocate(
reactions(ndata+nolddata),stat=err)
309 write(
eiram_unit, *)
"ERROR in eiram_load: cannot allocate the array of reactions ",&
310 "nData ",ndata+nolddata
315 reactions(1:ndata+nolddata) = reactions_(1:ndata+nolddata)
317 call deallocate_reactions
319 write(
eiram_unit, *)
"initalization from file "//trim(filepath)//trim(filename)//
" completed"
320 write(
eiram_unit, *)
" new data sets loaded: ", ndata
325 1000
write(
eiram_unit, *)
"ERROR in eiram_load: no data section is found in file "//trim(filepath)//trim(filename)
327 call deallocate_reactions
330 1300
write(
eiram_unit, *)
"ERROR in eiram_load: while reading line ", l,
" of "//trim(filepath)//trim(filename)
332 call deallocate_reactions
335 1303
write(
eiram_unit, *)
"ERROR in eiram_load: wrong format in line ", l, &
336 " of "//trim(filepath)//trim(filename), err
338 call deallocate_reactions
341 1304
write(
eiram_unit, *)
"ERROR in eiram_load: cannot allocate CREAC "
342 write(
eiram_unit, *)
" line ", l,
" of ",trim(filepath)//trim(filename),&
343 " reaction ",trim(reactions_(ndata)%TYPE)//
" "//trim(reactions_(ndata)%INDEX)
345 call deallocate_reactions
352 subroutine deallocate_reactions
356 do i=1,
size(reactions_)
357 if(
allocated(reactions_(i)%CREAC))
then
358 deallocate(reactions_(i)%CREAC,stat=err)
359 if(err /= 0) lerr=.true.
362 deallocate(reactions_,stat=err)
363 if(err /= 0 .or. lerr )
then
364 write(
eiram_unit, *)
"WARNING from eiram_load: problem while deallocating temporary array "
367 end subroutine deallocate_reactions
374 subroutine eiram_read_latex(reactions_,fileName,unit,l,nData,*,*,*)
376 character(*),
intent(in) :: fileName
377 integer,
intent(in) :: unit
378 integer,
intent(inout) :: l
379 integer,
intent(out) :: nData
380 integer :: gotoLine,numberOfUnclosedBraces,n,err,i1,i2
381 character(EIRAM_TYPE_LENGTH) :: stype
382 character(MAX_LINE_LENGTH) :: line
383 character(MAX_LINE_LENGTH*2) :: reactionName
385 intrinsic index,count,transfer,trim,adjustl,len_trim
390 read(unit,
'(A)', iostat=err,end=100) line
392 if(err /= 0)
return 1
393 newsection:
if(index(line,
"\section") == 1)
then
394 if(
debug) print *,
"found \section in line ", l
395 if(index(trim(line),
" ") == 0)
then
396 read(unit,
'(A)', iostat=err) line
398 if(err /= 0)
return 1
400 stype= line(index(line,
"{")+1:index(line,
" ")-1)
401 if(index(stype,
":")>0) stype=stype(1:index(stype,
":")-1)
404 newreaction:
if(index(line,
"subsection{") > 0)
then
405 numberofunclosedbraces = count(transfer(line,
'a',
max_line_length) ==
"{")
407 numberofunclosedbraces = numberofunclosedbraces - n
408 reactionname = trim(adjustl(line))
413 findendofreactionname:
do
414 if(numberofunclosedbraces == 0)
exit findendofreactionname
415 read(unit,
'(A)', iostat=err) line
417 if(err /= 0)
return 1
419 numberofunclosedbraces = numberofunclosedbraces + n
421 numberofunclosedbraces = numberofunclosedbraces - n
422 if(len_trim(reactionname) /= index(reactionname,
"{"))
then
423 reactionname = trim(reactionname)//
" "//trim(adjustl(line))
425 reactionname = trim(reactionname)//trim(adjustl(line))
427 if(line ==
"}")
exit findendofreactionname
428 end do findendofreactionname
430 if(index(reactionname,
'Reaction')<1) cycle
434 reactions_(ndata)%FILE = filename
435 reactions_(ndata)%TYPE = stype
437 if(
debug) print *,
"found Reaction in line ", l
439 i1=index(reactionname,
"Reaction")+8;
440 reactions_(ndata)%INDEX = reactionname(index(reactionname(i1:),
" ")+i1:)
441 reactions_(ndata)%INDEX = reactions_(ndata)%INDEX(:index(reactions_(ndata)%INDEX,
" ")-1)
442 if(
debug) print *,
" with index ", trim(reactions_(ndata)%INDEX)
444 i1=index(reactionname,
"$")
445 i2=index(reactionname,
"$",.true.)
446 if (i1>0 .and. i2>0 )
then
447 reactions_(ndata)%REACTION = reactionname(i1:i2)
448 if(
debug) print *,
" with equation ", trim(reactions_(ndata)%REACTION)
452 read(unit,
'(A)', iostat=err) line
454 if(err /= 0)
return 1
455 if(index(line,
"verbatim") > 0)
then
456 exit skiptillverbatim
458 end do skiptillverbatim
460 select case(reactions_(ndata)%TYPE)
461 case(
"H.1",
"H.2",
"H.8",
"H.11")
462 if(
debug) print *,
"h1/2/8/11"
463 call parse_single(reactions_(ndata),unit,gotoline,l)
464 if(gotoline == 1300)
return 1
465 if(gotoline == 1303)
return 2
466 if(gotoline == 1304)
return 3
467 if(.not.
allocated(reactions_(ndata)%CREAC)) ndata=ndata-1
468 case (
"H.3",
"H.4",
"H.9",
"H.10",
"H.12")
469 if(
debug) print *,
"h3/4/9/10/12"
470 call parse_double(reactions_(ndata),unit,gotoline,l)
471 if(gotoline == 1300)
return 1
472 if(gotoline == 1303)
return 2
473 if(gotoline == 1304)
return 3
474 if(.not.
allocated(reactions_(ndata)%CREAC)) ndata=ndata-1
478 if(
debug) print *,
">> exiting"
487 end subroutine eiram_read_latex
492 subroutine eiram_read_txt(reactions_,fileName,unit,l,nData,*,*,*)
494 character(*),
intent(in) :: fileName
495 integer,
intent(in) :: unit
496 integer,
intent(inout) :: l
497 integer,
intent(out) :: nData
498 integer :: gotoLine,err,i1,i2,itype
499 character(EIRAM_TYPE_LENGTH) :: stype
500 character(MAX_LINE_LENGTH) :: line, reactionName
502 intrinsic index,trim,adjustl,len_trim
508 read(unit,
'(A)', iostat=err,end=100) line
510 if(err /= 0)
return 1
511 call gettype(line,stype)
513 newreaction:
if(index(line,
"Reaction") > 0)
then
515 reactions_(ndata)%FILE = filename
516 reactions_(ndata)%TYPE = stype
517 reactionname = trim(adjustl(line))
519 i1=index(reactionname,
" ")+1
520 i2=index(reactionname(i1:),
" ")+i1-2
521 reactions_(ndata)%INDEX = reactionname(i1:i2)
523 reactions_(ndata)%REACTION =trim(adjustl(reactionname(i2+1:)))
525 print *,
"found new reaction"
526 print *,
" index ",trim(reactions_(ndata)%INDEX)
527 print *,
" equation ",trim(reactions_(ndata)%REACTION)
529 select case(reactions_(ndata)%TYPE)
530 case(
"H.1",
"H.2",
"H.8",
"H.11")
531 if(
debug) print *,
"h1/2/8/11"
532 call parse_single(reactions_(ndata),unit,gotoline,l)
533 if(gotoline == 1300)
return 1
534 if(gotoline == 1303)
return 2
535 if(gotoline == 1304)
return 3
536 if(.not.
allocated(reactions_(ndata)%CREAC)) ndata=ndata-1
537 case (
"H.3",
"H.4",
"H.9",
"H.10",
"H.12")
538 if(
debug) print *,
"h3/4/9/10/12"
539 call parse_double(reactions_(ndata),unit,gotoline,l)
540 if(gotoline == 1300)
return 1
541 if(gotoline == 1303)
return 2
542 if(gotoline == 1304)
return 3
543 if(.not.
allocated(reactions_(ndata)%CREAC)) ndata=ndata-1
547 if(
debug) print *,
">> exiting"
558 subroutine gettype(line,stype)
559 character(MAX_LINE_LENGTH),
intent(in) :: line
560 character(EIRAM_TYPE_LENGTH),
intent(inout) :: stype
562 integer,
parameter :: ntp=12
564 character(4),
parameter :: stp(0:ntp)= &
565 (/
'H.0 ',
'H.1 ',
'H.2 ',
'H.3 ',
'H.4 ',
'H.5 ',
'H.6 ',
'H.7 ',
'H.8 ',
'H.9 ',
'H.10',
'H.11',
'H.12'/)
567 if(index(line,
'H.')<1)
return
570 if(index(line,trim(stp(i)))>0)
then
573 if(
debug) print *,
"found new type ", stype
578 end subroutine gettype
580 end subroutine eiram_read_txt
586 integer,
intent(out) :: err
603 if(err /= 0) lerr=.true.
609 write(
eiram_unit, *)
"WARNING from eiram_deallocate: problem while deallocating memory, err ", err
615 write(
eiram_unit, *)
"WARNING from eiram_deallocate: problem while deallocating memory"
624 subroutine parse_single(reaction,unit,gotoLine,l)
626 integer,
intent(in) :: unit
627 integer,
intent(out) :: gotoLine
628 integer,
intent(inout) :: l
631 character(80) :: zeile
632 integer :: err,indff,iftflg,ind,ind2,i,j
640 if(reaction%TYPE ==
"H.1")
then
641 reaction%YUNITS =
"cm^2"
642 reaction%YQUANTITY =
"cross section"
643 reaction%X1QUANTITY =
"Energy"
645 elseif(reaction%TYPE ==
"H.2")
then
646 reaction%YUNITS =
"cm^3/s"
647 reaction%YQUANTITY =
"collision rate"
648 reaction%X1QUANTITY =
"Temperature"
650 elseif(reaction%TYPE ==
"H.8")
then
651 reaction%YUNITS =
"cm^3/s\cdot eV"
652 reaction%YQUANTITY =
"electron cooling rate"
653 reaction%X1QUANTITY =
"Temperature"
655 elseif(reaction%TYPE ==
"H.11")
then
657 reaction%YQUANTITY =
"ratio"
658 reaction%X1QUANTITY =
"Temperature"
661 reaction%X1UNITS =
"eV"
664 3
read(unit,
'(A80)',iostat=err) zeile
674 if( index(zeile,
'verbatim')>0 .or. index(zeile,
'subsection')>0 )
return
676 indff=index(zeile,
'fit-flag')
677 if (index(zeile,chr)+indff.EQ.0)
GOTO 3
679 read (zeile((indff+8):80),*,iostat=err) iftflg
687 allocate(reaction%CREAC(0:8,0:0),stat=err)
693 if(mod(iftflg,100) == 10)
then
694 ind=index(zeile,chr(1:1))
695 reaction%creac(:,0)=0.
696 read(zeile((ind+2):80),*,iostat=err) reaction%creac(0,0)
703 ind=index(zeile,chr(1:1))+2
705 ind2=index(zeile(ind:80),chr(1:1))
711 read(zeile(ind:ind2),*,iostat=err) reaction%creac(j*3+i,0)
718 read(unit,
'(A80)',iostat=err) zeile
727 if(
debug) print *, reaction%CREAC
729 end subroutine parse_single
734 subroutine parse_double(reaction,unit,gotoLine,l)
736 integer,
intent(in) :: unit
737 integer,
intent(out) :: gotoLine
738 integer,
intent(inout) :: l
740 character(80) :: zeile
741 integer :: err,indff,iftflg,ih,i,j,k
749 if(reaction%TYPE ==
"H.3")
then
750 reaction%YQUANTITY =
"collision rate"
751 reaction%YUNITS =
"cm^3/s"
752 reaction%X1QUANTITY =
"Energy"
753 reaction%X1UNITS =
"eV"
754 reaction%X2QUANTITY =
"Temperature"
755 reaction%X2UNITS =
"eV"
756 reaction%X2QUANTITY =
"Temperature"
757 elseif(reaction%TYPE ==
"H.4")
then
758 reaction%YQUANTITY =
"collision rate"
759 reaction%YUNITS =
"cm^3/s"
760 reaction%X1QUANTITY =
"Density"
761 reaction%X1UNITS =
"cm^{-3}"
762 reaction%X2QUANTITY =
"Temperature"
763 reaction%X2UNITS =
"eV"
764 elseif(reaction%TYPE ==
"H.9")
then
765 reaction%YQUANTITY =
"ion cooling rate"
766 reaction%YUNITS =
"cm^3/s\cdot eV"
767 reaction%X1QUANTITY =
"Energy"
768 reaction%X1UNITS =
"[eV]"
769 reaction%X2QUANTITY =
"Temperature"
770 reaction%X2UNITS =
"eV"
771 elseif(reaction%TYPE ==
"H.10")
then
772 reaction%YQUANTITY =
"electron cooling rate"
773 reaction%YUNITS =
"cm^3/s\cdot eV"
774 reaction%X1QUANTITY =
"Density"
775 reaction%X1UNITS =
"cm^{-3}"
776 reaction%X2QUANTITY =
"Temperature"
777 reaction%X2UNITS =
"eV"
778 elseif(reaction%TYPE ==
"H.12")
then
779 reaction%YQUANTITY =
"ratio"
781 reaction%X1QUANTITY =
"Density"
782 reaction%X1UNITS =
"cm^{-3}"
783 reaction%X2QUANTITY =
"Temperature"
784 reaction%X2UNITS =
"eV"
787 allocate(reaction%CREAC(0:8,0:8),stat=err)
797 16
read(unit,
'(A80)',iostat=err) zeile
805 if( index(zeile,
'verbatim')>0 .or. index(zeile,
'subsection')>0 )
return
807 indff=index(zeile,
'fit-flag')
808 if(index(zeile,
'Index')+indff==0)
goto 16
810 read(zeile((indff+8):80),*,iostat=err) iftflg
818 read(unit,
'(1X)',iostat=err)
825 if(mod(iftflg,100) == 10)
then
826 read(unit,*,iostat=err) ih,reaction%CREAC(0,0)
835 read(unit,*,iostat=err) ih,(reaction%CREAC(i,k),k=j*3,j*3+2)
844 if(
debug) print *, reaction%CREAC
846 end subroutine parse_double
856 integer function eiram_get_id(fileName, reactionType, reactionIndex, err)
858 character(*),
intent(in) :: fileName
860 character(*),
intent(in) :: reactionType
862 character(*),
intent(in) :: reactionIndex
864 integer,
intent(out) :: err
870 write(
eiram_unit, *)
"ERROR in eiram_get_id: EIRAM is not initialized"
879 .and.
reactions(i)%TYPE == reactiontype &
880 .and.
reactions(i)%INDEX == reactionindex)
then
887 write(
eiram_unit, *)
"ERROR in eiram_get_id: reaction "//&
888 trim(filename)//
" "//trim(reactiontype)//
" "//trim(reactionindex)//&
896 integer,
intent(out) :: N
898 integer,
intent(out) :: M
900 integer,
intent(in) :: Id
902 integer,
intent(out) :: err
909 write(
eiram_unit, *)
"ERROR in eiram_get_order: EIRAM is not initialized"
915 write(
eiram_unit,*)
"ERROR in eiram_get_order: reaction index is out of range"
934 integer,
intent(out) :: err
936 integer :: k,L,M,N,err0
943 write(
eiram_unit, *)
"ERROR in eiram_create_image: EIRAM is not initialized"
950 if(
allocated(data))
then
952 if(
allocated(
data(k)%CREAC))
then
953 deallocate(
data(k)%CREAC,stat=err)
955 write(
eiram_unit, *)
"ERROR in eiram_create_image: cannot deallocate memory"
961 deallocate(
data,stat=err)
963 write(
eiram_unit, *)
"ERROR in eiram_create_image: cannot deallocate memory"
969 allocate(
data(l),stat=err)
971 write(
eiram_unit, *)
"ERROR in eiram_create_image: cannot allocate memory for the array of reactions"
972 write(
eiram_unit, *)
" Total number of reactions = ",l
978 if(.not.
allocated(
reactions(k)%CREAC))
goto 300
984 allocate(
data(k)%creac(0:m,0:n),stat=err)
986 allocate(
data(k)%creac(0:n,0:0),stat=err)
988 if(err /= 0)
goto 200
997 data(k)%X1QUANTITY =
reactions(k)%X1QUANTITY
998 data(k)%X2QUANTITY =
reactions(k)%X2QUANTITY
999 data(k)%YQUANTITY =
reactions(k)%YQUANTITY
1001 data(k)%DESCRIPTION =
reactions(k)%DESCRIPTION
1010 write(
eiram_unit, *)
"ERROR in eiram_create_image: error wile allocating memory"
1011 write(
eiram_unit, *)
" Reaction ID, File, Type, Index ",&
1016 if(
allocated(
data(k)%CREAC))
deallocate(
data(k)%CREAC,stat=err0)
1018 deallocate(
data,stat=err0)
1021 write(
eiram_unit, *)
"ERROR detected in eiram_create_image: ", &
1022 "array of coefficients is not allocated"
1023 write(
eiram_unit, *)
" Reaction ID, File, Type, Index ",&
1027 if(
allocated(
data(k)%CREAC))
deallocate(
data(k)%CREAC,stat=err0)
1029 deallocate(
data,stat=err0)
1043 integer,
intent(in) :: Id
1045 real(EIRAM_DP),
intent(in) :: lnX
1061 real(EIRAM_DP),
intent(out) :: Y(:)
1063 integer,
intent(in) :: Id
1065 real(EIRAM_DP),
intent(in) :: lnX(:)
1067 integer,
intent(out) :: err
1076 if(l /=
size(lnx))
then
1077 write(
eiram_unit,*)
"ERROR in eiram_calc1: arrays have different lengths"
1078 write(
eiram_unit,*)
" length(Y), length(X) ",
size(y),
size(lnx)
1084 write(
eiram_unit, *)
"ERROR in eiram_calc1: EIRAM is not initialized"
1090 if(id<0 .or. id>m )
then
1091 write(
eiram_unit,*)
"ERROR in eiram_calc1: reaction index is out of range"
1092 write(
eiram_unit,*)
" index, min, max ",id,1,m
1097 if(.not.
allocated(
reactions(id)%CREAC))
then
1098 write(
eiram_unit,*)
"ERROR in eiram_calc1: array of fit coefficients is not allocated, Id ",id
1106 write(
eiram_unit,*)
"ERROR in eiram_calc1: wrong type of reaction"
1107 write(
eiram_unit,*)
" Single polynomial fit is requested for reaction ",&
1108 " described by a double polynomial fit"
1145 real(EIRAM_DP),
intent(out) :: B(:,:)
1147 integer,
intent(in) :: Id
1149 real(EIRAM_DP),
intent(in) :: lnX(:)
1151 integer,
intent(out) :: err
1160 if(l /=
size(lnx))
then
1161 write(
eiram_unit,*)
"ERROR in eiram_calc12: arrays have different lengths"
1162 write(
eiram_unit,*)
" length(B), length(X) ",l,
size(lnx)
1168 write(
eiram_unit, *)
"ERROR in eiram_calc12: EIRAM is not initialized"
1174 if(id<0 .or. id>m )
then
1175 write(
eiram_unit,*)
"ERROR in eiram_calc12: reaction index is out of range"
1176 write(
eiram_unit,*)
" index, min, max ",id,1,m
1181 if(.not.
allocated(
reactions(id)%CREAC))
then
1182 write(
eiram_unit,*)
"ERROR in eiram_calc12: array of fit coefficients is not allocated, Id ",id
1189 write(
eiram_unit,*)
"ERROR in eiram_calc12: wrong type of reaction"
1190 write(
eiram_unit,*)
" Double polynomial fit is requested for reaction ",&
1191 " described by a single polynomial fit"
1197 if( n+1 /=
size(b,1) )
then
1198 write(
eiram_unit,*)
"ERROR in eiram_calc12: mismatch of array sizes"
1199 write(
eiram_unit,*)
" order of polynomial ",n,
" requested order ",
size(b,1)-1
1220 real(EIRAM_DP),
intent(out) :: Y(:)
1222 integer,
intent(in) :: Id
1224 real(EIRAM_DP),
intent(in) :: lnX1(:)
1226 real(EIRAM_DP),
intent(in) :: lnX2(:)
1228 integer,
intent(out) :: err
1230 integer :: k,i,N,M,L,q,qk
1232 intrinsic size,exp,min
1237 if(l /=
size(lnx2))
then
1238 write(
eiram_unit,*)
"ERROR in eiram_calc2: arrays have different lengths"
1239 write(
eiram_unit,*)
" length(Y), length(X2) ",
size(y),
size(lnx2)
1245 if(q /=l .and. q /=1)
then
1246 write(
eiram_unit,*)
"ERROR in eiram_calc2: arrays have wrong length"
1247 write(
eiram_unit,*)
" length(X1), length(Y), ",
size(lnx1),
size(y)
1248 write(
eiram_unit,*)
" Length of X1 this array must be either = length(Y), or = 1"
1254 write(
eiram_unit, *)
"ERROR in eiram_calc2: EIRAM is not initialized"
1260 if(id<0 .or. id>m)
then
1261 write(
eiram_unit,*)
"ERROR in eiram_calc2: reaction index is out of range"
1262 write(
eiram_unit,*)
" index, min, max ",id,1,m
1267 if(.not.
allocated(
reactions(id)%CREAC))
then
1268 write(
eiram_unit,*)
"ERROR in eiram_calc 2: array of fit coefficients is not allocated, Id ",id
1275 write(
eiram_unit,*)
"ERROR in eiram_calc2: wrong type of reaction"
1276 write(
eiram_unit,*)
" Double polynomial fit is requested for reaction ",&
1277 " described by a single polynomial fit"
1300 integer function countlinescontaining(filePath, string, err)
1302 character(*),
intent(in) :: filePath
1304 character(*),
intent(in) :: string
1306 integer,
intent(out) :: err
1308 integer,
parameter :: UNIT = 22
1309 character(MAX_LINE_LENGTH) :: line
1313 open(unit, iostat=err, file=filepath, status=
'old', action=
'read')
1314 countlinescontaining = 0
1316 write(
eiram_unit, *)
"ERROR in countLinesContaining while reading "//trim(filepath), err
1322 read(unit,
'(A)', iostat=err,end=100) line
1324 write(
eiram_unit, *)
"ERROR in countLinesContaining while reading line of "//trim(filepath)
1329 if(index(line, string) > 0) countlinescontaining = countlinescontaining + 1
1333 end function countlinescontaining
integer, parameter reaction_length
Length of the string with the reaction equation.
integer, parameter units_length
Length of the string with units.
integer, parameter, public eiram_dp
Kind parameter for real numbers.
integer, parameter max_line_length
Maximum length of a line read from an file.
integer, public eiram_unit
Unit to which messages are written.
integer, parameter description_length
Length of the string with description of the process.
integer, parameter, public eiram_index_length
Length of the string with reaction index.
subroutine, public eiram_load(filePath, fileName, err)
Initialization of the module from input files (data sets)
subroutine, public eiram_deallocate(err)
Deallocate dynamic arrays used by this module.
subroutine, public eiram_get_order(N, M, Id, err)
Return order of the polynomial for both variables.
type(eiram_data), dimension(:), allocatable reactions
Array of reactions.
external, public eiram_fit
integer, parameter, public eiram_file_name_length
Length of the string with a name of an input file.
integer function, public eiram_get_id(fileName, reactionType, reactionIndex, err)
Return the ID-index of the given reaction in the arrays of the module.
integer, parameter, public eiram_type_length
Length of the string with reactiontype.
integer, public eiram_nreact
current number of loaded reactions
subroutine, public eiram_calc12(B, Id, lnX, err)
Reduce double polynomial fit to single polynomials for given values of the second variable...
real(dp) function eiram_fit(B, N, X)
Elementary function which calculates a single polynomial fit.
integer, parameter quantity_length
Length of the string with description of a quantity.
subroutine, public eiram_calc2(Y, Id, LnX1, LnX2, err)
Calculate double polynomial fit.
real(eiram_dp) function, public eiram_calc1_fast(Id, lnX)
Calculate single polynomial fit: scalar version W/O CHECKS.
subroutine, public eiram_create_image(data, err)
Create a copy (image) of the reactions array stored in the module.
subroutine, public eiram_calc1(Y, Id, lnX, err)
Calculate single polynomial fit.