Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
I am trying to join two flow regimes (weir flow and orifice flow) into one continuous vector / function. For some reason its giving me an error and I not sure why. You will see that I designed a similar structure (see first program block) which also contains if statements i.e.comparing each array element in turn at least I think that is what it is doing? I believe all the units are correct for taking into the second programming block, so why dosn't the program structure return a array of values. Also is there a way to avoid having to vectorizing the result from a program block output i.e. placing the forward arrow above the result. I must admit I am not sure why I have to from a mathematical perspective but it seems to work. My main concern however is programming block 2.
Thanking you in advance.
Regards, Mark
Solved! Go to Solution.
Another point to note is that the definitions for Q.o & Q.w have index variable as a parameter while the Q.out function calls them with parameter h
Attached will run, but (as the D.orifice issue is not correctly resolved) he plot has a discontinuity.
Regards
Andy
Check units please
Another point to note is that the definitions for Q.o & Q.w have index variable as a parameter while the Q.out function calls them with parameter h
Attached will run, but (as the D.orifice issue is not correctly resolved) he plot has a discontinuity.
Regards
Andy
You really should be more careful with units and variable/function names!!
Thanks everyone I agree there are a lot of sloppiness here but I am so glad Prime wont accept sloppy unit definitions which is a good thing. Looks like one should avoid using range variables as function variables. Looking back I don't know why I did this I.e not a smart way to go. Many thanks to Mr. Westerman, as for the discontinuity I will have to resolve this I must retread the paper where I obtained these formulas. It is still not obvious why one has to vectorize results in some cases I hope the penny drops as to why and when to use this modifier.
It is still not obvious why one has to vectorize results in some cases I hope the penny drops as to why and when to use this modifier.
Maybe the pic with examples below helps.
If you are sure that your formulas don't conatain any operations defines differently for vector than for scalars (dot product) you may omit vectorization but if you don't want to check every formula you are on the safe side to use vectorization. You may use the vetorize operater when calling a function, but you may also vetcorize the function definition itself and can save the vectorization when calling.
As an alternative you can use a range variable to create the result vector w/o vetcorization or use a small program with a for-loop.