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

Remove the property storage of XFEM deleted element and side #17067

Merged
merged 1 commit into from
Feb 19, 2021

Conversation

jiangwen84
Copy link
Contributor

closes #17063

@moosebuild
Copy link
Contributor

moosebuild commented Feb 18, 2021

Job Documentation on 45339a1 wanted to post the following:

View the site here

This comment will be updated on new commits.

@jiangwen84
Copy link
Contributor Author

@rwcarlsen could you review this PR? Thanks.

Comment on lines +1433 to +1437

// remove the property storage of deleted element/side
(*_material_data)[0]->eraseProperty(elem_to_delete);
(*_bnd_material_data)[0]->eraseProperty(elem_to_delete);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there are several places in the XFEM class/file that you delete elements. And you remove boundary info, erase material properties, etc. along with the actual element deletions. Would it be better to have a special removeElem function that safely did all these things atomically? - That way you won't have to worry about forgetting to do any of these things whenever you are deleting elements. Or are the situations for element deletion different enough that they all need different subsets of things done?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct that there are other three places that call element deletion. However those deletion is for elements on the displaced mesh, and there is no need to remove their material properties because undisplaced and displaced mesh share same material properties.

@@ -255,13 +255,13 @@ class MaterialPropertyStorage
return _prop_names.count(retrievePropertyId(prop_name)) > 0;
}

/// Remove the property storage and element pointer from internal data structures
void eraseProperty(const Elem * elem);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a sentence to the doc comment saying "Use this when elements are deleted so we don't end up with invalid elem pointers (for e.g. stateful properties) hanging around in our data structures." - or something like that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add what you suggest. Thanks.

Comment on lines 194 to 199
/**
* Remove the property storage and element pointer from MaterialPropertyStorage data structures
*/
void eraseProperty(const Elem * elem) { _storage.eraseProperty(elem); };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a sentence to the doc comment saying "Use this when elements are deleted so we don't end up with invalid elem pointers (for e.g. stateful properties) hanging around in our data structures." - or something like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add what you suggest. Thanks.

@moosebuild
Copy link
Contributor

Job Modules Parallel on 45339a1 : invalidated by @jiangwen84

failure is not related to this PR

@rwcarlsen rwcarlsen merged commit 7b30e5a into idaholab:next Feb 19, 2021
@hugary1995
Copy link
Contributor

@rwcarlsen Not sure if you remember this -- we actually depend on this "manual" erasing of material properties to copy some material properties from an old element to a new element. If the material property storage is actually cleaned up on time, that'll break something in xfem.

@hugary1995
Copy link
Contributor

@rwcarlsen The related PR I was talking about is #16278 .

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

Successfully merging this pull request may close these issues.

Backup causes random failure for XFEM problems
4 participants