Calculation of Jacobian for ode15s in hyperbolic/parabolic-Solver?
5 views (last 30 days)
Show older comments
I have implemented my own time integration method for a dynamic FEM-Simulation. I proceeded as in the hyperbolic.m, and now have to pass the Jacobian to my ode-solver. My PDE-Coefficient c depends on u. So like in pdehypdf.m, Line 37
if pdehyp.vc
pdehyp.K = K
end
and Line 25
[K,M]=assema(...,uFull,...)
I passed the u -dependent stiffness-matrix K .
My Question is now, if this is really the correct Jacobian?! I wonder whether this is that simple, because actually we have to calculate
d(K(u)u)/du .
But K(u) is only an approximation of this in Nonlinear FEM called "tangential stiffness matrix" d(K(u)u)/du , isn't it?
This is the reason, why an extra nonlinear solver pdenonlin.m exists for the steady nonlinear problem K(u)u=F, but I cannot find an analogon for the transient case?
0 Comments
Accepted Answer
Bill Greene
on 22 Feb 2014
Hi Lena,
Yes, you are correct that the Jacobian calculated in parabolic/hyperbolic is only approximate. However, in my experience, ode15s performs very robustly with this approximate Jacobian. In general, ode15s prefers to cut the step size rather than request a new Jacobian. If the problem is well-posed, I have not encountered a case where ode15s was not able to complete a solution in hyperbolic and parabolic. And, of course, the Jacobian is simply used as a predictor-- it doesn't affect the actual solution.
Yes, pdenonlin does have some additional methods for calculating approximate Jacobians but they are all slower than the approach used in parabolic and hyperbolic.
In fact, there is some commented out code in parabolic that you can experiment with if you like. If you change the line
doJacFinitDiff=false;
to
doJacFinitDiff=true;
ode15s will use the numjac routine to calculate an approximate Jacobian numerically. In my experiments, this is much slower than the currently-implemented approach in parabolic. The solutions are the same, of course. One of the main strengths of ode15s is that it will terminate if it can't calculate a solution to the user-requested accuracy at any time step.
Bill
More Answers (1)
Bill Greene
on 26 Feb 2014
If the Jacobian is a function of the dependent variables (or time), ode15s will typically call pdehypdf many times during a complete analysis. The number of times ode15s calculates and factors a new Jacobian is, by default, printed to the MATLAB command window when ode15s completes.
Bill
See Also
Categories
Find more on Ordinary Differential Equations 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!