User can now specify boundary conditions rather than being hard-coded.

This commit is contained in:
Paul Romano 2011-03-30 19:10:36 +00:00
parent 9386d6fb10
commit 420f4eac2f
10 changed files with 152 additions and 22 deletions

View file

@ -1,3 +1,14 @@
2011-03-30 Paul Romano <romano7@mit.edu>
* benchmarks: Added boundary conditions to PU-MET-FAST-001, 002,
and 005.
* fileio.f90: Added ability to read boundary conditions through
the new read_bc subroutine and a modification to adjust_indices.
* global.f90: Added parameter for periodic boundary conditions.
* input_sample: Added boundary conditions.
* lattice_sample: Sample lattice geometry file added.
* output.f90: Modified print_surface to show boundary condition.
2011-03-28 Paul Romano <romano7@mit.edu>
* fileio.f90: Ability to read lattice entries.

View file

@ -2,13 +2,14 @@
# Description: Bare Pu-239 Jezebel Benchmark
# Case: PU-MET-FAST-001
# Written By: Paul Romano
# Date: 3/21/2011
# Date: 3/30/2011
# ====================================================================
# cell no. universe material surfaces
cell 1 0 1 -1
surface 1 sph 0. 0. 0. 6.3849
bc 1 vacuum
source_box -1 -1 -1 1 1 1
@ -18,7 +19,6 @@ material 1 0.04029014 &
94241.03c 0.00011674 &
31000.03c 0.0013752
xs_library endfb7
xs_data /opt/serpent/xsdata/endfb7
criticality 3000 20 10000
verbosity 7

View file

@ -2,13 +2,14 @@
# Description: Bare Pu-240 Jezebel Benchmark
# Case: PU-MET-FAST-002
# Written By: Paul Romano
# Date: 3/22/2011
# Date: 3/30/2011
# ====================================================================
# cell no. universe material surfaces
cell 1 0 1 -1
surface 1 sph 0. 0. 0. 6.6595
bc 1 vacuum
source_box -1 -1 -1 1 1 1
@ -19,7 +20,6 @@ material 1 0.04055292 &
94242.03c 0.00015672 &
31000.03c 0.0013722
xs_library endfb7
xs_data /opt/serpent/xsdata/endfb7
criticality 3000 20 10000
verbosity 7

View file

@ -2,7 +2,7 @@
# Description: Unmoderated Plutonium Metal Button Array Benchmark
# Case: PU-MET-FAST-005
# Written By: Paul Romano
# Date: 3/22/2011
# Date: 3/30/2011
# ====================================================================
# cell no. universe material surfaces
@ -11,6 +11,7 @@ cell 2 0 2 1 -2
surface 1 sph 0. 0. 0. 5.0419
surface 2 sph 0. 0. 0. 9.7409
bc 2 vacuum
source_box -1 -1 -1 1 1 1
@ -26,7 +27,6 @@ material 2 0.06605308 &
29000.03c 0.0040774 &
40000.03c 0.00079528
xs_library endfb7
xs_data /opt/serpent/xsdata/endfb7
criticality 3000 20 10000
verbosity 7

View file

@ -10,10 +10,10 @@ module fileio
implicit none
type(DictionaryII), pointer :: & ! this dictionary is used to count
& ucount_dict => null() ! the number of universes as well
! as how many cells each universe
! contains
type(DictionaryII), pointer :: & ! used to count how many cells each
& ucount_dict => null(), & ! universe contains
& bc_dict => null() ! store boundary conditions
integer, allocatable :: index_cell_in_univ(:)
@ -177,6 +177,7 @@ contains
! Set up dictionaries
call dict_create(cell_dict)
call dict_create(surface_dict)
call dict_create(bc_dict)
call dict_create(material_dict)
! We also need to allocate the cell count lists for each
@ -257,22 +258,26 @@ contains
select case (trim(words(1)))
case ('cell')
! Read data from cell entry
! Read cell entry
index_cell = index_cell + 1
call read_cell(index_cell, words, n)
case ('surface')
! Read data from surface entry
! Read surface entry
index_surface = index_surface + 1
call read_surface(index_surface, words, n)
case ('bc')
! Read boundary condition entry
call read_bc(words, n)
case ('lattice')
! Read data from lattice entry
! Read lattice entry
index_lattice = index_lattice + 1
call read_lattice(index_lattice, words, n)
case ('material')
! Read data from material entry
! Read material entry
index_material = index_material + 1
call read_material(index_material, words, n)
@ -311,7 +316,8 @@ contains
! ADJUST_INDICES changes the values for 'surfaces' for each cell and
! the material index assigned to each to the indices in the surfaces
! and material array rather than the unique IDs assigned to each
! surface and material
! surface and material. Also assigns boundary conditions to surfaces
! based on those read into the bc_dict dictionary
!=====================================================================
subroutine adjust_indices()
@ -320,8 +326,11 @@ contains
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
type(Cell), pointer :: c => null() ! cell pointer
type(Cell), pointer :: c => null()
type(Surface), pointer :: surf => null()
type(ListKeyValueII), pointer :: key_list => null()
do i = 1, n_cells
! adjust boundary list
@ -352,6 +361,24 @@ contains
end if
end do
! Set boundary conditions for surfaces
key_list => dict_keys(bc_dict)
do while (associated(key_list))
! find index of universe in universes array
surf_num = key_list%data%key
bc = key_list%data%value
! establish pointer to surface
index = dict_get_key(surface_dict, surf_num)
surf => surfaces(index)
! set boundary condition
surf % bc = bc
! move to next universe
key_list => key_list%next
end do
end subroutine adjust_indices
!=====================================================================
@ -597,6 +624,49 @@ contains
end subroutine read_surface
!=====================================================================
! READ_BC creates a dictionary whose (key,value) pairs are the uids of
! surfaces and specified boundary conditions, respectively. This is
! later used in adjust_indices to set the surface boundary conditions.
!=====================================================================
subroutine read_bc(words, n_words)
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
! Read surface identifier
surface_uid = str_to_int(words(2))
if (surface_uid == ERROR_CODE) then
msg = "Invalid surface name: " // words(2)
call error(msg)
end if
! Read boundary condition
word = words(3)
call lower_case(word)
select case (trim(word))
case ('transmit')
bc = BC_TRANSMIT
case ('vacuum')
bc = BC_VACUUM
case ('reflect')
bc = BC_REFLECT
case default
msg = "Invalid boundary condition: " // words(3)
call error(msg)
end select
! Add (uid, bc) to dictionary
call dict_add_key(bc_dict, surface_uid, bc)
end subroutine read_bc
!=====================================================================
! READ_LATTICE parses the data on a lattice entry.
!=====================================================================

