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

[GeoMechanicsApplication] Extend the Check member function of the TransientPwLineElement #13151

Merged
merged 11 commits into from
Feb 21, 2025

Conversation

markelov208
Copy link
Contributor

@markelov208 markelov208 commented Feb 19, 2025

📝 Description
A brief description of the PR.

  • extended Check function
  • extended CheckProperty function and changed the error message
  • added unit test for Check function

@markelov208 markelov208 self-assigned this Feb 19, 2025
Copy link
Contributor

@WPK4FEM WPK4FEM left a comment

Choose a reason for hiding this comment

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

Hi Gennady,
Thank you for the extensions, tried to look at it from a user that gets errors point of view. I think there is still a lot of improvement possible on the existing error messages, but that may require a different form of overriding the check functions.
See the remarks.
Regards, Wijtze Pieter

Comment on lines 201 to 202
KRATOS_ERROR_IF(GetProperties()[rVariable] < 0.0 || GetProperties()[rVariable] > MaxValue)
<< rVariable.Name() << " has an invalid value at element " << Id() << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's nice that the element number is given, but the information that leads the user to the right thing to correct is the property Id. Also it would be nice if the error message gives information about which boundary is violated, so information about the boundary value(s) and the value of the property. That required knowledge on whether the upper boundary is a physical one or the default from the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the user' eye. Property Id is added to the messages. Concerning the max possible value, right now I know only bout porosity. It will be nice to use physical limits then we need a table. Shall we discuss it?

@@ -162,7 +164,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) TransientPwLineElement : public Elem
<< "DomainSize smaller than " << min_domain_size << " for element " << Id() << std::endl;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Apparently "DomainSize" means something like element size ( from reading the test with coincident nodes ). Very unexpected naming for, but its in core so just use the GetGeometry().DomainSize(). However the error text can be clearer, i.s.o. of mentioning a DomainSize for an element of which no user has a clue what it is.

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 have changed the private function name and the error message. Now they are "CheckElementLength" and "Lenght".

Comment on lines 234 to 250
p_element->GetProperties().SetValue(BULK_MODULUS_SOLID, -1.0E6);
KRATOS_EXPECT_EXCEPTION_IS_THROWN(p_element->Check(dummy_process_info),
"Error: BULK_MODULUS_SOLID has an invalid value at element 4")

p_element->GetProperties().SetValue(BULK_MODULUS_SOLID, 1.0E6);
KRATOS_EXPECT_EXCEPTION_IS_THROWN(
p_element->Check(dummy_process_info),
"Error: BULK_MODULUS_FLUID does not exist in the material properties at element 4")

p_element->GetProperties().SetValue(BULK_MODULUS_FLUID, -1.0E6);
KRATOS_EXPECT_EXCEPTION_IS_THROWN(p_element->Check(dummy_process_info),
"Error: BULK_MODULUS_FLUID has an invalid value at element 4")

p_element->GetProperties().SetValue(BULK_MODULUS_FLUID, 1.0E6);
KRATOS_EXPECT_EXCEPTION_IS_THROWN(
p_element->Check(dummy_process_info),
"Error: DYNAMIC_VISCOSITY does not exist in the material properties at element 4")
Copy link
Contributor

Choose a reason for hiding this comment

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

There is an interdependency between the bulk moduli of solid, fluid an Biot modulus. The bulk moduli can be used to compute a Biot alfa modulus, that may set some requirements on the relative values of the bulk moduli.

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 think it will require an implementation of some kind of a wizard. We can create an issue for it.

Copy link
Contributor

@rfaasse rfaasse left a comment

Choose a reason for hiding this comment

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

Thanks for adding the checks and the extensive test! I have a few comments, but nothing major

Copy link
Contributor Author

@markelov208 markelov208 left a comment

Choose a reason for hiding this comment

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

Hi Wijtze-Pieter and Richard, many thanks for the reviews. I agree that it is better to have physical grounded limits for the checks. Shall we work on them later?

rfaasse
rfaasse previously approved these changes Feb 21, 2025
Copy link
Contributor

@rfaasse rfaasse left a comment

Choose a reason for hiding this comment

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

Looks good to go to me, thanks for processing the review comments!

Copy link
Contributor

@WPK4FEM WPK4FEM left a comment

Choose a reason for hiding this comment

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

Good for me.

Comment on lines 200 to 217
KRATOS_ERROR_IF_NOT(GetProperties().Has(rVariable))
<< rVariable.Name() << " does not exist in the pressure element's properties" << std::endl;
KRATOS_ERROR_IF(GetProperties()[rVariable] < 0.0)
<< rVariable.Name() << " has an invalid value at element " << Id() << std::endl;
<< rVariable.Name()
<< " does not exist in the material properties (Id = " << GetProperties().Id()
<< ") at element " << Id() << std::endl;
constexpr auto min_value = 0.0;
if (MaxValue.has_value()) {
KRATOS_ERROR_IF(GetProperties()[rVariable] < min_value ||
GetProperties()[rVariable] > MaxValue.value())
<< rVariable.Name() << " of material Id = " << GetProperties().Id() << " at element "
<< Id() << " has an invalid value " << GetProperties()[rVariable] << " which is outside of the range [ "
<< min_value << ", " << MaxValue.value() << "]" << std::endl;
} else {
KRATOS_ERROR_IF(GetProperties()[rVariable] < min_value)
<< rVariable.Name() << " of material Id = " << GetProperties().Id()
<< " at element " << Id() << " has an invalid value " << GetProperties()[rVariable]
<< " which is below the minimum allowed value of " << min_value << std::endl;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

In this way the user is really informed on what is wrong and has a chance of quickly fixing the input. Thank you.

p_element->GetProperties().SetValue(DENSITY_WATER, -1.0E3);
KRATOS_EXPECT_EXCEPTION_IS_THROWN(
p_element->Check(dummy_process_info),
"DENSITY_WATER of material Id = 0 at element 4 has an invalid value -1000 which is below "
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if material Id = 0 is something that a user created model would have. Non programmers usually start counting at 1. However, all functionality is properly covered here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it may happen. If we have a common manual, it can be stressed there.

@markelov208 markelov208 merged commit 412f6c5 into master Feb 21, 2025
11 checks passed
@markelov208 markelov208 deleted the geo/13000-extend-cehck-for-TransientPwLneElement branch February 21, 2025 12:25
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.

[GeoMechanicsApplication] Extend the Check member function of the TransientPwLineElement
3 participants