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
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!
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.
Of course Alan is perfectly right with his remark. I guess I shouldn't just look for formal things 😉
Look if the attached helps.
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....
The attached works for a few sections, but fails to converge for all sections. Another solution method required!
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!
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