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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Odesolve solve block Variable still showing Undefined

ML_9447606
8-Gravel

Odesolve solve block Variable still showing Undefined

Am I missing something in the solve block? I tried not to extend the equations too much, for instance, Instead of typing out the full equation for h_tga, I define h_tga above then call for h_tga in equations 1,2 &3. Would I be better off typing all the variables **bleep** for tat?

3 REPLIES 3
Werner_E
25-Diamond I
(To:ML_9447606)

At first glace I see two problems:

 

1) You use function but omit the argument! That way its interpreted as variable! You have to write P.w(t), T.w(t), etc.

2) If you use that kind of "abbrevations" using auxiliary functions like P.w(t) which are dependent on the searched for functions like T.w(t), you must also let odesolve solve for these functions, too (and provide initial conditions).

So it may be better, not to use those aux functions.

A way to get around this problem and nonetheless use those aux functions could be this:

Define your functions above the solve block like this:

WE_2596071_0-1604364925717.png

and use this function in the solveblock that way:

WE_2596071_1-1604364991737.png

 

Using the workaround that you suggested, would I have it setup like the following then?

Werner_E
25-Diamond I
(To:ML_9447606)

When you click on the region with the error and go to the calculation ribbon menu, you have the option here to trace the error. If you do so, you are sent to this region:

Werner_E_0-1604591810729.png

There are a couple of problems:

1) You forgot to write Tw(t) instead of just Tw a couple of times

2) You would also have to define h.cwg to be a function of t, not just a variable

3) You can't define h.cwg(t) using T.w(t), because T.w(t) is not yet defined (you are just looking for it).

You could use the boolean = instead of the assignment, but if you do so, you would also include h.cwg in the least of functions you would like to find with odesolve.

A better approach IMHO is this:

As with P.w and P.g you define in front of the solve block

Werner_E_1-1604592357884.png

and use it in the solve block like

Werner_E_2-1604592411108.png

This may apply to other functions as well.

 

NOTE: Everything you define with an assignment operator ":=" should be placed outside and in (if necessary) in front of the solve block. And if it depends on the functions you are just looking for, you have to do it similar to what I just showed with h.cwg.

 

 

 

Announcements

Top Tags