Skip to main content
3-Newcomer
April 7, 2016
Solved

Help with step function

  • April 7, 2016
  • 2 replies
  • 6043 views

I have a problem using a solve block with equations that change at a specific point in the solution.  I've attached an example file (Mathcad Prime 3.1) showing the problem and how I've solved it.  The scenario is two vessels connected in series.  The first vessel is initially full of water while the second vessel is empty.  At time = 0, a flow of a second fluid starts into vessel 1.  The overflow from vessel 1 goes into vessel 2.  When vessel 2 is filled, then the overflow from vessel 2 goes to a drain.  I want to calculate the volume fraction of the second fluid in each vessel with time.  The equation for the volume fraction in the second vessel changes once the vessel is filled (because it starts to drain.)  The way I came up with to handle this is using the step function, but it does some strange things.  I've included two solutions, the first showing the problem with the step function, the second showing my messy-looking way of handling the problem with the step function.  I'm wondering if there is a better way to handle this.

thx

Mike

Best answer by Fred_Kohlhepp

You can solve it in steps, three problems sequentially.

2 replies

19-Tanzanite
April 7, 2016

Many of us can't read a Prime 3.1 file. Could you also post it as a pdf.

mhanks3-NewcomerAuthor
3-Newcomer
April 7, 2016

I'm attaching a pdf version of my file.

24-Ruby IV
April 8, 2016

See please new solution in attach

23-Emerald I
April 8, 2016

You can solve it in steps, three problems sequentially.

mhanks3-NewcomerAuthor
3-Newcomer
April 8, 2016

OK - that clearly is a good way to handle this.  I was hoping for a single solve block, but this is much cleaner, and your result looks like what I expected.  My solution from the 2nd solve block looks a bit odd at the early times which makes me concerned there is still something strange going on in my worksheet that I haven't figured out.

Of course, this is a simplified version of the problem I'm working on, but I think I can calculate the corresponding start and end times in my full problem, so I may be able to reliably break it up this way.

Thx for the feedback.