Merge remote-tracking branch 'upstream/develop' into mergeable-tallies

This commit is contained in:
Will Boyd 2015-05-25 00:05:25 -04:00
commit 7b945a20a2
2 changed files with 16 additions and 164 deletions

View file

@ -1,148 +0,0 @@
diff --git a/.gitignore b/.gitignore
index 8aa7c1f..4c50efb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
*.mod
*.log
*.out
+*__genmod.f90
# Compiler python objects
*.pyc
diff --git a/src/Makefile b/src/Makefile
index bab47d2..92f3228 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -43,6 +43,7 @@ GIT_SHA1 = $(shell git log -1 2>/dev/null | head -n 1 | awk '{print $$2}')
#===============================================================================
ifeq ($(COMPILER),gnu)
+ CC = gcc
F90 = gfortran
F90FLAGS := -cpp -fbacktrace -DNO_F2008
LDFLAGS =
@@ -71,6 +72,7 @@ endif
#===============================================================================
ifeq ($(COMPILER),intel)
+ CC = icc
F90 = ifort
F90FLAGS := -cpp -warn -assume byterecl -traceback
LDFLAGS =
@@ -98,6 +100,7 @@ endif
#===============================================================================
ifeq ($(COMPILER),pgi)
+ CC = pgcc
F90 = pgf90
F90FLAGS := -Mpreprocess -DNO_F2008 -Minform=inform -traceback
LDFLAGS =
@@ -125,6 +128,7 @@ endif
#===============================================================================
ifeq ($(COMPILER),ibm)
+ CC = xlc
F90 = xlf2003
F90FLAGS := -WF,-DNO_F2008 -O2
@@ -235,7 +239,7 @@ distclean: clean
cd xml-fortran; make clean
cd templates; make clean
clean:
- @rm -f *.o *.mod $(program)
+ @rm -f *.o *.mod *__genmod.f90 $(program)
neat:
@rm -f *.o *.mod
@@ -249,6 +253,9 @@ neat:
%.o: %.F90
$(F90) $(F90FLAGS) -DGIT_SHA1="\"$(GIT_SHA1)\"" -Ixml-fortran -Itemplates -c $<
+csignal.o: csignal.c
+ $(CC) -c $<
+
#===============================================================================
# Dependencies
#===============================================================================
diff --git a/src/OBJECTS b/src/OBJECTS
index d53f0a5..b2a7f52 100644
--- a/src/OBJECTS
+++ b/src/OBJECTS
@@ -15,6 +15,7 @@ cmfd_prod_operator.o \
cmfd_snes_solver.o \
constants.o \
cross_section.o \
+csignal.o \
dict_header.o \
doppler.o \
eigenvalue.o \
@@ -28,6 +29,7 @@ fixed_source.o \
geometry.o \
geometry_header.o \
global.o \
+handle_sigint.o \
hdf5_interface.o \
initialize.o \
interpolation.o \
diff --git a/src/csignal.c b/src/csignal.c
new file mode 100644
index 0000000..96bfdb5
--- /dev/null
+++ b/src/csignal.c
@@ -0,0 +1,7 @@
+#include <signal.h>
+
+typedef void (*sighandler_t)(int);
+void signal_(int* signum, sighandler_t handler)
+{
+ signal(*signum, handler);
+}
diff --git a/src/handle_sigint.F90 b/src/handle_sigint.F90
new file mode 100644
index 0000000..b2f7d1b
--- /dev/null
+++ b/src/handle_sigint.F90
@@ -0,0 +1,27 @@
+!===============================================================================
+! HANDLE_SIGINT
+!===============================================================================
+
+subroutine handle_sigint()
+
+ use, intrinsic :: ISO_FORTRAN_ENV
+
+ integer :: option ! selected user option
+
+ ! Display interrupt options
+ write(OUTPUT_UNIT,*) 'Run interrupted. Select one of the options below:'
+ write(OUTPUT_UNIT,*) ' 1. Continue simulation'
+ write(OUTPUT_UNIT,*) ' 2. Kill simulation'
+
+ ! Read input from user
+ read(INPUT_UNIT,*) option
+
+ ! Handle selected option
+ select case (option)
+ case (1)
+ return
+ case (2)
+ stop
+ end select
+
+end subroutine handle_sigint
diff --git a/src/initialize.F90 b/src/initialize.F90
index ff3a209..fd2e222 100644
--- a/src/initialize.F90
+++ b/src/initialize.F90
@@ -42,6 +42,10 @@ contains
subroutine initialize_run()
+ ! Set up signal handler for SIGINT
+ external handle_sigint
+ call signal(2, handle_sigint)
+
! Start total and initialization timer
call time_total % start()
call time_initialize % start()

