Reads periodic link data from periodic.dat if it exists.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | filename | |||
| type(mesh_t), | intent(inout) | :: | m |
subroutine read_periodic_optional(filename, m) character(len=*), intent(in) :: filename type(mesh_t), intent(inout) :: m integer :: unit_id, ios, nlinks, i integer :: face_id, pair_face_id, neighbor_cell open(newunit=unit_id, file=trim(filename), status='old', action='read', iostat=ios) if (ios /= 0) return read(unit_id, *, iostat=ios) nlinks if (ios /= 0 .or. nlinks < 0) call fatal_error('mesh_io', 'invalid periodic header') do i = 1, nlinks read(unit_id, *, iostat=ios) face_id, pair_face_id, neighbor_cell if (ios /= 0) call fatal_error('mesh_io', 'failed reading periodic link') if (face_id < 1 .or. face_id > m%nfaces) call fatal_error('mesh_io', 'periodic face id out of range') if (pair_face_id < 1 .or. pair_face_id > m%nfaces) call fatal_error('mesh_io', 'periodic pair face id out of range') if (neighbor_cell < 1 .or. neighbor_cell > m%ncells) call fatal_error('mesh_io', 'periodic neighbor cell out of range') m%faces(face_id)%periodic_face = pair_face_id m%faces(face_id)%periodic_neighbor = neighbor_cell end do close(unit_id) end subroutine read_periodic_optional