View file

@ -92,7 +92,8 @@ module global
integer, parameter :: &
& BC_TRANSMIT = 0, & ! Transmission boundary condition (default)
& BC_VACUUM = 1, & ! Vacuum boundary condition
& BC_REFLECT = 2 ! Reflecting boundary condition
& BC_REFLECT = 2, & ! Reflecting boundary condition
& BC_PERIODIC = 3 ! Periodic boundary condition
! Logical operators for cell definitions
integer, parameter :: &

View file

@ -9,6 +9,8 @@ surface 1 cylz 0 0 7
surface 2 cylz 0 0 9
surface 3 cylz 0 0 11
bc 3 vacuum
material 40 -4.5 &
92235.03c 1.0
@ -18,7 +20,6 @@ material 41 -1.0 &
source box -4 -4 -4 4 4 4
xs_library endfb7
xs_data /opt/serpent/xsdata/endfb7
criticality 15 5 10000
verbosity 7

41
src/lattice_sample Normal file
View file

@ -0,0 +1,41 @@
# test lattice input file
cell 1 0 fill 111 1 -2 3 -4
cell 100 3 40 -5
cell 101 3 41 5
lattice 111 rect 10 10 -5.0 -5.0 1.0 1.0 &
3 3 3 3 3 3 3 3 3 3 &
3 3 3 3 3 3 3 3 3 3 &
3 3 3 3 3 3 3 3 3 3 &
3 3 3 3 3 3 3 3 3 3 &
3 3 3 3 3 3 3 3 3 3 &
3 3 3 3 3 3 3 3 3 3 &
3 3 3 3 3 3 3 3 3 3 &
3 3 3 3 3 3 3 3 3 3 &
3 3 3 3 3 3 3 3 3 3 &
3 3 3 3 3 3 3 3 3 3
surface 1 px -4.9
surface 2 px 4.9
surface 3 py -4.9
surface 4 py 4.9
surface 5 cylz 0 0 0.4
bc 1 vacuum
bc 2 vacuum
bc 3 vacuum
bc 4 vacuum
material 40 -4.5 &
92235.03c 1.0
material 41 -1.0 &
1001.03c 2.0 &
8016.03c 1.0
source box -4 -4 -4 4 4 4
xs_data /opt/serpent/xsdata/endfb7
criticality 150 25 10000
verbosity 7

View file

@ -81,10 +81,6 @@ program main
call init_source()
! start problem
! surfaces(1)%bc = BC_VACUUM
! surfaces(2)%bc = BC_VACUUM
surfaces(1)%bc = BC_VACUUM
! surfaces(4)%bc = BC_VACUUM
call run_problem()
! deallocate arrays

View file

@ -471,6 +471,16 @@ contains
end do
end if
write(ou,*) ' Negative Neighbors =', trim(string)
select case (surf % bc)
case (BC_TRANSMIT)
write(ou,*) ' Boundary Condition = Transmission'
case (BC_VACUUM)
write(ou,*) ' Boundary Condition = Vacuum'
case (BC_REFLECT)
write(ou,*) ' Boundary Condition = Reflective'
case (BC_PERIODIC)
write(ou,*) ' Boundary Condition = Periodic'
end select
write(ou,*)
end subroutine print_surface