View file

@ -17,7 +17,7 @@ contains
! SET_UP_CMFD configures cmfd object for a CMFD eigenvalue calculation
!==============================================================================
subroutine set_up_cmfd()
subroutine set_up_cmfd()
use cmfd_header, only: allocate_cmfd
use constants, only: CMFD_NOACCEL
@ -41,7 +41,7 @@ contains
! Calculate dhat
call compute_dhat()
end subroutine set_up_cmfd
end subroutine set_up_cmfd
!===============================================================================
! COMPUTE_XS takes tallies and computes macroscopic cross sections
@ -123,7 +123,7 @@ contains
YLOOP: do j = 1,ny
XLOOP: do i = 1,nx
! Check for active mesh cell
if (allocated(cmfd%coremap)) then
if (cmfd%coremap(i,j,k) == CMFD_NOACCEL) then
@ -345,8 +345,8 @@ contains
! Check for reflector
if (cmfd % coremap(i,j,k) == 1) then
! reset value to CMFD no acceleration constant
cmfd % coremap(i,j,k) = CMFD_NOACCEL
! reset value to CMFD no acceleration constant
cmfd % coremap(i,j,k) = CMFD_NOACCEL
else
@ -368,7 +368,7 @@ contains
end subroutine set_coremap
!===============================================================================
! NEUTRON_BALANCE writes a file that contains n. bal. info for all cmfd mesh
! NEUTRON_BALANCE computes the RMS neutron balance over the CMFD mesh
!===============================================================================
subroutine neutron_balance()
@ -506,7 +506,7 @@ contains
real(8) :: cell_hxyz(3) ! cell dimensions of current ijk cell
real(8) :: neig_dc ! diffusion coefficient of neighbor cell
real(8) :: neig_hxyz(3) ! cell dimensions of neighbor cell
real(8) :: dtilde ! finite difference coupling parameter
real(8) :: dtilde ! finite difference coupling parameter
real(8) :: ref_albedo ! albedo to reflector
! Get maximum of spatial and group indices
@ -712,7 +712,7 @@ contains
neig_idx = (/i,j,k/) ! begin with i,j,k
neig_idx(xyz_idx) = shift_idx + neig_idx(xyz_idx)
! Get neigbor flux
! Get neigbor flux
neig_flux = cmfd%flux(g,neig_idx(1),neig_idx(2),neig_idx(3)) / &
product(cmfd%hxyz(:,neig_idx(1),neig_idx(2),neig_idx(3)))
@ -728,7 +728,7 @@ contains
else ! not a fuel-reflector interface
! Compute dhat
! Compute dhat
dhat = (net_current + shift_idx*cell_dtilde(l)* &
(neig_flux - cell_flux))/(neig_flux + cell_flux)
@ -736,7 +736,7 @@ contains
else ! not for fuel-reflector case
! Compute dhat
! Compute dhat
dhat = (net_current + shift_idx*cell_dtilde(l)* &
(neig_flux - cell_flux))/(neig_flux + cell_flux)
@ -786,7 +786,7 @@ contains
integer, intent(in) :: l ! iteration counter for leakages
integer :: shift_idx ! parameter to shift index by +1 or -1
real(8) :: current(12) ! partial currents for all faces of mesh cell
real(8) :: current(12) ! partial currents for all faces of mesh cell
real(8) :: albedo ! the albedo
! Get partial currents from object
@ -872,12 +872,12 @@ contains
siga2 = sigt2 - sigs22 - sigs21
! Compute effective downscatter xs
sigs12_eff = sigs12 - sigs21*flux2/flux1
sigs12_eff = sigs12 - sigs21*flux2/flux1
! Recompute total cross sections (use effective and no upscattering)
sigt1 = siga1 + sigs11 + sigs12_eff
sigt2 = siga2 + sigs22
! Record total xs
cmfd % totalxs(1,i,j,k) = sigt1
cmfd % totalxs(2,i,j,k) = sigt2
@ -886,14 +886,14 @@ contains
cmfd % scattxs(1,2,i,j,k) = sigs12_eff
! Zero out upscatter cross section
cmfd % scattxs(2,1,i,j,k) = ZERO
cmfd % scattxs(2,1,i,j,k) = ZERO
end do XLOOP
end do YLOOP
end do ZLOOP
end subroutine compute_effective_downscatter
end subroutine compute_effective_downscatter
end module cmfd_data