Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive for assignment of vacuum #805

Open
pshriwise opened this issue Apr 20, 2022 · 7 comments
Open

False positive for assignment of vacuum #805

pshriwise opened this issue Apr 20, 2022 · 7 comments

Comments

@pshriwise
Copy link
Member

@shimwell recently sent me an input with material assignments like "lower_vaccum_vessel", which DAGMC interpreted as a vaccuum assignment. This is caused by the following lines:

bool is_graveyard =
to_lower(grp_name).find(to_lower(graveyard_str)) != std::string::npos;
bool is_vacuum =
to_lower(grp_name).find(to_lower(vacuum_str)) != std::string::npos;

Prior to cc505bb, this would not have been a problem since only the presence of "Vacuum" (as opposed to "vacuum") in the material assignment would have triggered this behavior. This is still what I would call a bug, the corner case was just rarer.

I think we either need to document that "V/vacuum" should not be used in material names or only assign volumes a vacuum condition if the lowercase version of the name matches "mat:vacuum" exactly instead of searching for the presence of "vacuum", which is what happens in the lines linked above.

The word vacuum starts to look very strange after typing it so many times at this time of night.

@shimwell
Copy link
Member

Oh wow, I thought we squashed this bug a while back but I see how we didn't quite catch all the use cases. Looks like this is the difference between the current DAGMC used in OpenMC implementation and the version Shift implementation you are noticing @jbae11

I remembered not to call tags mat:vacuum. But I didn't recall the fix searched for the string vacuum in the entire material tag. Good to know, I can rename my tags.

Plus one vote for searching for a string that is equal to =="mat: vacuum" instead of finding vacuum in the string.

Material tags that would become a vacuum: 😀

mat:vacuum_vessel
mat:lid_of_vacuum_vessel
mat:not_a_vacuum
mat:partial_vacuum
mat:dyson_vacuum_cleaner
mat:area_needs_vacuuming

@pshriwise
Copy link
Member Author

I tend to agree, @shimwell -- I vote we use an exact match for those assignments.

@makeclean @gonuke any thoughts/feelings here?

@makeclean
Copy link
Contributor

makeclean commented Apr 20, 2022 via email

@pshriwise
Copy link
Member Author

pshriwise commented Apr 20, 2022

It's kind of a regression in that materials containing a lower-case "vacuum" trigger now also trigger this problem, yes, but I think the more general problem is that we're searching for "vacuum" instead of using an exact match. For example, use of the material name mat:VacuumVessel would also have caused that volume to be assigned a void/vacuum material before the switch to lowercase string comparisons.

I'm confident that the problem is in DAGMC proper, not the OpenMC interface. I have a DAGMC branch to this issue where an exact match is used and it fixed the problem in @shimwell's OpenMC simulation.

@gonuke
Copy link
Member

gonuke commented Apr 20, 2022

Looking back, this flaw has always been in this code. I'm all for the change you propose. Would it make sense to change vacuum_str to simply be mat:vacuum and then also change for a match rather than a find?

@pshriwise
Copy link
Member Author

I think vacuum_str is used in a couple of other places without the "mat:" bit. How about a new member variable, vacuum_mat_str?

@gonuke
Copy link
Member

gonuke commented Apr 20, 2022

I wasn't sure if the other uses were semantically different... ? or could deal with the redefined string.

Also - similar code exists in the mcnp_funcs.cpp interface and it might be good to update that for consistency. (or have the MCNP code rely on this??)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants