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

Fix FEPointEvaluation for non-zero starting component #12786

Conversation

gassmoeller
Copy link
Member

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.

Copy link
Member

@kronbichler kronbichler 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 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?

Comment on lines 753 to 768
{
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)
Copy link
Member

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:

Suggested change
{
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;

@gassmoeller gassmoeller force-pushed the fix_fepointevaluation_middle_component branch from d73e243 to acc9fa6 Compare October 3, 2021 13:19
@gassmoeller
Copy link
Member Author

Good catch, I rewrote this first and did not realize afterwards I could have used the existing loop. Fixed.

Copy link
Member

@kronbichler kronbichler left a comment

Choose a reason for hiding this comment

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

Thanks!

@kronbichler
Copy link
Member

/rebuild

@kronbichler kronbichler merged commit 436eeef into dealii:master Oct 3, 2021
@gassmoeller gassmoeller deleted the fix_fepointevaluation_middle_component branch October 4, 2021 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants