Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
implicit ode use for stiff problems

Subject: implicit ode use for stiff problems

From: Jonathan Nebauer

Date: 31 Jan, 2013 02:15:11

Message: 1 of 1


Firstly, thank-you to all who have replied to queries on this forum, the information has helped me a lot in the past.

I am solving a stiff system of ODE's, where the common approach is a mixed Crank-Nicolson/Adams-Bashforth formulation (Navier Stokes), using a spectral differential formation (matrix size square ~80). Using the AB/CN I'm still having difficulties with the stiffness, so I've moved into a fully implicit formulation to ease-up on time-step restrictions.

I would like to move the implicit, fixed-step formulation into and ode# setting, to make use of the adaptive-step capability. As can be seen from the code below, the operator matrix requires both the result of the previous step, as well as the current and future step size. Alternative formulatons would only require the past solution and the current step size.

The call-line for an explicit ode would be:
ode(@(t,u) somematrix(t)*u)

But I need something like:
ode(@(t,dt,u,uold) somematrix(t,dt)*somematrix(u,uold))

Is this possible? Is there any way to store the past result and time-step without repeated calls to evalin()/etc?



% Should be able to self-start the simulation with a two-step backward
% Euler, then move into 2nd order BDF
% Time-stepper:
for ii=1:length(t)-1
    if ii==1
        % 2-1/2step backward Euler
        % Use BDF 2nd order - expect a lot of sharp turning points
        unew=(3*I-2*dt*PHI*nu*LAP - 2*dt*PHI*advec(t(ii+1),alpha,beta,M,Tb,dU,U,dW,W,opts))\(4*u-uold);

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us