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
- :
- Help to solve a non-linear ODE in mathCAD 15

Options

- 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

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

12-20-2019
06:25 AM

12-20-2019
06:25 AM

Help to solve a non-linear ODE in mathCAD 15

Hi,

I am attempting to dynamically model the behaviour of granular solids in a rotary kiln using known equations, however i am having trouble setting up the following ODEs in mathCAD for the model....can anyone help. I have included the key points i am trying to model in Mathcad.

boundary condition:

where h0 is a fixed value (say 10% of the value of R).

From the above i'm looking to be able to determine the bed height (h) at any axial location (z) along the kiln tube.

Subsequently equations for Cross section area of the granular bed and residence time of the granular transport through the kiln (as a function of bed depth (h)) follow on from this...

Cross section area:

Residence time

So essentially i am looking to use MatCAD to find the residence time (t), given fixed values for: n (rotation speed in rpm), R (radius of kiln in m), D (diameter of kiln in m), angle of repose of the material (beta), angle of inclination of the kiln (theta), mass flow rate (ms) , bulk density of material (rho), axial length of the kiln tube (z).

My initial attempt using ODEsolver block did not get that far and with limited success (see attached) and seems very temperamental depending on what values are used and cannot utilise units for the variables (hence why they are all unitless.

29 REPLIES 29

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

12-20-2019
08:44 AM

12-20-2019
08:44 AM

Re: Help to solve a non-linear ODE in mathCAD 15

Hi,

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

12-23-2019
03:06 AM

12-23-2019
03:06 AM

Re: Help to solve a non-linear ODE in mathCAD 15

Thanks very much !!

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

12-23-2019
03:09 AM

12-23-2019
03:09 AM

Re: Help to solve a non-linear ODE in mathCAD 15

is there anyway to do it using the specific units for the different variables?

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

01-06-2020
01:52 PM

01-06-2020
01:52 PM

Re: Help to solve a non-linear ODE in mathCAD 15

Units in ODE's in Mathcad 15 pose a significant challenge: take them out incorrectly and the problem is not properly scaled. One solution I found was to use the function "UnitsOf".

If you define a variable with a unit (L := 2 ft), to use it in an ODE it must have the units stripped. Clearly, dividing by inches, feet, or meters will create different values. Mathcad has a consistent unit system (when I type L = my version 15 would have defaulted to meters,) to get all the scaling correct, divide each expression by the function. So L becomes "L/UnitsOf(ft)". Note that "L/UnitsOf(L) would work as well EXCEPT if you have a unit mismatch the first expression would catch it, the second one would not. (If L had dimensions of velocity the first expression (UnitsOf(ft) would crash, the second would happily just strip the wrong units.

But ODE's in Prime can use units. . .

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

01-07-2020
03:51 AM

01-07-2020
03:51 AM

Re: Help to solve a non-linear ODE in mathCAD 15

Hmmm interesting... trying your example out for myself i get this:

is this correct? it still looks like it has defaulted to metres i.e 2ft = 0.61m?

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

01-07-2020
08:10 AM

01-07-2020
08:10 AM

Re: Help to solve a non-linear ODE in mathCAD 15

is this correct? it still looks like it has defaulted to metres i.e 2ft = 0.61m?

You are correct-- 2 ft has become 0.61, but there are no attached units. So your equation (ODE) will be rendered unitless but with proper scaling.

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

01-07-2020
04:12 PM

01-07-2020
04:12 PM

Re: Help to solve a non-linear ODE in mathCAD 15

The unitless values are dependent on the unit system chosen.

With unit system "U.S."you get:

But with unit system set to "S.I." you get:

Success!

Luc

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

01-07-2020
04:22 PM

01-07-2020
04:22 PM

Re: Help to solve a non-linear ODE in mathCAD 15

Thanks Luc!

The point I was trying to make is that to solve an ODE correctly it must be properly scaled; using the UnitsOf function ensures that Mathcad will scale the equation correctly into whichever default system is selected. The solution can then be "reunitized" by multiplying by UnitsOf(the correct type of dimension).

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

01-07-2020
04:16 AM

01-07-2020
04:16 AM

Re: Help to solve a non-linear ODE in mathCAD 15

applying what your units workaround to my current Mathcad 15 sheet i cant get it to run - see attached? what have i missed?

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

01-07-2020
04:51 PM

01-07-2020
04:51 PM

Re: Help to solve a non-linear ODE in mathCAD 15

There are a couple things I've noticed, tried hard to address; see comments pdf attached

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

01-07-2020
05:33 PM

01-07-2020
05:33 PM

Re: Help to solve a non-linear ODE in mathCAD 15

Your rotational speed may be a litle low. 1/3 of a rotation per minute apparently isn't enough, 333 rotations per minute does give a solution.

Mind that you don't have to use the UnitsOf function to cancel units, and 'rad' is a unitless 'unit' anyway. You can also divide the units out directly.

See below.

Then, with Dw reduced to 0.5 m,and the minus sign in front of the derivative removed, I get:

Success!

Luc

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

12-23-2019
03:10 AM

12-23-2019
03:10 AM

Re: Help to solve a non-linear ODE in mathCAD 15

thanks. - will this work using specific units with the variables?

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

12-23-2019
03:25 AM

12-23-2019
03:25 AM

Re: Help to solve a non-linear ODE in mathCAD 15

In Mathcad 15 and before you cannot have units with an Odesolve (unless they cancel out).

One of the advantages of Prime is that you can.

Success!

Luc

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

12-23-2019
06:55 AM

12-23-2019
06:55 AM

Re: Help to solve a non-linear ODE in mathCAD 15

tried putting the same thing into Mathcad prime (so i could use units as suggested) but i just get various errors... clearly its done a bit differently in prime and i am missing something - any help?

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

12-23-2019
06:58 AM

12-23-2019
06:58 AM

Re: Help to solve a non-linear ODE in mathCAD 15

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

12-23-2019
07:51 AM

12-23-2019
07:51 AM

Re: Help to solve a non-linear ODE in mathCAD 15

Prime is different than 15.

Did you translate the 15 file, or start a new file?

Can you post your Prime sheet? (Usually gets prompter and more focused help.

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

12-23-2019
08:17 AM

12-23-2019
08:17 AM

Re: Help to solve a non-linear ODE in mathCAD 15

tried to start a new one... see attached.

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

12-23-2019
11:10 AM

12-23-2019
11:10 AM

Re: Help to solve a non-linear ODE in mathCAD 15

You don't need guess values for an odesolve. Put all variable definitions above, out of the guess part of the solve block.

Success!

Luc

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

12-23-2019
03:54 PM

12-23-2019
03:54 PM

Re: Help to solve a non-linear ODE in mathCAD 15

Concerning the odesolve block it should make no difference if you define your constants inside the solve block or above. But if you define them inside, the values are not available below and outside of the solve block. So it may be a good idea anyway to define those constants above the block.

The reason for your solve block failing is the value of your variable R.w.

Compared to your Mathcad sheet you used different values for m.s and R.w in your Prime attempt.

Especially the low value 0.25 for R.w compared to the value 2 you had in Mathcad seems to make the solve block fail. It looks like (with the other values unchanged) R.w must be at least 0.502 or larger.

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

01-06-2020
07:54 AM

01-06-2020
07:54 AM

Re: Help to solve a non-linear ODE in mathCAD 15

Hi,

when i tried to put the relevant units in (ant altered the values accordingly) it didn't want to work - various warnings (see attached). Any pointers?

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

01-06-2020
10:00 AM

01-06-2020
10:00 AM

Re: Help to solve a non-linear ODE in mathCAD 15

- The initial conditions must be given with the appropriate units. Its not necessary to write 0m instead of just 0, but its good habit to do so, too
- The solve block fails if R is lower than 1.97 m. You'll have to check your equation or the other values assigned if you think that R=0,5m should yield a valid result. I notice that you changed several values compared to the file I posted (where R must had a value of at least 0.502).
- To plot with units on the abscissa you need to define a range variable. I have chosen z.plot as the name for this variable which is only to be used for plotting, but you can chose any name you like (even simply z :-).

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

01-06-2020
10:04 AM

01-06-2020
10:04 AM

Re: Help to solve a non-linear ODE in mathCAD 15

Hi,

thanks for this - i see how that works now.

I was also trying to alter the initial condition for Hz as its not correct and should be Hz(L)=0.01 rather than Hz(0)=0.01 however this doesn't seem to work? does something else need to be changed?

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

01-06-2020
03:37 PM

01-06-2020
03:37 PM

Re: Help to solve a non-linear ODE in mathCAD 15

@Pyros1111 wrote:

Hi,

thanks for this - i see how that works now.

I was also trying to alter the initial condition for Hz as its not correct and should be Hz(L)=0.01 rather than Hz(0)=0.01 however this doesn't seem to work? does something else need to be changed?

Alan already solved that. Its as simple as writing the desired inital condition in the solve block and set the "end" value to zero. No R can be a higher value, too.

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

12-24-2019
11:27 AM

12-24-2019
11:27 AM

Re: Help to solve a non-linear ODE in mathCAD 15

One other thing:

Theta and beta are angles I guess. You provided a large value for Theta that you did not intend: 40, that is 40 radians, not degrees!

Sad to say that when I change to 40 degrees and 3 degrees respectively, no solution is found...

Success!

Luc

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

12-23-2019
03:40 AM

12-23-2019
03:40 AM

Re: Help to solve a non-linear ODE in mathCAD 15

sorry to be a bother again but when i try and put this in it still doesn't seem to work properly for the last bit - says variable undefined??? any pointers on what im doing wrong?

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

12-23-2019
03:58 AM

12-23-2019
03:58 AM

Re: Help to solve a non-linear ODE in mathCAD 15

my fault - was using a Boolean equals sign.

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

12-23-2019
05:19 AM

12-23-2019
05:19 AM

Re: Help to solve a non-linear ODE in mathCAD 15

If constants and variables are dimensioned, they must be rendered dimensionless before the Odesolve block. After it, you can redimension them again.

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

01-06-2020
08:36 AM

01-06-2020
08:36 AM

Re: Help to solve a non-linear ODE in mathCAD 15

hi again,

thanks again for your previous reply - i have been looking over it and trying to use the more accurate values to see what comes out and noticed i had initially described the inmitial condition for the ODEsolver as Hx(0)=0.01, whereas what i wanted to do was define it as Hx(L) = 0.01. However, when i do this in the Mathcad (See attached) it doesn't work and says the endpoints cannot be the same in the solve block?

can you explain why and how to make it work for this end constraint please?

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

01-06-2020
10:15 AM

01-06-2020
10:15 AM

Re: Help to solve a non-linear ODE in mathCAD 15

Try integrating in reverse from Lretort to zero:

See attached.

Alan