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
Fix FEPointEvaluation for non-zero starting component #12786
Fix FEPointEvaluation for non-zero starting component #12786
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.
Thanks for fixing this bug. Strange that we never tested this case, it seems obvious. I have a suggestion that may (hopefully) simplify the code a bit. Can you check if that works?
{ | ||
bool found_base_element = false; | ||
for (component_in_base_element = 0; | ||
component_in_base_element < | ||
fe.element_multiplicity(base_element_number); | ||
++component_in_base_element, ++component) | ||
if (component == first_selected_component) | ||
{ | ||
found_base_element = true; | ||
|
||
if (component_in_base_element + n_components > | ||
fe.element_multiplicity(base_element_number)) | ||
same_base_element = false; | ||
break; | ||
} | ||
if (found_base_element == true) |
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.
Shouldn't this also work:
{ | |
bool found_base_element = false; | |
for (component_in_base_element = 0; | |
component_in_base_element < | |
fe.element_multiplicity(base_element_number); | |
++component_in_base_element, ++component) | |
if (component == first_selected_component) | |
{ | |
found_base_element = true; | |
if (component_in_base_element + n_components > | |
fe.element_multiplicity(base_element_number)) | |
same_base_element = false; | |
break; | |
} | |
if (found_base_element == true) | |
if (component + fe.element_multiplicity(base_element_number) > | |
first_selected_component) | |
{ | |
if (first_selected_component + n_components > | |
component + fe.element_multiplicity(base_element_number)) | |
same_base_element = false; | |
component_in_base_element = first_selected_component - component; |
d73e243
to
acc9fa6
Compare
Good catch, I rewrote this first and did not realize afterwards I could have used the existing loop. Fixed. |
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!
/rebuild |
As described in the changelog, this fixes a bug in FEPointEvaluation.
The FEPointEvaluation class always evaluated a solution starting at the component 0 of the selected vector-valued base element, even if a different component was selected by the caller. This has been fixed to correctly start evaluating at the selected component.
Reported in geodynamics/aspect#4356 and fixed by a workaround in ASPECT (also for older deal.II versions) in geodynamics/aspect#4360.