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

[Structural] Adding SBM based on extension operators #12120

Merged
merged 12 commits into from
Mar 8, 2024

Conversation

rubenzorrilla
Copy link
Member

📝 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.

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);
Copy link
Member

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

Copy link
Member Author

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);
Copy link
Member

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

Copy link
Member Author

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);
Copy link
Member

Choose a reason for hiding this comment

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

Idem

Copy link
Member Author

Choose a reason for hiding this comment

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

(see my answer above)

///@name Operations
///@{

Condition::Pointer Create(
Copy link
Member

Choose a reason for hiding this comment

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

Missing doxygen

Copy link
Member Author

@rubenzorrilla rubenzorrilla Feb 29, 2024

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?

///@name Kratos Classes
///@{

template<std::size_t TDim>
Copy link
Member

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?

Copy link
Member Author

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(
Copy link
Member

Choose a reason for hiding this comment

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

Missing doxygen

Copy link
Member Author

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?


static constexpr std::size_t BlockSize = TDim;

static constexpr std::size_t LocalSize = NumNodes * TDim;
Copy link
Member

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)

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member

@loumalouomega loumalouomega left a comment

Choose a reason for hiding this comment

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

Comments

rubenzorrilla and others added 6 commits February 29, 2024 10:28
…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>
loumalouomega
loumalouomega previously approved these changes Feb 29, 2024
Copy link
Member

@loumalouomega loumalouomega left a 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.

Comment on lines +44 to +47
for node in self.GetComputingModelPart().Nodes:
dist = node.GetSolutionStepValue(KratosMultiphysics.DISTANCE)
if abs(dist) < tol:
node.SetSolutionStepValue(KratosMultiphysics.DISTANCE, 0, tol)
Copy link
Member

Choose a reason for hiding this comment

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

variable utils

Copy link
Member Author

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",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"extension_operator_type" : "MLS",
"extension_operator_type" : "mls",

Copy link
Member Author

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.

Copy link
Member

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 ;)

Copy link
Member Author

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).

Copy link
Member Author

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.

Copy link
Member

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)

Copy link
Member Author

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;
Copy link
Member

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

@rubenzorrilla
Copy link
Member Author

BTW, very nice job. I guess this is for FSI.

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.

@loumalouomega
Copy link
Member

BTW, very nice job. I guess this is for FSI.

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...

Copy link
Member

@philbucher philbucher left a 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 🤷

@rubenzorrilla
Copy link
Member Author

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).

@rubenzorrilla rubenzorrilla merged commit ab2ce58 into master Mar 8, 2024
15 of 17 checks passed
@rubenzorrilla rubenzorrilla deleted the structural/new-shifted-boundary-method branch March 8, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants