The interpretation of weight in integrate_difference is that it scales
the norm not the function being integrated. We therefore need to scale
the components of div u with the square root of the weight.
"with at least 'dim' components. In that case, this function "
"will take the divergence of the first 'dim' components."));
double sum = 0;
- // take the trace of the derivatives, square it, multiply it
- // with the weight function
+ // take the trace of the derivatives scaled by the weight and square it
for (unsigned int k=0; k<dim; ++k)
- sum += data.psi_grads[q][k][k] * data.weight_vectors[q](k);
+ sum += data.psi_grads[q][k][k] * std::sqrt(data.weight_vectors[q](k));
diff += sum * sum * fe_values.JxW(q);
}
diff = std::sqrt(diff);
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams