-
Notifications
You must be signed in to change notification settings - Fork 244
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] Add normal heat flux boundary condition #11783
Conversation
- added tests for these classes
added acceptance tests
# Conflicts: # applications/GeoMechanicsApplication/tests/test_GeoMechanicsApplication.py
# Conflicts: # applications/GeoMechanicsApplication/geo_mechanics_application.cpp # applications/GeoMechanicsApplication/geo_mechanics_application.h
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 adding this code, it looks clean and readable!
I have some comments, mostly related to style and minor improvements. A proposition with some more work related to it would be adding more validations in the unit tests, instead of checking just one of the functions (I think it should be doable, but we can have a look!).
applications/GeoMechanicsApplication/custom_conditions/T_condition.cpp
Outdated
Show resolved
Hide resolved
if (rLeftHandSideMatrix.size1() != TNumNodes || rLeftHandSideMatrix.size2() != TNumNodes) { | ||
rLeftHandSideMatrix.resize(TNumNodes, TNumNodes, false); | ||
} | ||
noalias(rLeftHandSideMatrix) = ZeroMatrix(TNumNodes, TNumNodes); |
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.
Is it necessary to first resize the matrix before assigning a ZeroMatrix with a certain size? Same holds for the rRightHandSideMatrix
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 checked with the debugger. Yes, we have to resize before noalias because the latter does not change the matrix size. Without noalias we do not need this resize. Shall we avoid noalias?
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 don't know enough about the advantages of noalias. It might be more efficient, but I don't know if that's the case here as well. Do you have a suggestion @avdg81?
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.
My understanding is that the primary aim of the noalias
syntax is to eliminate temporaries where the programmer sees this can be done safely. From the ublas documentation (see the Section named "Aliases"):
Abstract formulas on vectors and matrices normally compose a couple of unary and binary operations. The conventional way of evaluating such a formula is first to evaluate every leaf operation of a composition into a temporary and next to evaluate the composite resulting in another temporary. This method is expensive in terms of time especially for small and space especially for large vectors and matrices. [...]
One may get serious side effects using element wise evaluation on vectors or matrices. [...]
Our solution for this problem (i.e. where during the evaluation elements are overwritten that affect other evaluations) is to evaluate the right hand side of an assignment into a temporary and then to assign this temporary to the left hand side. [...] By using this syntax (i.e.
noalias
) a programmer can confirm, that the left and right hand sides of an assignment are independent, so that element wise evaluation and direct assignment to the target is safe.
The documentation doesn't mention that using noalias
prevents resizing of vectors and matrices, as observed by @markelov208. I need to investigate that behavior in more detail first before making any statements about that. However, for this particular case, where we assign a zero matrix, I don't directly see any benefit in using noalias
. Therefore, I would suggest to remove the noalias
here, as well as the preceding resizing operation, since it is confusing and not strictly necessary. Do you agree @markelov208 and @rfaasse?
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 agree with removing noalias in that case
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 removed resize and noalias
applications/GeoMechanicsApplication/custom_conditions/T_condition.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_conditions/T_normal_flux_condition.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_conditions/T_normal_flux_condition.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/test_t_normal_flux_condition.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/test_t_normal_flux_condition.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/test_transient_thermal.py
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/test_transient_thermal.py
Outdated
Show resolved
Hide resolved
- removed "start_time" from solver_settings - added Geo prefix
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 Richard for the valuable comments. Hope all your comments are resolved now.
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 a lot for adding the extra unit tests, these are quite some work to figure out how to do it and how to test for the values, but this creates a nice safety net!
I have a few minor comments left, but nothing blocking
applications/GeoMechanicsApplication/tests/cpp_tests/test_t_normal_flux_condition.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/cpp_tests/test_t_normal_flux_condition.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/test_GeoMechanicsApplication.py
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_conditions/T_condition.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/cpp_tests/test_t_normal_flux_condition.cpp
Outdated
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.
Richard, once again thank you for the thorough review.
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 all the hard work, it looks good to me now (but let's wait for the approval of @WPK4FEM 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.
Richard and Wijtze Pieter, almost last changes. There are still two comments I would like to talk tomorrow. Thank 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.
Nicely done! Ready for merge!
📝 Description
A brief description of the PR.
Please mark the PR with appropriate tags:
🆕 Changelog
Please summarize the changes in one list to generate the changelog:
E.g.