diff --git a/src/ace.f90 b/src/ace.f90 index 20ee422ca..97e5c45af 100644 --- a/src/ace.f90 +++ b/src/ace.f90 @@ -34,7 +34,7 @@ contains integer :: index_continuous ! index in xs_continuous integer :: index_thermal ! index in xs_thermal character(10) :: key ! name of isotope, e.g. 92235.03c - character(250) :: msg ! output/error message + character(max_line_len) :: msg ! output/error message type(Material), pointer :: mat => null() type(xsData), pointer :: iso => null() type(AceContinuous), pointer :: ace_cont => null() @@ -120,20 +120,20 @@ contains integer, intent(in) :: index_table ! index in xs_continuous array integer, intent(in) :: index ! index in xsdatas array - integer :: in = 7 ! unit to read from - integer :: ioError ! error status for file access - integer :: words_per_line ! number of words per line (data) - integer :: lines ! number of lines (data - integer :: n ! number of data values - real(8) :: kT ! ACE table temperature - logical :: file_exists ! does ACE library exist? - logical :: found_xs ! did we find table in library? - character(7) :: readable ! is ACE library readable? - character(250) :: msg ! output/error message - character(250) :: line ! single line to read - character(32) :: words(max_words) ! words on a line - character(100) :: filename ! name of ACE library file - character(10) :: tablename ! name of cross section table + integer :: in = 7 ! unit to read from + integer :: ioError ! error status for file access + integer :: words_per_line ! number of words per line (data) + integer :: lines ! number of lines (data + integer :: n ! number of data values + real(8) :: kT ! ACE table temperature + logical :: file_exists ! does ACE library exist? + logical :: found_xs ! did we find table in library? + character(7) :: readable ! is ACE library readable? + character(max_line_len) :: msg ! output/error message + character(max_line_len) :: line ! single line to read + character(max_word_len) :: words(max_words) ! words on a line + character(max_word_len) :: filename ! name of ACE library file + character(10) :: tablename ! name of cross section table type(AceContinuous), pointer :: table => null() filename = xsdatas(index)%path @@ -931,20 +931,20 @@ contains integer, intent(in) :: index_table ! index in xs_thermal array integer, intent(in) :: index ! index in xsdatas array - integer :: in = 7 ! unit to read from - integer :: ioError ! error status for file access - integer :: words_per_line ! number of words per line (data) - integer :: lines ! number of lines (data - integer :: n ! number of data values - real(8) :: kT ! ACE table temperature - logical :: file_exists ! does ACE library exist? - logical :: found_xs ! did we find table in library? - character(7) :: readable ! is ACE library readable? - character(250) :: msg ! output/error message - character(250) :: line ! single line to read - character(32) :: words(max_words) ! words on a line - character(100) :: filename ! name of ACE library file - character(10) :: tablename ! name of cross section table + integer :: in = 7 ! unit to read from + integer :: ioError ! error status for file access + integer :: words_per_line ! number of words per line (data) + integer :: lines ! number of lines (data + integer :: n ! number of data values + real(8) :: kT ! ACE table temperature + logical :: file_exists ! does ACE library exist? + logical :: found_xs ! did we find table in library? + character(7) :: readable ! is ACE library readable? + character(max_line_len) :: msg ! output/error message + character(max_line_len) :: line ! single line to read + character(max_word_len) :: words(max_words) ! words on a line + character(max_word_len) :: filename ! name of ACE library file + character(10) :: tablename ! name of cross section table type(AceThermal), pointer :: table => null() filename = xsdatas(index)%path diff --git a/src/cross_section.f90 b/src/cross_section.f90 index 7866936ac..54bc61881 100644 --- a/src/cross_section.f90 +++ b/src/cross_section.f90 @@ -19,17 +19,18 @@ contains character(*), intent(in) :: path - type(xsData), pointer :: iso => null() - character(250) :: line, msg - character(100) :: words(max_words) - character(100) :: filename - integer :: i, n - integer :: in = 7 - logical :: file_exists - character(7) :: readable - integer :: count - integer :: index - integer :: ioError + type(xsData), pointer :: iso => null() + character(max_line_len) :: line + character(max_line_len) :: msg + character(max_word_len) :: words(max_words) + character(max_word_len) :: filename + integer :: i, n + integer :: in = 7 + logical :: file_exists + character(7) :: readable + integer :: count + integer :: index + integer :: ioError msg = "Reading cross-section summary file..." call message(msg, 5) @@ -54,8 +55,8 @@ contains end if ! open xsdata file - open(file=filename, unit=in, status='old', & - & action='read', iostat=ioError) + open(FILE=filename, UNIT=in, STATUS='old', & + & ACTION='read', IOSTAT=ioError) if (ioError /= 0) then msg = "Error while opening file: " // filename call error(msg) @@ -64,13 +65,13 @@ contains ! determine how many lines count = 0 do - read(unit=in, fmt='(A250)', iostat=ioError) line + read(UNIT=in, FMT='(A)', IOSTAT=ioError) line if (ioError < 0) then ! reached end of file exit elseif (ioError > 0) then msg = "Unknown error while reading file: " // filename - close(unit=in) + close(UNIT=in) call error(msg) end if count = count + 1 @@ -84,7 +85,7 @@ contains index = 0 rewind(in) do - read(unit=in, fmt='(A250)', iostat=ioError) line + read(UNIT=in, FMT='(A)', IOSTAT=ioError) line if (ioError < 0) exit index = index + 1 call split_string(line, words, n) @@ -93,7 +94,7 @@ contains ! Check to make sure there are enough arguments if (n < 9) then msg = "Not enough arguments on xsdata line: " // line - close(unit=in) + close(UNIT=in) call error(msg) end if @@ -114,7 +115,7 @@ contains call dict_add_key(xsdata_dict, iso%alias, index) end do - close(unit=in) + close(UNIT=in) end subroutine read_xsdata @@ -139,7 +140,7 @@ contains real(8) :: E_i1 real(8) :: sigma_i real(8) :: sigma_i1 - character(250) :: msg + character(max_line_len) :: msg msg = "Creating material total cross-sections..." call message(msg, 4) diff --git a/src/data_structures.f90 b/src/data_structures.f90 index 3b5d04d79..de4f66d21 100644 --- a/src/data_structures.f90 +++ b/src/data_structures.f90 @@ -723,7 +723,7 @@ contains subroutine dict_ci_add_key(dict, key, value) type(DictionaryCI), pointer :: dict - character(len=*), intent(in) :: key + character(*), intent(in) :: key integer, intent(in) :: value type(KeyValueCI) :: data @@ -795,7 +795,7 @@ contains subroutine dict_ci_delete_key(dict, key) type(DictionaryCI), pointer :: dict - character(len=*), intent(in) :: key + character(*), intent(in) :: key type(ListKeyValueCI), pointer :: elem integer :: hash @@ -843,7 +843,7 @@ contains function dict_ci_get_key(dict, key) result(value) type(DictionaryCI), pointer :: dict - character(len=*), intent(in) :: key + character(*), intent(in) :: key integer :: value type(KeyValueCI) :: data @@ -895,7 +895,7 @@ contains function dict_ci_has_key(dict, key) result(has) type(DictionaryCI), pointer :: dict - character(len=*), intent(in) :: key + character(*), intent(in) :: key logical :: has type(ListKeyValueCI), pointer :: elem @@ -937,7 +937,7 @@ contains function dict_ci_get_elem(dict, key) result(elem) type(DictionaryCI), pointer :: dict - character(len=*), intent(in) :: key + character(*), intent(in) :: key type(ListKeyValueCI), pointer :: elem integer :: hash @@ -989,7 +989,7 @@ contains function dict_ci_hashkey(key) result(val) - character(len=*), intent(in) :: key + character(*), intent(in) :: key integer :: val integer :: hash diff --git a/src/energy_grid.f90 b/src/energy_grid.f90 index fcbba27c7..5b96c072e 100644 --- a/src/energy_grid.f90 +++ b/src/energy_grid.f90 @@ -25,7 +25,7 @@ contains type(AceReaction), pointer :: rxn => null() integer :: i, j integer :: n - character(100) :: msg + character(max_line_len) :: msg msg = "Creating unionized energy grid..." call message(msg, 5) diff --git a/src/fileio.f90 b/src/fileio.f90 index 764ec4c11..e45a33e7a 100644 --- a/src/fileio.f90 +++ b/src/fileio.f90 @@ -34,10 +34,10 @@ contains subroutine read_command_line() - integer :: argc ! number of command line arguments - logical :: file_exists ! does specified input file exist? - character(250) :: msg ! error message - character(7) :: readable ! is input file readable? + integer :: argc ! number of command line arguments + logical :: file_exists ! does specified input file exist? + character(max_line_len) :: msg ! error message + character(7) :: readable ! is input file readable? argc = COMMAND_ARGUMENT_COUNT() if (argc > 0) then @@ -72,15 +72,15 @@ contains character(*), intent(in) :: filename - integer :: in = 7 ! unit # for input file - integer :: index ! index in universes array - integer :: ioError ! error status for file access - integer :: n ! number of words on a line - integer :: count ! number of cells in a universe - integer :: universe_num ! user-specified universe # - character(250) :: line ! a line of words in input file - character(250) :: msg ! output/error message - character(32) :: words(max_words) ! words on a line + integer :: in = 7 ! unit # for input file + integer :: index ! index in universes array + integer :: ioError ! error status for file access + integer :: n ! number of words on a line + integer :: count ! number of cells in a universe + integer :: universe_num ! user-specified universe # + character(max_line_len) :: line ! a line of words in input file + character(max_line_len) :: msg ! output/error message + character(max_word_len) :: words(max_words) ! words on a line type(ListKeyValueII), pointer :: key_list => null() type(Universe), pointer :: univ => null() @@ -229,9 +229,9 @@ contains integer :: index_material ! index in materials array integer :: index_source ! index in source array (?) integer :: index_tally ! index in tally array - character(250) :: line ! a line of words - character(250) :: msg ! output/error message - character(32) :: words(max_words) ! words on a single line + character(max_line_len) :: line ! a line of words + character(max_line_len) :: msg ! output/error message + character(max_word_len) :: words(max_words) ! words on a single line msg = "Second pass through input file..." call message(msg, 5) @@ -300,7 +300,7 @@ contains case ('verbosity') verbosity = str_to_int(words(2)) if (verbosity == ERROR_INT) then - msg = "Invalid verbosity: " // words(2) + msg = "Invalid verbosity: " // trim(words(2)) call error(msg) end if @@ -329,12 +329,12 @@ contains subroutine adjust_indices() - integer :: i ! index in cells array - integer :: j ! index over surface list - integer :: index ! index in surfaces/materials array - integer :: surf_num ! user-specified surface number - integer :: bc ! boundary condition - character(250) :: msg ! output/error message + integer :: i ! index in cells array + integer :: j ! index over surface list + integer :: index ! index in surfaces/materials array + integer :: surf_num ! user-specified surface number + integer :: bc ! boundary condition + character(max_line_len) :: msg ! output/error message type(Cell), pointer :: c => null() type(Surface), pointer :: surf => null() type(ListKeyValueII), pointer :: key_list => null() @@ -464,20 +464,20 @@ contains character(*), intent(in) :: words(n_words) ! words on cell card entry integer, intent(in) :: n_words ! number of words - integer :: ioError ! error status for file access - integer :: i ! index for surface list in a cell - integer :: universe_num ! user-specified universe number - integer :: n_surfaces ! number of surfaces in a cell - character(250) :: msg ! output/error message - character(32) :: word ! single word - type(Cell), pointer :: c => null() + integer :: ioError ! error status for file access + integer :: i ! index for surface list in a cell + integer :: universe_num ! user-specified universe number + integer :: n_surfaces ! number of surfaces in a cell + character(max_line_len) :: msg ! output/error message + character(max_word_len) :: word ! single word + type(Cell), pointer :: c => null() c => cells(index) ! Read cell identifier c % uid = str_to_int(words(2)) if (c % uid == ERROR_INT) then - msg = "Invalid cell name: " // words(2) + msg = "Invalid cell name: " // trim(words(2)) call error(msg) end if call dict_add_key(cell_dict, c%uid, index) @@ -485,7 +485,7 @@ contains ! Read cell universe universe_num = str_to_int(words(3)) if (universe_num == ERROR_INT) then - msg = "Invalid universe: " // words(3) + msg = "Invalid universe: " // trim(words(3)) call error(msg) end if c % universe = dict_get_key(universe_dict, universe_num) @@ -498,7 +498,7 @@ contains ! find universe universe_num = str_to_int(words(5)) if (universe_num == ERROR_INT) then - msg = "Invalid universe fill: " // words(5) + msg = "Invalid universe fill: " // trim(words(5)) call error(msg) end if @@ -515,7 +515,7 @@ contains c % material = str_to_int(words(4)) c % fill = 0 if (c % material == ERROR_INT) then - msg = "Invalid material number: " // words(4) + msg = "Invalid material number: " // trim(words(4)) call error(msg) end if n_surfaces = n_words - 4 @@ -558,19 +558,19 @@ contains character(*), intent(in) :: words(n_words) ! words in surface card entry integer, intent(in) :: n_words ! number of words - integer :: ioError ! error status for file access - integer :: i ! index for surface coefficients - integer :: coeffs_reqd ! number of coefficients are required - character(250) :: msg ! output/error message - character(32) :: word ! single word - type(Surface), pointer :: surf => null() + integer :: ioError ! error status for file access + integer :: i ! index for surface coefficients + integer :: coeffs_reqd ! number of coefficients are required + character(max_line_len) :: msg ! output/error message + character(max_word_len) :: word ! single word + type(Surface), pointer :: surf => null() surf => surfaces(index) ! Read surface identifier read(words(2), FMT='(I8)', IOSTAT=ioError) surf % uid if (ioError > 0) then - msg = "Invalid surface name: " // words(2) + msg = "Invalid surface name: " // trim(words(2)) call error(msg) end if call dict_add_key(surface_dict, surf % uid, index) @@ -619,13 +619,13 @@ contains surf % type = SURF_GQ coeffs_reqd = 10 case default - msg = "Invalid surface type: " // words(3) + msg = "Invalid surface type: " // trim(words(3)) call error(msg) end select ! Make sure there are enough coefficients for surface type if (n_words-3 < coeffs_reqd) then - msg = "Not enough coefficients for surface: " // words(2) + msg = "Not enough coefficients for surface: " // trim(words(2)) call error(msg) end if @@ -648,15 +648,15 @@ contains character(*), intent(in) :: words(n_words) ! words in bc entry integer, intent(in) :: n_words ! number of words - integer :: surface_uid ! User-specified uid of surface - integer :: bc ! Boundary condition - character(32) :: word ! Boundary condition (in input file) - character(250) :: msg ! Output/error message + integer :: surface_uid ! User-specified uid of surface + integer :: bc ! Boundary condition + character(max_word_len) :: word ! Boundary condition (in input file) + character(max_line_len) :: msg ! Output/error message ! Read surface identifier surface_uid = str_to_int(words(2)) if (surface_uid == ERROR_INT) then - msg = "Invalid surface name: " // words(2) + msg = "Invalid surface name: " // trim(words(2)) call error(msg) end if @@ -671,7 +671,7 @@ contains case ('reflect') bc = BC_REFLECT case default - msg = "Invalid boundary condition: " // words(3) + msg = "Invalid boundary condition: " // trim(words(3)) call error(msg) end select @@ -690,21 +690,21 @@ contains character(*), intent(in) :: words(n_words) ! words in lattice entry integer, intent(in) :: n_words ! number of words - integer :: universe_num ! user-specified universe number - integer :: n_x ! number of lattice cells in x direction - integer :: n_y ! number of lattice cells in y direction - integer :: i,j ! loop indices for Lattice % universes - integer :: index_word ! index in words array - character(250) :: msg ! output/error/message - character(32) :: word ! single word - type(Lattice), pointer :: lat => null() + integer :: universe_num ! user-specified universe number + integer :: n_x ! number of lattice cells in x direction + integer :: n_y ! number of lattice cells in y direction + integer :: i,j ! loop indices for Lattice % universes + integer :: index_word ! index in words array + character(max_line_len) :: msg ! output/error/message + character(max_word_len) :: word ! single word + type(Lattice), pointer :: lat => null() lat => lattices(index) ! Read lattice universe universe_num = str_to_int(words(2)) if (universe_num == ERROR_INT) then - msg = "Invalid universe: " // words(2) + msg = "Invalid universe: " // trim(words(2)) call error(msg) end if lat % uid = universe_num @@ -718,7 +718,7 @@ contains case ('hex') lat % type = LATTICE_HEX case default - msg = "Invalid lattice type: " // words(3) + msg = "Invalid lattice type: " // trim(words(3)) call error(msg) end select @@ -726,10 +726,10 @@ contains n_x = str_to_int(words(4)) n_y = str_to_int(words(5)) if (n_x == ERROR_INT) then - msg = "Invalid number of lattice cells in x-direction: " // words(4) + msg = "Invalid number of lattice cells in x-direction: " // trim(words(4)) call error(msg) elseif (n_y == ERROR_INT) then - msg = "Invalid number of lattice cells in y-direction: " // words(5) + msg = "Invalid number of lattice cells in y-direction: " // trim(words(5)) call error(msg) end if lat % n_x = n_x @@ -757,7 +757,7 @@ contains index_word = 9 + j*n_x + i universe_num = str_to_int(words(index_word)) if (universe_num == ERROR_INT) then - msg = "Invalid universe number: " // words(index_word) + msg = "Invalid universe number: " // trim(words(index_word)) call error(msg) end if lat % element(i, n_y-j) = dict_get_key(universe_dict, universe_num) @@ -775,11 +775,11 @@ contains character(*), intent(in) :: words(n_words) ! words on source entry integer, intent(in) :: n_words ! number of words - integer :: i ! index in values list - integer :: ioError ! error status for file access - integer :: values_reqd ! number of values required to specify source - character(250) :: msg ! output/error message - character(32) :: word ! single word + integer :: i ! index in values list + integer :: ioError ! error status for file access + integer :: values_reqd ! # of values required to specify source + character(max_line_len) :: msg ! output/error message + character(max_word_len) :: word ! single word ! Read source type word = words(2) @@ -789,13 +789,13 @@ contains external_source % type = SRC_BOX values_reqd = 6 case default - msg = "Invalid source type: " // words(2) + msg = "Invalid source type: " // trim(words(2)) call error(msg) end select ! Make sure there are enough values for this source type if (n_words-2 < values_reqd) then - msg = "Not enough values for source of type: " // words(2) + msg = "Not enough values for source of type: " // trim(words(2)) call error(msg) end if @@ -825,8 +825,8 @@ contains integer :: cell_uid integer :: r_bins, c_bins, e_bins real(8) :: E - character(32) :: word - character(250) :: msg + character(max_word_len) :: word + character(max_line_len) :: msg type(Tally), pointer :: t => null() t => tallies(index) @@ -834,7 +834,7 @@ contains ! Read tally identifier t % uid = str_to_int(words(2)) if (t % uid == ERROR_INT) then - msg = "Invalid tally name: " // words(2) + msg = "Invalid tally name: " // trim(words(2)) call error(msg) end if call dict_add_key(tally_dict, t % uid, index) @@ -973,15 +973,15 @@ contains character(*), intent(in) :: words(n_words) ! words on material entry integer, intent(in) :: n_words ! number of words - integer :: i ! index over isotopes - integer :: ioError ! error status for file access - integer :: n_isotopes ! number of isotopes in material - character(250) :: msg ! output/error message + integer :: i ! index over isotopes + integer :: ioError ! error status for file access + integer :: n_isotopes ! number of isotopes in material + character(max_line_len) :: msg ! output/error message type(Material), pointer :: mat => null() ! Check for correct number of arguments if (mod(n_words,2) == 0 .or. n_words < 5) then - msg = "Invalid number of arguments for material: " // words(2) + msg = "Invalid number of arguments for material: " // trim(words(2)) call error(msg) end if @@ -993,7 +993,7 @@ contains ! Read surface identifier read(words(2), FMT='(I8)', IOSTAT=ioError) mat % uid if (ioError > 0) then - msg = "Invalid surface name: " // words(2) + msg = "Invalid surface name: " // trim(words(2)) call error(msg) end if call dict_add_key(material_dict, mat%uid, index) @@ -1031,7 +1031,7 @@ contains logical :: percent_in_atom ! isotopes specified in atom percent? logical :: density_in_atom ! density specified in atom/b-cm? character(10) :: key ! name of isotopes, e.g. 92235.03c - character(100) :: msg ! output/error message + character(max_line_len) :: msg ! output/error message type(xsData), pointer :: iso => null() type(Material), pointer :: mat => null() @@ -1116,7 +1116,7 @@ contains character(*), intent(in) :: words(n_words) ! words on criticality card integer, intent(in) :: n_words ! number of words - character(250) :: msg ! output/error message + character(max_line_len) :: msg ! output/error message ! Set problem type to criticality problem_type = PROB_CRITICALITY @@ -1124,21 +1124,21 @@ contains ! Read number of cycles n_cycles = str_to_int(words(2)) if (n_cycles == ERROR_INT) then - msg = "Invalid number of cycles: " // words(2) + msg = "Invalid number of cycles: " // trim(words(2)) call error(msg) end if ! Read number of inactive cycles n_inactive = str_to_int(words(3)) if (n_inactive == ERROR_INT) then - msg = "Invalid number of inactive cycles: " // words(2) + msg = "Invalid number of inactive cycles: " // trim(words(2)) call error(msg) end if ! Read number of particles n_particles = str_to_int(words(4)) if (n_particles == ERROR_INT) then - msg = "Invalid number of particles: " // words(2) + msg = "Invalid number of particles: " // trim(words(2)) call error(msg) end if @@ -1150,11 +1150,11 @@ contains subroutine read_line(unit, line, ioError) - integer, intent(in) :: unit ! unit to read from - character(max_line), intent(out) :: line ! line to return - integer, intent(out) :: ioError ! error status + integer, intent(in) :: unit ! unit to read from + character(*), intent(out) :: line ! line to return + integer, intent(out) :: ioError ! error status - read(UNIT=unit, FMT='(A250)', IOSTAT=ioError) line + read(UNIT=unit, FMT='(A)', IOSTAT=ioError) line end subroutine read_line @@ -1171,14 +1171,14 @@ contains integer, intent(out) :: n ! number of words integer, intent(out) :: ioError ! error status - character(250) :: line ! single line - character(32) :: local_words(max_words) ! words on one line - integer :: index ! index of words + character(max_line_len) :: line ! single line + character(max_word_len) :: local_words(max_words) ! words on one line + integer :: index ! index of words index = 0 do ! read line from file - read(UNIT=unit, FMT='(A250)', IOSTAT=ioError) line + read(UNIT=unit, FMT='(A100)', IOSTAT=ioError) line ! if we're at the end of the file, return if (ioError /= 0) return @@ -1215,11 +1215,11 @@ contains integer, intent(in) :: n_lines ! number of lines to skip integer, intent(out) :: ioError ! error status - integer :: i ! index for number of lines - character(max_line) :: tmp ! single line + integer :: i ! index for number of lines + character(max_line_len) :: tmp ! single line do i = 1, n_lines - read(UNIT=unit, FMT='(A250)', IOSTAT=ioError) tmp + read(UNIT=unit, FMT='(A)', IOSTAT=ioError) tmp end do end subroutine skip_lines diff --git a/src/geometry.f90 b/src/geometry.f90 index d3a6904e7..0d1839a5e 100644 --- a/src/geometry.f90 +++ b/src/geometry.f90 @@ -26,8 +26,8 @@ contains integer :: i ! index of surfaces in cell integer :: surf_num ! index in surfaces array (with sign) integer :: current_surface ! current surface of particle (with sign) - character(250) :: msg ! output/error message - type(Surface), pointer :: surf => null() + character(max_line_len) :: msg ! output/error message + type(Surface), pointer :: surf => null() current_surface = p%surface @@ -92,9 +92,9 @@ contains type(Particle), pointer :: p ! pointer to particle logical, intent(inout) :: found ! particle found? - character(250) :: msg ! error message - integer :: i ! index over cells - integer :: x, y + character(max_line_len) :: msg ! error message + integer :: i ! index over cells + integer :: x, y type(Cell), pointer :: c ! pointer to cell type(Lattice), pointer :: lat ! pointer to lattice type(Universe), pointer :: lower_univ ! if particle is in lower @@ -173,10 +173,10 @@ contains type(Particle), pointer :: p - integer :: i ! index of neighbors - integer :: index_cell ! index in cells array - logical :: found ! particle found in universe? - character(250) :: msg ! output/error message? + integer :: i ! index of neighbors + integer :: index_cell ! index in cells array + logical :: found ! particle found in universe? + character(max_line_len) :: msg ! output/error message? type(Surface), pointer :: surf type(Cell), pointer :: c type(Universe), pointer :: lower_univ => null() @@ -286,7 +286,7 @@ contains real(8) :: x0 ! half the width of lattice element real(8) :: y0 ! half the height of lattice element logical :: found ! particle found in cell? - character(250) :: msg ! output/error message + character(max_line_len) :: msg ! output/error message type(Lattice), pointer :: lat type(Universe), pointer :: univ @@ -405,11 +405,11 @@ contains real(8) :: a,b,c,k ! quadratic equation coefficients real(8) :: quad ! discriminant of quadratic equation logical :: on_surface ! is particle on surface? - character(250) :: msg ! output/error message - type(Cell), pointer :: cell_p => null() - type(Cell), pointer :: parent_p => null() - type(Surface), pointer :: surf_p => null() - type(LatticE), pointer :: lat => null() + character(max_line_len) :: msg ! output/error message + type(Cell), pointer :: cell_p => null() + type(Cell), pointer :: parent_p => null() + type(Surface), pointer :: surf_p => null() + type(LatticE), pointer :: lat => null() cell_p => cells(p%cell) @@ -920,9 +920,9 @@ contains integer, allocatable :: count_positive(:) ! # of cells on positive side integer, allocatable :: count_negative(:) ! # of cells on negative side logical :: positive ! positive side specified in surface list - character(250) :: msg ! output/error message - type(Cell), pointer :: c - type(Surface), pointer :: surf + character(max_line_len) :: msg ! output/error message + type(Cell), pointer :: c + type(Surface), pointer :: surf msg = "Building neighboring cells lists for each surface..." call message(msg, 4) diff --git a/src/global.f90 b/src/global.f90 index c90ef1779..b2bd3fb44 100644 --- a/src/global.f90 +++ b/src/global.f90 @@ -8,6 +8,12 @@ module global implicit none + ! Maximum number of words in a single line, length of line, and length of + ! single word + integer, parameter :: max_words = 500 + integer, parameter :: max_line_len = 250 + integer, parameter :: max_word_len = 150 + ! Main arrays for cells, surfaces, materials type(Cell), allocatable, target :: cells(:) type(Universe), allocatable, target :: universes(:) @@ -82,8 +88,8 @@ module global logical :: mpi_enabled ! is MPI in use and initialized? ! Paths to input file, cross section data, etc - character(100) :: & - & path_input, & + character(max_word_len) :: & + & path_input, & & path_xsdata integer, parameter :: UNIT_LOG = 9 ! unit # for writing log file @@ -256,9 +262,6 @@ module global ! screen and in logs integer :: verbosity - integer, parameter :: max_words = 500 - integer, parameter :: max_line = 250 - ! Versioning numbers integer, parameter :: VERSION_MAJOR = 0 integer, parameter :: VERSION_MINOR = 2 @@ -399,10 +402,10 @@ contains integer :: index_exponent ! index of exponent character integer :: w ! total field width integer :: d ! number of digits to right of decimal point - integer :: readError + integer :: ioError - character(8) :: fmt ! format for reading string - character(250) :: msg ! error message + character(8) :: fmt ! format for reading string + character(max_line_len) :: msg ! error message ! Determine total field width w = len_trim(string) @@ -425,8 +428,8 @@ contains write(fmt, '("(E",I2,".",I2,")")') w, d ! Read string - read(string, fmt, iostat=readError) num - if (readError > 0) num = ERROR_REAL + read(UNIT=string, FMT=fmt, IOSTAT=ioError) num + if (ioError > 0) num = ERROR_REAL end function str_to_real diff --git a/src/logging.f90 b/src/logging.f90 index 57f8ee23f..0d951471d 100644 --- a/src/logging.f90 +++ b/src/logging.f90 @@ -12,9 +12,9 @@ contains subroutine create_log() - character(100) :: path_log ! path of log file - logical :: file_exists ! does log file already exist? - integer :: ioError ! error status for file access + character(max_word_len) :: path_log ! path of log file + logical :: file_exists ! does log file already exist? + integer :: ioError ! error status for file access ! Create filename for log file path_log = trim(path_input) // ".log" diff --git a/src/main.f90 b/src/main.f90 index 77c7f18b4..c2dcf5eb4 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -22,8 +22,8 @@ program main implicit none - character(16) :: filename - character(250) :: msg + character(max_word_len) :: filename + character(max_line_len) :: msg type(Universe), pointer :: univ ! Setup MPI @@ -106,7 +106,7 @@ contains real(8) :: t0 real(8) :: t1 type(Particle), pointer :: p => null() - character(250) :: msg + character(max_line_len) :: msg msg = "Running problem..." call message(msg, 6) diff --git a/src/mpi_routines.f90 b/src/mpi_routines.f90 index e7fb38381..9cf687c2e 100644 --- a/src/mpi_routines.f90 +++ b/src/mpi_routines.f90 @@ -32,7 +32,7 @@ contains integer :: bank_types(4) ! Datatypes integer(MPI_ADDRESS_KIND) :: bank_disp(4) ! Displacements integer(MPI_ADDRESS_KIND) :: base - character(250) :: msg ! Error message + character(max_line_len) :: msg ! Error message type(Bank) :: b mpi_enabled = .true. @@ -128,7 +128,7 @@ contains & temp_sites(:), & ! local array of extra sites on each node & left_bank(:), & ! bank sites to send/recv to or from left node & right_bank(:) ! bank sites to send/recv to or fram right node - character(250) :: msg + character(max_line_len) :: msg msg = "Collecting number of fission sites..." call message(msg, 8) diff --git a/src/output.f90 b/src/output.f90 index bf6781600..2d3a3a5c1 100644 --- a/src/output.f90 +++ b/src/output.f90 @@ -58,8 +58,6 @@ contains subroutine echo_input() - character(32) :: string - ! Display problem summary write(ou,*) '=============================================' write(ou,*) '=> PROBLEM SUMMARY <=' @@ -225,8 +223,8 @@ contains type(Particle), pointer :: p - integer :: i - character(250) :: string + integer :: i + character(max_line_len) :: string type(Cell), pointer :: c => null() type(Surface), pointer :: s => null() type(Universe), pointer :: u => null() @@ -309,9 +307,9 @@ contains type(Cell), pointer :: c - integer :: temp - integer :: i - character(250) :: string + integer :: temp + integer :: i + character(max_line_len) :: string type(Universe), pointer :: u => null() type(Lattice), pointer :: l => null() type(Material), pointer :: m => null() @@ -370,9 +368,9 @@ contains type(Universe), pointer :: univ - integer :: i - character(250) :: string - type(Cell), pointer :: c => null() + integer :: i + character(max_line_len) :: string + type(Cell), pointer :: c => null() write(ou,*) 'Universe ' // int_to_str(univ % uid) write(ou,*) ' Level = ' // int_to_str(univ % level) @@ -416,7 +414,7 @@ contains type(Surface), pointer :: surf integer :: i - character(80) :: string + character(max_line_len) :: string write(ou,*) 'Surface ' // int_to_str(surf % uid) select case (surf % type) @@ -488,10 +486,10 @@ contains type(Material), pointer :: mat - integer :: i - integer :: n_lines - real(8) :: density - character(250) :: string + integer :: i + integer :: n_lines + real(8) :: density + character(max_line_len) :: string type(AceContinuous), pointer :: table => null() write(ou,*) 'Material ' // int_to_str(mat % uid) @@ -518,9 +516,9 @@ contains type(Tally), pointer :: tal - integer :: i - integer :: MT - character(250) :: string + integer :: i + integer :: MT + character(max_line_len) :: string write(ou,*) 'Tally ' // int_to_str(tal % uid) diff --git a/src/physics.f90 b/src/physics.f90 index 46dde9653..403e5211c 100644 --- a/src/physics.f90 +++ b/src/physics.f90 @@ -31,7 +31,7 @@ contains real(8) :: f ! interpolation factor logical :: found_cell ! found cell which particle is in? logical :: in_lattice ! is surface crossing in lattice? - character(250) :: msg ! output/error message + character(max_line_len) :: msg ! output/error message type(Universe), pointer :: univ if (p % cell == 0) then @@ -157,7 +157,7 @@ contains real(8) :: r1 ! random number real(8) :: flux ! collision estimator of flux real(8), allocatable :: Sigma_rxn(:) ! macroscopic xs for each nuclide - character(250) :: msg ! output/error message + character(max_line_len) :: msg ! output/error message type(AceContinuous), pointer :: table type(AceReaction), pointer :: rxn @@ -372,7 +372,7 @@ contains real(8) :: xi ! random number real(8) :: yield ! delayed neutron precursor yield real(8) :: prob ! cumulative probability - character(250) :: msg ! error message + character(max_line_len) :: msg ! error message ! copy energy of neutron E = p % E @@ -647,7 +647,7 @@ contains real(8) :: E ! outgoing energy in laboratory real(8) :: E_cm ! outgoing energy in center-of-mass real(8) :: u,v,w ! direction cosines - character(250) :: msg ! error message + character(max_line_len) :: msg ! error message ! copy energy of neutron E_in = p % E @@ -714,7 +714,7 @@ contains real(8) :: E ! outgoing energy in laboratory real(8) :: E_cm ! outgoing energy in center-of-mass real(8) :: u,v,w ! direction cosines - character(250) :: msg ! error message + character(max_line_len) :: msg ! error message ! copy energy of neutron E_in = p % E @@ -777,8 +777,8 @@ contains type(Particle), pointer :: p - integer :: cell_num ! user-specified cell number - character(250) :: msg ! output/error message + integer :: cell_num ! user-specified cell number + character(max_line_len) :: msg ! output/error message p % alive = .false. if (verbosity >= 10) then @@ -816,7 +816,7 @@ contains real(8) :: c_k ! cumulative frequency at k real(8) :: c_k1 ! cumulative frequency at k+1 real(8) :: p0,p1 ! probability distribution - character(250) :: msg ! error message + character(max_line_len) :: msg ! error message ! check if reaction has angular distribution -- if not, sample outgoing ! angle isotropically @@ -1008,7 +1008,7 @@ contains real(8) :: frac ! interpolation factor on outgoing energy real(8) :: U ! restriction energy real(8) :: T ! nuclear temperature - character(250) :: msg ! error message + character(max_line_len) :: msg ! error message ! TODO: If there are multiple scattering laws, sample scattering law diff --git a/src/score.f90 b/src/score.f90 index 1ff82af81..ffcda97e8 100644 --- a/src/score.f90 +++ b/src/score.f90 @@ -29,7 +29,7 @@ contains real(8), save :: k1 = 0. ! accumulated keff real(8), save :: k2 = 0. ! accumulated keff**2 real(8) :: std ! stdev of keff over active cycles - character(250) :: msg + character(max_line_len) :: msg msg = "Calculate cycle keff..." call message(msg, 8) @@ -98,9 +98,9 @@ contains real(8) :: E ! energy of particle real(8) :: val ! value to score real(8) :: Sigma ! macroscopic cross section of reaction - character(250) :: msg ! output/error message - type(Cell), pointer :: c => null() - type(Tally), pointer :: t => null() + character(max_line_len) :: msg ! output/error message + type(Cell), pointer :: c => null() + type(Tally), pointer :: t => null() ! ========================================================================== ! HANDLE LOCAL TALLIES diff --git a/src/search.f90 b/src/search.f90 index 829686db7..e06642111 100644 --- a/src/search.f90 +++ b/src/search.f90 @@ -1,5 +1,6 @@ module search + use global use output, only: error contains @@ -19,7 +20,7 @@ contains integer :: L integer :: R real(8) :: testval - character(250) :: msg + character(max_line_len) :: msg L = 1 R = n diff --git a/src/source.f90 b/src/source.f90 index 99618f1d0..de6f4bb03 100644 --- a/src/source.f90 +++ b/src/source.f90 @@ -28,7 +28,7 @@ contains real(8) :: E ! outgoing energy real(8) :: p_min(3) ! minimum coordinates of source real(8) :: p_max(3) ! maximum coordinates of source - character(250) :: msg ! error message + character(max_line_len) :: msg ! error message msg = 'Initializing source particles...' call message(msg, 6) diff --git a/src/string.f90 b/src/string.f90 index b44743661..c7be8311f 100644 --- a/src/string.f90 +++ b/src/string.f90 @@ -1,6 +1,6 @@ module string - use global, only: max_words + use global use output, only: error, warning implicit none @@ -27,12 +27,12 @@ contains integer :: i ! current index integer :: i_start ! starting index of word integer :: i_end ! ending index of word - character(250) :: msg + character(max_line_len) :: msg i_start = 0 i_end = 0 n = 0 - do i = 1, len(string) + do i = 1, len_trim(string) char = string(i:i) ! Note that ACHAR(9) is a horizontal tab @@ -41,7 +41,7 @@ contains end if if (i_start > 0) then if ((char == ' ') .or. (char == achar(9))) i_end = i - 1 - if (i == len(string)) i_end = i + if (i == len_trim(string)) i_end = i if (i_end > 0) then n = n + 1 if (i_end - i_start + 1 > len(words(n))) then @@ -132,7 +132,7 @@ contains character(*), intent(in) :: words(n_words) integer, intent(in) :: n_words - character(250) :: string + character(max_line_len) :: string integer :: i ! index diff --git a/src/types.f90 b/src/types.f90 index 4312e375a..4d0077e57 100644 --- a/src/types.f90 +++ b/src/types.f90 @@ -310,7 +310,7 @@ module types real(8) :: awr real(8) :: temp integer :: binary - character(100) :: path + character(150) :: path end type xsData !===============================================================================