diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..cabcdf54f --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# Compiled objects and modules +*.o +*.mod +# emacs backups +*~ \ No newline at end of file diff --git a/ChangeLog b/ChangeLog index 1842b7db7..280049a1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2011-06-22 Paul Romano + + * .gitignore: Specifies intentionally untracked files for git + version control + * src/ace.f90: Added capability to read unresolved resonance + probability tables. + * src/global.f90: Added log file unit. + * src/logging.f90: Added module for handling a log file. + * src/main.f90: Added call to create log. + * src/types.f90: Extended AceContinuous to handle unresolved + resonance probability table data. + 2011-04-25 Paul Romano * ace.f90: Fixed indentation of get_int and get_real. Added diff --git a/src/Makefile b/src/Makefile index 4593ebe29..a64b9066b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,6 +10,7 @@ modules = ace.f90 \ fileio.f90 \ geometry.f90 \ global.f90 \ + logging.f90 \ mcnp_random.f90 \ mpi_routines.f90 \ output.f90 \ @@ -28,7 +29,7 @@ test_objects = $(modules:.f90=.o) $(test:.f90=.o) F90 = ifort F90FLAGS = -g -fpp -traceback -USE_MPI = yes +USE_MPI = no ifeq ($(USE_MPI),yes) MPI = /opt/mpich2/1.3.3-gcc @@ -68,9 +69,10 @@ energy_grid.o: global.o output.o data_structures.o fileio.o: types.o global.o string.o output.o data_structures.o geometry.o: types.o global.o output.o string.o data_structures.o global.o: types.o +logging.o: global.o main.o: global.o fileio.o output.o geometry.o mcnp_random.o \ source.o physics.o cross_section.o data_structures.o \ - ace.o energy_grid.o score.o + ace.o energy_grid.o score.o logging.o mpi_routines.o: global.o output.o types.o mcnp_random.o source.o output.o: global.o types.o data_structures.o endf.o physics.o: types.o global.o mcnp_random.o geometry.o output.o \ diff --git a/src/ace.f90 b/src/ace.f90 index 39a922674..4bbaab0b1 100644 --- a/src/ace.f90 +++ b/src/ace.f90 @@ -64,6 +64,7 @@ contains mat%table(j) = dict_get_key(ace_dict, key) end if case ('t') + ! Need same logic as for continuous tables n_thermal = n_thermal + 1 case default msg = "Unknown cross section table type: " // key @@ -213,6 +214,7 @@ contains call read_reactions(table) call read_angular_dist(table) call read_energy_dist(table) + call read_unr_res(table) ! Free memory from XSS array if(allocated(XSS)) deallocate(XSS) @@ -870,6 +872,63 @@ contains end function length_energy_dist +!===================================================================== +! READ_UNR_RES reads in unresolved resonance probability tables if +! present. +!===================================================================== + + subroutine read_unr_res(table) + + type(AceContinuous), pointer :: table + + integer :: JXS23 ! location of URR data + integer :: loc ! locator + integer :: N ! # of incident energies + 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) + + ! check if URR data is present + if (JXS23 /= 0) then + table % urr_present = .true. + allocate(table % urr_params(6)) + loc = JXS23 + else + table % urr_present = .false. + return + end if + + ! read parameters + table % urr_params(1) = XSS(loc) ! # of incident energies + table % urr_params(2) = XSS(loc + 1) ! # of probabilities + table % urr_params(3) = XSS(loc + 2) ! interpolation parameter + table % urr_params(4) = XSS(loc + 3) ! inelastic competition flag + table % urr_params(5) = XSS(loc + 4) ! other absorption flag + table % urr_params(6) = XSS(loc + 5) ! factors flag + + ! allocate incident energies and probability tables + N = table % urr_params(1) + M = table % urr_params(2) + allocate(table % urr_energy(N)) + allocate(table % urr_prob(N,6,M)) + + ! read incident energies + XSS_index = loc + 6 + table % urr_energy = get_real(N) + + ! read probability tables + do i = 1, N + do j = 1, 6 + table % urr_prob(i,j,1:M) = get_real(M) + end do + end do + + end subroutine read_unr_res + !===================================================================== ! READ_ACE_THERMAL reads in a single ACE thermal scattering S(a,b) ! table. This routine in particular reads the header data and then diff --git a/src/global.f90 b/src/global.f90 index 48852565d..6995cd66e 100644 --- a/src/global.f90 +++ b/src/global.f90 @@ -85,6 +85,7 @@ module global character(100) :: & & path_input, & & path_xsdata + integer, parameter :: UNIT_LOG = 9 ! unit # for writing log file ! Physical constants real(8), parameter :: & diff --git a/src/logging.f90 b/src/logging.f90 new file mode 100644 index 000000000..27b548b02 --- /dev/null +++ b/src/logging.f90 @@ -0,0 +1,42 @@ +module logging + + use global + + implicit none + +contains + +!===================================================================== +! CREATE_LOG creates a new log file (or overwrites the existing log) +!===================================================================== + + 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 + + ! Create filename for log file + path_log = trim(path_input) // ".log" + + ! Check if log file already exists + inquire(FILE=path_log, EXIST=file_exists) + if (file_exists) then + ! Possibly copy old log file + end if + + ! Open log file for writing + open(FILE=path_log, UNIT=UNIT_LOG, STATUS='replace', & + & ACTION='write', IOSTAT=ioError) + + end subroutine create_log + +!===================================================================== +! LOG_TALLIES +!===================================================================== + + subroutine log_tallies() + + end subroutine log_tallies + +end module logging diff --git a/src/main.f90 b/src/main.f90 index 51f9be5c8..08fca798f 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -14,6 +14,7 @@ program main use energy_grid, only: unionized_grid, original_indices use mpi_routines, only: setup_mpi, synchronize_bank, t_sync use score, only: calculate_keff + use logging, only: create_log #ifdef MPI use mpi @@ -28,9 +29,12 @@ program main ! Setup MPI call setup_mpi() + ! Read command line arguments + call read_command_line() + if (master) call create_log() + ! Print the OpenMC title and version/date/time information if (master) call title() - ! Initialize random number generator. The first argument corresponds ! to which random number generator to use- in this case one of the ! L'Ecuyer 63-bit RNGs. @@ -39,9 +43,6 @@ program main ! Set default values for settings call set_defaults() - ! Read command line arguments - call read_command_line() - ! Read input file -- make a first pass through the file to count ! cells, surfaces, etc in order to allocate arrays, then do a second ! pass to actually read values diff --git a/src/types.f90 b/src/types.f90 index aef5c3b39..78571690e 100644 --- a/src/types.f90 +++ b/src/types.f90 @@ -264,6 +264,12 @@ module types real(8), allocatable :: nu_d_precursor_data(:) type(AceDistEnergy), allocatable :: nu_d_edist(:) + ! Unresolved resonance data + logical :: urr_present + integer, allocatable :: urr_params(:) + real(8), allocatable :: urr_energy(:) + real(8), allocatable :: urr_prob(:,:,:) + ! Reactions integer :: n_reaction type(AceReaction), pointer :: reactions(:) => null()