OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
qa_out_mod Module Reference

Data Types

type  tqa_value

Functions/Subroutines

subroutine qaopen (step)
 @purpose open QA extract file
subroutine qagetqakeyenv ()
 @purpose get and store the possible values of the QAKEY env variable
subroutine blank2underscore (textin, textout)
 @purpose replace blank char with _ for a given string
subroutine qaprint (name, idin, value)
 @purpose print one entry to QA extract file example of call for real print CALL QAPRINT('MY_LABEL',0,12345.6_8) (2nd argument is 0, 3rd is the real value to be printed followed with '_8') example of call for integer print CALL QAPRINT('MY_LABEL',123456,0.0_8) (2nd argument is the integer value to be printed, 3rd must be 0.0_8)
subroutine qaprint2 (name, idin, value, value2)
 @purpose print one entry to QA extract file in an energy style ()
subroutine qastatus (istatus)
 @purpose get QA status
subroutine qaseti (pos, title, i)
 @purpose write an integer value in standard values array qa_storage
subroutine qasetr (pos, title, r)
 @purpose write a real value in standard values array qa_storage
subroutine qaclose ()
 @purpose close QA extract fileCare when routine is called from Fortran (because of binding)
logical function myqakey (value)
 @purpose Check if a given value is part of the values set by env variable Useful to make a condition on a qaprint Return true or false
logical function is_value_in_qakeylist_avail (value)
 @purpose Check if a given value is the predefined array of available qakeys Useful to check if a qakey is allowed/available Return true or false (false = program must exit with an error)
integer function lastchar (a)

Variables

integer doqa
integer lunitqa
integer qaid
integer next_index
integer lqa_storage
integer, parameter qaprint_limit_default = 10000
integer, parameter qaprint_limit_maxx = 500000
integer qaprint_limit
type(tqa_value), dimension(:), allocatable qa_storage
character *12 qa_format
integer emax_index
integer nqakeylist_avail
character(len=64), dimension(520) split_qakey_env

Function/Subroutine Documentation

◆ blank2underscore()

subroutine qa_out_mod::blank2underscore ( character(len=*), intent(in) textin,
character(len=len_trim(textin)), intent(out) textout )

@purpose replace blank char with _ for a given string

Definition at line 319 of file qa_out_mod.F.

320#include "implicit_f.inc"
321 character(len=*), intent(in) :: textin
322 character(len=LEN_TRIM(textin)), intent(out) :: textout
323 integer i
324
325 textout=textin
326
327 do i=1,len_trim(textout)
328 if (textout(i:i) == ' ') then
329 textout(i:i)='_';
330 endif
331 enddo
332

◆ is_value_in_qakeylist_avail()

logical function qa_out_mod::is_value_in_qakeylist_avail ( value)

@purpose Check if a given value is the predefined array of available qakeys Useful to check if a qakey is allowed/available Return true or false (false = program must exit with an error)

Definition at line 725 of file qa_out_mod.F.

726#include "implicit_f.inc"
727 integer i,len1,len2
728 character *64 value, value_without_leading_blank
729 logical tf
730
731 tf = .false.
732
733 do i=1,size(qakeylist_avail)
734C Remove leading blank if any
735 value_without_leading_blank=adjustl(qakeylist_avail(i))
736 len1=len_trim(value_without_leading_blank)
737 len2=len_trim(value)
738 if(len1 == len2)then
739 if (value_without_leading_blank(1:len1) == value(1:len2)) then
740 tf = .true.
741 exit
742 endif
743 endif
744 enddo
745

◆ lastchar()

integer function qa_out_mod::lastchar ( character *(*) a)

Definition at line 755 of file qa_out_mod.F.

756#include "implicit_f.inc"
757 character *(*) a
758
759c lmax = len(a)
760c do while ( l <= lmax .and. a(l:l) > ' ' )
761c l = l + 1
762c enddo
763c lastchar = l
764 lastchar=len_trim(a)
765 return

◆ myqakey()

logical function qa_out_mod::myqakey ( character (len=*) value)

@purpose Check if a given value is part of the values set by env variable Useful to make a condition on a qaprint Return true or false

Definition at line 693 of file qa_out_mod.F.

694#include "implicit_f.inc"
695 integer i
696 character (len=*) :: value
697 character *64 value_without_leading_blank
698 logical tf
699
700 tf = .false.
701 if ( doqa /= 1 ) return
702
703 do i=1,size(split_qakey_env)
704C Remove leading blank if any
705 value_without_leading_blank=adjustl(split_qakey_env(i))
706 if (value_without_leading_blank(1:len_trim(value_without_leading_blank)) == value(1:len_trim(value))) then
707 tf = .true.
708 exit
709 endif
710 enddo
711

