From 3f479583c209077dacd7684f223cc62d3bf991f7 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 21 Apr 2023 18:08:08 -0600 Subject: [PATCH] Sort terms so that the bilinear form has ...phi_i * phi_j ... . --- examples/step-57/step-57.cc | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/examples/step-57/step-57.cc b/examples/step-57/step-57.cc index b1cc6f04f1..a282ea66b5 100644 --- a/examples/step-57/step-57.cc +++ b/examples/step-57/step-57.cc @@ -440,12 +440,13 @@ namespace Step57 { local_matrix(i, j) += (viscosity * - scalar_product(grad_phi_u[j], grad_phi_u[i]) + - present_velocity_gradients[q] * phi_u[j] * phi_u[i] + - grad_phi_u[j] * present_velocity_values[q] * - phi_u[i] - + scalar_product(grad_phi_u[i], grad_phi_u[j]) + + phi_u[i] * + (present_velocity_gradients[q] * phi_u[j]) + + phi_u[i] * + (grad_phi_u[j] * present_velocity_values[q]) - div_phi_u[i] * phi_p[j] - phi_p[i] * div_phi_u[j] + - gamma * div_phi_u[j] * div_phi_u[i] + + gamma * div_phi_u[i] * div_phi_u[j] + phi_p[i] * phi_p[j]) * fe_values.JxW(q); } @@ -454,13 +455,13 @@ namespace Step57 double present_velocity_divergence = trace(present_velocity_gradients[q]); local_rhs(i) += - (-viscosity * scalar_product(present_velocity_gradients[q], - grad_phi_u[i]) - - present_velocity_gradients[q] * present_velocity_values[q] * - phi_u[i] + - present_pressure_values[q] * div_phi_u[i] + - present_velocity_divergence * phi_p[i] - - gamma * present_velocity_divergence * div_phi_u[i]) * + (-viscosity * scalar_product(grad_phi_u[i], + present_velocity_gradients[q]) - + phi_u[i] * (present_velocity_values[q] * + present_velocity_gradients[q]) + + div_phi_u[i] * present_pressure_values[q] + + phi_p[i] * present_velocity_divergence - + gamma * div_phi_u[i] * present_velocity_divergence) * fe_values.JxW(q); } } -- 2.39.5