-
Notifications
You must be signed in to change notification settings - Fork 252
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
[Structural] Adding SBM based on extension operators #12120
Conversation
...StructuralMechanicsApplication/custom_conditions/displacement_shifted_boundary_condition.cpp
Outdated
Show resolved
Hide resolved
...StructuralMechanicsApplication/custom_conditions/displacement_shifted_boundary_condition.cpp
Outdated
Show resolved
Hide resolved
const double w = GetValue(INTEGRATION_WEIGHT); | ||
const auto& r_N = GetValue(SHAPE_FUNCTIONS_VECTOR); | ||
const auto& r_DN_DX = GetValue(SHAPE_FUNCTIONS_GRADIENT_MATRIX); | ||
array_1d<double,3> normal = GetValue(NORMAL); |
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 would add a check of the norm being different of 0
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.
Fair enough. But rather than putting it in here (it will be evaluated at each iteration), I'd put it in the ShiftedBoundaryMeshlessInterfaceUtility
that calculates the normal values, so we only check it once.
const double w = GetValue(INTEGRATION_WEIGHT); | ||
const auto& r_N = GetValue(SHAPE_FUNCTIONS_VECTOR); | ||
const auto& r_DN_DX = GetValue(SHAPE_FUNCTIONS_GRADIENT_MATRIX); | ||
array_1d<double,3> normal = GetValue(NORMAL); |
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.
Idem for the norm check
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.
(see my answer above)
const double w = GetValue(INTEGRATION_WEIGHT); | ||
const auto& r_N = GetValue(SHAPE_FUNCTIONS_VECTOR); | ||
const auto& r_DN_DX = GetValue(SHAPE_FUNCTIONS_GRADIENT_MATRIX); | ||
array_1d<double,3> normal = GetValue(NORMAL); |
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.
Idem
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.
(see my answer above)
...StructuralMechanicsApplication/custom_conditions/displacement_shifted_boundary_condition.cpp
Outdated
Show resolved
Hide resolved
...StructuralMechanicsApplication/custom_conditions/displacement_shifted_boundary_condition.cpp
Outdated
Show resolved
Hide resolved
...StructuralMechanicsApplication/custom_conditions/displacement_shifted_boundary_condition.cpp
Outdated
Show resolved
Hide resolved
///@name Operations | ||
///@{ | ||
|
||
Condition::Pointer Create( |
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.
Missing doxygen
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.
Shouldn't we rely on the base class one as this is override
?
...s/StructuralMechanicsApplication/custom_conditions/displacement_shifted_boundary_condition.h
Show resolved
Hide resolved
...StructuralMechanicsApplication/custom_elements/small_displacement_shifted_boundary_element.h
Outdated
Show resolved
Hide resolved
///@name Kratos Classes | ||
///@{ | ||
|
||
template<std::size_t TDim> |
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.
No doxygen. Why Template in element but not in condition?, why only dimension and not the number of nodes?
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 condition uses the base Kratos Geometry
, for which the dimension and number of nodes make no sense. Indeed, the number of nodes is completely dependent on the cloud of points used for the calculation of the extension operator.
About the Doxygen, I'm adding it right away.
///@name Operations | ||
///@{ | ||
|
||
Element::Pointer Create( |
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.
Missing doxygen
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.
Shouldn't we rely on the base class one as this is override
?
...StructuralMechanicsApplication/custom_elements/small_displacement_shifted_boundary_element.h
Outdated
Show resolved
Hide resolved
...StructuralMechanicsApplication/custom_elements/small_displacement_shifted_boundary_element.h
Outdated
Show resolved
Hide resolved
|
||
static constexpr std::size_t BlockSize = TDim; | ||
|
||
static constexpr std::size_t LocalSize = NumNodes * TDim; |
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.
Okay you assume simplex (triangle + tetrahedra)
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.
Yes, at least for the moment since our main levelset calculation routines assume this.
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.
perhaps add some compiletime checks for the geometries it is used with? Or at least runtime
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.
Comments
…displacement_shifted_boundary_condition.cpp Co-authored-by: Vicente Mataix Ferrándiz <vmataix@altair.com>
…displacement_shifted_boundary_condition.cpp Co-authored-by: Vicente Mataix Ferrándiz <vmataix@altair.com>
…displacement_shifted_boundary_condition.cpp Co-authored-by: Vicente Mataix Ferrándiz <vmataix@altair.com>
…displacement_shifted_boundary_condition.cpp Co-authored-by: Vicente Mataix Ferrándiz <vmataix@altair.com>
…displacement_shifted_boundary_condition.cpp Co-authored-by: Vicente Mataix Ferrándiz <vmataix@altair.com>
…ub.com/KratosMultiphysics/Kratos into structural/new-shifted-boundary-method
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.
BTW, very nice job. I guess this is for FSI.
for node in self.GetComputingModelPart().Nodes: | ||
dist = node.GetSolutionStepValue(KratosMultiphysics.DISTANCE) | ||
if abs(dist) < tol: | ||
node.SetSolutionStepValue(KratosMultiphysics.DISTANCE, 0, tol) |
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.
variable utils
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 problem in here is the if
statement (as far as I understand we cannot pass the function to be evaluated). Indeed, I'd do an SBM version of the distance modification process (I left this for a future PR).
def GetDefaultParameters(cls): | ||
this_defaults = KratosMultiphysics.Parameters(r"""{ | ||
"conforming_basis" : true, | ||
"extension_operator_type" : "MLS", |
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.
"extension_operator_type" : "MLS", | |
"extension_operator_type" : "mls", |
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 put it in capital letters as it is an acronym. Note that changing it to lower case would imply changing the ShiftedBoundaryMeshlessInterfaceUtility
settings as well.
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 still recommend to change it, so far we do it for most acronyms too
Up to you ;)
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.
Fair enough. If we're changing it, I'll do it at once (note that this involves another PR as well as things that are already merged to the master
).
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.
@philbucher if this makes sense for you I'll proceed with the merge.
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.
this one is ok for me, but I would still add the check regarding the geometry (see my other 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.
Done.
|
||
static constexpr std::size_t BlockSize = TDim; | ||
|
||
static constexpr std::size_t LocalSize = NumNodes * TDim; |
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.
perhaps add some compiletime checks for the geometries it is used with? Or at least runtime
Thanks. Well, not necessarily for FSI, I'd say is more suitable for rapid prototyping, optimization, or any application involving large displacements/rotations of the boundaries. |
Indeed, you could use it for topological optimization avoiding remeshing... |
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.
did you try to make this work at compile time?
Just curious if it is possible 🤷
I did not even try because, as far as I understand, it is not possible. The point is that the geometry is assigned when constructing the element in runtime (or when declaring the prototypes). |
📝 Description
This PR adds a new variant of the Shifted Boundary Method (SBM) based on extension operators for structural mechanics (so far only static small displacement problems). This implementation leverages the utility previously merged in #10346.
Details can be found in here.