Odd numerical artifact from ode15s where my dependent variable changes despite my derivative vector being zero for that time step.
2 views (last 30 days)
Show older comments
Hi
I am trying to chase down the origin of this numerical artifact that is messing up my 2d diffusion simulation. It shows up at a corner point in my grid after the first time step. At this point i am approximating the system with two forward 2nd order differences.
if(i==1)
ut(i)= D/dx^2*(u(i+2)-2*u(i+1)+u(i)) + ...
D/dy^2*(u(i+2*mesh_dim(1))-2*u(i+mesh_dim(1))+u(i));
I have a large if elseif structure so the corner point is only calculated once. At the end of pde code I put a break point and checked manually. All the neighboring points involved in the calculation of this point are the same value which would zero the time derivative. When my function is called again at the next time step a change was put in u(1). I needed to change the setting to format long to see it. From there it diffuses through the grid and messes up my solution.
Has anyone else seen this type of behavior and what is the cause. I am trying to step through the solver to identify where it is being introduced but it occurs after ode15s has called my function and was passed back a time derivative vector.
Any ideas?
[SL: edited to correct formatting of text]
0 Comments
Answers (1)
Steven Lord
on 5 Jan 2018
"All the neighboring points involved in the calculation of this point are the same value which would zero the time derivative."
How did you confirm this? Did you look at the values as they were displayed or did you use == or subtract the values to confirm they are exactly equal down to the last bit? From the fact that you said:
"I needed to change the setting to format long to see it."
that suggests the neighboring points were not the same value but were very, very close to the same value. Therefore the derivative would be very small but non-zero and the new value should be slightly different from the old value.
See Also
Categories
Find more on Eigenvalue Problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!