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
- :
- Solve Block for vectors

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

05-25-2014
02:43 PM

05-25-2014
02:43 PM

Solve Block for vectors

Dear all

I am trying to solve a hydraulics problem where Tunnel section changes at fixed location.

While writing solve block for getting the water depth at particular location, I am getting error.

I guess, writing sove block as a function will help, but I am unable to figure it out.

Please have a look on the files.

I am unsing mathcad 14.

I have also attached same file as version 11.

thanks in advance

aprasun

Labels:

7 REPLIES 7

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

05-25-2014
04:35 PM

05-25-2014
04:35 PM

Re: Solve Block for vectors

Get rid of the vecor index j in the solve block, just use a normal variable and setup the block that way to be solved for single scalar values.

Then turn it into a function with f(yy,AA,PP,vv):=find(yy,AA,PP,vv)

I assumed that you replace y[j by yy, etc. as your sheet already use y, etc. for the vectors.

Then create the four vectors y,A, etc. with guess values and call f(y,A...), but you will have to vectorize this call (ctrl&-). You get a vector consisting of a couple (size of x) of quadrupels, representing the y,A,P and v values. You will have to write a small routine to create the "pure" vectors y,A,P and v themselves in case you need them in that structure.

EDIT: You must also add B_D, shape, R,Sf and Sf_av as arguments of the function f, as the solve block also depends on those vectors. Again, set it up as a solve block for single scalars first, then turn it into a function and call it vectorized.

EDIT2: Haven't yet downloaded your files and just opened the first one. Maybe a better approach is to make the solve block a function of j. You would have to try if that works.

EDIT 3: No, it doesn't. Furthe note: get rid of Sf_av, or turn it into a predefined function or use it as solved for variable!

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

05-25-2014
04:36 PM

05-25-2014
04:36 PM

Re: Solve Block for vectors

I'm puzzled about what you are trying to solve for. All the parameters in your "solve block" are either defined by your input data or directly derived from it. The head differences don't match the losses as you've defined them, but you haven't left any free parameters to solve for to make them match.

Alan

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

05-25-2014
05:16 PM

05-25-2014
05:16 PM

Re: Solve Block for vectors

Of course Alan is perfectly right with his remark. I guess I shouldn't just look for formal things 😉

Look if the attached helps.

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

05-26-2014
12:04 AM

05-26-2014
12:04 AM

Re: Solve Block for vectors

I am trying to get new water depth and this will change the values of flow area and Perimeter so that the energy equation gets satisfied.

The value of Sf, velocity and flow area and perimeter, all vary as we change water depth. This water depth is changed upto a point to satisfaction of Energy equation.

I have modified the file as per advice. Modified file is attached, but still with error....

A Prasun

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

05-26-2014
12:52 PM

05-26-2014
12:52 PM

Re: Solve Block for vectors

The attached works for a few sections, but fails to converge for all sections. Another solution method required!

Alan

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

05-26-2014
01:35 PM

05-26-2014
01:35 PM

Re: Solve Block for vectors

And here's an attempt at a sort of simple Euler type approach. It works for all sections, but I've no idea if the results are sensible!

Alan

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

05-27-2014
07:16 AM

05-27-2014
07:16 AM

Re: Solve Block for vectors

Alan

Modified file is attached for your reference. But this is also unable to converge for all sections, although first four solutions are perfectly fine.

The second file which you sent, was having some bug in calculation and this was the reason, we got depth at all sections.

please have a look and suggest ways to converge and get depths at all sections.

Thanks in advance

Ashok