Issue with odesolve() in Mathcad Prime 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Issue with odesolve() in Mathcad Prime 10
Hello everyone,
I am solving mass and energy balances for a CSTR using odesolve in a solve block in Mathcad Prime 10. The system includes species balances and an energy balance with the heat of the reaction. However, the solver is not working.
Are there specific issues with my guess values, constraints, or equation setup that I should check? Any guidance on properly structuring odesolve would be helpful.
Thanks!
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I "fixed" the unit mismatches in your equations - especially the bold "fix" in equation #4 sure is NOT CORRECT!
I just wanted to demonstrate that the solve block with odesolve works OK once you get your equations fixed.
With my 'fixes" the results of Ca, Cb and Cc all looks the same - presumably because of the equal initial value of 10 mol/cm^3.
I tried an initial value of 0 for Ca, but then the solve block fails. A value of 10^-15 was accepted.
Maybe k*Ca*Cb should be in the nominator of the fourth equation?
But as long as you did not fix the equations the correct way it does not make much sense to investigate any further.
Prime 10 sheet attached
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The solver is working OK, but you're not feeding it a (set of) differential equation(s).
I see a 'd' in front of some identifiers, clearly intended to denote a differential, but the parameter to which you want to differentiate isn't clear. Specifically I'm missing something like:
or
to denote e.g. the first derivative of the function Ca with respect to parameter t. You can find these differential operators in the ........Operators menu under the "Math' tab.
In addition something like:
confuses Prime. Is Ca a function of t (left hand side of the = ) or is it just a parameter, independent of t (right hand)?
I propose you look up examples of the use of odesolve in the Help system of Prime. Click the circled question mark on the top right of the Prime screen, and search for odesolve.
Further:
- If you want to use kJ as a unit, you should define it as a unit (Change its label to 'Unit'.) You find labels in the "style' part of the Math tab on the ribbon.
- You define an R, which is almost half of the (predefined) universal gas constant R, is that intentional?. Type R= and change the label of that R to a 'Constant' and you'll see.
- For Odesolve you don't need any guess values, but you do need initial conditions and they must be placed in the "Constraints' section of the solve block. You now have Ca(t)=0, but that isn't an initial condition. Ca(0)=0 could be an intial condition.
- The function plot() doesn't do what you (might) want. It's undefined. You may want to look up Plots from the menu. It starts with 'Insert plot'.
Success!
Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Do you mean your function dC_A(t,...) to be the derivative of the function Ca(t) ?
Which units are the functions Ca, Cb, and C supposed to return? All three mol/[volume] ?
T is obviously supposed to return a temperature.
Did you look up the example(s) about solving a system of differential equations in the help pages?
E.g. Task 3–4: Solving Multiple ODEs with Solve Blocks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here is how I think you intended to set up your system:
It fails because you have unit mismatches in all but the very first equation!
The second and third equation seem to be missing a factor V(t) in the first summand.
Not sure about the last equation. The first summand has the correct unit K/s, but the second one is way off wrt the units!!
To check the units you may define dummy functions which return the correct units
Then evaluate the right hand sides of your equations and see if there is an error.
I already added the V(t) in the second and third equation - not sure if this fix is the correct one !!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I "fixed" the unit mismatches in your equations - especially the bold "fix" in equation #4 sure is NOT CORRECT!
I just wanted to demonstrate that the solve block with odesolve works OK once you get your equations fixed.
With my 'fixes" the results of Ca, Cb and Cc all looks the same - presumably because of the equal initial value of 10 mol/cm^3.
I tried an initial value of 0 for Ca, but then the solve block fails. A value of 10^-15 was accepted.
Maybe k*Ca*Cb should be in the nominator of the fourth equation?
But as long as you did not fix the equations the correct way it does not make much sense to investigate any further.
Prime 10 sheet attached
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @engr_mkhalid,
I wanted to see if you got the help you needed.
If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Please note that industry experts also review the replies and may eventually accept one of them as solution on your behalf.
Of course, if you have more to share on your issue, please pursue the conversation.
Thanks,
Anurag
