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 gradient layout in FE evaluation according to deal.II v 9.6 #63

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions include/solid_mechanics/mf_nh_operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -871,10 +871,18 @@ NeoHookOperator<dim, Number>::do_operation_on_cell(FECellIntegrator &phi) const
{
VectorizedArrayType sum =
inv_jac[e][0] *
#if DEAL_II_VERSION_GTE(9, 6, 0)
ref_grads[(d * n_q_points + q) * dim + 0];
#else
Comment on lines +874 to +876

Choose a reason for hiding this comment

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

@davidscn Is the original code also affected? If yes could you create a PR there as well?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I was not sure whether this code is currently maintained..

ref_grads[(d * dim + 0) * n_q_points + q];
#endif
for (unsigned int f = 1; f < dim; ++f)
sum += inv_jac[e][f] *
#if DEAL_II_VERSION_GTE(9, 6, 0)
ref_grads[(d * n_q_points + q) * dim + f];
#else
ref_grads[(d * dim + f) * n_q_points + q];
#endif
F[d][e] = sum;

// since we already have the inverse Jacobian,
Expand All @@ -883,10 +891,18 @@ NeoHookOperator<dim, Number>::do_operation_on_cell(FECellIntegrator &phi) const
// same otherwise)
VectorizedArrayType sum2 =
inv_jac[e][0] *
#if DEAL_II_VERSION_GTE(9, 6, 0)
x_grads[(d * n_q_points + q) * dim + 0];
#else
x_grads[(d * dim + 0) * n_q_points + q];
#endif
for (unsigned int f = 1; f < dim; ++f)
sum2 += inv_jac[e][f] *
#if DEAL_II_VERSION_GTE(9, 6, 0)
x_grads[(d * n_q_points + q) * dim + f];
#else
x_grads[(d * dim + f) * n_q_points + q];
#endif
grad_Nx_v[d][e] = sum2;
}
F[d][d] += one;
Expand Down