The Relative Error

Dear Juan,
I am a little confused about the relative error in your source code. The default value x_{ref} is set to 1e-10.
In your source code is minError https://github.com/devsim/devsim/blob/3d979d6a98685b2e51c15eebd20afdc1e643fc3a/src/Equation/Equation.cc#L40)
https://github.com/devsim/devsim/blob/3d979d6a98685b2e51c15eebd20afdc1e643fc3a/src/Equation/Equation.cc#L295
In my knowledges, the regular relative error is
relerr = \frac{ \Delta x }{x + x_{ref}}
Due to 1e-10 is very small, so I guess the solution x in your code has been scaled, such as
relerr = \frac{ \frac{\Delta x}{x} }{1 + \frac{x_{ref}}{x}}, where minError =\frac{x_{ref}}{x}
Is it right?

By the way, do you have plan to add this parameter to devsim.solve() that could be set by user in future release?

Best,
Tao

Hi @Tao

There is no scaling so it is just:

relerr = \frac{ \Delta x }{|x| + \text{minerror}}

So each solution variable is treated the same way with the same.

I’ve thought for a long time to change this, but I have not come up with a good idea. I assume that you would want to be able to set the minerror on a per solution variable basis?

This is the existing issue here:

If this is important to your work, please let me know.