Starting with the navier-stokes module and the work that Corey had already done (
https://github.com/csdechant/zapdos/tree/WorkInProgress), I'm starting to take a look at adding SUPG to Zapdos. I
think I have a basic implementation working with just the EFieldAdvection term. Unless I'm mistaken, our form looks almost identical to the one derived by Andrea Rovinelli in this thread:
with the major difference being that our velocity term is \mu * -_grad_potential. Based on the equations shown in Andrea's post, we need to take the divergence of the advective flux term. My first question about SUPG concerns that term: do we need to take the gradient of \mu into account?
The second derivative of the potential and the derivative of the nonlinear variable are easy to include, but \mu is a bit more complicated. For electrons this is an interpolated quantity, so we need to explicitly describe derivative terms in the ADMaterial via the chain rule. I think I'm taking the gradient correctly. It looks like this:
for (unsigned int component = 0; component < 3; ++component)
{
_grad_muem[_qp](component).value() = _mu_interpolation.sampleDerivative(std::exp(_mean_en[_qp].value() - _em[_qp].value())) *
std::exp(_mean_en[_qp].value() - _em[_qp].value()) *
(_grad_mean_en[_qp](component).value() - _grad_em[_qp](component).value()) * _voltage_scaling;
}
It looks ugly, and the derivative of that with respect to the nonlinear variables is even uglier. Am I approaching this correctly?
Thanks,
Shane