-
Notifications
You must be signed in to change notification settings - Fork 250
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
[GeoMechanicsApplication] Extend the Check member function of the TransientPwLineElement #13151
Conversation
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.
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
KRATOS_ERROR_IF(GetProperties()[rVariable] < 0.0 || GetProperties()[rVariable] > MaxValue) | ||
<< rVariable.Name() << " has an invalid value at element " << Id() << std::endl; |
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.
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.
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.
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; | |||
} |
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.
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.
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 have changed the private function name and the error message. Now they are "CheckElementLength" and "Lenght".
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") |
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.
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.
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 think it will require an implementation of some kind of a wizard. We can create an issue for it.
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.
Thanks for adding the checks and the extensive test! I have a few comments, but nothing major
applications/GeoMechanicsApplication/custom_elements/transient_Pw_line_element.h
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_elements/transient_Pw_line_element.h
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/cpp_tests/custom_elements/test_pw_line_element.cpp
Show resolved
Hide resolved
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.
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?
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 go to me, thanks for processing the review comments!
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.
Good for me.
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; | ||
} | ||
} |
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.
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 " |
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 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.
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, it may happen. If we have a common manual, it can be stressed there.
📝 Description
A brief description of the PR.