Creates a new Silo virtual data base (VDB) for this timestep.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(silo_obj), | intent(inout) | :: | this |
A silo object |
||
| real(kind=wp), | intent(in) | :: | time |
Time value for this time step |
impure subroutine silo_obj_NewTimeStep(this,time) !> Creates a new Silo virtual data base (VDB) for this timestep. implicit none class(silo_obj), intent(inout) :: this !! A silo object real(wp), intent(in) :: time !! Time value for this time step ! Work variables integer :: ierr type(sysutils_obj) :: sysutils character(SILOstr) :: record character(len=str64):: timestr logical :: finished real(wp) :: my_time ! Convert time to string in scientific notation write(timestr, fmt='(ES12.5)') time ! Remove leading space timestr = trim(adjustl(timestr(2:))) ! Append new timestep to Visit file if (this%parallel%RankIsRoot()) then ! Skip existing older time steps finished=.false. do while (.not.finished) read(this%fid_VisIt,fmt='(a)',iostat=ierr) record if (ierr.ne.0) then finished=.true. backspace(this%fid_VisIt) else read(record(6:17),*) my_time if (my_time.ge.time) then finished=.true. backspace(this%fid_VisIt) end if end if end do ! Add timestep write(this%fid_VisIt,fmt='(6a)') 'time_',trim(adjustl(timestr)),'/',trim(adjustl(this%filename)),SILO_EXTENSION end if ! Create Silo directory for this timestep write(this%filepath,fmt='(4a)') SILOdir,'/time_',trim(adjustl(timestr)),'/' ! Set name of VDB file this%vdbname=trim(adjustl(this%filepath))//trim(adjustl(this%filename))//SILO_EXTENSION ! MPI root creates the VDB file if (this%parallel%RankIsRoot()) then ! Create new folder for this time step call sysutils%CreateDirectory(trim(adjustl(this%filepath))) ! Create the VDB file ierr = DBcreate(this%vdbname,len_trim(this%vdbname),DB_CLOBBER,DB_LOCAL, & SILOinfo,len_trim(SILOinfo),SILOdriver,this%fid_VDB) if (this%fid_VDB.eq.-1) call this%parallel%Stop('Unable to create SILO file') ! Set length of names ierr= DBset2dstrlen(SILOstr) end if ! Synchronize call MPI_BARRIER(this%parallel%comm%g) ! Create group files call this%SetupGroupFiles(this%access_flag) return end subroutine silo_obj_NewTimeStep