Loading CAD file based on geometry flag from settings.xml

This commit is contained in:
shriwise 2018-02-23 12:38:41 -06:00 committed by pshriwise
parent 0df290f3a3
commit 88a41cbb85
8 changed files with 45 additions and 8 deletions

View file

@ -29,6 +29,10 @@ module openmc_api
use timer_header
use volume_calc, only: openmc_calculate_volumes
#ifdef CAD
use cad_header, only: free_memory_cad
#endif
implicit none
private
@ -149,6 +153,7 @@ contains
root_universe = -1
run_CE = .true.
run_mode = -1
dagmc = .false.
satisfy_triggers = .false.
call openmc_set_seed(DEFAULT_SEED)
source_latest = .false.
@ -325,7 +330,10 @@ contains
call free_memory_tally_filter()
call free_memory_tally_derivative()
call free_memory_bank()
#ifdef CAD
call free_memory_cad()
#endif
! Deallocate CMFD
call deallocate_cmfd(cmfd)

View file

@ -42,7 +42,7 @@ void load_cad_geometry_c()
return;
}
void dealloc_cad_c()
void free_memory_cad_c()
{
delete DAGMC;
}

View file

@ -5,7 +5,9 @@
#include "cell.h"
#include "surface.h"
extern moab::DagMC* DAGMC;
extern "C" void load_cad_geometry_c();
extern "C" void dealloc_cad_c();
extern "C" void free_memory_cad_c();
#endif // CAD_H

View file

@ -9,8 +9,8 @@ module cad_header
subroutine load_cad_geometry_c() bind(C)
end subroutine load_cad_geometry_c
subroutine dealloc_cad_c() bind(C)
end subroutine dealloc_cad_c
subroutine free_memory_cad_c() bind(C)
end subroutine free_memory_cad_c
end interface
@ -20,8 +20,8 @@ contains
call load_cad_geometry_c()
end subroutine load_cad_geometry
subroutine dealloc_cad()
call dealloc_cad_c()
end subroutine dealloc_cad
subroutine free_memory_cad()
call free_memory_cad_c()
end subroutine free_memory_cad
end module cad_header

View file

@ -429,7 +429,12 @@ module constants
MODE_EIGENVALUE = 2, & ! K eigenvalue mode
MODE_PLOTTING = 3, & ! Plotting mode
MODE_PARTICLE = 4, & ! Particle restart mode
#ifdef CAD
MODE_VOLUME = 5, & ! Volume calculation mode
MODE_CAD = 6 ! CAD-based Geometry mode
#else
MODE_VOLUME = 5 ! Volume calculation mode
#endif
! Electron treatments
integer, parameter :: &

View file

@ -11,6 +11,7 @@ module input_xml
use error, only: fatal_error, warning, write_message, openmc_err_msg
use geometry, only: neighbor_lists
use geometry_header
use cad_header
use hdf5_interface
use list_header, only: ListChar, ListInt, ListReal
use material_header
@ -216,6 +217,17 @@ contains
! Get proper XMLNode type given pointer
root % ptr = root_ptr
! Check for use of CAD geometry
if (check_for_node(root, "dagmc")) then
#ifdef CAD
call get_node_value_bool(root, "dagmc", dagmc)
#else
if (dagmc) then
call fatal_error("CAD mode unsupported for this build of OpenMC")
end if
#endif
end if
if (run_mode == MODE_EIGENVALUE) then
! Preallocate space for keff and entropy by generation
call k_generation % reserve(n_max_batches*gen_per_batch)
@ -375,6 +387,12 @@ contains
type(DictIntInt) :: cells_in_univ_dict ! Used to count how many cells each
! universe contains
if (dagmc) then
call write_message("Reading CAD geometry...", 5)
call load_cad_geometry()
return
end if
! Display output message
call write_message("Reading geometry XML file...", 5)

View file

@ -80,6 +80,9 @@ module settings
! Mode to run in (fixed source, eigenvalue, plotting, etc)
integer(C_INT), bind(C) :: run_mode
! flag for use of CAD geometry
logical, bind(C) :: dagmc = .false.
! Restart run
logical(C_BOOL), bind(C) :: restart_run

View file

@ -12,6 +12,7 @@ module xml_interface
public :: check_for_node
public :: get_node_list
public :: get_node_value
public :: get_node_value_bool
public :: get_node_array
public :: node_value_string
public :: node_word_count