cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

SOLVED
Highlighted
Newbie

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

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

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions

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

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

## 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.

## 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

## 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?

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

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?

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

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!

## 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.

## 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

## 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.

## 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: