Merge branch 'virtual_lattice' into virtual_lattice_0.15.2

This commit is contained in:
skywalker_cn 2025-09-03 12:49:14 +00:00
commit 309841ead1
11 changed files with 818 additions and 4 deletions

View file

@ -319,7 +319,15 @@ public:
Fill type_; //!< Material, universe, or lattice
int32_t universe_; //!< Universe # this cell is in
int32_t fill_; //!< Universe # filling this cell
bool virtual_lattice_; //!< If the cell is the base of a virtual triso lattice
bool triso_particle_;
//! \brief Specification of the virtual lattice
vector<double> vl_lower_left_;
vector<double> vl_pitch_;
vector<int32_t> vl_shape_;
vector<vector<int32_t>> vl_triso_distribution_;
//! \brief Index corresponding to this cell in distribcell arrays
int distribcell_index_ {C_NONE};

View file

@ -39,6 +39,9 @@ public:
std::string name_; //!< User-defined name
unique_ptr<BoundaryCondition> bc_; //!< Boundary condition
bool surf_source_ {false}; //!< Activate source banking for the surface?
int triso_base_index_;
int triso_particle_index_ = -1;
bool is_triso_surface_ = false;
explicit Surface(pugi::xml_node surf_node);
Surface();
@ -78,6 +81,15 @@ public:
//! exactly on the surface.
virtual double distance(Position r, Direction u, bool coincident) const = 0;
virtual bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const
{
return {};
};
virtual void connect_to_triso_base(int triso_index, std::string key) {};
virtual vector<double> get_center() const { return {}; };
virtual double get_radius() const { return {}; };
//! Compute the local outward normal direction of the surface.
//! \param r A 3D Cartesian coordinate.
//! \return Normal direction
@ -116,6 +128,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
BoundingBox bounding_box(bool pos_side) const override;
double x0_;
@ -134,6 +148,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
BoundingBox bounding_box(bool pos_side) const override;
double y0_;
@ -152,6 +168,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
BoundingBox bounding_box(bool pos_side) const override;
double z0_;
@ -169,6 +187,8 @@ public:
double evaluate(Position r) const override;
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
void to_hdf5_inner(hid_t group_id) const override;
double A_, B_, C_, D_;
@ -188,6 +208,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
BoundingBox bounding_box(bool pos_side) const override;
double y0_, z0_, radius_;
@ -207,6 +229,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
BoundingBox bounding_box(bool pos_side) const override;
double x0_, z0_, radius_;
@ -226,6 +250,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
BoundingBox bounding_box(bool pos_side) const override;
double x0_, y0_, radius_;
@ -245,9 +271,12 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
BoundingBox bounding_box(bool pos_side) const override;
double x0_, y0_, z0_, radius_;
// int triso_base_index_ = -1;
};
//==============================================================================
@ -264,6 +293,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
double x0_, y0_, z0_, radius_sq_;
};
@ -282,6 +313,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
double x0_, y0_, z0_, radius_sq_;
};
@ -300,6 +333,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
double x0_, y0_, z0_, radius_sq_;
};
@ -318,6 +353,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
// Ax^2 + By^2 + Cz^2 + Dxy + Eyz + Fxz + Gx + Hy + Jz + K = 0
double A_, B_, C_, D_, E_, F_, G_, H_, J_, K_;
@ -336,6 +373,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
double x0_, y0_, z0_, A_, B_, C_;
};
@ -353,6 +392,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
double x0_, y0_, z0_, A_, B_, C_;
};
@ -370,6 +411,8 @@ public:
double distance(Position r, Direction u, bool coincident) const override;
Direction normal(Position r) const override;
void to_hdf5_inner(hid_t group_id) const override;
bool triso_in_mesh(
vector<double> mesh_center, vector<double> lattice_pitch) const override;
double x0_, y0_, z0_, A_, B_, C_;
};

View file

