cadet / CADET-Core

A modular, fast, and accurate simulation framework for (bio)chemical processes
Other
53 stars 25 forks source link

Specific particle geometry sensitivities disabled in DG units #214

Open jbreue16 opened 2 months ago

jbreue16 commented 2 months ago

The DG method is implemented using matrix operators (Eigen library matrices) with double scalar type. For the particle transport, we construct a matrix of the form $M=M' r + M^{''} r^2 + M^{'''} \Delta_r $, ie. we'd either need an active type matrix or three double type matrices from which we compute M in each residual call. The latter results in less performant code and thus requires an implementation specific to when this sensitivity is computed. Having active scalar type matrices raises the issue of matrix vector arithmetics with multiple scalar types (not supported by Eigen library). Hence, this would alse require extensive type casting just for this special case. Either way, thats a lot of ugly code in the sense that it reduces readability, hinders maintenance.

We've thus decided to not fix this, users must fall back to using the FV discretization for this sensitivity. Unsupported sensitivities for the reasoning explained above are:

PARTICLE_RADIUS PARTICLE_CORE_RADIUS

For 2D models we additionally cannot compute sensitivities for COLUMN_RADIUS COL_DISPERSION COL_DISPERSION_RADIAL

lieres commented 2 months ago

I think this is fine at the moment. We could add to the documentation that these sensitivities can also be approximated with finite differences. This was always required for the section switch times, also with the finite volume discretization.