A monte carlo pin cell spectral code for nuclear engineering applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Geometry Class Reference

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...
 
RegionfindContainingRegion (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
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Member Function Documentation

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

Parameters
regionthe 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.

Parameters
neutronthe 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.

Parameters
xthe x-coordinate of interest
ythe y-coordinate of interest
zthe 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.

Parameters
neutronthe 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.

Parameters
xthe x-coordinate of interest
ythe y-coordinate of interest
zthe z-coordinate of interest
float Geometry::getBucklingSquared ( )

Returns the square of the geometric buckling for this geometry.

Returns
the square of the geometric buckling
const char * Geometry::getName ( )

Returns the name of the geometry.

Returns
the name of the goemetry
int Geometry::getNumBatches ( )

Returns the number of batches of neutrons for this simulation.

Returns
the number of batches
int Geometry::getNumNeutronsPerBatch ( )

Returns the number of neutrons per batch for this simulation.

Returns
the number of neutrons per batch
int Geometry::getNumThreads ( )

Returns the number of parallel threads for this simulation.

Returns
the number of threads
float Geometry::getSourceSamplingRadius ( )

Returns the source sampling radius used for rejection sampling of random fission emission source sites.

Returns
the source sampling radius (cm)
spatialType Geometry::getSpatialType ( )

Return the spatial type of Geometry (INFINITE_HOMOGENEOUS, HOMOGENEOUS_EQUIVALENCE or HETEROGENEOUS).

Returns
the spatial type
int Geometry::getTotalNumNeutrons ( )

Returns the total number of neutrons for this simulation.

Returns
the total number of neutrons for this simulation
float Geometry::getVolume ( )

Returns the total volume occuppied by the geometry.

Returns
The total volume for the geometry
void Geometry::initializeProbModFuelRatios ( )
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.

Parameters
neutronthe 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.

Parameters
buckling_squaredthe 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.

Parameters
dancoffthe dancoff factor
void Geometry::setFuelPinRadius ( float  radius)

Sets the fuel pin radius.

Parameters
radiusthe fuel pin radius (cm)
void Geometry::setName ( const char *  name)

Sets the name of the geometry.

Parameters
namethe name of the geometry
void Geometry::setNeutronsPerBatch ( int  num_neutrons_per_batch)

Sets the number of neutrons per batch for this simulation.

Parameters
num_neutrons_per_batchthe number of neutrons per batch
void Geometry::setNumBatches ( int  num_batches)

Sets the number of batches for this simulation.

Parameters
num_batchesthe number of batches
void Geometry::setNumThreads ( int  num_threads)

Sets the number of batches for this simulation.

Parameters
num_threadsthe number of batches
void Geometry::setPinCellPitch ( float  pitch)

Sets the lattice pin cell pitch.

Parameters
pitchthe pin cell pitch (cm)
void Geometry::setSourceSamplingRadius ( float  radius)

Sets the source sampling radius used for rejection sampling of random fission emission source sites.

Parameters
radiusthe source sampling radius (cm)
void Geometry::setSpatialType ( spatialType  spatial_type)

Set the geometry's spatial type (INFINITE_HOMOGENEOUS, HOMOGENEOUS_EQUIVALENCE or HETEROGENEOUS).

Parameters
spatial_typethe spatial type

Member Data Documentation

float Geometry::_alpha1
private

The user-specified alpha1 value for Carlvik's rational approximation

float Geometry::_alpha2
private

The user-specified alpha2 value for Carlvik's rational approximation

float Geometry::_beta
private

The user-specified beta value for Carlvik's rational approximation

float Geometry::_buckling_squared
private

The square of the geometric buckling

float Geometry::_dancoff
private

The user-specified dancoff factor

Fissioner* Geometry::_fissioner
private

The fissioner used to sample new neutron fission emission energies

EquivalenceRegion* Geometry::_fuel
private

FUEL type region if the geometry is HOMOGENEOUS_EQUIVALANCE

float Geometry::_fuel_radius
private

The fuel pin radius for a heterogeneous-homogeneous equivalent geometry

const char* Geometry::_geometry_name
private

The name of the geometry

InfiniteMediumRegion* Geometry::_infinite_medium
private

INFINITE type region if the geometery is INFINITE_HOMOGENEOUS

EquivalenceRegion* Geometry::_moderator
private

MODERATOR type region if the geometry is HOMOGENEOUS_EQUIVALANCE

int Geometry::_num_batches
private

The number of batches

int Geometry::_num_neutrons_per_batch
private

The number of neutrons per batch

int Geometry::_num_prob
private

The number of first flight collision probabilities

int Geometry::_num_threads
private

The number of threads

float Geometry::_pitch
private

The pin cell pitch for a heterogenous-homogeneous equivalent geometry

float* Geometry::_prob_energies
private

The energies on a uniform lethargy grid for which the first flight collision probabilities are defined

float* Geometry::_prob_ff
private

The first flight fuel-to-fuel collision probabilities

float* Geometry::_prob_mf
private

The first flight moderator-to-fuel collision probabilities

std::vector<BoundedRegion*> Geometry::_regions
private

A container of BOUNDED type regions if the geometry is HETEROGENEOUS

float Geometry::_sigma_e
private

The user-specified escape cross-section

float Geometry::_source_sampling_radius
private

A 3D spherical radius within which to sample random source sites

spatialType Geometry::_spatial_type
private

The spatial type for the geometry


The documentation for this class was generated from the following files: