Geometry And Materials
Materials describe physical composition. Geometry assigns one material to each transport region.
Materials
Create stable user input with MaterialInputDefinition:
MaterialInputDefinition{
.name = "aluminum",
.density_g_cm3 = 2.70,
.temperature_kelvin = 293.6,
.components = {
element_atom_fraction("Al", 1.0),
},
};Available component helpers are:
element_atom_fraction,element_mass_fraction;nuclide_atom_fraction,nuclide_mass_fraction.
Convert the full input list once with material_definitions_from_inputs. This assigns MaterialId values used by geometry and package tables.
Use explicit nuclides when the evaluation is isotope-specific. A material can also declare ThermalScatteringBindingDefinition entries containing the physical target and binding state used by a neutron data resolver.
Import A Supported OpenMC Flat Problem
import_openmc_flat_problem_xml can convert the supported flat, single-universe subset of an OpenMC model.xml into both geometry and validated material definitions:
OpenmcFlatProblemImportResult imported =
import_openmc_flat_problem_xml(
model_xml,
OpenmcFlatProblemImportOptions{
.geometry = OpenmcFlatGeometryImportOptions{
.material_by_openmc_id = material_ids,
},
.materials = OpenmcMaterialDefinitionImportOptions{
.material_by_openmc_id = material_ids,
.temperature_kelvin = temperature,
.component_representation =
OpenmcMaterialComponentRepresentation::nuclide,
.nuclide_atomic_mass_g_mol = resolve_atomic_mass,
},
});The mass callback receives OpenmcNuclideIdentity, not a filename. The application's selected data resolver maps that physical identity to an atomic mass. For element-based EM material tables, select element representation.
The importer intentionally supports only the documented flat CSG subset. Unsupported universes, transforms, boundary conditions, material forms and region operators fail. Sources, physics packages, observables and run settings remain application inputs to SimulationModel.
Geometry Handle
SimulationModel accepts GeometryHandle:
auto geometry = std::make_shared<RectilinearGrid>(...);
GeometryHandle handle = hold_geometry(geometry);hold_geometry keeps the concrete object alive. A supported concrete geometry can also compile a CPU spatial scene for the runtime.
The geometry contract provides location, distance to boundary, boundary normal, safety, region material and optional observable-region identity.
Rectilinear Grid
Use RectilinearGrid for slabs and Cartesian meshes. Input contains x/y/z edge arrays plus one material name, observable-region id and optional region name per cell.
RectilinearGrid grid = make_rectilinear_grid(
RectilinearGridInputDefinition{
.x_edges = {0.0, 1.0, 2.0},
.y_edges = {-1.0, 1.0},
.z_edges = {-1.0, 1.0},
.material_names = {"shield", "detector"},
.observable_regions = {ObservableId{0}, ObservableId{1}},
.region_names = {"shield", "detector"},
},
materials);Cell arrays use flattened x/y/z grid order. Query volume and bounds directly from the grid when calculating scoring mass or checking model dimensions.
Constructive Solid Geometry
CsgGeometry supports these surface types:
- plane;
- sphere;
- x-, y-, z- and arbitrary-axis cylinder;
- arbitrary-axis cone defined from two radius/axis points;
- general quadric.
Build cells from positive and negative halfspaces. halfspaces describes one intersection. union_terms describes a union of intersections.
CsgGeometry geometry = make_csg_geometry(
CsgGeometryDefinition{
.surfaces = {
csg_sphere({0.0, 0.0, 0.0}, 5.0),
},
.cells = {
CsgCellDefinition{
.halfspaces = {csg_negative(Index{0})},
.material = material_id,
.observable_region = ObservableId{0},
.name = "sphere",
},
},
});Use csg_cone_from_points for a cone and csg_quadric for the ten-coefficient quadric form.
Observable Regions
A geometry region identifies transport topology and material. Its optional ObservableId groups one or more physical regions for scoring. An observable can instead target a named region directly.
Inspect The Actual Geometry
write_geometry_slice_svg renders slices from the same GeometryQuery used by transport. Generate a full view and close views of sources, thin layers, detectors and penetrations before a production run.
std::ofstream output{"geometry-xz.svg"};
write_geometry_slice_svg(
output,
geometry->query(),
GeometrySliceDefinition{
.origin = {0.0, 0.0, 0.0},
.horizontal_axis = {1.0, 0.0, 0.0},
.vertical_axis = {0.0, 0.0, 1.0},
.horizontal_min_cm = -10.0,
.horizontal_max_cm = 10.0,
.vertical_min_cm = -10.0,
.vertical_max_cm = 10.0,
.title = "Transport geometry at y = 0 cm",
},
[&](RegionId region) {
return std::string{geometry->region_name(region)};
});A correct slice verifies geometry topology only. It does not verify material composition, source, physics data or estimator.