diff --git a/src/cross_section.f90 b/src/cross_section.f90 index cfef08b440..9bd02e8147 100644 --- a/src/cross_section.f90 +++ b/src/cross_section.f90 @@ -43,9 +43,6 @@ contains character(10) :: key ! name of isotope, e.g. 92235.03c character(MAX_LINE_LEN) :: msg ! output/error message type(Material), pointer :: mat => null() - type(xsData), pointer :: iso => null() - type(Nuclide), pointer :: ace_cont => null() - type(SAB_Table), pointer :: ace_thermal => null() type(DictionaryCI), pointer :: temp_dict => null() call dict_create(nuclide_dict) @@ -276,7 +273,7 @@ contains type(Nuclide), pointer :: nuc - integer :: i, j ! loop indices + integer :: i ! loop index integer :: JXS2 ! location for fission nu data integer :: JXS24 ! location for delayed neutron data integer :: KNU ! location for nu data @@ -672,7 +669,7 @@ contains integer :: loc ! locator integer :: length ! length of data to allocate integer :: length_interp_data ! length of interpolation data - integer :: i, j, k, l ! indices + integer :: i ! loop index type(Reaction), pointer :: rxn => null() LED = JXS(10) @@ -887,7 +884,6 @@ contains integer :: M ! # of probabilities integer :: i ! index over incoming energies integer :: j ! index over values - integer :: k ! index over cumulative probabilities ! determine locator for URR data JXS23 = JXS(23) @@ -1184,15 +1180,15 @@ contains xs = ZERO ! find material atom density - density = cMaterial%atom_density + density = mat % atom_density ! loop over all nuclides in material - n_nuclides = cMaterial % n_nuclides + n_nuclides = mat % n_nuclides do i = 1, n_nuclides - nuc => nuclides(cMaterial % nuclide(i)) + nuc => nuclides(mat % nuclide(i)) ! determine nuclide atom density - density_i = cMaterial%atom_percent(i) * density + density_i = mat % atom_percent(i) * density ! search nuclide energy grid IE = nuc%grid_index(p % IE) @@ -1240,7 +1236,7 @@ contains character(MAX_LINE_LEN) :: msg character(MAX_WORD_LEN) :: words(MAX_WORDS) character(MAX_WORD_LEN) :: filename - integer :: i, n + integer :: n integer :: in = 7 logical :: file_exists character(7) :: readable @@ -1347,7 +1343,6 @@ contains integer :: i, j, k integer :: index integer :: IE - real(8) :: xs real(8) :: density real(8) :: density_i real(8) :: val diff --git a/src/datatypes.f90 b/src/datatypes.f90 index b7739aa081..052e8d374e 100644 --- a/src/datatypes.f90 +++ b/src/datatypes.f90 @@ -846,7 +846,6 @@ contains character(*), intent(in) :: key integer :: value - type(KeyValueCI) :: data type(ListKeyValueCI), pointer :: elem elem => dict_get_elem(dict, key) @@ -872,7 +871,6 @@ contains integer, intent(in) :: key integer :: value - type(KeyValueII) :: data type(ListKeyValueII), pointer :: elem elem => dict_get_elem(dict, key) @@ -990,14 +988,13 @@ contains function dict_ci_hashkey(key) result(val) character(*), intent(in) :: key + integer :: val - integer :: val - integer :: hash integer :: i val = 0 - do i = 1,len(key) + do i = 1, len(key) val = HASH_MULTIPLIER * val + ichar(key(i:i)) enddo @@ -1016,10 +1013,7 @@ contains function dict_ii_hashkey(key) result(val) integer, intent(in) :: key - - integer :: val - integer :: hash - integer :: i + integer :: val val = 0 @@ -1040,7 +1034,7 @@ contains type(ListKeyValueCI), pointer :: current => null() type(ListKeyValueCI), pointer :: elem => null() - integer :: i, j + integer :: i head => null() @@ -1072,7 +1066,7 @@ contains type(ListKeyValueII), pointer :: current => null() type(ListKeyValueII), pointer :: elem => null() - integer :: i, j + integer :: i head => null() diff --git a/src/energy_grid.f90 b/src/energy_grid.f90 index b5d443c25a..5b884546a8 100644 --- a/src/energy_grid.f90 +++ b/src/energy_grid.f90 @@ -22,7 +22,6 @@ contains type(ListReal), pointer :: current => null() type(Material), pointer :: mat => null() type(Nuclide), pointer :: nuc => null() - type(Reaction), pointer :: rxn => null() integer :: i, j integer :: n character(MAX_LINE_LEN) :: msg diff --git a/src/fileio.f90 b/src/fileio.f90 index 46cd4eab09..ab4f227d61 100644 --- a/src/fileio.f90 +++ b/src/fileio.f90 @@ -84,7 +84,6 @@ contains 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() @@ -235,7 +234,6 @@ contains integer :: index_material ! index in materials array integer :: index_source ! index in source array (?) integer :: index_tally ! index in tally array - 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 @@ -470,7 +468,6 @@ 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 @@ -564,7 +561,6 @@ 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(MAX_LINE_LEN) :: msg ! output/error message @@ -574,8 +570,8 @@ contains surf => surfaces(index) ! Read surface identifier - read(words(2), FMT='(I8)', IOSTAT=ioError) surf % uid - if (ioError > 0) then + surf % uid = str_to_int(words(2)) + if (surf % uid == ERROR_INT) then msg = "Invalid surface name: " // trim(words(2)) call fatal_error(msg) end if @@ -782,7 +778,6 @@ contains integer, intent(in) :: n_words ! number of words 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 @@ -980,7 +975,6 @@ contains integer, intent(in) :: n_words ! number of words integer :: i ! index over nuclides - integer :: ioError ! error status for file access integer :: n_nuclides ! number of nuclides in material character(MAX_LINE_LEN) :: msg ! output/error message type(Material), pointer :: mat => null() @@ -997,8 +991,8 @@ contains mat % n_nuclides = n_nuclides ! Read surface identifier - read(words(2), FMT='(I8)', IOSTAT=ioError) mat % uid - if (ioError > 0) then + mat % uid = str_to_int(words(2)) + if (mat % uid == ERROR_INT) then msg = "Invalid surface name: " // trim(words(2)) call fatal_error(msg) end if @@ -1032,16 +1026,14 @@ contains integer :: j ! index over nuclides in material real(8) :: sum_percent ! real(8) :: awr ! atomic weight ratio - real(8) :: w ! weight percent real(8) :: x ! atom percent logical :: percent_in_atom ! nuclides specified in atom percent? logical :: density_in_atom ! density specified in atom/b-cm? character(10) :: key ! name of nuclide, e.g. 92235.03c character(MAX_LINE_LEN) :: msg ! output/error message - type(xsData), pointer :: iso => null() type(Material), pointer :: mat => null() - ! first find the index in the xsdata array for each isotope in each material + ! first find the index in the xsdata array for each nuclide in each material do i = 1, n_materials mat => materials(i) @@ -1249,7 +1241,6 @@ contains integer :: i ! line index integer :: loc ! locator for array - integer :: ioError ! error status loc = 0 do i = 1, lines @@ -1277,7 +1268,6 @@ contains integer :: i ! line index integer :: loc ! locator for array - integer :: ioError ! error status loc = 0 do i = 1, lines diff --git a/src/geometry.f90 b/src/geometry.f90 index 5d4b4321ae..aa9b23d9a0 100644 --- a/src/geometry.f90 +++ b/src/geometry.f90 @@ -30,7 +30,6 @@ 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(MAX_LINE_LEN) :: msg ! output/error message type(Surface), pointer :: surf => null() current_surface = p%surface diff --git a/src/global.f90 b/src/global.f90 index eccf8b0ed6..225d918dbf 100644 --- a/src/global.f90 +++ b/src/global.f90 @@ -135,7 +135,9 @@ contains subroutine free_memory() +#ifdef MPI integer :: ierr +#endif ! Deallocate cells, surfaces, materials if (allocated(cells)) deallocate(cells) diff --git a/src/main.f90 b/src/main.f90 index 06d89900da..c151148d77 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -26,8 +26,6 @@ program main implicit none - character(max_word_len) :: filename - character(max_line_len) :: msg type(Universe), pointer :: univ ! Start timers @@ -117,15 +115,10 @@ contains subroutine run_problem() - integer :: i, j - integer :: ierr - integer :: i_cycle ! cycle index - integer(8) :: i_particle ! history index - integer :: total_bank ! total number of particles banked - real(8) :: t0 - real(8) :: t1 + integer :: i_cycle ! cycle index + integer(8) :: i_particle ! history index + character(MAX_LINE_LEN) :: msg ! output/error message type(Particle), pointer :: p => null() - character(max_line_len) :: msg if (master) call header("BEGIN SIMULATION", 1) diff --git a/src/mcnp_random.f90 b/src/mcnp_random.f90 index 70cdbaa701..23e6733814 100644 --- a/src/mcnp_random.f90 +++ b/src/mcnp_random.f90 @@ -285,7 +285,7 @@ CONTAINS integer(I8) :: itemp1, itemp2, itemp3, itemp4 if( new_standard_gen<1 .or. new_standard_gen>n_RN_GEN ) then - call expire( 0, 'RN_init_problem', & + call expire( 'RN_init_problem', & & ' ***** ERROR: illegal index for built-in RN generator') endif @@ -334,7 +334,7 @@ CONTAINS ! double-check on number of bits in a long int if( bit_size(RN_SEED)<64 ) then - call expire( 0, 'RN_init_problem', & + call expire( 'RN_init_problem', & & ' ***** ERROR: <64 bits in long-int, can-t generate RN-s') endif itemp1 = 5_I8**25 @@ -342,7 +342,7 @@ CONTAINS itemp3 = ishft(2_I8**62-1_I8,1) + 1_I8 itemp4 = itemp1*itemp2 if( iand(itemp4,itemp3)/=8443747864978395601_I8 ) then - call expire( 0, 'RN_init_problem', & + call expire( 'RN_init_problem', & & ' ***** ERROR: can-t do 64-bit integer ops for RN-s') endif @@ -502,8 +502,7 @@ CONTAINS !------------------------------------------------------------------- - subroutine expire( i, c1, c2 ) - integer, intent(in) :: i + subroutine expire( c1, c2 ) character(len=*), intent(in) :: c1, c2 write(*,*) ' ********** error: ',c1 write(*,*) ' ********** error: ',c2 @@ -610,7 +609,7 @@ CONTAINS write(jtty,"(a,i20,z20)") " RN_MASK = ", RN_MASK, RN_MASK write(jtty,"(a,i20)") " RN_BITS = ", RN_BITS write(jtty,"(a,i20)") " RN_PERIOD = ", RN_PERIOD - write(jtty,"(a,es20.14)") " RN_NORM = ", RN_NORM + write(jtty,"(a,es20.13)") " RN_NORM = ", RN_NORM write(jtty,"(a)") " " do i = 1,10 j = i diff --git a/src/mpi_routines.f90 b/src/mpi_routines.f90 index c7a2902889..9e907119c1 100644 --- a/src/mpi_routines.f90 +++ b/src/mpi_routines.f90 @@ -107,11 +107,7 @@ contains integer, intent(in) :: i_cycle - integer :: i, j, k ! loop indices -#ifdef MPI - integer :: status(MPI_STATUS_SIZE) ! message status -#endif - integer :: ierr + integer :: i, j, k ! loop indices integer(8) :: start ! starting index in local fission bank integer(8) :: finish ! ending index in local fission bank integer(8) :: total ! total sites in global fission bank @@ -120,18 +116,22 @@ contains integer :: send_to_left ! # of bank sites to send/recv to or from left integer :: send_to_right ! # of bank sites to send/recv to or from right integer(8) :: sites_needed ! # of sites to be sampled - integer(8) :: sites_remaining ! # of sites left in fission bank - integer :: request ! communication request for sending sites - integer :: request_left ! communication request for recv sites from left - integer :: request_right ! communication request for recv sites from right real(8) :: p_sample ! probability of sampling a site - real(8) :: t0, t1, t2, t3, t4 type(Bank), allocatable :: & & 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(MAX_LINE_LEN) :: msg +#ifdef MPI + integer :: ierr + integer :: status(MPI_STATUS_SIZE) ! message status + integer :: request ! communication request for sending sites + integer :: request_left ! communication request for recv sites from left + integer :: request_right ! communication request for recv sites from right + real(8) :: t0, t1, t2, t3, t4 +#endif + msg = "Collecting number of fission sites..." call message(msg, 8) diff --git a/src/output.f90 b/src/output.f90 index a8714be61c..38007cc719 100644 --- a/src/output.f90 +++ b/src/output.f90 @@ -214,8 +214,6 @@ contains type(Particle), pointer :: p - integer :: i - character(max_line_len) :: string type(Cell), pointer :: c => null() type(Surface), pointer :: s => null() type(Universe), pointer :: u => null() @@ -478,7 +476,6 @@ contains type(Material), pointer :: mat integer :: i - integer :: n_lines real(8) :: density character(max_line_len) :: string type(Nuclide), pointer :: nuc => null() diff --git a/src/physics.f90 b/src/physics.f90 index 0e8158e143..028bf19201 100644 --- a/src/physics.f90 +++ b/src/physics.f90 @@ -281,7 +281,6 @@ contains type(Reaction), pointer :: rxn real(8) :: awr ! atomic weight ratio of target - real(8) :: phi ! azimuthal angle real(8) :: mu ! cosine of polar angle real(8) :: vx ! velocity of neutron in x-direction real(8) :: vy ! velocity of neutron in y-direction @@ -653,7 +652,6 @@ contains real(8) :: E_cm ! outgoing energy in center-of-mass real(8) :: u,v,w ! direction cosines real(8) :: Q ! Q-value of reaction - character(MAX_LINE_LEN) :: msg ! error message ! copy energy of neutron E_in = p % E @@ -724,7 +722,6 @@ contains real(8) :: E_cm ! outgoing energy in center-of-mass real(8) :: u,v,w ! direction cosines real(8) :: Q ! Q-value of reaction - character(MAX_LINE_LEN) :: msg ! error message ! copy energy of neutron E_in = p % E diff --git a/src/score.f90 b/src/score.f90 index 096a249bd9..1b0fac3225 100644 --- a/src/score.f90 +++ b/src/score.f90 @@ -24,15 +24,16 @@ contains integer, intent(in) :: i_cycle ! index of current cycle - integer(8) :: total_bank - integer :: n + integer(8) :: total_bank ! total number of source sites + integer :: n ! active cycle number + real(8) :: kcoll ! keff collision estimator + 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(MAX_LINE_LEN) :: msg ! output/error message +#ifdef MPI integer :: ierr - real(8) :: kcoll ! keff collision estimator - real(8) :: ktemp ! MPI-reduced keff and stdev - 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(max_line_len) :: msg +#endif msg = "Calculate cycle keff..." call message(msg, 8) @@ -101,7 +102,7 @@ contains real(8) :: E ! energy of particle real(8) :: val ! value to score real(8) :: Sigma ! macroscopic cross section of reaction - character(max_line_len) :: msg ! output/error message + character(MAX_LINE_LEN) :: msg ! output/error message type(Cell), pointer :: c => null() type(Tally), pointer :: t => null() diff --git a/src/source.f90 b/src/source.f90 index 8c69b1565a..ca2c256db7 100644 --- a/src/source.f90 +++ b/src/source.f90 @@ -137,10 +137,10 @@ contains ! ADD_BANK_SITES !=============================================================================== - subroutine add_bank_sites(p, table, n) + subroutine add_bank_sites(p, nuc, n) type(Particle), pointer :: p - type(Nuclide), pointer :: table + type(Nuclide), pointer :: nuc integer, intent(in) :: n integer :: i diff --git a/src/string.f90 b/src/string.f90 index 3c65cd0732..64c27acc60 100644 --- a/src/string.f90 +++ b/src/string.f90 @@ -272,14 +272,12 @@ contains character(*), intent(in) :: string real(8) :: num - integer :: index_decimal ! index of decimal point - integer :: index_exponent ! index of exponent character - integer :: w ! total field width - integer :: d ! number of digits to right of decimal point - integer :: ioError - - character(8) :: fmt ! format for reading string - character(MAX_LINE_LEN) :: msg ! error message + integer :: index_decimal ! index of decimal point + integer :: index_exponent ! index of exponent character + integer :: w ! total field width + integer :: d ! number of digits to right of decimal point + integer :: ioError + character(8) :: fmt ! format for reading string ! Determine total field width w = len_trim(string)