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"
60 virtual moab::ErrorCode
check(
const moab::ErrorCode input)
const;
87 virtual unsigned int getFieldBin(
const unsigned int & field_index,
const Elem *
const elem)
const;
95 virtual unsigned int getFieldBin(
const std::string & name,
const Elem *
const elem)
const;
117 return _blocks.at(elem->subdomain_id());
151 const std::string & param_name)
const;
162 virtual unsigned int getBin(
const Elem *
const elem)
const;
180 const std::shared_ptr<moab::Interface> &
moabPtr()
const {
return _moab; }
205 std::shared_ptr<moab::Interface>
_moab;
311 createGroup(
const unsigned int &
id,
const std::string & name, moab::EntityHandle & group_set);
315 createVol(
const unsigned int &
id, moab::EntityHandle & volume_set, moab::EntityHandle group_set);
319 moab::EntityHandle & surface_set,
321 const std::vector<VolData> & voldata,
328 unsigned int & surf_id,
336 unsigned int & surf_id,
338 const Real & factor);
347 const Real & factor)
const;
356 moab::Range & surface_tris);
359 moab::EntityHandle
createTri(
const std::vector<moab::EntityHandle> & vertices,
369 setTags(moab::EntityHandle ent, std::string name, std::string category,
unsigned int id,
int dim);
372 void setTagData(moab::Tag tag, moab::EntityHandle ent, std::string data,
unsigned int SIZE);
375 void setTagData(moab::Tag tag, moab::EntityHandle ent,
void * data);
381 const std::vector<std::vector<unsigned int>> &
getTetSets(ElemType type)
const;
414 const std::string & param_name);
428 const unsigned int side,
429 const libMesh::BoundaryInfo & boundary_info)
const;
441 const moab::Range & skin,
442 moab::Range & transmission_tris,
443 moab::Range & vacuum_tris,
444 moab::Range & reflective_tris);
458 unsigned int & surf_id);
494 void groupLocalElems(std::set<dof_id_type> elems, std::vector<moab::Range> & localElems);
501 moab::EntityHandle group,
502 unsigned int & vol_id,
503 unsigned int & surf_id,
504 moab::EntityHandle & volume_set);
513 std::unique_ptr<moab::GeomTopoTool>
gtt;
Skins the [Mesh] according to individual bins for user-specified fields and subdomain ID.
Definition MoabSkinner.h:41
void setGraveyard(bool build)
void buildTetMesh()
If the mesh has non-tetrahedral elements, clone it into _tet_mesh and convert to all-TET4.
void splitSkinByBoundaryCondition(const moab::Range ®ion, const moab::Range &skin, moab::Range &transmission_tris, moab::Range &vacuum_tris, moab::Range &reflective_tris)
void createGroup(const unsigned int &id, const std::string &name, moab::EntityHandle &group_set)
void createVol(const unsigned int &id, moab::EntityHandle &volume_set, moab::EntityHandle group_set)
Helper method to create MOAB volume entity set.
virtual unsigned int getBin(const Elem *const elem) const
const bool & _output_skins
Whether to output the MOAB mesh skins to a .h5m file.
Definition MoabSkinner.h:230
std::vector< std::vector< unsigned int > > _tet4_nodes
Node ordering for a TET4 MOAB element, based on libMesh node numberings.
Definition MoabSkinner.h:574
virtual void initialize() override
const Real & _graveyard_scale_outer
Multiplier on bounding box for outer surface of graveyard.
Definition MoabSkinner.h:227
moab::Tag category_tag
Tag for type of entity set.
Definition MoabSkinner.h:568
bool _verbose
Whether to print diagnostic information.
Definition MoabSkinner.h:208
virtual void update()
Perform the skinning operation.
std::set< BoundaryID > _vacuum_bcs_surface_ids
Resolved vacuum BC sideset IDs (from 'vacuum_bcs_surfaces' input parameter)
Definition MoabSkinner.h:525
virtual void setScaling(const Real &scale)
Definition MoabSkinner.h:130
std::map< moab::EntityHandle, BoundaryConditionType > _surface_bc_types
Definition MoabSkinner.h:532
unsigned int firstBoundaryConditionGroupID() const
bool _build_graveyard
Definition MoabSkinner.h:239
bool _standalone
Whether this class runs by itself, or is controlled by an external class.
Definition MoabSkinner.h:257
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.
moab::Tag faceting_tol_tag
Tag for faceting tolerance.
Definition MoabSkinner.h:562
MeshBase & getDAGMCGeometryMesh()
virtual void finalize() override
virtual moab::ErrorCode check(const moab::ErrorCode input) const
virtual void setVerbosity(const bool &verbose)
Definition MoabSkinner.h:136
virtual void setMaterialNames(std::vector< std::string > names)
Definition MoabSkinner.h:73
moab::EntityHandle createTri(const std::vector< moab::EntityHandle > &vertices, unsigned int v1, unsigned int v2, unsigned int v3)
Create MOAB tri surface element.
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:516
void createSurfaceFromBox(const BoundingBox &box, const VolData &voldata, unsigned int &surf_id, bool normalout, const Real &factor)
static InputParameters validParams()
const std::shared_ptr< moab::Interface > & moabPtr() const
Definition MoabSkinner.h:180
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:541
std::vector< std::vector< unsigned int > > _tet10_nodes
Definition MoabSkinner.h:580
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.
std::unique_ptr< moab::Skinner > skinner
Moab skinner for finding temperature surfaces.
Definition MoabSkinner.h:510
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:535
virtual void createTags()
Helper method to create MOAB tags.
std::shared_ptr< moab::Interface > _moab
MOAB interface.
Definition MoabSkinner.h:205
MoabSkinner(const InputParameters ¶meters)
const Real & _geom_tol
Geometry tolerence needed by DAGMC.
Definition MoabSkinner.h:221
std::map< moab::EntityHandle, std::vector< VolData > > surfsToVols
Save some topological data: map from surface handle to vol handle and sense.
Definition MoabSkinner.h:553
virtual void threadJoin(const UserObject &) override
Definition MoabSkinner.h:53
std::string materialName(const unsigned int &block) const
void recordBoundaryConditionSurface(moab::EntityHandle surface_set, BoundaryConditionType bc_type)
std::unordered_map< dof_id_type, moab::EntityHandle > _node_id_to_handle
Map from libMesh id to MOAB vertex handles.
Definition MoabSkinner.h:519
std::vector< std::string > _material_names
Definition MoabSkinner.h:215
virtual void makeDependentOnExternalAction()
Definition MoabSkinner.h:142
std::unique_ptr< moab::GeomTopoTool > gtt
Topology tool for setting surface sense.
Definition MoabSkinner.h:513
virtual void write()
Write MOAB volume and/or skin meshes to file.
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:544
std::set< BoundaryID > _reflective_bcs_surface_ids
Resolved reflective BC sideset IDs (from 'reflective_bcs_surfaces' input parameter)
Definition MoabSkinner.h:528
bool _tet_mesh_built
True when buildTetMesh() is called.
Definition MoabSkinner.h:260
moab::Tag geometry_dimension_tag
Tag for dimension for geometry.
Definition MoabSkinner.h:556
MooseMesh & getMooseMesh()
Get the MooseMesh (displaced or not, depending on _use_displaced)
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 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.
moab::EntityHandle _all_tets
Entity handle to represent the set of all tets.
Definition MoabSkinner.h:550
Sense
Encode the whether the surface normal faces into or out of the volume.
Definition MoabSkinner.h:267
@ FORWARDS
Definition MoabSkinner.h:269
@ BACKWARDS
Definition MoabSkinner.h:268
void reset()
Clear mesh data.
const bool & _output_full
Whether to output the MOAB mesh to a .h5m file.
Definition MoabSkinner.h:233
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:263
virtual unsigned int getFieldBin(const std::string &name, const Elem *const elem) const
BoundaryConditionType recordedBoundaryCondition(moab::EntityHandle surface_set) const
void setUseDisplacedMesh(const bool &use)
const std::vector< std::vector< unsigned int > > & getTetSets(ElemType type) const
moab::Tag name_tag
Tag for name of entity set.
Definition MoabSkinner.h:571
moab::Tag geometry_resabs_tag
Tag needed by DAGMC.
Definition MoabSkinner.h:565
std::vector< std::string > binnedFieldNames() const
unsigned int nBins() const
void readFieldParameters()
Read the 'fields' parameters and populate _fields.
moab::EntityHandle offset
Save the first tet entity handle.
Definition MoabSkinner.h:522
virtual const bool & hasGraveyard() const
Definition MoabSkinner.h:168
std::set< BoundaryID > boundaryNamesToIDs(const std::vector< BoundaryName > &names, const std::string ¶m_name)
const Real & _faceting_tol
Faceting tolerence needed by DAGMC.
Definition MoabSkinner.h:218
virtual unsigned int getFieldBin(const unsigned int &field_index, const Elem *const elem) const
void checkBoundaryConditionOverlap() const
Error if the same sideset ID appears in both vacuum and reflective BC sets.
moab::Tag id_tag
Tag for entitiy set ID.
Definition MoabSkinner.h:559
std::vector< moab::EntityHandle > createNodesFromBox(const BoundingBox &box, const Real &factor) const
const Real BIN_TOLERANCE
Tolerance to use for comparing values to bin bounds.
Definition MoabSkinner.h:586
unsigned int _n_write
Count number of times output files have been written.
Definition MoabSkinner.h:254
void setTagData(moab::Tag tag, moab::EntityHandle ent, void *data)
Helper function to wrap moab::tag_set_data for a generic pointer.
const unsigned int NODES_PER_MOAB_TET
Number of nodes per MOAB tet (which are first order, so TET4)
Definition MoabSkinner.h:583
virtual void sortElemsByResults()
Sort all the elements in the [Mesh] into bins for temperature, density, and subdomain.
BoundaryConditionType
Boundary condition types that can be assigned to DAGMC surfaces.
Definition MoabSkinner.h:185
void groupLocalElems(std::set< dof_id_type > elems, std::vector< moab::Range > &localElems)
bool binsByField(const std::string &name) const
void buildGraveyard(unsigned int &vol_id, unsigned int &surf_id)
Build a graveyard volume around the domain.
const Real & _graveyard_scale_inner
Multiplier on bounding box for inner surface of graveyard.
Definition MoabSkinner.h:224
std::string boundaryConditionGroupName(BoundaryConditionType bc_type) const
std::vector< BinnedField > _fields
Fields by which elements are binned (in the order given by the user)
Definition MoabSkinner.h:211
bool _set_bcs
Whether to assign boundary conditions to surfaces.
Definition MoabSkinner.h:538
virtual void findBlocks()
Store a mapping from [Mesh] subdomain IDs to an index, to be used for binning by block ID.
void createSurfaces(moab::Range &faces, VolData &voldata, unsigned int &surf_id, BoundaryConditionType bc_type=BoundaryConditionType::Transmission)
void createBoundaryConditionGroups()
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.
Real _scaling
Length multiplier to get from [Mesh] units into OpenMC's centimeters.
Definition MoabSkinner.h:251
bool _set_implicit_complement_material
Whether to assign a material to the implicit complement region.
Definition MoabSkinner.h:242
std::string _implicit_complement_group_name
OpenMC material name or ID which will be assigned to the implicit complement.
Definition MoabSkinner.h:245
virtual unsigned int getSubdomainBin(const Elem *const elem) const
Definition MoabSkinner.h:115
virtual void execute() override
std::map< SubdomainID, std::string > _block_id_to_material_name
Map from mesh SubdomainID to OpenMC material name.
Definition MoabSkinner.h:589
bool resetMOAB()
Clear MOAB entity sets.
BoundaryConditionType boundaryConditionType(const Elem *const elem, const unsigned int side, const libMesh::BoundaryInfo &boundary_info) const
virtual unsigned int getFieldBin(const BinnedField &field, const Elem *const elem) const
std::unique_ptr< NumericVector< Number > > _serialized_solution
Definition MoabSkinner.h:202
unsigned int getAuxiliaryVariableNumber(const std::string &name, const std::string ¶m_name) const
bool _use_displaced
Whether the skinned mesh should be generated from a displaced mesh.
Definition MoabSkinner.h:248
void updateSurfData(moab::EntityHandle surface_set, const VolData &data)
Add parent-child metadata relating a surface to its volume.
std::map< SubdomainID, unsigned int > _blocks
Blocks in the [Mesh].
Definition MoabSkinner.h:547
void createSurfacesFromSkin(const moab::Range ®ion, moab::Range &skin, VolData &voldata, unsigned int &surf_id)
Definition CardinalEnums.h:93
Definition MoabSkinner.h:16
Real min
Lower bound of the bins.
Definition MoabSkinner.h:22
Real width
Bin width.
Definition MoabSkinner.h:26
std::vector< Real > bounds
Bounds of the bins (size n_bins + 1)
Definition MoabSkinner.h:30
Real max
Upper bound of the bins.
Definition MoabSkinner.h:24
unsigned int n_bins
Number of bins.
Definition MoabSkinner.h:28
std::string name
Name of the auxiliary variable.
Definition MoabSkinner.h:18
unsigned int var_num
Auxiliary variable number in the auxiliary system.
Definition MoabSkinner.h:20
Encode MOAB information about volumes needed when creating surfaces.
Definition MoabSkinner.h:274
moab::EntityHandle vol
Definition MoabSkinner.h:275
Sense sense
Definition MoabSkinner.h:276