-
Notifications
You must be signed in to change notification settings - Fork 244
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
[MPM] Moving enforcement of nonconforming SLIP from MPMBoundaryRotationUtility to to the relevant Condition #12018
Conversation
…nd setting a static pointer
Thanks Guozhen for creating this PR to discuss the topic. We like to refactor/clean the boundary rotation utility in MPM application and therefore move the rotations needed for the particle based conditions locally to the conditions. This is the idea we came up with. |
Hi @philbucher hi @sunethwarna |
I dont recommend Instead I recommend to check out how |
Check for what do you think @rubenzorrilla ? Seems like a similar application to me |
Thanks @philbucher for the feedback! I tried out your suggestion; unfortunately, a similar implementation to I understand your concern with the use of What are your thoughts on this? Do you have any other suggestions? |
I see, this is indeed a problem Can you post the error that you get when trying to add the serialization? I was not aware that this is not working, perhaps this needs a more global change. Other than that I also dont have good suggestions. It is indeed |
The issue lies with the However, even if this had worked, I'm personally not very comfortable with the idea since the current implementation of the rotation utility (with all members as const) suggests that it can neither be copied nor moved. There's two main issues I see here:
Perhaps a better solution would be to change the implementation of the rotation utility (including the base class) instead, i.e. to remove the Otherwise, I'm more inclined to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some general recommendations
} | ||
|
||
// Checking whether it is normal element or penalty element | ||
bool IsParticleBased(GeometryType& rGeometry) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Input should be const, otherwise you might accidentally allocate some data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it!
|
||
return is_penalty; | ||
} | ||
bool IsParticleBased(NodeType& rNode) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
{ | ||
if(this->IsSlip(rNode) ) | ||
{ | ||
const double identifier = rNode.FastGetSolutionStepValue(mrFlagVariable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usage of flag variables is outdated in favor of actual flags (like SLIP)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there's no existing Kratos flag that corresponds to this use case I guess I should define a new local flag via KRATOS_DEFINE_LOCAL_APPLICATION_FLAG
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could do that, but flags are a bit delicate in their usage (local and global flags that use the same bit will conflict with each other)
You could still use similar code, but I recommend a variable of type bool
and saved in the non-historical data. This can be accesses with GetValue
. The double in your current case is a leftover from when variables could not have other types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, thanks!
} | ||
|
||
if (CalculateStiffnessMatrixFlag == true) { | ||
MatrixType temp_matrix = ZeroMatrix(rLeftHandSideMatrix.size1(),rLeftHandSideMatrix.size2()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allocating such a large matrix on the fly can have a performance impact.
Maybe you can reuse an existing variable or modify in-place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll modify it in-place instead.
// Checking whether it is normal element or penalty element | ||
bool IsParticleBased(GeometryType& rGeometry) const | ||
{ | ||
for(unsigned int itNode = 0; itNode < rGeometry.PointsNumber(); ++itNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better iterate over the nodes directly with geometry.Points
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it
# Conflicts: # applications/MPMApplication/custom_conditions/particle_based_conditions/mpm_particle_base_condition.h
… RHS contributions from particle-based slip boundaries are expected to result in correct tangential contributions)
…f-ed RotationToolType
After some discussion with @VeronikaSinger, we decided to rotate the contributions of particle-based conditions back to the global frame of reference after correcting for SLIP to avoid complications with mis-aligned frames of reference. The cleanest way to do this involves minor modifications of the base transformation utility seen in the pull request here. I hope this is okay - the changes made do not affect the existing interface and functionality as far as I'm aware. I have also added a test case for penalty-based nonconforming slip, involving the motion of a block down a 15 degree incline with g = 10 m/s2. I'm currently facing some issues that only crops up in Windows: there's a linking error related to the
|
Thanks @philbucher :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, minor comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please make a separate PR for the core changes?
This is the standard procedure, then it usually gets reviewed and merged much faster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR created for core changes (#12327)
# Conflicts: # applications/MPMApplication/custom_strategies/schemes/mpm_residual_based_bossak_scheme.hpp # applications/MPMApplication/custom_utilities/mpm_boundary_rotation_utility.h # applications/MPMApplication/python_scripts/apply_mpm_slip_boundary_process.py
… into mpm/refactor_nonconforming_slip
# Conflicts: # kratos/utilities/coordinate_transformation_utilities.h
The core changes have been merged to master in #12327 and the resulting conflicts with the changes in this PR have been resolved. This PR, which now no longer contain core changes, is now ready to be merged. |
Thanks @gzjing for the changes. I tested several examples and it works as expected. |
Currently, the
MPMBoundaryRotationUtility
is used to enforce both conforming and non-conforming slip Dirichlet conditions. While this makes sense in the conforming case, for which the contributions of all conditions and elements need to be modified, this makes little sense in the case of non-conforming boundary conditions. Here, the modifications only concerns the relevant particle-based condition and may be implementation-specific. Hence, it is better for this to be done within the condition itself, especially since the current development of another particle Dirichlet condition based on Langrange multipliers would otherwise further complicate the code in the rotation utility.To do so, however, requires access to the
Rotate
method of the utility instance from all relevant condition objects. This is not possible in the current code, since this utility class is not static (because the base class in the core is not static) and the instance is currently only available as a member of theMPMResidualBasedBossakScheme
object.This PR presents a possible way of providing access via a static member pointer in
MPMParticleBaseCondition
to theMPMBoundaryRotationUtility
instance held by the scheme. This way, the pointer just needs to be set once in theInitialize
method call of the scheme to be made available to all condition instances.What are your thoughts on this? Are there any better ways that this can be done?