◆ qaclose()

subroutine qa_out_mod::qaclose

@purpose close QA extract fileCare when routine is called from Fortran (because of binding)

Definition at line 638 of file qa_out_mod.F.

639#include "implicit_f.inc"
640 integer i
641
642 if ( doqa /= 1 ) return
643
644C Exclusive section in case of SPM (concurrence!) only the 1st thread executes this
645!$OMP SINGLE
646
647C Look for EMAX index in struct
648 emax_index = 0
649 do i=1,lqa_storage
650 if (qa_storage(i)%title == "EMAX") then
651 emax_index = i
652 exit
653 end if
654 end do
655
656! dump value qa_storage values before closing ...
657 do i=1,lqa_storage
658 if (qa_storage(i)%itype>0) then
659 if (qa_storage(i)%title == 'IENERGY'
660 . .OR. qa_storage(i)%title == 'KENERGYT'
661 . .OR. qa_storage(i)%title == 'KENERGYR'
662 . .OR. qa_storage(i)%title == 'EXTWORK'
663 . ) then
664 call qaprint2 ( qa_storage(i)%title, qa_storage(i)%valuei, qa_storage(i)%valuer, qa_storage(emax_index)%valuer)
665 else
666 if (i /= emax_index) then
667C A trick to pass an integer is to use idin (2nd parameter) and valuer = 0.0
668 call qaprint ( qa_storage(i)%title, qa_storage(i)%valuei, qa_storage(i)%valuer)
669 end if
670 end if
671 end if
672 end do
673! dump value qa_storage values before closing end.
674
675 close ( lunitqa )
676
677!$OMP END SINGLE
678 return
679 RETURN

◆ qagetqakeyenv()

subroutine qa_out_mod::qagetqakeyenv

@purpose get and store the possible values of the QAKEY env variable

Definition at line 219 of file qa_out_mod.F.

220#include "implicit_f.inc"
221 integer QAKEY_ENV_len, QAKEY_ENV_status, QAKEY_SPECIFIC_len, QAKEY_SPECIFIC_status, i, j, k
222C length is (64 chars + 1 comma)*16 occurrence - last comma (no comma at the end) = 1039
223 character(LEN=1039) QAKEY_ENV, QAKEY_SPECIFIC
224 character(64) temp_qakey
225 integer QAPRINT_LIMIT_ENV_len, QAPRINT_LIMIT_ENV_status
226 character(LEN=12) QAPRINT_LIMIT_ENV
227
228C Initializing qaprint_limit with its default value
229 qaprint_limit = qaprint_limit_default
230C If the env variable QAPRINT_LIMIT is defined, we replace the limit
231 qaprint_limit_env = ''
232 call get_environment_variable("QAPRINT_LIMIT",qaprint_limit_env,qaprint_limit_env_len,qaprint_limit_env_status,.true.)
233 if (qaprint_limit_env /= '') then
234 read(qaprint_limit_env,'(i12)') qaprint_limit
235 endif
236
237 if (qaprint_limit > qaprint_limit_maxx) then
238 qaprint_limit = qaprint_limit_maxx
239 endif
240
241C WRITE(*,'(a,i12)') "TRACE qaprint_limit is ",qaprint_limit,"END"
242
243 qakey_env = ''
244 call get_environment_variable("QAKEY",qakey_env,qakey_env_len,qakey_env_status,.true.)
245
246 temp_qakey=''
247 j=1
248 k=1
249 do i=1,len_trim(qakey_env)+1
250 if (qakey_env(i:i) == ',' .OR. i == len_trim(qakey_env)+1) then
251 if (temp_qakey /= '') then
252
253 ! Checking if the found keyword is allowed, if not => error reading input
254 IF (is_value_in_qakeylist_avail(temp_qakey)) THEN
255 IF (.NOT. myqakey(temp_qakey)) THEN
256 split_qakey_env(j)=temp_qakey
257 j=j+1
258 ENDIF
259 ELSE
260 print*,"ERROR : THE QAKEY ", temp_qakey(1:len_trim(temp_qakey)), " IS NOT AVAILABLE, ABORTING"
261 close ( lunitqa )
262 stop
263 ENDIF
264 temp_qakey=''
265 endif
266 k=1
267 else
268 temp_qakey(k:k)=qakey_env(i:i)
269 k=k+1
270 endif
271 end do
272
273 call get_environment_variable("QAKEY_SPECIFIC",qakey_specific,qakey_specific_len,qakey_specific_status,.true.)
274
275 temp_qakey=''
276 k=1
277 do i=1,len_trim(qakey_specific)+1
278 if (qakey_specific(i:i) == ',' .OR. i == len_trim(qakey_specific)+1) then
279 if (temp_qakey /= '') then
280
281 ! Checking if the found keyword is allowed, if not => error reading input
282 IF (is_value_in_qakeylist_avail(temp_qakey)) THEN
283 IF (.NOT. myqakey(temp_qakey)) THEN
284 split_qakey_env(j)=temp_qakey
285 j=j+1
286 ENDIF
287 ELSE
288 print*,"ERROR : THE QAKEY ", temp_qakey(1:len_trim(temp_qakey)), " IS NOT AVAILABLE, ABORTING"
289 close ( lunitqa )
290 stop
291 ENDIF
292 temp_qakey=''
293 endif
294 k=1
295 else
296 temp_qakey(k:k)=qakey_specific(i:i)
297 k=k+1
298 endif
299 end do
300
301C TRACE
302C do i=1,size(split_qakey_env)
303C PRINT*,"QAKEY TRACE : ",split_qakey_env(i)
304C enddo
305
306
307 RETURN

