wgreene310 / pde1dm

1D PDE Solver for MATLAB and Octave written in m-code
GNU General Public License v3.0
7 stars 1 forks source link

mathworks heat eq example fails #4

Open dasergatskov opened 1 year ago

dasergatskov commented 1 year ago

Trying heat equation example from https://www.mathworks.com/help/matlab/ref/pdepe.html

It fails with:

octave:3> sol = pdepe(m,@heatcyl,@heatic,@heatbc,x,t)

[IDA ERROR]  IDASolve
  At t = 0, the linear solver setup failed unrecoverably.

error: IDASolve failed
error: called from
    ode15i at line 259 column 22
    solveTransient at line 253 column 21
    pde1dm at line 124 column 7
    pdepe at line 3 column 30

Quite possible that the issue is with ode15i. According to the same web page (See "Algorithm" section):

The time integration is done with the ode15s solver. pdepe exploits the capabilities of ode15s for solving the differential-algebraic equations that arise when the PDE contains elliptic equations, and for handling Jacobians with a specified sparsity pattern.

wgreene310 commented 1 year ago

For the m=1 (cylindrical) and m=2 (spherical) geometries, pdepe sets the left-end boundary condition to a zero-Neumann condition regardless of what the user has specified.

It is unclear to me that this is the best thing to do so have not done the same in pde1dm.

The referenced pdepe example actually sets the left-end BC to a nonsensical value knowing that it is irrelevant. In my opinion this is a big mistake in a tutorial like this one as it may mislead users in how to prescribe boundary conditions in general.

In the example, if you set ql = 1 instead of ql = 0, pde1dm will produce the correct result.