AURORA
|
UserObject class which wraps a moab::Interface pointer. More...
#include <MoabUserObject.h>
Classes | |
struct | VolData |
Encode MOAB information about volumes needed when creating surfaces. More... | |
Public Member Functions | |
MoabUserObject (const InputParameters ¶meters) | |
virtual void | execute () |
Override MOOSE virtual method to do nothing. More... | |
virtual void | initialize () |
Override MOOSE virtual method to do nothing. More... | |
virtual void | finalize () |
Override MOOSE virtual method to do nothing. More... | |
virtual void | threadJoin (const UserObject &) |
Override MOOSE virtual method to do nothing. More... | |
void | setProblem (FEProblemBase *problem) |
Pass in the FE Problem. More... | |
bool | hasProblem () |
Check if problem has been set. More... | |
FEProblemBase & | problem () |
Get a reference to the FE problem. More... | |
void | initMOAB () |
Initialise MOAB. More... | |
void | initBinningData () |
Intialise objects needed to perform binning of elements. More... | |
void | reset () |
Clear mesh data. More... | |
bool | update () |
Update MOAB with any results from MOOSE. More... | |
bool | setSolution (std::string var_now, std::vector< double > &results, double scaleFactor=1., bool isErr=false, bool normToVol=true) |
Pass the OpenMC results into the libMesh systems solution. More... | |
void | getMaterialProperties (std::vector< std::string > &mat_names_out, std::vector< double > &initial_densities, std::vector< std::string > &tails, std::vector< MOABMaterialProperties > &properties) |
Retrieve a list of original material names and properties. More... | |
Public Attributes | |
std::shared_ptr< moab::Interface > | moabPtr |
Publically available pointer to MOAB interface. More... | |
Private Types | |
enum | Sense { BACKWARDS =-1, FORWARDS =1 } |
Encode the whether the surface normal faces into or out of the volume. More... | |
Private Member Functions | |
MeshBase & | mesh () |
Get a modifyable reference to the underlying libmesh mesh. More... | |
EquationSystems & | systems () |
Get a modifyable reference to the underlying libmesh equation systems. More... | |
System & | system (std::string var_now) |
Get a modifyable reference to the underlying libmesh system. More... | |
moab::ErrorCode | createNodes (std::map< dof_id_type, moab::EntityHandle > &node_id_to_handle) |
Helper method to create MOAB nodes. More... | |
void | createElems (std::map< dof_id_type, moab::EntityHandle > &node_id_to_handle) |
Helper method to create MOAB elements. More... | |
moab::ErrorCode | createTags () |
Helper method to create MOAB tags. More... | |
moab::ErrorCode | createGroup (unsigned int id, std::string name, moab::EntityHandle &group_set) |
Helper method to create MOAB group entity set. More... | |
moab::ErrorCode | createVol (unsigned int id, moab::EntityHandle &volume_set, moab::EntityHandle group_set) |
Helper method to create MOAB volume entity set. More... | |
moab::ErrorCode | createSurf (unsigned int id, moab::EntityHandle &surface_set, moab::Range &faces, std::vector< VolData > &voldata) |
Helper method to create MOAB surface entity set. More... | |
moab::ErrorCode | createSurfaces (moab::Range &reversed, VolData &voldata, unsigned int &surf_id) |
Helper method to create MOAB surfaces with no overlaps. More... | |
moab::ErrorCode | createSurfaceFromBox (const BoundingBox &box, VolData &voldata, unsigned int &surf_id, bool normalout, double factor=1.0) |
Create a MOAB surface from a bounding box. More... | |
moab::ErrorCode | createNodesFromBox (const BoundingBox &box, double factor, std::vector< moab::EntityHandle > &vert_handles) |
Create MOAB nodes from a bounding box. More... | |
moab::ErrorCode | 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) More... | |
moab::ErrorCode | createTri (const std::vector< moab::EntityHandle > &vertices, unsigned int v1, unsigned int v2, unsigned int v3, moab::Range &surface_tris) |
Create MOAB tri surface element. More... | |
moab::ErrorCode | updateSurfData (moab::EntityHandle surface_set, VolData data) |
Add parent-child metadata relating a surface to its volume. More... | |
moab::ErrorCode | setTags (moab::EntityHandle ent, std::string name, std::string category, unsigned int id, int dim) |
Generic method to set the tags that DAGMC requires. More... | |
moab::ErrorCode | setTagData (moab::Tag tag, moab::EntityHandle ent, std::string data, unsigned int SIZE) |
Helper function to wrap moab::tag_set_data for a string. More... | |
moab::ErrorCode | setTagData (moab::Tag tag, moab::EntityHandle ent, void *data) |
Helper function to wrap moab::tag_set_data for a generic pointer. More... | |
bool | getTetSets (ElemType type, std::vector< std::vector< unsigned int > > &perms) |
Return all sets of node indices for sub-tetrahedra if we have a second order mesh. More... | |
moab::ErrorCode | buildGraveyard (unsigned int &vol_id, unsigned int &surf_id) |
Build the graveyard (needed by OpenMC) More... | |
std::vector< Point > | boxCoords (const BoundingBox &box, double factor) |
Get the coords of the box back as an array (possibly scaled) More... | |
void | findMaterials () |
Look for materials in the FE problem. More... | |
void | clearElemMaps () |
Clear the maps between entity handles and dof ids. More... | |
void | addElem (dof_id_type id, moab::EntityHandle ent) |
Add an element to maps. More... | |
void | setSolution (unsigned int iSysNow, unsigned int iVarNow, std::vector< double > &results, double scaleFactor, bool isErr, bool normToVol) |
Helper method to set the results in a given system and variable. More... | |
dof_id_type | elem_to_soln_index (const Elem &elem, unsigned int iSysNow, unsigned int iVarNow) |
Helper method to convert between elem / solution indices. More... | |
NumericVector< Number > & | getSerialisedSolution (libMesh::System *sysPtr) |
Get a serialised version of solution for a given system. More... | |
void | setMeshFunction (std::string var_name_in) |
Create and save a mesh function for the provided variable. More... | |
double | evalMeshFunction (std::shared_ptr< MeshFunction > meshFunctionPtr, const Point &p) |
Evaluate a mesh function at a point. More... | |
std::shared_ptr< MeshFunction > | getMeshFunction (std::string var_name_in) |
Fetch the mesh function associated with a variable. More... | |
bool | sortElemsByResults () |
Sort elems in to bins of a given temperature. More... | |
bool | findSurfaces () |
Group the binned elems into local temperature regions and find their surfaces. More... | |
void | groupLocalElems (std::set< dof_id_type > elems, std::vector< moab::Range > &localElems) |
int | getResultsBin (double value) |
Given a value of our variable, find what bin this corresponds to. More... | |
int | getResultsBinLin (double value) |
Find results bin if we have linear binning. More... | |
int | getResultsBinLog (double value) |
Find results bin if we have logarithmic. More... | |
int | getRelDensityBin (double value) |
Return the bin index of a given relative density. More... | |
int | getSortBin (int iVarBin, int iDenBin, int iMat, int nVarBinsIn, int nDenBinsIn, int nMatsIn) |
Map material, density and temp bin indices onto a linearised index. More... | |
int | getSortBin (int iVarBin, int iDenBin, int iMat) |
int | getMatBin (int iVarBin, int iDenBin, int nVarBinsIn, int nDenBinsIn) |
Map density and temp bin indices onto a linearised index. More... | |
int | getMatBin (int iVarBin, int iDenBin) |
void | calcMidpoints () |
Calculate the variable evaluated at the bin midpoints. More... | |
void | calcMidpointsLin () |
Calculate the variable evaluated at the bin midpoints for linear binning. More... | |
void | calcMidpointsLog () |
Calculate the variable evaluated at the bin midpoints for log binning. More... | |
void | calcDenMidpoints () |
Calculate the density evaluated at the bin midpoints. More... | |
void | calcMidpointsLin (double var_min_in, double bin_width_in, int nbins_in, std::vector< double > &midpoints_in) |
Calculate a generic variable midpoints given binning params. More... | |
Point | elemCentroid (Elem &elem) |
Return the centroid position of an element. More... | |
void | resetContainers () |
Clear the containers of elements grouped into bins of constant temp. More... | |
bool | resetMOAB () |
Clear MOAB entity sets. More... | |
bool | 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. More... | |
bool | write () |
Write to file. More... | |
void | communicateDofSet (std::set< dof_id_type > &dofset) |
MPI communication of DOFs of binned elements. More... | |
Private Attributes | |
FEProblemBase * | _problem_ptr |
Pointer to the feProblem we care about. More... | |
std::unique_ptr< moab::Skinner > | skinner |
Pointer to a moab skinner for finding temperature surfaces. More... | |
std::unique_ptr< moab::GeomTopoTool > | gtt |
Pointer for gtt for setting surface sense. More... | |
double | lengthscale |
Convert MOOSE units to dagmc length units. More... | |
double | densityscale |
Convert MOOSE density units to openmc density units. More... | |
std::map< dof_id_type, std::vector< moab::EntityHandle > > | _id_to_elem_handles |
Map from libmesh id to MOAB element entity handles. More... | |
moab::EntityHandle | offset |
Save the first tet entity handle. More... | |
std::string | var_name |
Name of the MOOSE variable. More... | |
bool | binElems |
Whether or not to perform binning. More... | |
bool | logscale |
Whether or not to bin in a log scale. More... | |
double | var_min |
Minimum value of our variable. More... | |
double | var_max |
Maximum value of our variable for binning on a linear scale. More... | |
double | bin_width |
Fixed bin width for binning on a linear scale. More... | |
int | powMin |
Minimum power of 10. More... | |
int | powMax |
Maximum power of 10. More... | |
unsigned int | nVarBins |
Number of variable bins to use. More... | |
unsigned int | nPow |
Number of powers of 10 to bin in for binning on a log scale. More... | |
unsigned int | nMinor |
Number of minor divisions for binning on a log scale. More... | |
std::vector< double > | midpoints |
Store the temperature corresponding to the bin mipoint. More... | |
std::vector< double > | den_midpoints |
Store the relative density corresponding to the bin mipoint. More... | |
std::string | den_var_name |
Data members relating to binning in density. More... | |
bool | binByDensity |
Switch to determine if we should bin by material density. More... | |
double | rel_den_min |
Minimum relative density diff. More... | |
double | rel_den_max |
Max relative density diff. More... | |
double | rel_den_bw |
Relative density diff bin width. More... | |
unsigned int | nDenBins |
Number of relative density bins. More... | |
unsigned int | nMatBins |
Number of distinct subdomains (e.g. vols, mats) More... | |
std::vector< std::set< dof_id_type > > | sortedElems |
Container for elems sorted by variable bin and materials. More... | |
std::map< std::string, std::shared_ptr< MeshFunction > > | meshFunctionPtrs |
A map to store mesh functions against their variable name. More... | |
std::map< unsigned int, std::unique_ptr< NumericVector< Number > > > | serial_solutions |
A place to store the entire solution. More... | |
std::vector< std::string > | mat_names |
material names More... | |
std::vector< std::string > | openmc_mat_names |
OpenMC material names. More... | |
std::vector< std::set< SubdomainID > > | mat_blocks |
all element blocks assigned to mats More... | |
std::vector< double > | initialDensities |
vector for initial densities if binning by density More... | |
moab::EntityHandle | meshset |
An entitiy handle to represent the set of all tets. More... | |
std::map< moab::EntityHandle, std::vector< VolData > > | surfsToVols |
Save some topological data: map from surface handle to vol handle and sense. More... | |
moab::Tag | geometry_dimension_tag |
Tag for dimension for geometry. More... | |
moab::Tag | id_tag |
Tag for entitiy set ID. More... | |
moab::Tag | faceting_tol_tag |
Tag for faceting tolerance. More... | |
moab::Tag | geometry_resabs_tag |
Tag needed by DAGMC. More... | |
moab::Tag | category_tag |
Tag for type of entity set. More... | |
moab::Tag | name_tag |
Tag for name of entity set. More... | |
const unsigned int | nNodesPerTet = 4 |
Const to encode that MOAB tets have 4 nodes. More... | |
double | faceting_tol |
Faceting tolerence needed by DAGMC. More... | |
double | geom_tol |
Geometry tolerence needed by DAGMC. More... | |
double | scalefactor_inner |
Scalefactors applied to bounding box for inner surface of graveyard. More... | |
double | scalefactor_outer |
Scalefactors applied to bounding box for outer surface of graveyard. More... | |
bool | output_skins |
Flag to control whether to save surface skins to file. More... | |
bool | output_full |
Flag to control whether to output the full MOAB mesh database. More... | |
std::string | output_base |
Base name of skins output file. More... | |
std::string | output_base_full |
Base name of full database output file. More... | |
unsigned int | n_output |
Number of times to write to file. More... | |
unsigned int | n_period |
Period of writes (skip every n_period -1) More... | |
unsigned int | n_write |
Count number of times file has been written to. More... | |
unsigned int | n_its |
Store the number of times writeSurfaces is called. More... | |
PerfID | _init_timer |
Performance timer for initialisation. More... | |
PerfID | _update_timer |
Performance timer for update. More... | |
PerfID | _setsolution_timer |
Performance timer for setSolution. More... | |
UserObject class which wraps a moab::Interface pointer.
The main role of this class is to bin elements of the mesh according named variables (presumed temperature and density), and subsequently perform a skinning operation to find the surfaces of these local regions.
|
private |
Encode the whether the surface normal faces into or out of the volume.
|
private |
Add an element to maps.
|
private |
Get the coords of the box back as an array (possibly scaled)
|
private |
Build the graveyard (needed by OpenMC)
|
private |
Calculate the density evaluated at the bin midpoints.
|
private |
Calculate the variable evaluated at the bin midpoints.
|
private |
Calculate the variable evaluated at the bin midpoints for linear binning.
|
private |
Calculate a generic variable midpoints given binning params.
|
private |
Calculate the variable evaluated at the bin midpoints for log binning.
|
private |
Clear the maps between entity handles and dof ids.
|
private |
MPI communication of DOFs of binned elements.
|
private |
Create 3 tri faces stemming from one corner of a cude (an open tetrahedron)
|
private |
Helper method to create MOAB elements.
|
private |
Helper method to create MOAB group entity set.
|
private |
Helper method to create MOAB nodes.
|
private |
Create MOAB nodes from a bounding box.
|
private |
Helper method to create MOAB surface entity set.
|
private |
Create a MOAB surface from a bounding box.
|
private |
Helper method to create MOAB surfaces with no overlaps.
|
private |
Helper method to create MOAB tags.
|
private |
Create MOAB tri surface element.
|
private |
Helper method to create MOAB volume entity set.
|
private |
Helper method to convert between elem / solution indices.
|
private |
Return the centroid position of an element.
|
private |
Evaluate a mesh function at a point.
|
inlinevirtual |
Override MOOSE virtual method to do nothing.
|
inlinevirtual |
Override MOOSE virtual method to do nothing.
|
private |
Look for materials in the FE problem.
|
private |
Find the surfaces for the provided range and add to group.
|
private |
Group the binned elems into local temperature regions and find their surfaces.
|
inlineprivate |
Map density and temp bin indices onto a linearised index with default parameters for number of bins
|
private |
Map density and temp bin indices onto a linearised index.
void MoabUserObject::getMaterialProperties | ( | std::vector< std::string > & | mat_names_out, |
std::vector< double > & | initial_densities, | ||
std::vector< std::string > & | tails, | ||
std::vector< MOABMaterialProperties > & | properties | ||
) |
Retrieve a list of original material names and properties.
|
private |
Fetch the mesh function associated with a variable.
|
inlineprivate |
Return the bin index of a given relative density.
|
private |
Given a value of our variable, find what bin this corresponds to.
|
inlineprivate |
Find results bin if we have linear binning.
|
private |
Find results bin if we have logarithmic.
|
private |
Get a serialised version of solution for a given system.
|
inlineprivate |
Map material, density and temp bin indices onto a linearised index with default parameters for number of bins
|
private |
Map material, density and temp bin indices onto a linearised index.
|
private |
Return all sets of node indices for sub-tetrahedra if we have a second order mesh.
|
private |
Group a given bin into local regions NB elems in param is a copy, localElems is a reference
|
inline |
Check if problem has been set.
void MoabUserObject::initBinningData | ( | ) |
Intialise objects needed to perform binning of elements.
|
inlinevirtual |
Override MOOSE virtual method to do nothing.
void MoabUserObject::initMOAB | ( | ) |
Initialise MOAB.
|
private |
Get a modifyable reference to the underlying libmesh mesh.
FEProblemBase & MoabUserObject::problem | ( | ) |
Get a reference to the FE problem.
void MoabUserObject::reset | ( | ) |
Clear mesh data.
|
private |
Clear the containers of elements grouped into bins of constant temp.
|
private |
Clear MOAB entity sets.
|
private |
Create and save a mesh function for the provided variable.
|
inline |
Pass in the FE Problem.
bool MoabUserObject::setSolution | ( | std::string | var_now, |
std::vector< double > & | results, | ||
double | scaleFactor = 1. , |
||
bool | isErr = false , |
||
bool | normToVol = true |
||
) |
Pass the OpenMC results into the libMesh systems solution.
|
private |
Helper method to set the results in a given system and variable.
|
private |
Helper function to wrap moab::tag_set_data for a string.
|
private |
Helper function to wrap moab::tag_set_data for a generic pointer.
|
private |
Generic method to set the tags that DAGMC requires.
|
private |
Sort elems in to bins of a given temperature.
|
private |
Get a modifyable reference to the underlying libmesh system.
|
private |
Get a modifyable reference to the underlying libmesh equation systems.
|
inlinevirtual |
Override MOOSE virtual method to do nothing.
bool MoabUserObject::update | ( | ) |
Update MOAB with any results from MOOSE.
|
private |
Add parent-child metadata relating a surface to its volume.
|
private |
Write to file.
|
private |
Map from libmesh id to MOAB element entity handles.
|
private |
Performance timer for initialisation.
|
private |
Pointer to the feProblem we care about.
|
private |
Performance timer for setSolution.
|
private |
Performance timer for update.
|
private |
Fixed bin width for binning on a linear scale.
|
private |
Switch to determine if we should bin by material density.
|
private |
Whether or not to perform binning.
|
private |
Tag for type of entity set.
|
private |
Store the relative density corresponding to the bin mipoint.
|
private |
Data members relating to binning in density.
Name of the MOOSE variable containing the density
|
private |
Convert MOOSE density units to openmc density units.
|
private |
Faceting tolerence needed by DAGMC.
|
private |
Tag for faceting tolerance.
|
private |
Geometry tolerence needed by DAGMC.
|
private |
Tag for dimension for geometry.
|
private |
Tag needed by DAGMC.
|
private |
Pointer for gtt for setting surface sense.
|
private |
Tag for entitiy set ID.
|
private |
vector for initial densities if binning by density
|
private |
Convert MOOSE units to dagmc length units.
|
private |
Whether or not to bin in a log scale.
|
private |
all element blocks assigned to mats
|
private |
material names
|
private |
A map to store mesh functions against their variable name.
|
private |
An entitiy handle to represent the set of all tets.
|
private |
Store the temperature corresponding to the bin mipoint.
std::shared_ptr<moab::Interface> MoabUserObject::moabPtr |
Publically available pointer to MOAB interface.
|
private |
Store the number of times writeSurfaces is called.
|
private |
Number of times to write to file.
|
private |
Period of writes (skip every n_period -1)
|
private |
Count number of times file has been written to.
|
private |
Tag for name of entity set.
|
private |
Number of relative density bins.
|
private |
Number of distinct subdomains (e.g. vols, mats)
|
private |
Number of minor divisions for binning on a log scale.
|
private |
Const to encode that MOAB tets have 4 nodes.
|
private |
Number of powers of 10 to bin in for binning on a log scale.
|
private |
Number of variable bins to use.
|
private |
Save the first tet entity handle.
|
private |
OpenMC material names.
|
private |
Base name of skins output file.
|
private |
Base name of full database output file.
|
private |
Flag to control whether to output the full MOAB mesh database.
|
private |
Flag to control whether to save surface skins to file.
|
private |
Maximum power of 10.
|
private |
Minimum power of 10.
|
private |
Relative density diff bin width.
|
private |
Max relative density diff.
|
private |
Minimum relative density diff.
|
private |
Scalefactors applied to bounding box for inner surface of graveyard.
|
private |
Scalefactors applied to bounding box for outer surface of graveyard.
|
private |
A place to store the entire solution.
|
private |
Pointer to a moab skinner for finding temperature surfaces.
|
private |
Container for elems sorted by variable bin and materials.
|
private |
Save some topological data: map from surface handle to vol handle and sense.
|
private |
Maximum value of our variable for binning on a linear scale.
|
private |
Minimum value of our variable.
|
private |
Name of the MOOSE variable.