3 #include "GeneralUserObject.h" 4 #include "MaterialBase.h" 7 #include "moab/Core.hpp" 8 #include "moab/Skinner.hpp" 9 #include "moab/GeomTopoTool.hpp" 10 #include "MBTagConventions.hpp" 26 virtual void execute()
override;
39 virtual moab::ErrorCode
check(
const moab::ErrorCode input)
const;
43 const unsigned int & temp)
const;
60 unsigned int nBins()
const;
74 virtual unsigned int getDensityBin(
const Elem *
const elem)
const;
83 return _blocks.at(elem->subdomain_id());
117 const std::string & param_name)
const;
129 virtual unsigned int getBin(
const unsigned int & temp_bin,
130 const unsigned int & density_bin,
131 const unsigned int & subdomain_bin)
const;
162 const std::shared_ptr<moab::Interface> &
moabPtr()
const {
return _moab; }
176 std::shared_ptr<moab::Interface>
_moab;
297 createGroup(
const unsigned int &
id,
const std::string & name, moab::EntityHandle & group_set);
301 createVol(
const unsigned int &
id, moab::EntityHandle & volume_set, moab::EntityHandle group_set);
305 moab::EntityHandle & surface_set,
307 const std::vector<VolData> & voldata,
314 unsigned int & surf_id,
322 unsigned int & surf_id,
324 const Real & factor);
333 const Real & factor)
const;
342 moab::Range & surface_tris);
345 moab::EntityHandle
createTri(
const std::vector<moab::EntityHandle> & vertices,
355 setTags(moab::EntityHandle ent, std::string name, std::string category,
unsigned int id,
int dim);
358 void setTagData(moab::Tag tag, moab::EntityHandle ent, std::string data,
unsigned int SIZE);
361 void setTagData(moab::Tag tag, moab::EntityHandle ent,
void * data);
367 const std::vector<std::vector<unsigned int>> &
getTetSets(ElemType type)
const;
381 void buildGraveyard(
unsigned int & vol_id,
unsigned int & surf_id);
400 const std::string & param_name);
414 const unsigned int side,
415 const libMesh::BoundaryInfo & boundary_info)
const;
427 const moab::Range & skin,
428 moab::Range & transmission_tris,
429 moab::Range & vacuum_tris,
430 moab::Range & reflective_tris);
444 unsigned int & surf_id);
480 void groupLocalElems(std::set<dof_id_type> elems, std::vector<moab::Range> & localElems);
487 moab::EntityHandle group,
488 unsigned int & vol_id,
489 unsigned int & surf_id,
490 moab::EntityHandle & volume_set);
493 virtual void write();
499 std::unique_ptr<moab::GeomTopoTool>
gtt;
const Real _temperature_bin_width
Temperature bin width.
Definition: MoabSkinner.h:194
std::vector< std::string > _material_names
Definition: MoabSkinner.h:201
virtual void makeDependentOnExternalAction()
Definition: MoabSkinner.h:108
const std::vector< std::vector< unsigned int > > & getTetSets(ElemType type) const
std::shared_ptr< moab::Interface > _moab
MOAB interface.
Definition: MoabSkinner.h:176
const Real & _temperature_min
Lower bound of temperature bins.
Definition: MoabSkinner.h:185
unsigned int _density_var_num
Auxiliary variable number for density.
Definition: MoabSkinner.h:593
bool _tet_mesh_built
True when buildTetMesh() is called.
Definition: MoabSkinner.h:246
const Real & _temperature_max
Upper bound of temperature bins.
Definition: MoabSkinner.h:188
bool _standalone
Whether this class runs by itself, or is controlled by an external class.
Definition: MoabSkinner.h:243
std::map< moab::EntityHandle, std::vector< VolData > > surfsToVols
Save some topological data: map from surface handle to vol handle and sense.
Definition: MoabSkinner.h:554
virtual void write()
Write MOAB volume and/or skin meshes to file.
unsigned int firstBoundaryConditionGroupID() const
bool _set_bcs
Whether to assign boundary conditions to surfaces.
Definition: MoabSkinner.h:527
std::set< BoundaryID > _vacuum_bcs_surface_ids
Resolved vacuum BC sideset IDs (from 'vacuum_bcs_surfaces' input parameter)
Definition: MoabSkinner.h:514
static InputParameters validParams()
std::string materialName(const unsigned int &block, const unsigned int &density, const unsigned int &temp) const
virtual unsigned int getTemperatureBin(const Elem *const elem) const
void findSurface(const moab::Range ®ion, moab::EntityHandle group, unsigned int &vol_id, unsigned int &surf_id, moab::EntityHandle &volume_set)
Find the surfaces for the provided range and add to group.
MeshBase & getDAGMCGeometryMesh()
virtual void initialize() override
bool _verbose
Whether to print diagnostic information.
Definition: MoabSkinner.h:179
void createSurfaceFromBox(const BoundingBox &box, const VolData &voldata, unsigned int &surf_id, bool normalout, const Real &factor)
std::string boundaryConditionGroupName(BoundaryConditionType bc_type) const
std::string _density_name
Name of the MOOSE variable containing the density.
Definition: MoabSkinner.h:511
std::set< BoundaryID > _reflective_bcs_surface_ids
Resolved reflective BC sideset IDs (from 'reflective_bcs_surfaces' input parameter)
Definition: MoabSkinner.h:517
void splitSkinByBoundaryCondition(const moab::Range ®ion, const moab::Range &skin, moab::Range &transmission_tris, moab::Range &vacuum_tris, moab::Range &reflective_tris)
virtual void update()
Perform the skinning operation.
std::vector< std::set< dof_id_type > > _elem_bins
Mapping from total bin ID to a set of elements sorted into that bin.
Definition: MoabSkinner.h:545
void findSurfaces()
Group the binned elems into local temperature regions and find their surfaces.
unsigned int _n_block_bins
Number of block bins.
Definition: MoabSkinner.h:542
std::vector< Real > _density_bin_bounds
Bounds of the density bins.
Definition: MoabSkinner.h:578
unsigned int _n_density_bins
Number of density bins.
Definition: MoabSkinner.h:539
virtual void threadJoin(const UserObject &) override
Definition: MoabSkinner.h:32
virtual void finalize() override
std::unique_ptr< moab::GeomTopoTool > gtt
Topology tool for setting surface sense.
Definition: MoabSkinner.h:499
MoabSkinner(const InputParameters ¶meters)
void setTagData(moab::Tag tag, moab::EntityHandle ent, std::string data, unsigned int SIZE)
Helper function to wrap moab::tag_set_data for a string.
unsigned int nBins() const
Definition: MoabSkinner.h:254
void groupLocalElems(std::set< dof_id_type > elems, std::vector< moab::Range > &localElems)
Real _density_bin_width
Density bin width.
Definition: MoabSkinner.h:536
void setUseDisplacedMesh(const bool &use)
moab::EntityHandle createTri(const std::vector< moab::EntityHandle > &vertices, unsigned int v1, unsigned int v2, unsigned int v3)
Create MOAB tri surface element.
virtual unsigned int getBin(const unsigned int &temp_bin, const unsigned int &density_bin, const unsigned int &subdomain_bin) const
virtual void setScaling(const Real &scale)
Definition: MoabSkinner.h:96
const std::shared_ptr< moab::Interface > & moabPtr() const
Definition: MoabSkinner.h:162
moab::Tag name_tag
Tag for name of entity set.
Definition: MoabSkinner.h:572
virtual bool hasDensitySkinning() const
Definition: MoabSkinner.h:156
const std::string & _temperature_name
Name of the temperature variable.
Definition: MoabSkinner.h:182
moab::Tag geometry_dimension_tag
Tag for dimension for geometry.
Definition: MoabSkinner.h:557
std::set< BoundaryID > boundaryNamesToIDs(const std::vector< BoundaryName > &names, const std::string ¶m_name)
void createGroup(const unsigned int &id, const std::string &name, moab::EntityHandle &group_set)
std::map< SubdomainID, std::string > _block_id_to_material_name
Map from mesh SubdomainID to OpenMC material name.
Definition: MoabSkinner.h:602
bool _set_implicit_complement_material
Whether to assign a material to the implicit complement region.
Definition: MoabSkinner.h:228
virtual unsigned int nDensityBins() const
Definition: MoabSkinner.h:150
moab::Tag id_tag
Tag for entitiy set ID.
Definition: MoabSkinner.h:560
Definition: CardinalEnums.h:233
void createSurf(const unsigned int &id, moab::EntityHandle &surface_set, moab::Range &faces, const std::vector< VolData > &voldata, BoundaryConditionType bc_type=BoundaryConditionType::Transmission)
Helper method to create MOAB surface entity set.
unsigned int getAuxiliaryVariableNumber(const std::string &name, const std::string ¶m_name) const
std::unique_ptr< NumericVector< Number > > _serialized_solution
Definition: MoabSkinner.h:173
BoundaryConditionType recordedBoundaryCondition(moab::EntityHandle surface_set) const
const bool & _output_skins
Whether to output the MOAB mesh skins to a .h5m file.
Definition: MoabSkinner.h:216
void recordBoundaryConditionSurface(moab::EntityHandle surface_set, BoundaryConditionType bc_type)
virtual void setVerbosity(const bool &verbose)
Definition: MoabSkinner.h:102
void createSurfacesFromSkin(const moab::Range ®ion, moab::Range &skin, VolData &voldata, unsigned int &surf_id)
std::map< dof_id_type, std::vector< moab::EntityHandle > > _id_to_elem_handles
Map from libmesh id to MOAB element entity handles.
Definition: MoabSkinner.h:502
MooseMesh & getMooseMesh()
Get the MooseMesh (displaced or not, depending on _use_displaced)
const Real & _graveyard_scale_outer
Multiplier on bounding box for outer surface of graveyard.
Definition: MoabSkinner.h:213
const bool & _output_full
Whether to output the MOAB mesh to a .h5m file.
Definition: MoabSkinner.h:219
std::unique_ptr< moab::Skinner > skinner
Moab skinner for finding temperature surfaces.
Definition: MoabSkinner.h:496
BoundaryConditionType
Boundary condition types that can be assigned to DAGMC surfaces.
Definition: MoabSkinner.h:166
void createCornerTris(const std::vector< moab::EntityHandle > &verts, unsigned int corner, unsigned int v1, unsigned int v2, unsigned int v3, bool normalout, moab::Range &surface_tris)
Create 3 tri faces stemming from one corner of a cude (an open tetrahedron)
void checkBoundaryConditionOverlap() const
Error if the same sideset ID appears in both vacuum and reflective BC sets.
std::unordered_map< moab::EntityHandle, dof_id_type > _elem_handle_to_id
Reverse map from MOAB tet entity handle to libMesh element ID. Populated in createMOABElems()
Definition: MoabSkinner.h:524
Real _scaling
Length multiplier to get from [Mesh] units into OpenMC's centimeters.
Definition: MoabSkinner.h:237
moab::Tag geometry_resabs_tag
Tag needed by DAGMC.
Definition: MoabSkinner.h:566
std::vector< std::vector< unsigned int > > _tet4_nodes
Node ordering for a TET4 MOAB element, based on libMesh node numberings.
Definition: MoabSkinner.h:581
Sense
Encode the whether the surface normal faces into or out of the volume.
Definition: MoabSkinner.h:252
void buildGraveyard(unsigned int &vol_id, unsigned int &surf_id)
Build a graveyard volume around the domain.
std::unique_ptr< MeshBase > _tet_mesh
TET4 clone of the MOOSE mesh. Present only when the source mesh contains non-tetrahedral elements....
Definition: MoabSkinner.h:249
std::vector< moab::EntityHandle > createNodesFromBox(const BoundingBox &box, const Real &factor) const
moab::Tag faceting_tol_tag
Tag for faceting tolerance.
Definition: MoabSkinner.h:563
void createVol(const unsigned int &id, moab::EntityHandle &volume_set, moab::EntityHandle group_set)
Helper method to create MOAB volume entity set.
unsigned int _n_write
Count number of times output files have been written.
Definition: MoabSkinner.h:240
moab::EntityHandle offset
Save the first tet entity handle.
Definition: MoabSkinner.h:508
BoundaryConditionType boundaryConditionType(const Elem *const elem, const unsigned int side, const libMesh::BoundaryInfo &boundary_info) const
virtual unsigned int getSubdomainBin(const Elem *const elem) const
Definition: MoabSkinner.h:81
Sense sense
Definition: MoabSkinner.h:262
moab::EntityHandle _all_tets
Entity handle to represent the set of all tets.
Definition: MoabSkinner.h:551
const Real & _graveyard_scale_inner
Multiplier on bounding box for inner surface of graveyard.
Definition: MoabSkinner.h:210
void createSurfaces(moab::Range &faces, VolData &voldata, unsigned int &surf_id, BoundaryConditionType bc_type=BoundaryConditionType::Transmission)
virtual moab::ErrorCode check(const moab::ErrorCode input) const
Definition: MoabSkinner.h:255
bool _use_displaced
Whether the skinned mesh should be generated from a displaced mesh.
Definition: MoabSkinner.h:234
std::map< SubdomainID, unsigned int > _blocks
Blocks in the [Mesh].
Definition: MoabSkinner.h:548
virtual void sortElemsByResults()
Sort all the elements in the [Mesh] into bins for temperature, density, and subdomain.
const unsigned int & _n_temperature_bins
Number of temperature bins.
Definition: MoabSkinner.h:191
virtual void setMaterialNames(std::vector< std::string > names)
Definition: MoabSkinner.h:54
bool resetMOAB()
Clear MOAB entity sets.
const Real & _geom_tol
Geometry tolerence needed by DAGMC.
Definition: MoabSkinner.h:207
void setTags(moab::EntityHandle ent, std::string name, std::string category, unsigned int id, int dim)
Generic method to set the tags that DAGMC requires.
virtual unsigned int getDensityBin(const Elem *const elem) const
void createBoundaryConditionGroups()
Real _density_max
Upper bound of density bins.
Definition: MoabSkinner.h:533
Skins the [Mesh] according to individual bins for temperature, density, and subdomain ID.
Definition: MoabSkinner.h:19
std::unordered_map< dof_id_type, moab::EntityHandle > _node_id_to_handle
Map from libMesh id to MOAB vertex handles.
Definition: MoabSkinner.h:505
virtual void findBlocks()
Store a mapping from [Mesh] subdomain IDs to an index, to be used for binning by block ID.
std::map< moab::EntityHandle, BoundaryConditionType > _surface_bc_types
Definition: MoabSkinner.h:521
moab::EntityHandle vol
Definition: MoabSkinner.h:261
std::vector< std::vector< unsigned int > > _tet10_nodes
Definition: MoabSkinner.h:587
bool _build_graveyard
Definition: MoabSkinner.h:225
std::string _implicit_complement_group_name
OpenMC material name or ID which will be assigned to the implicit complement.
Definition: MoabSkinner.h:231
void buildTetMesh()
If the mesh has non-tetrahedral elements, clone it into _tet_mesh and convert to all-TET4.
moab::Tag category_tag
Tag for type of entity set.
Definition: MoabSkinner.h:569
const bool _bin_by_density
Whether elements are binned by density (in addition to temperature and block)
Definition: MoabSkinner.h:197
const Real BIN_TOLERANCE
Tolerance to use for comparing values to bin bounds.
Definition: MoabSkinner.h:599
const Real & _faceting_tol
Faceting tolerence needed by DAGMC.
Definition: MoabSkinner.h:204
void setGraveyard(bool build)
virtual void execute() override
virtual const bool & hasGraveyard() const
Definition: MoabSkinner.h:137
Encode MOAB information about volumes needed when creating surfaces.
Definition: MoabSkinner.h:259
Real _density_min
Lower bound of density bins.
Definition: MoabSkinner.h:530
void updateSurfData(moab::EntityHandle surface_set, const VolData &data)
Add parent-child metadata relating a surface to its volume.
void reset()
Clear mesh data.
const unsigned int NODES_PER_MOAB_TET
Number of nodes per MOAB tet (which are first order, so TET4)
Definition: MoabSkinner.h:596
std::vector< Real > _temperature_bin_bounds
Bounds of the temperature bins.
Definition: MoabSkinner.h:575
virtual void createTags()
Helper method to create MOAB tags.
unsigned int _temperature_var_num
Auxiliary variable number for temperature.
Definition: MoabSkinner.h:590