# replace non-smooth discrete values with analytical function

I do have a Diffusion coefficient in a convection diffusion PDE which is discontinuous and looks like (concentration on the x-Axis):

For numerical reasons i use the integrated form:

I calculate the functions in beforehand and during my calculations i interpolate the diffusion coefficient depending on the actual concentration value on each grid point. Note that the function is discontinuous at x = 0.1 and x = 0.5

If i could fit an analytical function to the data i could avoid the interpolation at each time step and may speed up the calculation. Is that possible and would it make sense ? Which function would make sense ? something like:

myfun = somefunction*((u>=0.1) && (u<=0.5)


If your data is available on a uniform grid, you are unlikely to accelerate your computations: all you currently have to do is a single division $i=\lfloor x/\Delta x \rfloor$ to find which interval you're in, and a linear interpolation between data point $i$ and $i+1$. Pretty much any function that is not a low-order polynomial will cost far more than these operations.