@ -114,6 +114,11 @@ class Cell(IDManagerMixin):
self._num_instances = None
self._volume = None
self._atoms = None
self._triso_particle = False
self.virtual_lattice = False
self.lower_left = None
self.pitch = None
self.shape = None
def __contains__(self, point):
if self.region is None:
@ -593,6 +598,13 @@ class Cell(IDManagerMixin):
"""
element = ET.Element("cell")
element.set("id", str(self.id))
if self._triso_particle:
element.set("triso_particle", 'true')
if self.virtual_lattice:
element.set("virtual_lattice", str(self.virtual_lattice))
element.set("lower_left", ' '.join(map(str, self.lower_left)))
element.set("pitch", ' '.join(map(str, self.pitch)))
element.set("shape", ' '.join(map(str, self.shape)))
if len(self._name) > 0:
element.set("name", str(self.name))

View file

@ -55,6 +55,7 @@ class TRISO(openmc.Cell):
def __init__(self, outer_radius, fill, center=(0., 0., 0.)):
self._surface = openmc.Sphere(r=outer_radius)
self._triso_particle = False
super().__init__(fill=fill, region=-self._surface)
self.center = np.asarray(center)
@ -802,7 +803,7 @@ class _SphericalShell(_Container):
q[:] = (q - c)*ll[0]/r + c
def create_triso_lattice(trisos, lower_left, pitch, shape, background):
def create_triso_lattice(trisos, lower_left, pitch, shape, background, virtual=False):
"""Create a lattice containing TRISO particles for optimized tracking.
Parameters
@ -826,6 +827,12 @@ def create_triso_lattice(trisos, lower_left, pitch, shape, background):
"""
if virtual:
real_pitch = copy.deepcopy(pitch)
real_shape = copy.deepcopy(shape)
pitch = [real_pitch[i]*real_shape[i] for i in range(len(real_pitch))]
shape = [1 for i in range(len(real_shape))]
lattice = openmc.RectLattice()
lattice.lower_left = lower_left
lattice.pitch = pitch
@ -845,6 +852,8 @@ def create_triso_lattice(trisos, lower_left, pitch, shape, background):
y0=t._surface.y0,
z0=t._surface.z0)
t_copy.region = -t_copy._surface
if virtual:
t_copy._triso_particle = True
triso_locations[idx].append(t_copy)
else:
warnings.warn('TRISO particle is partially or completely '
@ -859,6 +868,12 @@ def create_triso_lattice(trisos, lower_left, pitch, shape, background):
else:
background_cell = openmc.Cell(fill=background)
if virtual:
background_cell.virtual_lattice = True
background_cell.pitch = real_pitch
background_cell.shape = real_shape
background_cell.lower_left = [-pitch[i]/2 for i in range(len(pitch))]
u = openmc.Universe()
u.add_cell(background_cell)
for t in triso_list:

View file

@ -36,6 +36,47 @@ vector<unique_ptr<Cell>> cells;
} // namespace model
vector<vector<int32_t>> generate_triso_distribution(vector<int> lattice_shape,
vector<double> lattice_pitch, vector<double> lattice_lower_left,
vector<std::int32_t> cell_rpn, int id)
{
vector<vector<int32_t>> triso_distribution(
lattice_shape[0] * lattice_shape[1] * lattice_shape[2]);
vector<double> mesh_center(3);
vector<int> mesh_ind(3);
for (int32_t token : cell_rpn) {
if (token >= OP_UNION)
continue;
vector<double> triso_center = model::surfaces[abs(token) - 1]->get_center();
for (int i = 0; i < 3; i++) {
mesh_ind[i] =
floor((triso_center[i] - lattice_lower_left[i]) / lattice_pitch[i]);
}
for (int i = mesh_ind[0] - 1; i <= mesh_ind[0] + 1; i++) {
for (int j = mesh_ind[1] - 1; j <= mesh_ind[1] + 1; j++) {
for (int k = mesh_ind[2] - 1; k <= mesh_ind[2] + 1; k++) {
if (i < 0 || i >= lattice_shape[0] || j < 0 ||
j >= lattice_shape[1] || k < 0 || k >= lattice_shape[2])
continue;
mesh_center[0] = (i + 0.5) * lattice_pitch[0] + lattice_lower_left[0];
mesh_center[1] = (j + 0.5) * lattice_pitch[1] + lattice_lower_left[1];
mesh_center[2] = (k + 0.5) * lattice_pitch[2] + lattice_lower_left[2];
if (model::surfaces[abs(token) - 1]->triso_in_mesh(
mesh_center, lattice_pitch)) {
triso_distribution[i + j * lattice_shape[0] +
k * lattice_shape[0] * lattice_shape[1]]
.push_back(token);
model::surfaces[abs(token) - 1]->connect_to_triso_base(id, "base");
}
}
}
}
}
return triso_distribution;
}
//==============================================================================
// Cell implementation
//==============================================================================
@ -272,6 +313,33 @@ CSGCell::CSGCell(pugi::xml_node cell_node)
universe_ = 0;
}
// Check if the cell is the base of a virtual triso lattice
bool virtual_lattice_present = check_for_node(cell_node, "virtual_lattice");
if (virtual_lattice_present) {
virtual_lattice_ = get_node_value_bool(cell_node, "virtual_lattice");
if (virtual_lattice_) {
if (check_for_node(cell_node, "lower_left") &&
check_for_node(cell_node, "pitch") &&
check_for_node(cell_node, "shape")) {
vl_lower_left_ = get_node_array<double>(cell_node, "lower_left");
vl_pitch_ = get_node_array<double>(cell_node, "pitch");
vl_shape_ = get_node_array<int>(cell_node, "shape");
} else {
fatal_error(fmt::format("Lower_left, pitch and shape of the virtual "
"lattice must be specified for cell {}",
id_));
}
}
} else {
virtual_lattice_ = false;
}
if (check_for_node(cell_node, "triso_particle")) {
triso_particle_ = get_node_value_bool(cell_node, "triso_particle");
} else {
triso_particle_ = false;
}
// Make sure that either material or fill was specified, but not both.
bool fill_present = check_for_node(cell_node, "fill");
bool material_present = check_for_node(cell_node, "material");
@ -355,6 +423,20 @@ CSGCell::CSGCell(pugi::xml_node cell_node)
Region region(region_spec, id_);
region_ = region;
if (virtual_lattice_) {
vl_triso_distribution_ = generate_triso_distribution(
vl_shape_, vl_pitch_, vl_lower_left_, rpn_, id_);
}
if (triso_particle_) {
if (rpn_.size() != 1) {
fatal_error(
fmt::format("Wrong surface definition of triso particle cell {}", id_));
} else {
model::surfaces[abs(rpn_[0]) - 1]->connect_to_triso_base(id_, "particle");
}
}
// Read the translation vector.
if (check_for_node(cell_node, "translation")) {
if (fill_ == C_NONE) {
@ -420,6 +502,100 @@ vector<int32_t>::iterator CSGCell::find_left_parenthesis(
}
return it;
}
std::pair<double, int32_t> CSGCell::distance(
Position r, Direction u, int32_t on_surface, GeometryState* p) const
{
double min_dist {INFTY};
int32_t i_surf {std::numeric_limits<int32_t>::max()};
double min_dis_vl;
int32_t i_surf_vl;
if (virtual_lattice_) {
double max_dis = p->collision_distance();
double tol_dis = 0;
vector<double> dis_to_bou(3), dis_to_bou_max(3);
double u_value = sqrt(pow(u.x, 2) + pow(u.y, 2) +
pow(u.z, 2)); // don't know if u has been normalized
vector<double> norm_u = {u.x / u_value, u.y / u_value, u.z / u_value};
vector<int> lat_ind(3);
vector<double> temp_pos = {r.x, r.y, r.z};
int loop_time;
for (int i = 0; i < 3; i++) {
lat_ind[i] = floor((temp_pos[i] - vl_lower_left_[i]) / vl_pitch_[i]);
if (lat_ind[i] == vl_shape_[i] && norm_u[i] < 0) {
lat_ind[i] = vl_shape_[i] - 1;
}
if (lat_ind[i] == -1 && norm_u[i] > 0) {
lat_ind[i] = 0;
}
}
dis_to_bou = {INFTY, INFTY, INFTY};
for (int i = 0; i < 3; i++) {
if (norm_u[i] > 0) {
dis_to_bou[i] = std::abs(
((lat_ind[i] + 1) * vl_pitch_[i] + vl_lower_left_[i] - temp_pos[i]) /
norm_u[i]);
dis_to_bou_max[i] = vl_pitch_[i] / norm_u[i];
} else if (norm_u[i] < 0) {
dis_to_bou[i] = std::abs(
(lat_ind[i] * vl_pitch_[i] + vl_lower_left_[i] - temp_pos[i]) /
norm_u[i]);
dis_to_bou_max[i] = -vl_pitch_[i] / norm_u[i];
}
}
while (true) {
if (lat_ind[0] < 0 || lat_ind[0] >= vl_shape_[0] || lat_ind[1] < 0 ||
lat_ind[1] >= vl_shape_[1] || lat_ind[2] < 0 ||
lat_ind[2] >= vl_shape_[2])
break;
for (int token :
vl_triso_distribution_[lat_ind[0] + lat_ind[1] * vl_shape_[0] +
lat_ind[2] * vl_shape_[0] * vl_shape_[1]]) {
bool coincident {std::abs(token) == std::abs(on_surface)};
double d {model::surfaces[abs(token) - 1]->distance(r, u, coincident)};
if (d < min_dist) {
if (min_dist - d >= FP_PRECISION * min_dist) {
min_dist = d;
i_surf = -token;
}
}
}
int mes_bou_crossed = 0;
if (dis_to_bou[1] < dis_to_bou[0]) {
mes_bou_crossed = 1;
}
if (dis_to_bou[2] < dis_to_bou[mes_bou_crossed]) {
mes_bou_crossed = 2;
}
tol_dis = dis_to_bou[mes_bou_crossed];
if (min_dist < tol_dis) {
break;
}
if (norm_u[mes_bou_crossed] > 0) {
lat_ind[mes_bou_crossed] += 1;
} else {
lat_ind[mes_bou_crossed] += -1;
}
dis_to_bou[mes_bou_crossed] += dis_to_bou_max[mes_bou_crossed];
if (tol_dis > max_dis) {
break;
}
}
} else {
region_.distance(r, u, on_surface);
}
return {min_dist, i_surf};
}
//==============================================================================
// Region implementation
@ -1042,6 +1218,10 @@ void populate_universes()
model::universes[it->second]->cells_.push_back(index_cell);
}
if (model::cells[index_cell]->virtual_lattice_) {
model::universes[it->second]->filled_with_triso_base_ =
model::cells[index_cell]->id_;
}
}
// Add DAGUniverse implicit complement cells last

View file

@ -226,7 +226,6 @@ void Particle::event_calculate_xs()
void Particle::event_advance()
{
// Find the distance to the nearest boundary
boundary() = distance_to_boundary(*this);
// Sample a distance to collision
if (type() == ParticleType::electron || type() == ParticleType::positron) {
@ -237,6 +236,8 @@ void Particle::event_advance()
collision_distance() = -std::log(prn(current_seed())) / macro_xs().total;
}
boundary() = distance_to_boundary(*this);
double speed = this->speed();
double time_cutoff = settings::time_cutoff[static_cast<int>(type())];
double distance_cutoff =
@ -576,8 +577,98 @@ void Particle::cross_surface(const Surface& surf)
#endif
bool verbose = settings::verbosity >= 10 || trace();
if (neighbor_list_find_cell(*this, verbose)) {
return;
if (surf->is_triso_surface_) {
if (surface() > 0) {
for (int i = n_coord(); i < model::n_coord_levels; i++) {
coord(i).reset();
}
coord(n_coord() - 1).cell =
model::cell_map[model::surfaces[i_surface - 1]->triso_base_index_];
} else if (surface() < 0) {
for (int i = n_coord(); i < model::n_coord_levels; i++) {
coord(i).reset();
}
if (model::surfaces[i_surface - 1]->triso_particle_index_ == -1) {
fatal_error(fmt::format("Particle cell of surface {} is not defined",
model::surfaces[i_surface - 1]->id_));
}
coord(n_coord() - 1).cell =
model::cell_map[model::surfaces[i_surface - 1]->triso_particle_index_];
}
// find material
bool found = true;
int i_cell = coord(n_coord() - 1).cell;
for (;; ++n_coord()) {
if (i_cell == C_NONE) {
int i_universe = coord(n_coord() - 1).universe;
const auto& univ {model::universes[i_universe]};
if (univ->filled_with_triso_base_ != -1) {
coord(n_coord() - 1).cell =
model::cell_map[univ->filled_with_triso_base_];
found = true;
} else {
found = univ->find_cell(*this);
}
if (!found) {
break;
}
}
i_cell = coord(n_coord() - 1).cell;
Cell& c {*model::cells[i_cell]};
if (c.type_ == Fill::MATERIAL) {
// Found a material cell which means this is the lowest coord level.
cell_instance() = 0;
// Find the distribcell instance number.
if (c.distribcell_index_ >= 0) {
cell_instance() = cell_instance_at_level(*this, n_coord() - 1);
}
// Set the material and temperature.
material_last() = material();
if (c.material_.size() > 1) {
material() = c.material_[cell_instance()];
} else {
material() = c.material_[0];
}
sqrtkT_last() = sqrtkT();
if (c.sqrtkT_.size() > 1) {
sqrtkT() = c.sqrtkT_[cell_instance()];
} else {
sqrtkT() = c.sqrtkT_[0];
}
return;
} else if (c.type_ == Fill::UNIVERSE) {
//========================================================================
//! Found a lower universe, update this coord level then search the
//! next.
// Set the lower coordinate level universe.
auto& coor {coord(n_coord())};
coor.universe = c.fill_;
// Set the position and direction.
coor.r = r_local();
coor.u = u_local();
// Apply translation.
coor.r -= c.translation_;
// Apply rotation.
if (!c.rotation_.empty()) {
coor.rotate(c.rotation_);
}
i_cell = C_NONE;
}
}
} else {
if (neighbor_list_find_cell(*this, verbose))
return;
}
// ==========================================================================

View file

@ -257,6 +257,11 @@ BoundingBox SurfaceXPlane::bounding_box(bool pos_side) const
}
}
bool SurfaceXPlane::triso_in_mesh(vector<double> mesh_center, vector<double> lattice_pitch) const
{
return false;
}
//==============================================================================
// SurfaceYPlane implementation
//==============================================================================
@ -340,6 +345,10 @@ BoundingBox SurfaceZPlane::bounding_box(bool pos_side) const
//==============================================================================
// SurfacePlane implementation
//==============================================================================
bool SurfacePlane::triso_in_mesh(vector<double> mesh_center, vector<double> lattice_pitch) const
{
return false;
}
SurfacePlane::SurfacePlane(pugi::xml_node surf_node) : Surface(surf_node)
{
@ -459,6 +468,11 @@ Direction axis_aligned_cylinder_normal(
// SurfaceXCylinder implementation
//==============================================================================
bool SurfaceXCylinder::triso_in_mesh(vector<double> mesh_center, vector<double> lattice_pitch) const
{
return false;
}
SurfaceXCylinder::SurfaceXCylinder(pugi::xml_node surf_node)
: Surface(surf_node)
{
@ -502,6 +516,11 @@ BoundingBox SurfaceXCylinder::bounding_box(bool pos_side) const
// SurfaceYCylinder implementation
//==============================================================================
bool SurfaceYCylinder::triso_in_mesh(vector<double> mesh_center, vector<double> lattice_pitch) const
{
return false;
}
SurfaceYCylinder::SurfaceYCylinder(pugi::xml_node surf_node)
: Surface(surf_node)
{
@ -546,6 +565,11 @@ BoundingBox SurfaceYCylinder::bounding_box(bool pos_side) const
// SurfaceZCylinder implementation
//==============================================================================
bool SurfaceZCylinder::triso_in_mesh(vector<double> mesh_center, vector<double> lattice_pitch) const
{
return false;
}
SurfaceZCylinder::SurfaceZCylinder(pugi::xml_node surf_node)
: Surface(surf_node)
{
@ -664,6 +688,66 @@ BoundingBox SurfaceSphere::bounding_box(bool pos_side) const
}
}
void SurfaceSphere::connect_to_triso_base(int triso_index, std::string key)
{
if (key=="base") {
triso_base_index_=triso_index;
is_triso_surface_=true;
} else if (key=="particle") {
triso_particle_index_=triso_index;
}
}
vector<double> SurfaceSphere::get_center() const {
return {x0_,y0_,z0_};
}
double SurfaceSphere::get_radius() const {
return radius_;
}
bool SurfaceSphere::triso_in_mesh(vector<double> mesh_center, vector<double> lattice_pitch) const
{
double dis_x;
double dis_y;
double dis_z;
double x_min=mesh_center[0]-lattice_pitch[0]/2;
double x_max=mesh_center[0]+lattice_pitch[0]/2;
double y_min=mesh_center[1]-lattice_pitch[1]/2;
double y_max=mesh_center[1]+lattice_pitch[1]/2;
double z_min=mesh_center[2]-lattice_pitch[2]/2;
double z_max=mesh_center[2]+lattice_pitch[2]/2;
if (x0_>=x_min && x0_<=x_max) {
dis_x=0;
} else if (x0_<x_min) {
dis_x=pow(x_min-x0_, 2);
} else {
dis_x=pow(x_max-x0_, 2);
}
if (y0_>=y_min && y0_<=y_max) {
dis_y=0;
} else if (y0_<y_min) {
dis_y=pow(y_min-y0_, 2);
} else {
dis_y=pow(y_max-y0_, 2);
}
if (z0_>=z_min && z0_<=z_max) {
dis_z=0;
} else if (z0_<z_min) {
dis_z=pow(z_min-z0_, 2);
} else {
dis_z=pow(z_max-z0_, 2);
}
if (sqrt(dis_x+dis_y+dis_z) < radius_) {
return true;
} else {
return false;
}
}
//==============================================================================
// Generic functions for x-, y-, and z-, cones
//==============================================================================
@ -1117,6 +1201,10 @@ Direction SurfaceYTorus::normal(Position r) const
//==============================================================================
// SurfaceZTorus implementation
//==============================================================================
bool SurfaceZTorus::triso_in_mesh(vector<double> mesh_center, vector<double> lattice_pitch) const
{
return false;
}
SurfaceZTorus::SurfaceZTorus(pugi::xml_node surf_node) : Surface(surf_node)
{

View file

@ -0,0 +1,278 @@
<?xml version='1.0' encoding='utf-8'?>
<geometry>
<cell id="13" material="13" region="-9" universe="9" />
<cell id="14" material="14" region="9 -10" universe="9" />
<cell id="15" material="15" region="10 -11" universe="9" />
<cell id="16" material="16" region="11 -12" universe="9" />
<cell id="17" material="17" region="12" universe="9" />
<cell fill="10" id="18" region="13 -14 15 -16 17 -18" universe="0" />
<cell fill="9" id="135" region="-128" translation="-0.3347395345150967 0.3180755861660365 0.2414856636730901" triso_particle="true" universe="11" />
<cell fill="9" id="136" region="-129" translation="-0.22423430693555943 -0.004179177767328068 -0.046240930185910245" triso_particle="true" universe="11" />
<cell fill="9" id="137" region="-130" translation="0.13878336652768952 0.2643262279645623 -0.3718215483081879" triso_particle="true" universe="11" />
<cell fill="9" id="138" region="-131" translation="-0.43179788524410323 0.30739295263864075 -0.06155174933292362" triso_particle="true" universe="11" />
<cell fill="9" id="139" region="-132" translation="0.2401174154902459 -0.45582190815705814 -0.04999802384282931" triso_particle="true" universe="11" />
<cell fill="9" id="140" region="-133" translation="0.2028198996079864 -0.2483181864269006 0.4076453217796159" triso_particle="true" universe="11" />
<cell fill="9" id="141" region="-134" translation="0.36750683744331325 -0.4297448705327817 -0.43445431426048664" triso_particle="true" universe="11" />
<cell fill="9" id="142" region="-135" translation="0.037913118842446136 0.4020410585237264 -0.10875752039644154" triso_particle="true" universe="11" />
<cell fill="9" id="143" region="-136" translation="-0.2594532519269235 -0.07130227505402231 -0.4311631589752084" triso_particle="true" universe="11" />
<cell fill="9" id="144" region="-137" translation="-0.24436118578919225 -0.2463916812192289 -0.2574559603173461" triso_particle="true" universe="11" />
<cell fill="9" id="145" region="-138" translation="-0.03698302711710488 -0.19245493184241047 -0.4380761748290604" triso_particle="true" universe="11" />
<cell fill="9" id="146" region="-139" translation="0.30905263671908545 0.05168393238830282 0.1302704892646539" triso_particle="true" universe="11" />
<cell fill="9" id="147" region="-140" translation="-0.2875528135733859 0.45092349384718766 0.3295310471120879" triso_particle="true" universe="11" />
<cell fill="9" id="148" region="-141" translation="-0.3470752417977842 -0.15316755780280183 0.20276897514248216" triso_particle="true" universe="11" />
<cell fill="9" id="149" region="-142" translation="0.19334606515602848 0.39956135721490527 -0.07131104153532436" triso_particle="true" universe="11" />
<cell fill="9" id="150" region="-143" translation="0.30214767719264635 0.155914746052082 -0.1800161282409139" triso_particle="true" universe="11" />
<cell fill="9" id="151" region="-144" translation="0.08018004492442865 0.3501595252615657 0.3169437365711203" triso_particle="true" universe="11" />
<cell fill="9" id="152" region="-145" translation="0.00483733774062417 0.08148156718302602 -0.4261416024964468" triso_particle="true" universe="11" />
<cell fill="9" id="153" region="-146" translation="-0.23552155422132157 0.2722735886359643 -0.07844553364014112" triso_particle="true" universe="11" />
<cell fill="9" id="154" region="-147" translation="-0.29936172385437887 0.044675266050854034 0.18588381767108564" triso_particle="true" universe="11" />
<cell fill="9" id="155" region="-148" translation="0.15974177782488064 -0.11470938473074832 -0.055880627694202434" triso_particle="true" universe="11" />
<cell fill="9" id="156" region="-149" translation="0.007714449992858363 0.2549142140326335 0.019169121324834393" triso_particle="true" universe="11" />
<cell fill="9" id="157" region="-150" translation="-0.09772496056025104 -0.009435582016802613 -0.43067412048829656" triso_particle="true" universe="11" />
<cell fill="9" id="158" region="-151" translation="-0.4179373856785991 0.18619630211681182 0.4423583551970065" triso_particle="true" universe="11" />
<cell fill="9" id="159" region="-152" translation="0.08530970516294267 -0.09740948712101977 -0.3017953102786238" triso_particle="true" universe="11" />
<cell fill="9" id="160" region="-153" translation="0.002049400245853761 0.44134116166652815 0.24766393451509794" triso_particle="true" universe="11" />
<cell fill="9" id="161" region="-154" translation="0.036269774055772475 0.3298452926017631 -0.24519275475831015" triso_particle="true" universe="11" />
<cell fill="9" id="162" region="-155" translation="0.012607957648281654 0.41423389395960075 0.0712211465420014" triso_particle="true" universe="11" />
<cell fill="9" id="163" region="-156" translation="-0.03741489943578313 -0.21122463840237887 0.0439406213163509" triso_particle="true" universe="11" />
<cell fill="9" id="164" region="-157" translation="0.41848995567683767 -0.45252329198816527 0.2596863654593894" triso_particle="true" universe="11" />
<cell fill="9" id="165" region="-158" translation="0.2934048523677787 0.3535474062462105 0.2201808735332913" triso_particle="true" universe="11" />
<cell fill="9" id="166" region="-159" translation="0.28301757924875504 0.017099968565308377 0.056173125204605934" triso_particle="true" universe="11" />
<cell fill="9" id="167" region="-160" translation="-0.06766398274549851 -0.40636912111976214 0.3387442970642137" triso_particle="true" universe="11" />
<cell fill="9" id="168" region="-161" translation="0.06408439016382617 -0.2747970108278255 0.00432158793112436" triso_particle="true" universe="11" />
<cell fill="9" id="169" region="-162" translation="-0.013801059755509382 -0.13110878745909305 -0.1409156651388792" triso_particle="true" universe="11" />
<cell fill="9" id="170" region="-163" translation="0.03522733749799645 0.11305459403611595 0.10295023150858529" triso_particle="true" universe="11" />
<cell fill="9" id="171" region="-164" translation="-0.03831660450870228 -0.43213890207124234 -0.2475465938658846" triso_particle="true" universe="11" />
<cell fill="9" id="172" region="-165" translation="-0.2955130924417275 0.07732392719766301 0.3305036121112189" triso_particle="true" universe="11" />
<cell fill="9" id="173" region="-166" translation="0.2732208500986335 0.2719928185927968 0.28969841274831254" triso_particle="true" universe="11" />
<cell fill="9" id="174" region="-167" translation="-0.2240283063000714 0.31286739394693486 0.15848543253913627" triso_particle="true" universe="11" />
<cell fill="9" id="175" region="-168" translation="-0.3815491468405315 -0.44246972812920515 -0.4444203429563343" triso_particle="true" universe="11" />
<cell fill="9" id="176" region="-169" translation="0.23398969274338743 -0.2292785289142914 -0.35751316171201397" triso_particle="true" universe="11" />
<cell fill="9" id="177" region="-170" translation="0.11425630804159204 -0.14243086791965892 -0.39410867095500923" triso_particle="true" universe="11" />
<cell fill="9" id="178" region="-171" translation="-0.31161283214278257 0.02506675532845576 -0.30381330173336696" triso_particle="true" universe="11" />
<cell fill="9" id="179" region="-172" translation="-0.20789683309249835 0.19371057833811733 -0.04147065769319469" triso_particle="true" universe="11" />
<cell fill="9" id="180" region="-173" translation="-0.10385697059087434 -0.07239894918409101 -0.285600016500173" triso_particle="true" universe="11" />
<cell fill="9" id="181" region="-174" translation="-0.3581786705662241 0.3660338370759365 0.009261180540203251" triso_particle="true" universe="11" />
<cell fill="9" id="182" region="-175" translation="-0.43869102165974744 -0.4413950311821534 -0.32366427666439873" triso_particle="true" universe="11" />
<cell fill="9" id="183" region="-176" translation="0.20034387531341857 -0.3110616389475054 0.18731645229850835" triso_particle="true" universe="11" />
<cell fill="9" id="184" region="-177" translation="0.1631199405760454 0.04092483075648701 -0.2557909306852396" triso_particle="true" universe="11" />
<cell fill="9" id="185" region="-178" translation="0.43540678106227226 0.2726458402299813 0.01519685776716928" triso_particle="true" universe="11" />
<cell fill="9" id="186" region="-179" translation="-0.2534142631841729 0.13595762576986914 -0.09622087197472673" triso_particle="true" universe="11" />
<cell fill="9" id="187" region="-180" translation="0.06943697893246592 -0.1636494615445378 0.11988276699391809" triso_particle="true" universe="11" />
<cell fill="9" id="188" region="-181" translation="-0.4039322261129572 -0.18437625312013128 0.42836548044313905" triso_particle="true" universe="11" />
<cell fill="9" id="189" region="-182" translation="0.34380160059728826 -0.17725304908491335 0.32821993901943003" triso_particle="true" universe="11" />
<cell fill="9" id="190" region="-183" translation="-0.17361209915820575 0.4021685596198511 0.2232374596397494" triso_particle="true" universe="11" />
<cell fill="9" id="191" region="-184" translation="0.4231451301030389 0.06434186205946246 -0.3007260993647986" triso_particle="true" universe="11" />
<cell fill="9" id="192" region="-185" translation="0.3367035644902364 0.43374122870419773 0.1867831868031803" triso_particle="true" universe="11" />
<cell fill="9" id="193" region="-186" translation="-0.2800343805160589 -0.36214962398859274 0.15193411713913396" triso_particle="true" universe="11" />
<cell fill="9" id="194" region="-187" translation="-0.18669546779237473 -0.0001831711922081758 -0.15989605296102538" triso_particle="true" universe="11" />
<cell fill="9" id="195" region="-188" translation="0.3402194900462647 0.36590545585064216 -0.4411858734771481" triso_particle="true" universe="11" />
<cell fill="9" id="196" region="-189" translation="-0.27386906802598476 -0.1577033844843671 0.4458940167631079" triso_particle="true" universe="11" />
<cell fill="9" id="197" region="-190" translation="0.25881219398024335 -0.1473079343924702 -0.26272122141336496" triso_particle="true" universe="11" />
<cell fill="9" id="198" region="-191" translation="0.15971361633210523 0.30916532972595434 0.39566763051861575" triso_particle="true" universe="11" />
<cell fill="9" id="199" region="-192" translation="-0.014191419448261688 0.4444827844055178 -0.24293668187556428" triso_particle="true" universe="11" />
<cell fill="9" id="200" region="-193" translation="0.20641337800388493 -0.3802252490537087 -0.30239501318723816" triso_particle="true" universe="11" />
<cell fill="9" id="201" region="-194" translation="0.3762593158016361 -0.26277761748535117 0.237220865276901" triso_particle="true" universe="11" />
<cell fill="9" id="202" region="-195" translation="0.09174118398607445 0.31230652516871027 -0.12074712654412828" triso_particle="true" universe="11" />
<cell fill="9" id="203" region="-196" translation="-0.14621886735567996 -0.1911424043751062 0.33637284849380944" triso_particle="true" universe="11" />
<cell fill="9" id="204" region="-197" translation="-0.42191934538452835 -0.3907414250589849 0.33522713116909675" triso_particle="true" universe="11" />
<cell fill="9" id="205" region="-198" translation="0.2637706088079447 0.3007472168799734 -0.14565837160126788" triso_particle="true" universe="11" />
<cell fill="9" id="206" region="-199" translation="0.06480048668590577 -0.2529397663985018 -0.38291404331638357" triso_particle="true" universe="11" />
<cell fill="9" id="207" region="-200" translation="-0.21356450485022038 0.35774822105153203 0.059001075831400684" triso_particle="true" universe="11" />
<cell fill="9" id="208" region="-201" translation="0.3891490235303072 -0.03866224334773988 -0.20398917762840219" triso_particle="true" universe="11" />
<cell fill="9" id="209" region="-202" translation="0.262761924489481 0.30007174740916553 -0.4464145129224567" triso_particle="true" universe="11" />
<cell fill="9" id="210" region="-203" translation="0.35252249443257966 -0.4211084519770542 -0.23836565446379523" triso_particle="true" universe="11" />
<cell fill="9" id="211" region="-204" translation="0.4469091054738229 -0.07231206070759028 -0.3519564856677738" triso_particle="true" universe="11" />
<cell fill="9" id="212" region="-205" translation="-0.30451046300415074 -0.23672972899292466 0.22338787433963114" triso_particle="true" universe="11" />
<cell fill="9" id="213" region="-206" translation="-0.3636053393495334 0.37605482493472964 -0.11143715881676097" triso_particle="true" universe="11" />
<cell fill="9" id="214" region="-207" translation="0.4305267254415768 0.3746434076219761 -0.18857140797960453" triso_particle="true" universe="11" />
<cell fill="9" id="215" region="-208" translation="-0.22575302045434847 -0.02104725713738881 -0.3660817687133612" triso_particle="true" universe="11" />
<cell fill="9" id="216" region="-209" translation="0.1392019576325615 -0.42147769461975354 -0.44813161828465553" triso_particle="true" universe="11" />
<cell fill="9" id="217" region="-210" translation="0.44180531010694923 -0.18717410312521576 0.08841042383901798" triso_particle="true" universe="11" />
<cell fill="9" id="218" region="-211" translation="0.37846039171541845 0.43011405494529475 0.43009869986651816" triso_particle="true" universe="11" />
<cell fill="9" id="219" region="-212" translation="-0.35579780507883046 -0.2607405612819519 0.10785219865057927" triso_particle="true" universe="11" />
<cell fill="9" id="220" region="-213" translation="0.43939686703236547 0.03928703229725711 0.17228776926768086" triso_particle="true" universe="11" />
<cell fill="9" id="221" region="-214" translation="0.14815941963538226 -0.220556774457988 0.03808687169681996" triso_particle="true" universe="11" />
<cell fill="9" id="222" region="-215" translation="-0.17639751664264391 -0.23218801498409805 -0.38325689529114226" triso_particle="true" universe="11" />
<cell fill="9" id="223" region="-216" translation="-0.2006897545765396 0.4425313846143629 -0.04769549879176793" triso_particle="true" universe="11" />
<cell fill="9" id="224" region="-217" translation="0.13916564434634993 0.13134319648704007 0.4034924551189595" triso_particle="true" universe="11" />
<cell fill="9" id="225" region="-218" translation="-0.10026688643231585 -0.17688897806343928 -0.15816048485392958" triso_particle="true" universe="11" />
<cell fill="9" id="226" region="-219" translation="-0.16777897302623124 0.3178018781138999 0.36024947477502567" triso_particle="true" universe="11" />
<cell fill="9" id="227" region="-220" translation="-0.18052805868481137 -0.15166776712672753 0.040488366683789634" triso_particle="true" universe="11" />
<cell fill="9" id="228" region="-221" translation="0.07231116694829032 0.08785370537091952 -0.2333627774338999" triso_particle="true" universe="11" />
<cell fill="9" id="229" region="-222" translation="-0.43909757695745594 -0.2345883610075431 -0.3915341427407233" triso_particle="true" universe="11" />
<cell fill="9" id="230" region="-223" translation="0.046877953125145755 -0.39282606551755617 -0.3889686751909842" triso_particle="true" universe="11" />
<cell fill="9" id="231" region="-224" translation="0.1239423066569788 -0.19150287059104332 0.2674951458412387" triso_particle="true" universe="11" />
<cell fill="9" id="232" region="-225" translation="0.0013087859341976982 0.2700573885244849 -0.3871585540753848" triso_particle="true" universe="11" />
<cell fill="9" id="233" region="-226" translation="0.4439221700323984 0.2943791575126874 -0.16498774544300332" triso_particle="true" universe="11" />
<cell fill="9" id="234" region="-227" translation="-0.359903433990582 0.013144978841080679 0.38392127784738483" triso_particle="true" universe="11" />
<cell id="235" lower_left="-0.5 -0.5 -0.5" material="18" pitch="0.3333333333333333 0.3333333333333333 0.3333333333333333" region="128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227" shape="3 3 3" universe="11" virtual_lattice="True" />
<cell id="236" material="18" universe="12" />
<lattice id="10">
<pitch>1.0 1.0 1.0</pitch>
<outer>12</outer>
<dimension>1 1 1</dimension>
<lower_left>-0.5 -0.5 -0.5</lower_left>
<universes>
11 </universes>
</lattice>
<surface coeffs="0.0 0.0 0.0 0.02125" id="9" type="sphere" />
<surface coeffs="0.0 0.0 0.0 0.03125" id="10" type="sphere" />
<surface coeffs="0.0 0.0 0.0 0.03475" id="11" type="sphere" />
<surface coeffs="0.0 0.0 0.0 0.03825" id="12" type="sphere" />
<surface boundary="reflective" coeffs="-0.5" id="13" type="x-plane" />
<surface boundary="reflective" coeffs="0.5" id="14" type="x-plane" />
<surface boundary="reflective" coeffs="-0.5" id="15" type="y-plane" />
<surface boundary="reflective" coeffs="0.5" id="16" type="y-plane" />
<surface boundary="reflective" coeffs="-0.5" id="17" type="z-plane" />
<surface boundary="reflective" coeffs="0.5" id="18" type="z-plane" />
<surface coeffs="-0.3347395345150967 0.3180755861660365 0.2414856636730901 0.04225" id="128" type="sphere" />
<surface coeffs="-0.22423430693555943 -0.004179177767328068 -0.046240930185910245 0.04225" id="129" type="sphere" />
<surface coeffs="0.13878336652768952 0.2643262279645623 -0.3718215483081879 0.04225" id="130" type="sphere" />
<surface coeffs="-0.43179788524410323 0.30739295263864075 -0.06155174933292362 0.04225" id="131" type="sphere" />
<surface coeffs="0.2401174154902459 -0.45582190815705814 -0.04999802384282931 0.04225" id="132" type="sphere" />
<surface coeffs="0.2028198996079864 -0.2483181864269006 0.4076453217796159 0.04225" id="133" type="sphere" />
<surface coeffs="0.36750683744331325 -0.4297448705327817 -0.43445431426048664 0.04225" id="134" type="sphere" />
<surface coeffs="0.037913118842446136 0.4020410585237264 -0.10875752039644154 0.04225" id="135" type="sphere" />
<surface coeffs="-0.2594532519269235 -0.07130227505402231 -0.4311631589752084 0.04225" id="136" type="sphere" />
<surface coeffs="-0.24436118578919225 -0.2463916812192289 -0.2574559603173461 0.04225" id="137" type="sphere" />
<surface coeffs="-0.03698302711710488 -0.19245493184241047 -0.4380761748290604 0.04225" id="138" type="sphere" />
<surface coeffs="0.30905263671908545 0.05168393238830282 0.1302704892646539 0.04225" id="139" type="sphere" />
<surface coeffs="-0.2875528135733859 0.45092349384718766 0.3295310471120879 0.04225" id="140" type="sphere" />
<surface coeffs="-0.3470752417977842 -0.15316755780280183 0.20276897514248216 0.04225" id="141" type="sphere" />
<surface coeffs="0.19334606515602848 0.39956135721490527 -0.07131104153532436 0.04225" id="142" type="sphere" />
<surface coeffs="0.30214767719264635 0.155914746052082 -0.1800161282409139 0.04225" id="143" type="sphere" />
<surface coeffs="0.08018004492442865 0.3501595252615657 0.3169437365711203 0.04225" id="144" type="sphere" />
<surface coeffs="0.00483733774062417 0.08148156718302602 -0.4261416024964468 0.04225" id="145" type="sphere" />
<surface coeffs="-0.23552155422132157 0.2722735886359643 -0.07844553364014112 0.04225" id="146" type="sphere" />
<surface coeffs="-0.29936172385437887 0.044675266050854034 0.18588381767108564 0.04225" id="147" type="sphere" />
<surface coeffs="0.15974177782488064 -0.11470938473074832 -0.055880627694202434 0.04225" id="148" type="sphere" />
<surface coeffs="0.007714449992858363 0.2549142140326335 0.019169121324834393 0.04225" id="149" type="sphere" />
<surface coeffs="-0.09772496056025104 -0.009435582016802613 -0.43067412048829656 0.04225" id="150" type="sphere" />
<surface coeffs="-0.4179373856785991 0.18619630211681182 0.4423583551970065 0.04225" id="151" type="sphere" />
<surface coeffs="0.08530970516294267 -0.09740948712101977 -0.3017953102786238 0.04225" id="152" type="sphere" />
<surface coeffs="0.002049400245853761 0.44134116166652815 0.24766393451509794 0.04225" id="153" type="sphere" />
<surface coeffs="0.036269774055772475 0.3298452926017631 -0.24519275475831015 0.04225" id="154" type="sphere" />
<surface coeffs="0.012607957648281654 0.41423389395960075 0.0712211465420014 0.04225" id="155" type="sphere" />
<surface coeffs="-0.03741489943578313 -0.21122463840237887 0.0439406213163509 0.04225" id="156" type="sphere" />
<surface coeffs="0.41848995567683767 -0.45252329198816527 0.2596863654593894 0.04225" id="157" type="sphere" />
<surface coeffs="0.2934048523677787 0.3535474062462105 0.2201808735332913 0.04225" id="158" type="sphere" />
<surface coeffs="0.28301757924875504 0.017099968565308377 0.056173125204605934 0.04225" id="159" type="sphere" />
<surface coeffs="-0.06766398274549851 -0.40636912111976214 0.3387442970642137 0.04225" id="160" type="sphere" />
<surface coeffs="0.06408439016382617 -0.2747970108278255 0.00432158793112436 0.04225" id="161" type="sphere" />
<surface coeffs="-0.013801059755509382 -0.13110878745909305 -0.1409156651388792 0.04225" id="162" type="sphere" />
<surface coeffs="0.03522733749799645 0.11305459403611595 0.10295023150858529 0.04225" id="163" type="sphere" />
<surface coeffs="-0.03831660450870228 -0.43213890207124234 -0.2475465938658846 0.04225" id="164" type="sphere" />
<surface coeffs="-0.2955130924417275 0.07732392719766301 0.3305036121112189 0.04225" id="165" type="sphere" />
<surface coeffs="0.2732208500986335 0.2719928185927968 0.28969841274831254 0.04225" id="166" type="sphere" />
<surface coeffs="-0.2240283063000714 0.31286739394693486 0.15848543253913627 0.04225" id="167" type="sphere" />
<surface coeffs="-0.3815491468405315 -0.44246972812920515 -0.4444203429563343 0.04225" id="168" type="sphere" />
<surface coeffs="0.23398969274338743 -0.2292785289142914 -0.35751316171201397 0.04225" id="169" type="sphere" />
<surface coeffs="0.11425630804159204 -0.14243086791965892 -0.39410867095500923 0.04225" id="170" type="sphere" />
<surface coeffs="-0.31161283214278257 0.02506675532845576 -0.30381330173336696 0.04225" id="171" type="sphere" />
<surface coeffs="-0.20789683309249835 0.19371057833811733 -0.04147065769319469 0.04225" id="172" type="sphere" />
<surface coeffs="-0.10385697059087434 -0.07239894918409101 -0.285600016500173 0.04225" id="173" type="sphere" />
<surface coeffs="-0.3581786705662241 0.3660338370759365 0.009261180540203251 0.04225" id="174" type="sphere" />
<surface coeffs="-0.43869102165974744 -0.4413950311821534 -0.32366427666439873 0.04225" id="175" type="sphere" />
<surface coeffs="0.20034387531341857 -0.3110616389475054 0.18731645229850835 0.04225" id="176" type="sphere" />
<surface coeffs="0.1631199405760454 0.04092483075648701 -0.2557909306852396 0.04225" id="177" type="sphere" />
<surface coeffs="0.43540678106227226 0.2726458402299813 0.01519685776716928 0.04225" id="178" type="sphere" />
<surface coeffs="-0.2534142631841729 0.13595762576986914 -0.09622087197472673 0.04225" id="179" type="sphere" />
<surface coeffs="0.06943697893246592 -0.1636494615445378 0.11988276699391809 0.04225" id="180" type="sphere" />
<surface coeffs="-0.4039322261129572 -0.18437625312013128 0.42836548044313905 0.04225" id="181" type="sphere" />
<surface coeffs="0.34380160059728826 -0.17725304908491335 0.32821993901943003 0.04225" id="182" type="sphere" />
<surface coeffs="-0.17361209915820575 0.4021685596198511 0.2232374596397494 0.04225" id="183" type="sphere" />
<surface coeffs="0.4231451301030389 0.06434186205946246 -0.3007260993647986 0.04225" id="184" type="sphere" />
<surface coeffs="0.3367035644902364 0.43374122870419773 0.1867831868031803 0.04225" id="185" type="sphere" />
<surface coeffs="-0.2800343805160589 -0.36214962398859274 0.15193411713913396 0.04225" id="186" type="sphere" />
<surface coeffs="-0.18669546779237473 -0.0001831711922081758 -0.15989605296102538 0.04225" id="187" type="sphere" />
<surface coeffs="0.3402194900462647 0.36590545585064216 -0.4411858734771481 0.04225" id="188" type="sphere" />
<surface coeffs="-0.27386906802598476 -0.1577033844843671 0.4458940167631079 0.04225" id="189" type="sphere" />
<surface coeffs="0.25881219398024335 -0.1473079343924702 -0.26272122141336496 0.04225" id="190" type="sphere" />
<surface coeffs="0.15971361633210523 0.30916532972595434 0.39566763051861575 0.04225" id="191" type="sphere" />
<surface coeffs="-0.014191419448261688 0.4444827844055178 -0.24293668187556428 0.04225" id="192" type="sphere" />
<surface coeffs="0.20641337800388493 -0.3802252490537087 -0.30239501318723816 0.04225" id="193" type="sphere" />
<surface coeffs="0.3762593158016361 -0.26277761748535117 0.237220865276901 0.04225" id="194" type="sphere" />
<surface coeffs="0.09174118398607445 0.31230652516871027 -0.12074712654412828 0.04225" id="195" type="sphere" />
<surface coeffs="-0.14621886735567996 -0.1911424043751062 0.33637284849380944 0.04225" id="196" type="sphere" />
<surface coeffs="-0.42191934538452835 -0.3907414250589849 0.33522713116909675 0.04225" id="197" type="sphere" />
<surface coeffs="0.2637706088079447 0.3007472168799734 -0.14565837160126788 0.04225" id="198" type="sphere" />
<surface coeffs="0.06480048668590577 -0.2529397663985018 -0.38291404331638357 0.04225" id="199" type="sphere" />
<surface coeffs="-0.21356450485022038 0.35774822105153203 0.059001075831400684 0.04225" id="200" type="sphere" />
<surface coeffs="0.3891490235303072 -0.03866224334773988 -0.20398917762840219 0.04225" id="201" type="sphere" />
<surface coeffs="0.262761924489481 0.30007174740916553 -0.4464145129224567 0.04225" id="202" type="sphere" />
<surface coeffs="0.35252249443257966 -0.4211084519770542 -0.23836565446379523 0.04225" id="203" type="sphere" />
<surface coeffs="0.4469091054738229 -0.07231206070759028 -0.3519564856677738 0.04225" id="204" type="sphere" />
<surface coeffs="-0.30451046300415074 -0.23672972899292466 0.22338787433963114 0.04225" id="205" type="sphere" />
<surface coeffs="-0.3636053393495334 0.37605482493472964 -0.11143715881676097 0.04225" id="206" type="sphere" />
<surface coeffs="0.4305267254415768 0.3746434076219761 -0.18857140797960453 0.04225" id="207" type="sphere" />
<surface coeffs="-0.22575302045434847 -0.02104725713738881 -0.3660817687133612 0.04225" id="208" type="sphere" />
<surface coeffs="0.1392019576325615 -0.42147769461975354 -0.44813161828465553 0.04225" id="209" type="sphere" />
<surface coeffs="0.44180531010694923 -0.18717410312521576 0.08841042383901798 0.04225" id="210" type="sphere" />
<surface coeffs="0.37846039171541845 0.43011405494529475 0.43009869986651816 0.04225" id="211" type="sphere" />
<surface coeffs="-0.35579780507883046 -0.2607405612819519 0.10785219865057927 0.04225" id="212" type="sphere" />
<surface coeffs="0.43939686703236547 0.03928703229725711 0.17228776926768086 0.04225" id="213" type="sphere" />
<surface coeffs="0.14815941963538226 -0.220556774457988 0.03808687169681996 0.04225" id="214" type="sphere" />
<surface coeffs="-0.17639751664264391 -0.23218801498409805 -0.38325689529114226 0.04225" id="215" type="sphere" />
<surface coeffs="-0.2006897545765396 0.4425313846143629 -0.04769549879176793 0.04225" id="216" type="sphere" />
<surface coeffs="0.13916564434634993 0.13134319648704007 0.4034924551189595 0.04225" id="217" type="sphere" />
<surface coeffs="-0.10026688643231585 -0.17688897806343928 -0.15816048485392958 0.04225" id="218" type="sphere" />
<surface coeffs="-0.16777897302623124 0.3178018781138999 0.36024947477502567 0.04225" id="219" type="sphere" />
<surface coeffs="-0.18052805868481137 -0.15166776712672753 0.040488366683789634 0.04225" id="220" type="sphere" />
<surface coeffs="0.07231116694829032 0.08785370537091952 -0.2333627774338999 0.04225" id="221" type="sphere" />
<surface coeffs="-0.43909757695745594 -0.2345883610075431 -0.3915341427407233 0.04225" id="222" type="sphere" />
<surface coeffs="0.046877953125145755 -0.39282606551755617 -0.3889686751909842 0.04225" id="223" type="sphere" />
<surface coeffs="0.1239423066569788 -0.19150287059104332 0.2674951458412387 0.04225" id="224" type="sphere" />
<surface coeffs="0.0013087859341976982 0.2700573885244849 -0.3871585540753848 0.04225" id="225" type="sphere" />
<surface coeffs="0.4439221700323984 0.2943791575126874 -0.16498774544300332 0.04225" id="226" type="sphere" />
<surface coeffs="-0.359903433990582 0.013144978841080679 0.38392127784738483 0.04225" id="227" type="sphere" />
</geometry>
<?xml version='1.0' encoding='utf-8'?>
<materials>
<material depletable="true" id="13">
<density units="g/cm3" value="10.5" />
<nuclide ao="0.14154" name="U235" />
<nuclide ao="0.85846" name="U238" />
<nuclide ao="0.5" name="C0" />
<nuclide ao="1.5" name="O16" />
</material>
<material id="14">
<density units="g/cm3" value="1.0" />
<nuclide ao="1.0" name="C0" />
<sab name="c_Graphite" />
</material>
<material id="15">
<density units="g/cm3" value="1.9" />
<nuclide ao="1.0" name="C0" />
<sab name="c_Graphite" />
</material>
<material id="16">
<density units="g/cm3" value="3.2" />
<nuclide ao="1.0" name="C0" />
<nuclide ao="0.9222968" name="Si28" />
<nuclide ao="0.0468316" name="Si29" />
<nuclide ao="0.0308716" name="Si30" />
</material>
<material id="17">
<density units="g/cm3" value="1.87" />
<nuclide ao="1.0" name="C0" />
<sab name="c_Graphite" />
</material>
<material id="18">
<density units="g/cm3" value="1.1995" />
<nuclide ao="1.0" name="C0" />
<sab name="c_Graphite" />
</material>
</materials>
<?xml version='1.0' encoding='utf-8'?>
<settings>
<run_mode>eigenvalue</run_mode>
<particles>100</particles>
<batches>4</batches>
<inactive>0</inactive>
<source strength="1.0">
<space type="point">
<parameters>0.0 0.0 0.0</parameters>
</space>
</source>
</settings>

View file

@ -0,0 +1,2 @@
k-combined:
1.719897E+00 3.608153E-02

View file

@ -0,0 +1,97 @@
import random
from math import sqrt
import numpy as np
import openmc
import openmc.model
from tests.testing_harness import PyAPITestHarness
class TRISOVirtualLatticeTestHarness(PyAPITestHarness):
def _build_inputs(self):
# Define TRISO matrials
fuel = openmc.Material()
fuel.set_density('g/cm3', 10.5)
fuel.add_nuclide('U235', 0.14154)
fuel.add_nuclide('U238', 0.85846)
fuel.add_nuclide('C0', 0.5)
fuel.add_nuclide('O16', 1.5)
porous_carbon = openmc.Material()
porous_carbon.set_density('g/cm3', 1.0)
porous_carbon.add_nuclide('C0', 1.0)
porous_carbon.add_s_alpha_beta('c_Graphite')
ipyc = openmc.Material()
ipyc.set_density('g/cm3', 1.90)
ipyc.add_nuclide('C0', 1.0)
ipyc.add_s_alpha_beta('c_Graphite')
sic = openmc.Material()
sic.set_density('g/cm3', 3.20)
sic.add_nuclide('C0', 1.0)
sic.add_element('Si', 1.0)
opyc = openmc.Material()
opyc.set_density('g/cm3', 1.87)
opyc.add_nuclide('C0', 1.0)
opyc.add_s_alpha_beta('c_Graphite')
graphite = openmc.Material()
graphite.set_density('g/cm3', 1.1995)
graphite.add_nuclide('C0', 1.0)
graphite.add_s_alpha_beta('c_Graphite')
# Create TRISO particles
spheres = [openmc.Sphere(r=r*1e-4)
for r in [212.5, 312.5, 347.5, 382.5]]
c1 = openmc.Cell(fill=fuel, region=-spheres[0])
c2 = openmc.Cell(fill=porous_carbon, region=+spheres[0] & -spheres[1])
c3 = openmc.Cell(fill=ipyc, region=+spheres[1] & -spheres[2])
c4 = openmc.Cell(fill=sic, region=+spheres[2] & -spheres[3])
c5 = openmc.Cell(fill=opyc, region=+spheres[3])
inner_univ = openmc.Universe(cells=[c1, c2, c3, c4, c5])
# Define box to contain lattice and to pack TRISO particles in
min_x = openmc.XPlane(-0.5, boundary_type='reflective')
max_x = openmc.XPlane(0.5, boundary_type='reflective')
min_y = openmc.YPlane(-0.5, boundary_type='reflective')
max_y = openmc.YPlane(0.5, boundary_type='reflective')
min_z = openmc.ZPlane(-0.5, boundary_type='reflective')
max_z = openmc.ZPlane(0.5, boundary_type='reflective')
box_region = +min_x & -max_x & +min_y & -max_y & +min_z & -max_z
box = openmc.Cell(region=box_region)
outer_radius = 422.5*1e-4
centers = openmc.model.pack_spheres(radius=outer_radius,
region=box_region, num_spheres=100)
trisos = [openmc.model.TRISO(outer_radius, inner_univ, c)
for c in centers]
# Create lattice
ll, ur = box.region.bounding_box
shape = (3, 3, 3)
pitch = (ur - ll) / shape
lattice = openmc.model.create_triso_lattice(
trisos, ll, pitch, shape, graphite, virtual=True)
box.fill = lattice
root = openmc.Universe(0, cells=[box])
geom = openmc.Geometry(root)
geom.export_to_xml()
settings = openmc.Settings()
settings.batches = 4
settings.inactive = 0
settings.particles = 100
settings.source = openmc.Source(space=openmc.stats.Point())
settings.export_to_xml()
mats = openmc.Materials([fuel, porous_carbon, ipyc, sic, opyc, graphite])
mats.export_to_xml()
def test_triso_virtual_lattice():
harness = TRISOVirtualLatticeTestHarness('statepoint.4.h5')
harness.main()