Skip to main content
1-Visitor
May 25, 2014
Question

Solve Block for vectors

  • May 25, 2014
  • 2 replies
  • 3249 views

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

2 replies

25-Diamond I
May 25, 2014

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!

19-Tanzanite
May 25, 2014

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

25-Diamond I
May 25, 2014

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

Look if the attached helps.