Dynamically adds a new step and actual physical time entry to flow.pvd.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(case_params_t), | intent(in) | :: | params | |||
| type(flow_mpi_t), | intent(in) | :: | flow | |||
| integer, | intent(in) | :: | step | |||
| real(kind=rk), | intent(in) | :: | time |
subroutine update_pvd_collection(params, flow, step, time) type(case_params_t), intent(in) :: params type(flow_mpi_t), intent(in) :: flow integer, intent(in) :: step real(rk), intent(in) :: time integer :: unit_id, i character(len=path_len + 32) :: filename character(len=64) :: vtu_name character(len=32) :: time_text if (flow%rank /= 0 .or. .not. params%write_vtu) return if (.not. allocated(pvd_steps)) then allocate(pvd_steps(params%nsteps + 10)) allocate(pvd_times(params%nsteps + 10)) n_pvd_entries = 0 end if ! Verify if the step is already in the list to avoid duplicate entries on restart step 0 do i = 1, n_pvd_entries if (pvd_steps(i) == step) then pvd_times(i) = time goto 100 end if end do if (n_pvd_entries < params%nsteps + 10) then n_pvd_entries = n_pvd_entries + 1 pvd_steps(n_pvd_entries) = step pvd_times(n_pvd_entries) = time end if 100 continue filename = trim(params%output_dir)//'/VTK/flow.pvd' open(newunit=unit_id, file=trim(filename), status='replace', action='write') write(unit_id,'(a)') '<?xml version="1.0"?>' write(unit_id,'(a)') '<VTKFile type="Collection" version="0.1" byte_order="LittleEndian">' write(unit_id,'(a)') ' <Collection>' do i = 1, n_pvd_entries write(vtu_name,'("flow_",i6.6,".pvtu")') pvd_steps(i) write(time_text,'(ES26.16E4)') pvd_times(i) time_text = adjustl(time_text) write(unit_id,'(a,a,a,a,a)') ' <DataSet timestep="', trim(time_text), & '" group="" part="0" file="', trim(vtu_name), '"/>' end do write(unit_id,'(a)') ' </Collection>' write(unit_id,'(a)') '</VTKFile>' close(unit_id) end subroutine update_pvd_collection