A monte carlo pin cell spectral code for nuclear engineering applications.
|
The Geometry represents the highest level entity in which a neutron may reside during a PINSPEC simulaiton. The geometry consists of one or more regions and controls the highest level Monte Carlo kernel. More...
#include "pinspec/src/Geometry.h"
Public Member Functions | |
Geometry (spatialType spatial_type, const char *name=(const char *)"") | |
Geomtery constructor. More... | |
virtual | ~Geometry () |
Destructor lets SWIG delete regions, materials, isotopes and tallies during garbage collection. | |
const char * | getName () |
Returns the name of the geometry. More... | |
int | getNumNeutronsPerBatch () |
Returns the number of neutrons per batch for this simulation. More... | |
int | getTotalNumNeutrons () |
Returns the total number of neutrons for this simulation. More... | |
int | getNumBatches () |
Returns the number of batches of neutrons for this simulation. More... | |
int | getNumThreads () |
Returns the number of parallel threads for this simulation. More... | |
spatialType | getSpatialType () |
Return the spatial type of Geometry (INFINITE_HOMOGENEOUS, HOMOGENEOUS_EQUIVALENCE or HETEROGENEOUS). More... | |
float | getBucklingSquared () |
Returns the square of the geometric buckling for this geometry. More... | |
float | getVolume () |
Returns the total volume occuppied by the geometry. More... | |
float | getSourceSamplingRadius () |
Returns the source sampling radius used for rejection sampling of random fission emission source sites. More... | |
void | setName (const char *name) |
Sets the name of the geometry. More... | |
void | setSourceSamplingRadius (float radius) |
Sets the source sampling radius used for rejection sampling of random fission emission source sites. More... | |
void | setNeutronsPerBatch (int num_neutrons_per_batch) |
Sets the number of neutrons per batch for this simulation. More... | |
void | setNumBatches (int num_batches) |
Sets the number of batches for this simulation. More... | |
void | setNumThreads (int num_threads) |
Sets the number of batches for this simulation. More... | |
void | setSpatialType (spatialType spatial_type) |
Set the geometry's spatial type (INFINITE_HOMOGENEOUS, HOMOGENEOUS_EQUIVALENCE or HETEROGENEOUS). More... | |
void | setFuelPinRadius (float radius) |
Sets the fuel pin radius. More... | |
void | setPinCellPitch (float pitch) |
Sets the lattice pin cell pitch. More... | |
void | setDancoffFactor (float dancoff) |
Sets the dancoff factor and computes the escape cross-section, beta, alpha1 and alpha2 parameters used for a two region heterogeneous-homogeneous pin cell simulation. More... | |
void | addRegion (Region *region) |
Adds a new region to the geometry. More... | |
void | setBucklingSquared (float buckling_squared) |
Sets the square of the geometric buckling for the geometry. More... | |
bool | contains (neutron *neutron) |
Determines whether or not the geometry contains this neutron. More... | |
bool | contains (float x, float y, float z) |
Determine whether or not this point is contained in the geometry. More... | |
void | findContainingRegion (neutron *neutron) |
Finds the region containing a neutron. More... | |
Region * | findContainingRegion (float x, float y, float z) |
Finds the region containing a neutron. More... | |
void | runMonteCarloSimulation () |
The primary Monte Carlo kernel for a PINSPEC simulation. More... | |
void | initializeSourceNeutron (neutron *neutron) |
Initializes a new source neutron within the geometry. More... | |
Private Member Functions | |
void | initializeProbModFuelRatios () |
Initializes a pre-computed array of moderator to first flight collsion probabilities using Carlvik's two term rational model. More... | |
Private Attributes | |
const char * | _geometry_name |
int | _num_neutrons_per_batch |
int | _num_batches |
int | _num_threads |
spatialType | _spatial_type |
InfiniteMediumRegion * | _infinite_medium |
EquivalenceRegion * | _fuel |
EquivalenceRegion * | _moderator |
std::vector< BoundedRegion * > | _regions |
float | _fuel_radius |
float | _pitch |
float | _buckling_squared |
float | _dancoff |
float | _sigma_e |
float | _beta |
float | _alpha1 |
float | _alpha2 |
int | _num_prob |
float * | _prob_energies |
float * | _prob_ff |
float * | _prob_mf |
Fissioner * | _fissioner |
float | _source_sampling_radius |
The Geometry represents the highest level entity in which a neutron may reside during a PINSPEC simulaiton. The geometry consists of one or more regions and controls the highest level Monte Carlo kernel.
Geometry::Geometry | ( | spatialType | spatial_type, |
const char * | name = (const char*)"" |
||
) |
Geomtery constructor.
Sets a default number of neutrons per batch (10,000), number of batches (10) and number of threads (1). Sets the source sampling radius to 10 cm by default.
void Geometry::addRegion | ( | Region * | region | ) |
Adds a new region to the geometry.
Checks to make sure that the region type (INFINITE, FUEL, MODERATOR) does not conflict with other regions that have already been added to the geometry
region | the region to add to the geometry |
bool Geometry::contains | ( | neutron * | neutron | ) |
Determines whether or not the geometry contains this neutron.
If the geometry contains this neutron's location, sets the neutron struct's region pointer to this region and returns true. If no region is found, returns false.
neutron | the neutron of interest |
bool Geometry::contains | ( | float | x, |
float | y, | ||
float | z | ||
) |
Determine whether or not this point is contained in the geometry.
Returns true for INFINITE_HOMOGENEOUS and HOMOGENEOUS_EQUIVALENCE geometries. Returns true for HETEROGENEOUS geometries if the point is contained within one of the geomtry's regions.
x | the x-coordinate of interest |
y | the y-coordinate of interest |
z | the z-coordinate of interest |
void Geometry::findContainingRegion | ( | neutron * | neutron | ) |
Finds the region containing a neutron.
Finds the region and sets the neutron struct's region pointer to this region. If no region is found, throws exception.
neutron | the neutron of interest |
Region * Geometry::findContainingRegion | ( | float | x, |
float | y, | ||
float | z | ||
) |
Finds the region containing a neutron.
Finds the region containing a neutron and returns a pointer to it or NULL if no region was found. Also returns NULL for INFINITE_HOMOGENEOUS and HOMOGENEOUS_EQUIVALENCE geometry types.
x | the x-coordinate of interest |
y | the y-coordinate of interest |
z | the z-coordinate of interest |
float Geometry::getBucklingSquared | ( | ) |
Returns the square of the geometric buckling for this geometry.
const char * Geometry::getName | ( | ) |
Returns the name of the geometry.
int Geometry::getNumBatches | ( | ) |
Returns the number of batches of neutrons for this simulation.
int Geometry::getNumNeutronsPerBatch | ( | ) |
Returns the number of neutrons per batch for this simulation.
int Geometry::getNumThreads | ( | ) |
Returns the number of parallel threads for this simulation.
float Geometry::getSourceSamplingRadius | ( | ) |
Returns the source sampling radius used for rejection sampling of random fission emission source sites.
spatialType Geometry::getSpatialType | ( | ) |
Return the spatial type of Geometry (INFINITE_HOMOGENEOUS, HOMOGENEOUS_EQUIVALENCE or HETEROGENEOUS).
int Geometry::getTotalNumNeutrons | ( | ) |
Returns the total number of neutrons for this simulation.
float Geometry::getVolume | ( | ) |
Returns the total volume occuppied by the geometry.
|
private |
Initializes a pre-computed array of moderator to first flight collsion probabilities using Carlvik's two term rational model.
The pre-computaiton of the probabilities is an optimization to save time in the monte carlo kernel for the homogeneous-heterogeneous equivalence geometry type. Each of the fuel and moderator equivalence theory regions contains a reference to the arrays of first flight collision probabilities in addition to the geometery. Everyone (both regions and the geometry) reference the same arrays to optimize cache performance. The geometry is in charge of deleting the memory for the arrays at the end of the simulation.
void Geometry::initializeSourceNeutron | ( | neutron * | neutron | ) |
Initializes a new source neutron within the geometry.
A source neutron initialized within the geometry will have an energy (eV) from a Watt spectrum, an _alive attribute set to true, a _collided attribute set to false, and its _region pointer set to this region. The _material and _isotope attributes will be set to NULL. For HETEROGENEOUS geometries, this method uses rejection sampling to initialize the neutrons location to a source site within the geometry with a non-zero fission cross-section. An isotropic (in lab) direction vector is sampled for the neutron's trajectory in 3D.
neutron | the neutron of interest |
void Geometry::runMonteCarloSimulation | ( | ) |
The primary Monte Carlo kernel for a PINSPEC simulation.
This method executes an appropriate Monte Carlo kernel depending on the geometry's spatial type. This method loops over batches and neutrons and collides each neutron in the appropriate region until it is absorbed, while tallying all user-specific quanties throughout.
void Geometry::setBucklingSquared | ( | float | buckling_squared | ) |
Sets the square of the geometric buckling for the geometry.
buckling_squared | the square of the geometric buckling |
void Geometry::setDancoffFactor | ( | float | dancoff | ) |
Sets the dancoff factor and computes the escape cross-section, beta, alpha1 and alpha2 parameters used for a two region heterogeneous-homogeneous pin cell simulation.
dancoff | the dancoff factor |
void Geometry::setFuelPinRadius | ( | float | radius | ) |
Sets the fuel pin radius.
radius | the fuel pin radius (cm) |
void Geometry::setName | ( | const char * | name | ) |
Sets the name of the geometry.
name | the name of the geometry |
void Geometry::setNeutronsPerBatch | ( | int | num_neutrons_per_batch | ) |
Sets the number of neutrons per batch for this simulation.
num_neutrons_per_batch | the number of neutrons per batch |
void Geometry::setNumBatches | ( | int | num_batches | ) |
Sets the number of batches for this simulation.
num_batches | the number of batches |
void Geometry::setNumThreads | ( | int | num_threads | ) |
Sets the number of batches for this simulation.
num_threads | the number of batches |
void Geometry::setPinCellPitch | ( | float | pitch | ) |
Sets the lattice pin cell pitch.
pitch | the pin cell pitch (cm) |
void Geometry::setSourceSamplingRadius | ( | float | radius | ) |
Sets the source sampling radius used for rejection sampling of random fission emission source sites.
radius | the source sampling radius (cm) |
void Geometry::setSpatialType | ( | spatialType | spatial_type | ) |
Set the geometry's spatial type (INFINITE_HOMOGENEOUS, HOMOGENEOUS_EQUIVALENCE or HETEROGENEOUS).
spatial_type | the spatial type |
|
private |
The user-specified alpha1 value for Carlvik's rational approximation
|
private |
The user-specified alpha2 value for Carlvik's rational approximation
|
private |
The user-specified beta value for Carlvik's rational approximation
|
private |
The square of the geometric buckling
|
private |
The user-specified dancoff factor
|
private |
The fissioner used to sample new neutron fission emission energies
|
private |
FUEL type region if the geometry is HOMOGENEOUS_EQUIVALANCE
|
private |
The fuel pin radius for a heterogeneous-homogeneous equivalent geometry
|
private |
The name of the geometry
|
private |
INFINITE type region if the geometery is INFINITE_HOMOGENEOUS
|
private |
MODERATOR type region if the geometry is HOMOGENEOUS_EQUIVALANCE
|
private |
The number of batches
|
private |
The number of neutrons per batch
|
private |
The number of first flight collision probabilities
|
private |
The number of threads
|
private |
The pin cell pitch for a heterogenous-homogeneous equivalent geometry
|
private |
The energies on a uniform lethargy grid for which the first flight collision probabilities are defined
|
private |
The first flight fuel-to-fuel collision probabilities
|
private |
The first flight moderator-to-fuel collision probabilities
|
private |
A container of BOUNDED type regions if the geometry is HETEROGENEOUS
|
private |
The user-specified escape cross-section
|
private |
A 3D spherical radius within which to sample random source sites
|
private |
The spatial type for the geometry