Turn on suggestions

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

Showing results for

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

Showing results for

** Community Tip** - Learn all about the Community Ranking System, a fun gamification element of the PTC Community.
X

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

Dec 20, 2019
06:25 AM

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

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

Labels:

29 REPLIES 29

Dec 20, 2019
08:44 AM

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

Dec 20, 2019
08:44 AM

Hi,

Dec 23, 2019
03:06 AM

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

Dec 23, 2019
03:06 AM

Thanks very much !!

Dec 23, 2019
03:09 AM

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

Dec 23, 2019
03:09 AM

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

Jan 06, 2020
01:52 PM

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

Jan 06, 2020
01:52 PM

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

Jan 07, 2020
03:51 AM

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

Jan 07, 2020
03:51 AM

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?

Jan 07, 2020
08:10 AM

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

Jan 07, 2020
08:10 AM

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.

Jan 07, 2020
04:12 PM

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

Jan 07, 2020
04:12 PM

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

Jan 07, 2020
04:22 PM

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

Jan 07, 2020
04:22 PM

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

Jan 07, 2020
04:16 AM

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

Jan 07, 2020
04:16 AM

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

Jan 07, 2020
04:51 PM

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

Jan 07, 2020
04:51 PM

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

Jan 07, 2020
05:33 PM

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

Jan 07, 2020
05:33 PM

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

Dec 23, 2019
03:10 AM

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

Dec 23, 2019
03:10 AM

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

Dec 23, 2019
03:25 AM

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

Dec 23, 2019
03:25 AM

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

Dec 23, 2019
06:55 AM

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

Dec 23, 2019
06:55 AM

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?

Dec 23, 2019
06:58 AM

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

Dec 23, 2019
06:58 AM

Dec 23, 2019
07:51 AM

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

Dec 23, 2019
07:51 AM

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.

Dec 23, 2019
08:17 AM

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

Dec 23, 2019
11:10 AM

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

Dec 23, 2019
11:10 AM

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

Dec 23, 2019
03:54 PM

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

Dec 23, 2019
03:54 PM

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.

Jan 06, 2020
07:54 AM

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

Jan 06, 2020
07:54 AM

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?

Jan 06, 2020
10:00 AM

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

Jan 06, 2020
10:00 AM

- 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 :-).

Jan 06, 2020
10:04 AM

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

Jan 06, 2020
10:04 AM

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?

Jan 06, 2020
03:37 PM

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

Jan 06, 2020
03:37 PM

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

Dec 24, 2019
11:27 AM

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

Dec 24, 2019
11:27 AM

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

Dec 23, 2019
03:40 AM

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

Dec 23, 2019
03:40 AM

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?

Dec 23, 2019
03:58 AM

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

Dec 23, 2019
03:58 AM

my fault - was using a Boolean equals sign.

Dec 23, 2019
05:19 AM

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

Dec 23, 2019
05:19 AM

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

Jan 06, 2020
08:36 AM

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

Jan 06, 2020
08:36 AM

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?

Jan 06, 2020
10:15 AM

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

Jan 06, 2020
10:15 AM

Try integrating in reverse from Lretort to zero:

See attached.

Alan