octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1D PDE solver for Octave


From: Carlo De Falco
Subject: Re: 1D PDE solver for Octave
Date: Tue, 5 Jul 2016 18:49:38 +0000

On 5 Jul 2016, at 20:32, Bill Greene <address@hidden> wrote:

> Regarding demo, I removed the non-working demo section from pde1d.m,
> created an "examples" directory, and put a single file "heatCond.m" in
> there.

I compared performance of your code to a solution of the same problem
with bim + daspk:

  >> tic, heatCond, toc
  warning: pde1d: User-defined initial conditions were changed to create a 
consistent solution to the equations at the initial time.
  Elapsed time is 1.26389 seconds.

  >> tic, mytest, toc
  Elapsed time is 1.05033 seconds.

on my system, though, most of the time is spent in producing the plot, so I 
tried
commenting out the plotting of the results in both examples, and I get:

  >> tic, heatCond, toc
  warning: pde1d: User-defined initial conditions were changed to create a 
consistent solution to the equations at the initial time.
  Elapsed time is 0.253297 seconds.

  >> tic, mytest, toc
  Elapsed time is 0.0677781 seconds.

This seems to confirm my previous knowledge that the mex interface is not very 
efficient.
If you don't want to learn Octave's C++ API, you might want to consider writing 
your code as 
m-files. The benefits would be:

- simplify distribution and installation
- trivially solve issues with complex coefficients

I do agree that sundials is many respects superior to daspk and/or lsode so an 
option
to keep using that is to do so via the new implementation of ode15s instead ...

What do you think about this?

c.


Attachment: mytest.m
Description: mytest.m


reply via email to

[Prev in Thread] Current Thread [Next in Thread]