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

[SBM-IGA] Adding snake_sbm_utilities and test #13095

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

NickNick9
Copy link
Contributor

📝 Description

We have added a utility that enables the calculation of the surrogate model part. This utility will be used in the nurbs_sbm_modeler in one of the upcoming PRs.

It computes the surrogate nodes based on the skin boundaries, which can be either inner (one or more) or outer (only one), depending on the specifications in the ProjectParameters.

@NickNick9 NickNick9 requested review from a team as code owners February 4, 2025 17:16
@andrewgorgi andrewgorgi self-assigned this Feb 5, 2025
@NickNick9
Copy link
Contributor Author

-- Not ready --

@NickNick9
Copy link
Contributor Author

@rubenzorrilla
Now it is ready to be checked and approved

Comment on lines +10 to +11
// Main authors: Nicolo' Antonelli
// Main authors: Andrea Gorgi
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
// Main authors: Nicolo' Antonelli
// Main authors: Andrea Gorgi
// Main authors: Nicolo' Antonelli
// Andrea Gorgi

Copy link
Member

@rubenzorrilla rubenzorrilla left a comment

Choose a reason for hiding this comment

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

Amend the formatting issues as it is a bit annoying to go through it right now. Please take the observations I did so far into account while doing so. I'll do a follow up review once you fixed these.

On top of this, the API seems a bit complicated to me. Most probably this is what it is as we are creating a static utility. To confirm that doing it static is the way to go, can you please describe where is this intended to be called (I guess that in some sort of modeler).

SnakeSbmUtilities::CreateTheSnakeCoordinates(iga_model_part, skin_model_part_inner_initial, skin_model_part_outer_initial, skin_model_part, 0,
unique_knot_vector_u, unique_knot_vector_v, mParameters) ;

const double tolerance = 1.0e-6;
Copy link
Member

Choose a reason for hiding this comment

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

I'd put this a bit more strict.

SnakeSbmUtilities::CreateTheSnakeCoordinates(iga_model_part, skin_model_part_inner_initial, skin_model_part_outer_initial, skin_model_part, 0,
unique_knot_vector_u, unique_knot_vector_v, mParameters) ;

const double tolerance = 1.0e-6;
Copy link
Member

Choose a reason for hiding this comment

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

I'd put this a bit more strict.

SnakeSbmUtilities::CreateTheSnakeCoordinates(iga_model_part, skin_model_part_inner_initial, skin_model_part_outer_initial, skin_model_part, 0,
unique_knot_vector_u, unique_knot_vector_v, mParameters) ;

const double tolerance = 1.0e-6;
Copy link
Member

Choose a reason for hiding this comment

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

I'd put this a bit more strict.

Comment on lines +21 to +28
void SnakeSbmUtilities::CreateTheSnakeCoordinates(ModelPart& rIgaModelPart,
ModelPart& rSkinModelPartInnerInitial,
ModelPart& rSkinModelPartOuterInitial,
ModelPart& rSkinModelPart,
int rEchoLevel,
Vector& knotVectorU,
Vector& knotVectorV,
const Parameters mParameters) {
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
void SnakeSbmUtilities::CreateTheSnakeCoordinates(ModelPart& rIgaModelPart,
ModelPart& rSkinModelPartInnerInitial,
ModelPart& rSkinModelPartOuterInitial,
ModelPart& rSkinModelPart,
int rEchoLevel,
Vector& knotVectorU,
Vector& knotVectorV,
const Parameters mParameters) {
void SnakeSbmUtilities::CreateTheSnakeCoordinates(
ModelPart& rIgaModelPart,
ModelPart& rSkinModelPartInnerInitial,
ModelPart& rSkinModelPartOuterInitial,
ModelPart& rSkinModelPart,
int rEchoLevel,
Vector& knotVectorU,
Vector& knotVectorV,
const Parameters mParameters)
{

Please follow our standard. Do so for the rest of methods.

ModelPart& rSkinModelPartInnerInitial,
ModelPart& rSkinModelPartOuterInitial,
ModelPart& rSkinModelPart,
int rEchoLevel,
Copy link
Member

Choose a reason for hiding this comment

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

Why passing the echo level by argument if you are providing a parameters?

Vector startingPositionUV);

private:
///@name IGA functionalities
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
///@name IGA functionalities
///@name IGA functionalities

Stick to the fields we normally have to keep a consistent Doxygen compilation across Kratos.

using DistanceVector = std::vector<double>;
using DistanceIterator = std::vector<double>::iterator;
using DynamicBins = BinsDynamic<3, PointType, PointVector, PointTypePointer, PointIterator, DistanceIterator>;
using PointerType = DynamicBins::PointerType;
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
using PointerType = DynamicBins::PointerType;
using DynamicBinsPointerType = DynamicBins::PointerType;

PointerType is meaningless when browsing the code.

Comment on lines +134 to +135
double x_true_boundary0 = initial_condition.GetGeometry()[0].X();
double y_true_boundary0 = initial_condition.GetGeometry()[0].Y();
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
double x_true_boundary0 = initial_condition.GetGeometry()[0].X();
double y_true_boundary0 = initial_condition.GetGeometry()[0].Y();
const double x_true_boundary0 = initial_condition.GetGeometry()[0].X();
const double y_true_boundary0 = initial_condition.GetGeometry()[0].Y();

Comment on lines +167 to +171
if (isInner &&
(knot_span_uv[0][0] < 0 || knot_span_uv[0][0] >= n_knot_spans_uv[0] ||
knot_span_uv[1][0] < 0 || knot_span_uv[1][0] >= n_knot_spans_uv[1] ||
knot_span_uv[0][1] < 0 || knot_span_uv[0][1] >= n_knot_spans_uv[0] ||
knot_span_uv[1][1] < 0 || knot_span_uv[1][1] >= n_knot_spans_uv[1]) )
Copy link
Member

Choose a reason for hiding this comment

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

Please do this check in a separate function namely IsInside

Comment on lines +201 to +210
if (isInner)
if (mParameters["sbm_parameters"].Has("lambda_inner"))
lambda = mParameters["sbm_parameters"]["lambda_inner"].GetDouble();
else
lambda = 0.5;
else
if (mParameters["sbm_parameters"].Has("lambda_outer"))
lambda = mParameters["sbm_parameters"]["lambda_outer"].GetDouble();
else
lambda = 0.5;
Copy link
Member

Choose a reason for hiding this comment

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

I'd move this to a separate GetLambdaFunction.

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.

3 participants