Write a restart file if enabled in &restart_input.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_t), | intent(in) | :: | mesh | |||
| type(flow_mpi_t), | intent(inout) | :: | flow | |||
| type(case_params_t), | intent(in) | :: | params | |||
| type(flow_fields_t), | intent(in) | :: | fields | |||
| type(species_fields_t), | intent(in) | :: | species | |||
| type(energy_fields_t), | intent(in) | :: | energy | |||
| type(transport_properties_t), | intent(in) | :: | transport | |||
| integer, | intent(in) | :: | step | |||
| real(kind=rk), | intent(in) | :: | time | |||
| real(kind=rk), | intent(in), | optional | :: | chemistry_accum_dt |
subroutine write_restart_file(mesh, flow, params, fields, species, energy, transport, step, time, chemistry_accum_dt) type(mesh_t), intent(in) :: mesh type(flow_mpi_t), intent(inout) :: flow type(case_params_t), intent(in) :: params type(flow_fields_t), intent(in) :: fields type(species_fields_t), intent(in) :: species type(energy_fields_t), intent(in) :: energy type(transport_properties_t), intent(in) :: transport integer, intent(in) :: step real(rk), intent(in) :: time real(rk), intent(in), optional :: chemistry_accum_dt character(len=path_len) :: restart_dir, filename character(len=16) :: step_text integer :: ierr if (.not. params%write_restart) return if (params%restart_interval <= 0) return if (mod(step, params%restart_interval) /= 0 .and. step /= params%nsteps) return call restart_directory(params, restart_dir) if (flow%rank == 0) then call execute_command_line('mkdir -p ' // trim(restart_dir)) end if call MPI_Barrier(flow%comm, ierr) if (ierr /= MPI_SUCCESS) call fatal_error('restart', 'MPI_Barrier failed before restart write') write(step_text, '(i8.8)') step filename = trim(restart_dir) // '/restart_' // trim(step_text) // '.rst' if (present(chemistry_accum_dt)) then call write_restart_to_path(trim(filename), mesh, flow, params, fields, species, energy, transport, step, time, chemistry_accum_dt) else call write_restart_to_path(trim(filename), mesh, flow, params, fields, species, energy, transport, step, time, zero) end if if (flow%rank == 0) then if (trim(params%terminal_detail) == 'full') then write(output_unit,'(a,a)') 'wrote restart: ', trim(filename) end if call prune_restart_files(params, trim(restart_dir)) end if end subroutine write_restart_file