# Calculation of Jacobian for ode15s in hyperbolic​/parabolic​-Solver?

4 ビュー (過去 30 日間)
Lena 2014 年 2 月 22 日
コメント済み: Lena 2014 年 2 月 26 日
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?

サインインしてコメントする。

### 採用された回答

Bill Greene 2014 年 2 月 22 日
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
##### 2 件のコメント表示非表示 1 件の古いコメント
Lena 2014 年 2 月 22 日
Hi Bill,
I have one question remaining: What do you mean by "Jacobian is simply used as a predictor"?
Does ode15s calculate a new Jacobian, although pdehypdf.m has been passed as the 'Jacobian' in odeset in hyperbolic.m ? Thank you very much!

サインインしてコメントする。

### その他の回答 (1 件)

Bill Greene 2014 年 2 月 26 日
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
##### 1 件のコメント表示非表示 なし
Lena 2014 年 2 月 26 日
But ode15s doesn't try to improve the (approximated) Jacobian itself, does it? If I get the Stats for ode15s / hyperbolic , e.g.
152 successful steps
31 failed attempts
251 function evaluations
1 partial derivatives
67 LU decompositions
250 solutions of linear Systems
the numbers 251 (or 250) give me the number of calls of pdehypdf and the number of calculations of a new Jacobian, is that correct? Thank you!

サインインしてコメントする。

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by