Get Help

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Which Differential Solver do I need for my system?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-09-2011
04:19 PM

03-09-2011
04:19 PM

Which Differential Solver do I need for my system?

Hello,

I am trying to implement the Anaerobic Digestion Model No.1 (ADM1) in MathCAD. The model has 27 dynamic state variables, for which I have 27 1st order, non-linear differential equations. The model also implements a set of 9 implicit algebraic equations that must be satisfied.

I was able to set up a solve block and solve all of the equations with 'ODESOLVE', but when looking at the MathCAD help, I'm unclear whether this solver is able to handle non-linear systems.

The help says that ODESOLVE is only for linear systems, but then says it dynamically detects which solver to use depending on the system. One of the choices is rkfixed, which the help claims can solve non-linear systems.

The reason I ask is that while most of the variables are returning sensible values, a couple of the values that are calculated by the algebraic constraints are coming out negative. I have been troubleshooting reasons for this for a while now, and one of them is that maybe I am using the wrong solve function for my system.

Any thoughts would be greatly appreciated,

Donnie

Labels:

3 REPLIES 3

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-09-2011
04:35 PM

03-09-2011
04:35 PM

Re: Which Differential Solver do I need for my system?

Right-click on ODESOLVE and you should be able to choose from a selection of solvers - try them all!

Can you upload the worksheet? - difficult to give more specific advice without it.

Alan

Message was edited by: AlanStevens Correction! If you include algebraic constraints Odesolve automatically chooses the Radau solver - and you can't override this!

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-09-2011
05:27 PM

03-09-2011
05:27 PM

Re: Which Differential Solver do I need for my system?

Thanks for your response Alan.

I am seeing that it is forcing me into the Radau solver, does this mean it is capable of nonlinear? When I look into help I'm mostly just seeing how it can solve stiff systems with algebraic constraints, but no mention of its capability to handle nonlinear.

I have attached MC13 and MC15 versions of my file. I apologize as I'm new to MathCAD and so my sheet is a little messy.

The negative values are coming from my charge balance and I end up with a negative proton concentration in solution.

-Donnie

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

03-10-2011
04:46 AM

03-10-2011
04:46 AM

Re: Which Differential Solver do I need for my system?

Hell's bells and buckets of blood!!! That's not easy on the eye!

Donald Stallman wrote:

Thanks for your response Alan.

I am seeing that it is forcing me into the Radau solver, does this mean it is capable of nonlinear?

Yes - it* is* solving your equations - just not giving you the answers you want! (Incidentally, you don't need to specify the number of intervals as 200 - it works without specifying any number here).

Check and double check that your equations are correct (especially the signs of each term -especially SH). I don't have the domain knowledge to help there (nor the patience to trawl through all of them!).

There are some large instantaneous changes from initial values for some parameters - are you sure all your initial conditions are correct and consistent?

You could simplify the equation set somewhat. For example you could replace SHCO3 with Ka_co2.SIc(t)/(Ka_co2+SH(t)) everywhere it occurs inside the solve block, and just define it as a function outside the solve block. You could then reduce the number of variables to solve for. You could do this for some of your other constraint variables as well. Not that this will necessarily solve your problem, but it might make it easier to identify the problem.

I'll have another look when I have a little more time.

Alan