open the ascii transient output unit
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(hvs_ascii_type), | intent(inout) | :: | ascii |
ascii output type |
||
type(tem_comm_env_type), | intent(in) | :: | outProc |
Parallel environment to use for the output. |
||
type(tem_varSys_type), | intent(in) | :: | varSys |
solver-provided variable systems |
||
integer, | intent(in) | :: | varPos(:) |
Position of variables to dump in varSys |
||
integer, | intent(in) | :: | nDofs |
The number of dofs for each scalar variable of the equation system |
subroutine hvs_ascii_open( ascii, outProc, varSys, varPos, nDofs ) ! --------------------------------------------------------------------------- !> ascii output type type(hvs_ascii_type ), intent(inout) :: ascii !> Parallel environment to use for the output. type(tem_comm_env_type ), intent(in) :: outProc !> solver-provided variable systems type(tem_varSys_type), intent(in) :: varSys !> Position of variables to dump in varSys integer, intent(in) :: varPos(:) !> The number of dofs for each scalar variable of the equation system integer, intent(in) :: nDofs ! --------------------------------------------------------------------------- character(len=labelLen) :: logName character(len=1500) :: buffer logical :: nUnitOpened logical :: file_exists integer :: UnitNumber ! --------------------------------------------------------------------------- file_exists = .false. nUnitOpened = .false. write(buffer,'(i5.5)') outProc%rank ! Include the rank name in the file name to avoid overwriting of files ! by different processes write(logName,'(a)') trim(ascii%basename)//'_p'//trim(buffer)//'.res' ! check if the file exists inquire( file = trim(logName), exist = file_exists ) if( file_exists )then ! \todo: SZ: before simply appending check if header lua exists, open ! it, read the varSys and compare it with the one requested ! by this tracking object. ! if equal -> appened file_exists ! if not equal -> put a new behind the filename and open ! a new file ! in case the file exists, check wether it is already opened somewhere ! else (dyn load balancing) inquire( file=trim(logName), opened=nUnitOpened, number=UnitNumber ) if (nUNitOpened) then ! if it is opened, use the corresponding unit ascii%outunit = UnitNumber else ! get a new unit and reopen the file call tem_open( newunit = ascii%outunit, & & file = trim(logName), & & action = 'WRITE', & & position = 'APPEND', & & status = 'OLD' ) end if else ! in case the file does not exist, get a new unit and open a new file ! and write the header call tem_open( newunit = ascii%outunit, & & file = trim(logName), & & action = 'WRITE', & & status = 'NEW' ) write ( ascii%outunit , '(a,i7)' ) '# Rank of the process: ', & & outProc%rank end if if (.not. file_exists .and. .not. nUnitOpened) then write( buffer, '(a)' ) '#' write( buffer, '(a,a23)' ) trim(buffer),'time' buffer = trim(buffer) & & //trim(getHeader( varSys, varPos, nDofs, ascii%isReduce )) ! ... and write the header row to the file write ( ascii%outunit , '(a)' ) trim(buffer) end if end subroutine hvs_ascii_open