A monte carlo pin cell spectral code for nuclear engineering applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Region.h
Go to the documentation of this file.
1 
8 #ifndef REGION_H_
9 #define REGION_H_
10 
11 #ifdef __cplusplus
12 #include <vector>
13 #include <math.h>
14 #include <algorithm>
15 #include <stdarg.h>
16 #include <string.h>
17 #include <utility>
18 #include "Surface.h"
19 #include "Material.h"
20 #endif
21 
22 #define _USE_MATH_DEFINES
23 
33 typedef enum regionTypes {
46 } regionType;
47 
48 
49 
58 class Region {
59 
60 protected:
62  char* _region_name;
64  static int _n;
66  int _uid;
74  float _volume;
75 
76 public:
77  Region(const char* region_name=(char*)"");
81  virtual ~Region();
82  char* getName();
83  int getUid() const;
85  bool containsIsotope(Isotope* isotope);
87  float getVolume();
88  float getBucklingSquared();
89 
90  float getTotalMacroXS(float energy);
91  float getTotalMacroXS(int energy_index);
92  float getTotalMicroXS(float energy);
93  float getTotalMicroXS(int energy_index);
94 
95  float getElasticMacroXS(float energy);
96  float getElasticMacroXS(int energy_index);
97  float getElasticMicroXS(float energy);
98  float getElasticMicroXS(int energy_index);
99 
100  float getAbsorptionMacroXS(float energy);
101  float getAbsorptionMacroXS(int energy_index);
102  float getAbsorptionMicroXS(float energy);
103  float getAbsorptionMicroXS(int energy_index);
104 
105  float getCaptureMacroXS(float energy);
106  float getCaptureMacroXS(int energy_index);
107  float getCaptureMicroXS(float energy);
108  float getCaptureMicroXS(int energy_index);
109 
110  float getFissionMacroXS(float energy);
111  float getFissionMacroXS(int energy_index);
112  float getFissionMicroXS(float energy);
113  float getFissionMicroXS(int energy_index);
114 
115  float getTransportMicroXS(float energy);
116  float getTransportMicroXS(int energy_index);
117  float getTransportMacroXS(float energy);
118  float getTransportMacroXS(int energy_index);
119 
120  void setMaterial(Material* material);
121  void setVolume(float volume);
122  void setBucklingSquared(float buckling_squared);
123 
132  virtual void collideNeutron(neutron* neutron) =0;
133 };
134 
135 
146 
147 public:
148  InfiniteMediumRegion(const char* region_name=(char*)"");
152  virtual ~InfiniteMediumRegion() { };
153 
155 };
156 
157 
170 class EquivalenceRegion: public Region {
171 
172 private:
176  float _pitch;
178  float _half_width;
179 
183 
185  float* _prob_ff;
187  float* _prob_mf;
198 
199 public:
200  EquivalenceRegion(const char* region_name=(char*)"");
204  virtual ~EquivalenceRegion() { };
205  float getFuelPinRadius();
206  float getPinCellPitch();
207  int getEnergyGridIndex(float lethargy);
208  bool isFuel();
209  bool isModerator();
210 
211  void setFirstFlightCollProb(float* prob_ff, float* prob_mf,
212  float* prob_energies, int num_prob);
213  void setOtherRegion(EquivalenceRegion* region);
214  void setFuelPinRadius(float radius);
215  void setPinCellPitch(float pitch);
216 
220 };
221 
222 
236 
237 public:
238  EquivalenceFuelRegion(const char* region_name=(char*)"");
243 };
244 
245 
259 
260 public:
261  EquivalenceModeratorRegion(const char* region_name=(char*)"");
266 };
267 
268 
278 class BoundedRegion: public Region {
279 
280 private:
282  std::vector< std::pair<int, Surface*> > _surfaces;
283 
284 public:
285  BoundedRegion(const char* region_name=(char*)"");
289  virtual ~BoundedRegion() { };
290  void addBoundingSurface(int halfspace, Surface* surface);
291  void removeBoundingSurface(int halfspace, Surface* surface);
292 
293  bool contains(neutron* neutron);
294  bool contains(float x, float y, float z);
295  bool onBoundary(neutron* neutron);
297 
299 };
300 
301 
302 
303 
316 
317 public:
318  BoundedFuelRegion(const char* region_name=(char*)"");
323 
324  void ringify(int num_rings);
325 };
326 
327 
340 
341 public:
342  BoundedModeratorRegion(const char* region_name=(char*)"");
347 
348  void ringify(int num_rings);
349 };
350 
351 
362 
363 public:
364  BoundedGeneralRegion(const char* region_name=(char*)"");
369 };
370 
371 #endif /* REGION_H_ */
372 
The EquivalenceFuelRegion is a fuel region treated using the heterogenous-homogeneous equivalence the...
Definition: Region.h:235
The BoundedFuelRegion is a circular fuel pin region bounded by the interior halfspace of a circle sur...
Definition: Region.h:315
void collideNeutron(neutron *neutron)
This method collides a neutron within the region.
Definition: Region.cpp:422
float getTransportMacroXS(float energy)
Computes and returns the macroscopic transport cross-section in the region at some index into the uni...
Definition: Region.cpp:349
Represents a neutron in a PINSPEC simulation.
Definition: Neutron.h:27
float getTotalMicroXS(float energy)
Computes and returns the total microscopic cross-section in the region at some energy (eV)...
Definition: Region.cpp:129
void setVolume(float volume)
Sets the volume for this region .
Definition: Region.cpp:369
float getAbsorptionMacroXS(float energy)
Computes and returns the macroscopic absorption cross-section in the region at energy (eV)...
Definition: Region.cpp:195
float getTotalMacroXS(float energy)
Computes and returns the total macroscopic cross-section in the region at some energy (eV)...
Definition: Region.cpp:107
Definition: Region.h:41
Material * getMaterial()
Returns a pointer to the material filling this region.
Definition: Region.cpp:59
void setPinCellPitch(float pitch)
Sets the pin cell pitch.
Definition: Region.cpp:607
float getFuelPinRadius()
Returns the fuel pin radius.
Definition: Region.cpp:460
float getPinCellPitch()
Returns the pin cell pitch.
Definition: Region.cpp:469
int _num_prob
Definition: Region.h:191
BoundedModeratorRegion(const char *region_name=(char *)"")
BoundedModeratorRegion constructor.
Definition: Region.cpp:1012
char * _region_name
Definition: Region.h:62
The Surface represents a quadratic surface in the xy-plane.
Definition: Surface.h:73
EquivalenceFuelRegion(const char *region_name=(char *)"")
EquivalenceFuelRegion constructor.
Definition: Region.cpp:738
The Equivalence Region is a fuel or moderator region treated using the heterogenous-homogeneous equiv...
Definition: Region.h:170
The Material class.
float * _prob_ff
Definition: Region.h:185
The Isotope represents a nuclide at some temperature.
Definition: Isotope.h:41
int getEnergyGridIndex(float lethargy)
This method returns the index for a certain lethargy (log10(eV)) into the uniform lethargy grid of th...
Definition: Region.cpp:484
The BoundedModeratorRegion is a the space defined four surfaces bounding a square pin minus a circula...
Definition: Region.h:339
BoundedFuelRegion(const char *region_name=(char *)"")
BoundedFuelRegion constructor.
Definition: Region.cpp:988
BoundedGeneralRegion(const char *region_name=(char *)"")
BoundedGeneralRegion constructor.
Definition: Region.cpp:1036
Definition: Region.h:43
float getBucklingSquared()
Returns the squared geometric buckling.
Definition: Region.cpp:96
Definition: Region.h:45
The InfiniteMediumRegion is a homogenized region treated without geometric effects.
Definition: Region.h:145
float _end_lethargy
Definition: Region.h:195
float getFissionMacroXS(float energy)
Computes and returns the macroscopic fission cross-section in the region at some energy (eV)...
Definition: Region.cpp:283
virtual ~Region()
Empty destructor allows SWIG to cleanup memory for surfaces.
Definition: Region.cpp:32
virtual void collideNeutron(neutron *neutron)=0
This method collides a neutron within the region.
InfiniteMediumRegion(const char *region_name=(char *)"")
InfiniteMediumRegion constructor.
Definition: Region.cpp:410
void addBoundingSurface(int halfspace, Surface *surface)
Adds a new halfspace of a bounding surface to a region.
Definition: Region.cpp:767
float _pitch
Definition: Region.h:176
Definition: Region.h:39
The region class represents a region in 2D space.
Definition: Region.h:58
The BoundedGeneralRegion is a the space defined by the intersection of some number surface halfspaces...
Definition: Region.h:361
EquivalenceRegion * _other_region
Definition: Region.h:182
Definition: Region.h:37
void ringify(int num_rings)
Generates a series of equal area circular rings within the fuel.
Definition: Region.cpp:1001
std::vector< std::pair< int, Surface * > > _surfaces
Definition: Region.h:282
float _fuel_radius
Definition: Region.h:174
bool isModerator()
Returns true if this region is the moderator, false otherwise.
Definition: Region.cpp:515
float _start_lethargy
Definition: Region.h:193
bool containsIsotope(Isotope *isotope)
Determines whether this region contains a particular isotope.
Definition: Region.cpp:69
~BoundedFuelRegion()
Empty destructor allows SWIG to cleanup memory for surfaces.
Definition: Region.h:322
void setFirstFlightCollProb(float *prob_ff, float *prob_mf, float *prob_energies, int num_prob)
Sets the first flight collision probabilities.
Definition: Region.cpp:536
float getElasticMicroXS(float energy)
Computes and returns the microscopic elastic scattering cross-section in the region at some energy (e...
Definition: Region.cpp:173
regionType getRegionType()
Return the type of region.
Definition: Region.cpp:78
virtual ~BoundedRegion()
Empty destructor allows SWIG to cleanup memory for surfaces.
Definition: Region.h:289
float computeModeratorFuelCollisionProb(neutron *neutron)
Finds the first flight moderator-to-fuel collision probability for a neutron.
Definition: Region.cpp:666
void setOtherRegion(EquivalenceRegion *region)
Sets other region for a homogeneous equivalence region.
Definition: Region.cpp:557
float computeParametrizedDistance(neutron *neutron)
This method computes the parametrized distance along a neutron's unit trajectory vector to the neares...
Definition: Region.cpp:878
The Surface class.
The EquivalenceModeratorRegion is a fuel region treated using the heterogenous-homogeneous equivalenc...
Definition: Region.h:258
~EquivalenceModeratorRegion()
Empty destructor allows SWIG to cleanup memory for surfaces.
Definition: Region.h:265
float getElasticMacroXS(float energy)
Computes and returns the macroscopic elastic scattering cross-section in the region at some energy (e...
Definition: Region.cpp:151
EquivalenceModeratorRegion(const char *region_name=(char *)"")
EquivalenceModeratorRegion constructor.
Definition: Region.cpp:749
enum regionTypes regionType
Region spatial type.
virtual ~EquivalenceRegion()
Empty destructor allows SWIG to cleanup memory for surfaces.
Definition: Region.h:204
void setBucklingSquared(float buckling_squared)
Sets the squared geometric buckling for the geometry.
Definition: Region.cpp:394
regionType _region_type
Definition: Region.h:70
float _volume
Definition: Region.h:74
void ringify(int num_rings)
Generates a series of equal area circular rings within the moderator.
Definition: Region.cpp:1025
float getAbsorptionMicroXS(float energy)
Computes and returns the microscopic absorption cross-section in the region at some energy (eV)...
Definition: Region.cpp:217
void collideNeutron(neutron *neutron)
This method collides a neutron within the region.
Definition: Region.cpp:692
float _half_width
Definition: Region.h:178
float computeFuelFuelCollsionProb(neutron *neutron)
Finds the first flight fuel-to-fuel collision probability for a neutron.
Definition: Region.cpp:637
float getFissionMicroXS(float energy)
Computes and returns the microscopic fission cross-section in the region at some energy (eV) ...
Definition: Region.cpp:305
regionTypes
Spatial Types of regions.
Definition: Region.h:33
The Material class represents a collection of isotope objects.
Definition: Material.h:37
EquivalenceRegion(const char *region_name=(char *)"")
EquivalenceRegion constructor.
Definition: Region.cpp:447
~BoundedModeratorRegion()
Empty destructor allows SWIG to cleanup memory for surfaces.
Definition: Region.h:346
The BoundedRegion is a region bounded by surfaces using a constructive solid geometry formulation...
Definition: Region.h:278
float getVolume()
returns the volume of this Region .
Definition: Region.cpp:87
char * getName()
Return the name of the region.
Definition: Region.cpp:41
BoundedRegion(const char *region_name=(char *)"")
BoundedRegion constructor.
Definition: Region.cpp:759
~EquivalenceFuelRegion()
Empty destructor allows SWIG to cleanup memory for surfaces.
Definition: Region.h:242
static int _n
Definition: Region.h:64
void setMaterial(Material *material)
Set the material filling this region.
Definition: Region.cpp:383
virtual ~InfiniteMediumRegion()
Empty destructor allows SWIG to cleanup memory for surfaces.
Definition: Region.h:152
void setFuelPinRadius(float radius)
Sets the fuel radius if the region.
Definition: Region.cpp:583
float _delta_lethargy
Definition: Region.h:197
bool isFuel()
Returns true if this region is the fuel, false otherwise.
Definition: Region.cpp:503
float * _prob_mf
Definition: Region.h:187
bool onBoundary(neutron *neutron)
Checks if a neutron at some 2D location is on the region boundary.
Definition: Region.cpp:859
float getCaptureMicroXS(float energy)
Computes and returns the microscopic capture cross-section in the region at some energy (eV)...
Definition: Region.cpp:261
Definition: Region.h:35
int _uid
Definition: Region.h:66
Material * _material
Definition: Region.h:68
float getTransportMicroXS(float energy)
Computes and returns the microscopic transport cross-section in the region at some index into the uni...
Definition: Region.cpp:327
Region(const char *region_name=(char *)"")
Region constructor.
Definition: Region.cpp:12
float * _prob_energies
Definition: Region.h:189
void removeBoundingSurface(int halfspace, Surface *surface)
Removes a halfspace of a bounding surface for a region.
Definition: Region.cpp:786
int getUid() const
Returns the unique ID auto-generated for the region.
Definition: Region.cpp:50
float getCaptureMacroXS(float energy)
Computes and returns the macroscopic capture cross-section in the region at some energy (eV)...
Definition: Region.cpp:239
float _buckling_squared
Definition: Region.h:72
void collideNeutron(neutron *neutron)
This method collides a neutron within the region.
Definition: Region.cpp:907
~BoundedGeneralRegion()
Empty destructor allows SWIG to cleanup memory for surfaces.
Definition: Region.h:368
bool contains(neutron *neutron)
Check if this region contains a neutron at some location in space.
Definition: Region.cpp:834