Get Help

Turn on suggestions

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
- :
- Problems with solving a system of 5 differential e...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-23-2013
09:08 AM

05-23-2013
09:08 AM

Hello PTC Community,

I have problems solving a system of 5 differential equations simultaneously by using ODESOLVE in Mathcad Prime 2.0. I tried other solvers too, but i have the most experience with odesolve. I just don't get the solver to work, no matter what I do. Could you please take a look at my file and tell me, if I have some Syntax-mistakes or anything like it.

The equations should be able to calculate the dispersion of gas, leaking out of a ruptured vessel in a cylindric form.

u represents the speed of the flowing gas

b is the radius of the cylinder

Theta is the angle between the direction of the gas and the horizon

c is the concentration of the leaking gas

T is the temperature of the flow

All those five dependent varibles depend on the independant variable sL, which represents the distance of the center of the cylindric flow to its origin at the ruptured vessel.

Am i maybe using the wrong solver? Any help or suggestions are greatly appreciated.

Tim

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

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

05-26-2013
10:37 AM

05-26-2013
10:37 AM

In spite of my earlier comment I have had a go at rearranging the equations. The process I followed was:

1. Collect together all terms multiplying a given derivative on the RHS.

2. Define ancillary functions for each of these.

3. Because dtheta/dw doesn't depend on the other derivatives replace this in the other equations by the functions on its RHS.

4. There are three equations that now contain only du/dw, db/dw and dT/dw, so solve for each of these explicitly (ie solve for du/dw, db/dw and dT/dw)

5. Create functions from each of these solutions (they have a common denominator)

6. Now odesolve works.

See attached.

I will almost certainly have made a midtake somewhere along the line, so you will need to repeat the process, rather than relying on my results. I've plotted the results, but I've no idea if they look sensible or not.

Alan

PS I'll have a quick look at your latest attempts shortly.

27 REPLIES 27

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

05-23-2013
11:31 AM

05-23-2013
11:31 AM

Re: Problems with solving a system of 5 differential equations 1st order

I couldn't spot a severe syntax error on first sight.

When I first open the file directly from you post I get an error telling me that the matrix of derivatives could not be created.

When I let the file recalculate or on saving it and reopening I get a different error: " Unknown error: exp%_too%_large".

So maybe its a bug in Prime or a limitation which should be dealt with. Prime is a work in progress, a rather unfinshed product and by no means can live up tp prior Mathcad versions like 15 or 14 (or 11 of course).

Unfortunately there is no way to save a file in MC15 format from within Prime and there is no converter available, so, as I'm not really that idle that I would retype the whole sheet, I cannot try if it would work in Mathcad 15.

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

05-23-2013
11:53 AM

05-23-2013
11:53 AM

Re: Problems with solving a system of 5 differential equations 1st order

We have problems with odesolve:

- in Mathcad 15 we can not work with units

- in Prime we have problems with lables of variables, functions and constants (find and see please my messages here about it).

And some litle remarks

- g is built-in constant

- do not use the = operator after the odesolve function

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

05-23-2013
12:04 PM

05-23-2013
12:04 PM

Re: Problems with solving a system of 5 differential equations 1st order

- in Mathcad 15 we can not work with units

which is rather annoying indeed as we have to use some nasty and unsatisfyable workarounds.

- in Prime we have problems with lables of variables, functions and constants (find and see please my messages here about it).

I remember that problem from some other threads. I looked over the expressions (but not with the necessary meticulousness, though) and didn't spot anything of that kind. Did you find some of these inconsistancies in Tim's file?

According to the error mesages thrown I guess the error to be something else.

- g is built-in constant

Tim redefined it at the top which should not do any harm.

- do not use the = operator after the odesolve function

Agreed, but deleting it does not change the situation.

Do you have the same problem in your Prime3 installation?

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

05-23-2013
12:12 PM

05-23-2013
12:12 PM

Re: Problems with solving a system of 5 differential equations 1st order

Thank you for your fast answer,

yes those are the two errors i do get as well. Do you have any idea how i can find those limitations? Or do I have to look at each term in separate?

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

05-23-2013
12:22 PM

05-23-2013
12:22 PM

Re: Problems with solving a system of 5 differential equations 1st order

Thank you, too for your fast answer.

Would you recommend to use a different type of solver, if odesolve has some known "bugs"?

I will look for your previous posting about the problems, thank you so far!

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

05-23-2013
12:38 PM

05-23-2013
12:38 PM

Re: Problems with solving a system of 5 differential equations 1st order

I am not sure. As you have possibly guessed I don't like Prime and so I lack experience using it. I'll stay with Mathcad 15 as long as possible.

I am not sure about the Prime bug or limitation and don't know how to verify unless someone from PTC will confirm.

Maybe you can try to simplify your huge expressions just to see if its a syntax issue. If the system gets somehow unsolveable at least the error message should change.

Its a pity we cannot try in MC15 as there is no converter available.

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

05-24-2013
09:13 AM

05-24-2013
09:13 AM

Re: Problems with solving a system of 5 differential equations 1st order

Hello Werner,

I was thinking, that maybe the solver starts at the right point, but it proceeds in the wrong direction. For Example if u take the speed u, it starts pretty fast at roundabout 400 m/s, but it will decrease now and not increase. Is there any way in mathcad, that i can tell the programme to go back and not forth, if you know what I mean.

Another way of solving this problem could be as u said the limitations. So if I want to do that, do I just define for example u(sL):=400m/s, 399.9m/s..3m/s before the solveblock, or is there a different way?

Regards,

Tim

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

05-24-2013
09:58 AM

05-24-2013
09:58 AM

Re: Problems with solving a system of 5 differential equations 1st order

AFAIK Mathcad takes the starting point from you initial conditions (in your case 0m) and the endpoint is set in the odesolve() command (in your file 100m). If the latter is smaller than the first it works backwards but it will always start at the points defined by your initial conditions. The solver cannot start at the "right point" as you demanded, as there is no "point" to start from - we don't know what u(100m) etc. will be.

Of course if you can define values for sL=100 you could change your initial conditions and use odesolve((),sL,0) to solve from 100 to 0.

Defining a range variable for sL should have no effect on the solving and would not make any sense.

And you cannot define a function as range as you sketched with u(sL):_....

My best guess (from the error messages thrown) still is that the problem has to do with the complexity of your equations. Not sure if MC15 would be able to deal with them.

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

05-24-2013
01:45 PM

05-24-2013
01:45 PM

Re: Problems with solving a system of 5 differential equations 1st order

Sometime I use an open program to see a part of ODEs solution:

Top Tags