From 26835a79fb1899a1e39ca8f1c049a40df7555fd9 Mon Sep 17 00:00:00 2001 From: David Schneider Date: Tue, 19 Sep 2023 23:41:36 +0200 Subject: [PATCH 1/3] Fix gradient layout in FE evaluation according to deal.II v 9.6 --- include/solid_mechanics/mf_nh_operator.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/solid_mechanics/mf_nh_operator.h b/include/solid_mechanics/mf_nh_operator.h index 0431791..a0395d8 100644 --- a/include/solid_mechanics/mf_nh_operator.h +++ b/include/solid_mechanics/mf_nh_operator.h @@ -871,10 +871,10 @@ NeoHookOperator::do_operation_on_cell(FECellIntegrator &phi) const { VectorizedArrayType sum = inv_jac[e][0] * - ref_grads[(d * dim + 0) * n_q_points + q]; + ref_grads[(d * n_q_points + q) * dim + 0]; for (unsigned int f = 1; f < dim; ++f) sum += inv_jac[e][f] * - ref_grads[(d * dim + f) * n_q_points + q]; + ref_grads[(d * n_q_points + q) * dim + f]; F[d][e] = sum; // since we already have the inverse Jacobian, @@ -883,10 +883,10 @@ NeoHookOperator::do_operation_on_cell(FECellIntegrator &phi) const // same otherwise) VectorizedArrayType sum2 = inv_jac[e][0] * - x_grads[(d * dim + 0) * n_q_points + q]; + x_grads[(d * n_q_points + q) * dim + 0]; for (unsigned int f = 1; f < dim; ++f) sum2 += inv_jac[e][f] * - x_grads[(d * dim + f) * n_q_points + q]; + x_grads[(d * n_q_points + q) * dim + f]; grad_Nx_v[d][e] = sum2; } F[d][d] += one; From a39eb6fa89f6f81fda15aafbf21daf44a99dd7f8 Mon Sep 17 00:00:00 2001 From: David Schneider Date: Tue, 19 Sep 2023 23:55:44 +0200 Subject: [PATCH 2/3] Backwards compatibility --- include/solid_mechanics/mf_nh_operator.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/solid_mechanics/mf_nh_operator.h b/include/solid_mechanics/mf_nh_operator.h index a0395d8..cccfc3e 100644 --- a/include/solid_mechanics/mf_nh_operator.h +++ b/include/solid_mechanics/mf_nh_operator.h @@ -871,10 +871,18 @@ NeoHookOperator::do_operation_on_cell(FECellIntegrator &phi) const { VectorizedArrayType sum = inv_jac[e][0] * +#if DEAL_II_GTE(9, 6, 0) ref_grads[(d * n_q_points + q) * dim + 0]; +#else + 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_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, @@ -883,10 +891,18 @@ NeoHookOperator::do_operation_on_cell(FECellIntegrator &phi) const // same otherwise) VectorizedArrayType sum2 = inv_jac[e][0] * +#if DEAL_II_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_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; From eea2d010aabba051ccec917b0d007ee90dd1ada9 Mon Sep 17 00:00:00 2001 From: David Schneider Date: Wed, 20 Sep 2023 08:17:22 +0200 Subject: [PATCH 3/3] Typo --- include/solid_mechanics/mf_nh_operator.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/solid_mechanics/mf_nh_operator.h b/include/solid_mechanics/mf_nh_operator.h index cccfc3e..07b5924 100644 --- a/include/solid_mechanics/mf_nh_operator.h +++ b/include/solid_mechanics/mf_nh_operator.h @@ -871,14 +871,14 @@ NeoHookOperator::do_operation_on_cell(FECellIntegrator &phi) const { VectorizedArrayType sum = inv_jac[e][0] * -#if DEAL_II_GTE(9, 6, 0) +#if DEAL_II_VERSION_GTE(9, 6, 0) ref_grads[(d * n_q_points + q) * dim + 0]; #else 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_GTE(9, 6, 0) +#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]; @@ -891,14 +891,14 @@ NeoHookOperator::do_operation_on_cell(FECellIntegrator &phi) const // same otherwise) VectorizedArrayType sum2 = inv_jac[e][0] * -#if DEAL_II_GTE(9, 6, 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_GTE(9, 6, 0) +#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];