Hello all,
As Zapdos and Crane start being used for more complicated systems (e.g. gas mixtures), it's going to be very difficult to generalize the code to handle all possible jacobians. Our jacobians seem to be pretty much perfect for our use cases so far, but if we started adding more capabilities, like a linear model using streamline-upwind petrov-galerkin stabilization or a mixture-averaged diffusion model (like COMSOL!) where every heavy species diffusion coefficient depends on the concentration of every other species, I think it would be beneficial for everyone if we can write code that just works rather than spending days or weeks trying to get the perfect Jacobians.
Point being, I've started rewriting Crane and Zapdos with AD functionality (keniley1/zapdos, ad_kernels branch and keniley1/crane, ad_kernels branch). It seems to be working as advertised so far, which is really nice! I just have a couple questions:
1.) Does AD work with scalar variables and scalar kernels? I use Crane in 0D a lot so this could be useful.
There is support for doing AD with scalar variables in ADKernels, AD boundary conditions, and ADMaterials, (see moose/test/src/bcs/ADMatchedScalarValueBC.C) but there is not currently an ADScalarKernel. You could create an issue on idaholab/moose and assign me to it. It wouldn't be that much work to implement (you could even try it yourself if you wanted to).
2.) Does AD work with ParsedMaterials? I see ADFunctionDirichletBC in moose so I know it can work with functions in general, but I can't find any examples of it being used in a material. (Many rate coefficients are written in terms of functions that depend on electron temperature, so I would need AD to be able to account for that.)
I actually don't know the answer to the question about ParsedMaterials. I am cc'ing the MOOSE users list, hoping Daniel will answer this. It looks like he added some support to the FunctionParser contrib in libMesh.
Daniel does have
this ticket open on github, but I'm not quite yet sure what he wants yet :-)
3.) I noticed that there is no ADSplineInterpolation. Using ADLinearInterpolation to interpolate rate coefficients only causes a slight difference in the final densities so it's not a huge deal, but I'm assuming splines are more accurate. How hard would it be to add AD splines to moose?
Maybe Daniel's ticket actually is related to this. For all the Interpolation objects other than the LinearInterpolationTempl template, `sample` is hard-coded to accept `Real` arguments, and hence you cannot call it with an AD argument. But even for ADLinearInterpolation you're not going to get the derivative propagation that you might expect from an AD object. The reason for this is that the LinearInterpolation data is still stored as vectors of Reals. So the right way to get derivatives (conceptually) with any Interpolation object (including linear) is to apply the chain rule. E.g. if you have some property:
property = interpolation.sample(coupled_var);
then in order to get the Jacobian right you would need to do:
property = interpolation.sampleDerivative(coupled_var.value()) * coupled_var.derivatives();
The best example of this is in ADPiecewiseLinearInterpolationMaterial.C
--
You received this message because you are subscribed to the Google Groups "zapdos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zapdos-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/zapdos-users/574bbdd5-c298-4b36-83ac-72cda7249e46%40googlegroups.com.