◆ qaopen()

subroutine qa_out_mod::qaopen ( character(len=*) step)

@purpose open QA extract file

Definition at line 131 of file qa_out_mod.F.

132#include "implicit_f.inc"
133 integer preci
134 integer i
135 logical RD_extract_file
136 character *100 env
137 character(len=*) :: step
138
139 rd_extract_file=.false.
140
141 call getenv ( 'DO_QA', env )
142 doqa = 0
143
144 if ( env /= 'ON' ) then
145 return
146 endif
147
148
149 allocate(qa_storage(lqa_storage))
150 do i=1,lqa_storage
151 qa_storage(i)%itype=0
152 qa_storage(i)%title=''
153 qa_storage(i)%valuer=0.0_8
154 qa_storage(i)%valuei=0
155 end do
156
157! open the file
158 open ( lunitqa, file='RD-qa.extract', err=9010 )
159
160C In engine step we append print in the extract file, in starter we
161C create the file from scratch
162
163 if (step(1:len_trim(step)) == "engine") then
164
165C We get the next index value (in the case we are in engine, we want
166C to continue the id at the following, so read the RD.extract file
167C to get the value and set qaid for next qaprint
168
169 next_index=0
170 1001 read ( lunitqa, 2001, end=3001 ) next_index
171 2001 format(i10)
172 goto 1001
173 3001 continue
174
175#ifdef __GFORTRAN__
176 ! Only Gfortran / Intel compiler works fine
177 ! -----------------------------------------
178 ! Gfortran cannot write after EOF
179 ! Needs to do a Backspace to place just before EOF.
180 backspace lunitqa
181#endif
182
183 qaid = next_index
184 endif
185 qa_format = '(g16.9)'
186 preci = 9
187
188 write( qa_format, 1200 ) 7+preci, preci
189 1200 format('(g',i2,'.',i1,')')
190
191 doqa = 1
192
193
194C Get possible defined env variable QAKEY
195 call qagetqakeyenv()
196
197
198 return
199
200 9010 continue
201
202 write(*,*) 'Error opening extract file'
203 doqa = 2
204 RETURN

◆ qaprint()

subroutine qa_out_mod::qaprint ( character(len=*) name,
integer idin,
value )

@purpose print one entry to QA extract file example of call for real print CALL QAPRINT('MY_LABEL',0,12345.6_8) (2nd argument is 0, 3rd is the real value to be printed followed with '_8') example of call for integer print CALL QAPRINT('MY_LABEL',123456,0.0_8) (2nd argument is the integer value to be printed, 3rd must be 0.0_8)

Definition at line 389 of file qa_out_mod.F.

390#include "implicit_f.inc"
391
392 character(len=*) :: name
393 character(len=LEN_TRIM(name)) :: name2
394 integer idin, id
395 double precision value !(2)
396 real rvalue
397 character *20 srvalue
398 character *6 siid
399 character*4 simg
400 integer intstart, is
401 integer ma4cmplx
402 data ma4cmplx/-999/
403 character *40 qaprint_limit_char
404 character(len=512) :: warning_msg
405
406 qaprint_limit_char = ' '
407
408 if ( doqa /= 1 ) return
409
410 if (qaid == qaprint_limit) then
411c we don't go over a specified limit (default or manual set or limit threshold)
412 return
413 endif
414
415 qaid = qaid + 1
416
417C If the value (double precision) variable is 0.0 we consider using the idin (integer)
418C The problem with doing that, is that a SPECIFIC VARIABLE PRINT with a real id and a value =0.0 will result in losing the suffix
419C as it will be used as value e.g. (CALL QAPRINT('stop_starter',2,0.0_8) => STOP_STARTER 2 and no more STOP_STARTER_2 0 ) !!!
420 if (value == 0.0) then
421C Forcing the id to 0, we don't want to add any name suffix in this case
422 id = 0
423 else
424 id = abs(idin)
425 endif
426
427 if ( id > 99999 ) id = 90000 + mod(id,10000)
428
429
430 if ( id == 0 ) then
431 intstart = 6
432 siid = ' '
433 else
434 write (siid,'(i6.6)') id
435 intstart = 1
436 if ( id <= 999 ) intstart = 3
437 siid(intstart:intstart) = '_'
438 endif
439
440 simg = '<i> '
441 is = 4
442
443 rvalue = real(value) !(i)
444 if ( rvalue == 0.0 ) then
445! normalize zero to limit p4 differences between platforms
446 srvalue = ' 0.00000'
447 else
448 write(srvalue,qa_format) value !(i)
449 endif
450
451c replace possible blank char in name(when it comes from array print)
452 call blank2underscore(name,name2)
453
454c we don't go over 9999 lines, this is a default limitation
455 if (qaid == qaprint_limit) then
456
457 write(qaprint_limit_char, '(i12)') qaprint_limit
458 qaprint_limit_char = ADJUSTL(qaprint_limit_char)
459 write ( lunitqa, 1002 ) qaid, 'qaprint_is_limited_to_',qaprint_limit_char(1:LEN_TRIM(qaprint_limit_char)),
460 . '_lines_(use_variable_qaprint_limit_in_qa.files_to_change_limit)', siid(intstart:6), simg(is:4), 0
461
462 PRINT*,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
463 write ( warning_msg, 1003 )
464 . 'warning : the qaprint max number of lines to be printed in the extract file has been reached('
465 . ,qaprint_limit_char(1:LEN_TRIM(qaprint_limit_char)),' lines).'
466 PRINT*,warning_msg(1:LEN_TRIM(warning_msg))
467 PRINT*,'to change this limit please setenv the variable qaprint_limit'
468 PRINT*,'in the related qa.filesxxx'
469 PRINT*,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
470
471 else
472C If the value (double precision) variable is 0.0 we consider using the idin (integer) as value
473 if (value == 0.0) then
474 write ( lunitqa, 1000 ) qaid, name2(1:LEN_TRIM(name2)), siid(intstart:6), simg(is:4), idin
475 else
476 write ( lunitqa, 1001 ) qaid, name2(1:LEN_TRIM(name2)), siid(intstart:6), simg(is:4), srvalue(1:lastchar(srvalue))
477 endif
478 endif
479
480 1000 format( i10, 2x, a, a, a, i12 )
481 1001 format( i10, 2x, a, a, a, a )
482 1002 format( i10, 2x, a, a, a, a, a, i12 )
483 1003 format( a, a, a )
484
485 is = 1
486
487 call flush(lunitqa)
488 RETURN
end diagonal values have been computed in the(sparse) matrix id.SOL
#define max(a, b)
Definition macros.h:21
initmumps id

◆ qaprint2()

subroutine qa_out_mod::qaprint2 ( character *(*) name,
integer idin,
value,
double precision, value value2 )

@purpose print one entry to QA extract file in an energy style ()

Definition at line 502 of file qa_out_mod.F.

503#include "implicit_f.inc"
504
505 character *(*) name
506 integer idin, id
507 double precision value !(2)
508 double precision value2 !(2)
509 real rvalue
510 real rvalue2
511 character *20 srvalue
512 character *20 srvalue2
513 character *6 siid
514 character*4 simg
515 integer intstart, is
516 integer ma4cmplx
517 data ma4cmplx/-999/
518
519 if ( doqa /= 1 ) return
520
521 qaid = qaid + 1
522
523 id = abs(idin)
524 if ( id > 99999 ) id = 90000 + mod(id,10000)
525
526 if ( id == 0 ) then
527 intstart = 6
528 siid = ' '
529 else
530 write (siid,'(i6.6)') id
531 intstart = 1
532 if ( id <= 999 ) intstart = 3
533 siid(intstart:intstart) = '_'
534 endif
535
536 simg = '<i> '
537 is = 4
538
539 rvalue = real(value) !(i)
540 if ( rvalue == 0.0 ) then
541! normalize zero to limit p4 differences between platforms
542 srvalue = ' 0.00000'
543 else
544 write(srvalue,qa_format) value !(i)
545 endif
546
547 rvalue2 = real(value2) !(i)
548 if ( rvalue2 == 0.0 ) then
549! normalize zero to limit p4 differences between platforms
550 srvalue2 = ' 0.00000'
551 else
552 write(srvalue2,qa_format) value2 !(i)
553 endif
554
555 write ( lunitqa, 1000 ) qaid, name(1:len_trim(name)), siid(intstart:6), simg(is:4),
556 . srvalue(1:lastchar(srvalue)),
557 . srvalue2(1:lastchar(srvalue2))
558 1000 format( i10, 2x, a, a, a, a, a )
559
560 is = 1
561
562 call flush(lunitqa)
563 RETURN

◆ qaseti()

subroutine qa_out_mod::qaseti ( integer pos,
character(*) title,
integer i )

@purpose write an integer value in standard values array qa_storage

Definition at line 592 of file qa_out_mod.F.

593#include "implicit_f.inc"
594 integer pos
595 character(*) title
596 integer i
597
598 qa_storage(pos)%itype=1
599 write(qa_storage(pos)%title,'(A)')title(1:len_trim(title))
600 qa_storage(pos)%valuei=i
601 qa_storage(pos)%itype=1
602 RETURN

◆ qasetr()

subroutine qa_out_mod::qasetr ( integer pos,
character(*) title,
double precision r )

@purpose write a real value in standard values array qa_storage

Definition at line 612 of file qa_out_mod.F.

613#include "implicit_f.inc"
614 integer pos
615 character(*) title
616 double precision r
617
618 qa_storage(pos)%itype=2
619 write(qa_storage(pos)%title,'(A)')title(1:len_trim(title))
620 qa_storage(pos)%valuer=r
621 qa_storage(pos)%itype=1
622 RETURN

◆ qastatus()

subroutine qa_out_mod::qastatus ( integer istatus)

@purpose get QA status

Definition at line 573 of file qa_out_mod.F.

574#include "implicit_f.inc"
575 integer istatus
576
577 if ( doqa == 1) then
578 istatus = 1
579 else
580 istatus = 0
581 endif
582 RETURN

Variable Documentation

◆ doqa

integer qa_out_mod::doqa

Definition at line 84 of file qa_out_mod.F.

84 integer doqa, lunitqa, qaid, next_index

◆ emax_index

integer qa_out_mod::emax_index

Definition at line 107 of file qa_out_mod.F.

107 integer emax_index

◆ lqa_storage

integer qa_out_mod::lqa_storage

Definition at line 85 of file qa_out_mod.F.

85 integer lqa_storage

◆ lunitqa

integer qa_out_mod::lunitqa

Definition at line 84 of file qa_out_mod.F.

◆ next_index

integer qa_out_mod::next_index

Definition at line 84 of file qa_out_mod.F.

◆ nqakeylist_avail

integer qa_out_mod::nqakeylist_avail

Definition at line 111 of file qa_out_mod.F.

111 INTEGER NQAKEYLIST_AVAIL

◆ qa_format

character*12 qa_out_mod::qa_format

Definition at line 100 of file qa_out_mod.F.

100 character*12 qa_format

◆ qa_storage

type(tqa_value), dimension(:), allocatable qa_out_mod::qa_storage

Definition at line 98 of file qa_out_mod.F.

98 type(tqa_value), dimension(:), allocatable :: qa_storage

◆ qaid

integer qa_out_mod::qaid

Definition at line 84 of file qa_out_mod.F.

◆ qaprint_limit

integer qa_out_mod::qaprint_limit

Definition at line 89 of file qa_out_mod.F.

89 integer qaprint_limit

◆ qaprint_limit_default

integer, parameter qa_out_mod::qaprint_limit_default = 10000

Definition at line 87 of file qa_out_mod.F.

87 integer,parameter :: qaprint_limit_default = 10000

◆ qaprint_limit_maxx

integer, parameter qa_out_mod::qaprint_limit_maxx = 500000

Definition at line 88 of file qa_out_mod.F.

88 integer,parameter :: qaprint_limit_maxx = 500000

◆ split_qakey_env

character(len=64), dimension(520) qa_out_mod::split_qakey_env

Definition at line 115 of file qa_out_mod.F.

115 CHARACTER(len=64), DIMENSION(520) :: split_qakey_env