Add vacuum and reflective BCs using the MoabSkinner#1286
Add vacuum and reflective BCs using the MoabSkinner#1286meltawila wants to merge 5 commits intoneams-th-coe:develfrom
Conversation
|
Job Documentation, step Sync to remote on 585a259 wanted to post the following: View the site here This comment will be updated on new commits. |
|
Job Precheck, step Clang format on 7b6eb7b wanted to post the following: Your code requires style changes. A patch was auto generated and copied here
Alternatively, with your repository up to date and in the top level of your repository:
|
|
@aprilnovak this should be ready for review now |
| params.addParam<std::vector<BoundaryName>>("vacuum_bcs_surfaces", | ||
| "Sideset names/ids to assign vacuum BCs to"); | ||
| params.addParam<std::vector<BoundaryName>>("reflective_bcs_surfaces", | ||
| "Sideset names/ids to assign reflective BCs to"); |
There was a problem hiding this comment.
Question: does the code work with either names or IDs?
| { | ||
| auto namesToSidesetIDs = | ||
| [&](const std::vector<BoundaryName> & names, const std::string & param_name) | ||
| { |
There was a problem hiding this comment.
this inline function seems more complicated than it needs to be? it does not use the param_name input. Since you just call this right below, I'd suggest to get rid of this inline thing to simplify the code.
| { | ||
| const BoundaryID id = getMooseMesh().getBoundaryID(n); | ||
| if (!getMooseMesh().meshSidesetIds().count(id)) | ||
| mooseError("Boundary '", n, "' is not a sideset."); |
There was a problem hiding this comment.
Does this work properly if user provides IDs directly in the .i file?
| for (auto id : vac_ids) | ||
| if (ref_ids.count(id)) | ||
| mooseError( | ||
| "Same sideset ", id, " appears in both vacuum_bcs_surfaces and reflective_bcs_surfaces."); |
There was a problem hiding this comment.
Is this covered by a test?
| for (const auto * elem : getMooseMesh().getMesh().active_element_ptr_range()) | ||
| { | ||
| auto elem_to_moab_tets_it = _id_to_elem_handles.find(elem->id()); | ||
| if (elem_to_moab_tets_it == _id_to_elem_handles.end()) |
There was a problem hiding this comment.
does this ever get called or is this dead code?
| { | ||
| const moab::EntityHandle surf_set = surf_pair.first; | ||
| moab::Range tris; | ||
| check(_moab->get_entities_by_handle(surf_set, tris)); |
There was a problem hiding this comment.
what is this check checking?
| (!ref_tris.empty() && !moab::intersect(tris, ref_tris).empty()); | ||
|
|
||
| if (has_vacuum_tris) | ||
| check(_moab->add_entities(vac_group, &surf_set, 1)); |
There was a problem hiding this comment.
what is this check checking?
| if (has_vacuum_tris) | ||
| check(_moab->add_entities(vac_group, &surf_set, 1)); | ||
| if (has_reflective_tris) | ||
| check(_moab->add_entities(ref_group, &surf_set, 1)); |
There was a problem hiding this comment.
what is this check checking?
| input = openmc.i | ||
| csvdiff = 'all_vacuum.csv' | ||
| cli_args = 'UserObjects/moab/vacuum_bcs_surfaces="top bottom front back left right" Outputs/file/file_base="all_vacuum"' | ||
| requirement = "The system shall give identical Monte Carlo solution (file mesh tallies and k) when adding " |
There was a problem hiding this comment.
the requirement needs to be unique for each test. This is identical to the all_reflective test.
There was a problem hiding this comment.
and several other tests here, it looks like
| [] | ||
|
|
||
| allow_renumbering = false | ||
| parallel_type = replicated |
There was a problem hiding this comment.
Since you already have the restriction to replicated mesh in the tests file, you don't need to include it here
There was a problem hiding this comment.
A few questions/comments based on a first pass through this. I'll try to take a deeper look soon.
Also, while I'm not fully versed in the style conventions of this project, it seems like the function to add the boundary conditions would be more readable if broken into a number of smaller functions each with a clear semantic purpose.
| for (auto id : vac_ids) | ||
| if (ref_ids.count(id)) | ||
| mooseError( | ||
| "Same sideset ", id, " appears in both vacuum_bcs_surfaces and reflective_bcs_surfaces."); |
There was a problem hiding this comment.
Don't you want to test this sooner, ie. in the constructor?
| const auto ref_ids = namesToSidesetIDs(_reflective_bcs_surfaces, "reflective_bcs_surfaces"); | ||
|
|
||
| for (auto id : vac_ids) | ||
| if (ref_ids.count(id)) |
There was a problem hiding this comment.
Is there a simple way to use set logic to get all the overlapping ids at once and issue a single error with them all?
| for (const auto tet : elem_to_moab_tets_it->second) | ||
| { | ||
| moab::Range tri_faces; | ||
| check(_moab->get_adjacencies(&tet, 1, 2, true, tri_faces)); |
There was a problem hiding this comment.
Could also replace those magic numbers (1,2) with a variable that clarifies their purpose.
| } | ||
|
|
||
| void | ||
| MoabSkinner::addBoundaryConditionGroups() |
There was a problem hiding this comment.
I wonder if this would be simpler if the method only handled one of the boundary conditions at a time, and was called once for each boundary conditions (assuming that the user has requested it)
|
|
||
| const auto & boundary_info = getMooseMesh().getMesh().get_boundary_info(); | ||
|
|
||
| for (const auto * elem : getMooseMesh().getMesh().active_element_ptr_range()) |
There was a problem hiding this comment.
(Caveat: I'm not deeply familiar with this particular implementation of skinning, but am very familiar with the concept.) This whole loop appears to be almost like it's performing a skinning operation again. Could some of this information have been captured more easily during the process of skinning the mesh rather than going back after the fact to query the mesh again?
| const moab::EntityHandle moab_surface_meshset = surface_entry.first; | ||
| unsigned int surface_id = 0; | ||
| check(_moab->tag_get_data(id_tag, &moab_surface_meshset, 1, &surface_id)); | ||
| max_surface_id = std::max(max_surface_id, surface_id); |
There was a problem hiding this comment.
I wonder if it's more efficient to load all the surface meshset handles into a vector and get all the IDs in a single call to tag_get_data?
closes #1285