-
Notifications
You must be signed in to change notification settings - Fork 248
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] Extract computation of integration coefficients #12334
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.
Nice PR, quite some changes, but a very precise scope! I have one question left, I believe we discussed it already, but just double checking before approving
applications/GeoMechanicsApplication/custom_elements/U_Pw_small_strain_element.cpp
Show resolved
Hide resolved
@markelov208 FYI, this is Annes PR for making the lists for the integration coefficients. In the end, lists were only added for the CalculateAll functions, so you could follow a similar way in the CalculateMassMatrix function (note that the signature of the CalculateIntegrationCoefficient has changed, so it's a good idea to bring your branch up to date with master when this has merged). |
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 Anne, nice work: a single point PR, a step forward to change from the integration point level to the element level and to get rid of ElementVariables. I have only one question: why not to create a static function to calculate integration_coefficients?
Hi Gennady, good question. I have considered that, but then I realized that this is only an intermediate step. The aim is to have such a function available later, perhaps as part of an |
Hi Anne, thank you for the clarification. Can we put such a function into 'geometry.h'? The 'geometry' class has already integration points. I have personal interest in this function ;) to use it for CalculateMassMatrix; of course I can copy the statement. Kind regards, |
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.
The number of times you had to do the same action reveals how many copies exist within our code base. Your change looks to be consequently executed for all of them.
Remarks that I would like to make would without exception refer to the existing situation that you start improving here, so they would not be productive here.
Please go ahead and merge this, such that a next step can be taken.
// Compute weighting coefficient for integration | ||
Variables.IntegrationCoefficient = | ||
this->CalculateIntegrationCoefficient(IntegrationPoints, GPoint, Variables.detJ); | ||
Variables.IntegrationCoefficient = integration_coefficients[GPoint]; | ||
|
||
Variables.IntegrationCoefficientInitialConfiguration = this->CalculateIntegrationCoefficient( | ||
IntegrationPoints, GPoint, Variables.detJInitialConfiguration); |
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.
This piece of code seems to use the same function with the same input. Therefore I think that detJ == detJInitialConfiguration. In the new implementation storing the list of detJ for the integrationpoints would then avoid the second call to CalculateIntegrationCoefficient.
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'm not sure. ElementVariables::detJ
is taken from ElementVariables::detJContainer
, which is computed by calling member InitializeElementVariables
. ElementVariables::detJInitialConfiguration
on the other hand is computed by calling member CalculateKinematics
(which in turn calls member CalculateDerivativesOnInitialConfiguration
). So they are probably two different things. However, it is unclear to me where ElementVariables::detJInitialConfiguration
is being used and whether that is correct. To be investigated.
Calculation of the integration coefficient does not require the member function to be non-`const`. Also, these member functions were declared `virtual`, but never overridden.
To reduce the amount of duplicated code. As a result, the variables that store the result could be made `const`.
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 reduced the duplications, looks good to go to me!
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 consistent to me. No comments from my side.
📝 Description
Extracted the computation of a vector of integration points from the integration point loops in (virtually) all implementations of
CalculateAll
. Also modified a few function parameters types from reference to reference-to-const. In that way, it becomes clearer that the supplied object won't be modified by the callee.