cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Solve Block - Now a function of solving variable, too many arguments

SOLVED
Participant

Solve Block - Now a function of solving variable, too many arguments

I am wondering then how to fix this new problem. I have fixed the error for the basic file, but now I want to express the heat transfer not knowing the wall temperature but rather knowing the ambient temperature. The equations are not too bad to solve, but I'm having issues with the solve block having too many arguments after I made the functions of the variable I wish to solve for. I would like to put my conditions in as a function and get the feedback for the correct outlet temperature (assuming the thermal gradient isn't too large that the wall temperature varies greatly in the z direction along the pipe axis).

The issue is I would like to express the properties of any given substance as a function of temperature (or average temperature in most cases).

The excel spreadsheet (minus updating the properties) gives a correct answer by iterating through. The user needs to press the buttons several times until all errors are zero.

I know I can do this problem in excel or a programing language, but the outputs look messy. For my project homework I'd like to use Mathcad to express the given solution, that way it is more readily checked.

Any insight would be much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Solve Block - Now a function of solving variable, too many arguments

It is my impression that in Mathcad the while loop should repeat while the condition is true, and stop when it is false.

Thats the behaviour in any other programming language I know of, too.

The problem is again that you use the same name for different things as you did in your other sheet.

Chose different names for the higlighted variables.

The second time your loop is executed h_i is no function anymore because you redefined it as variable in the first run and therefore the error message. Its a shame that Prime is not more helpful in finding errors in programs.

temp.png

View solution in original post

16 REPLIES 16

Re: Solve Block - Now a function of solving variable, too many arguments

The problem are function definitions like the following one you are using.

02.12.png

You use a similar construction for other functions as well.

Use the error tracing in the calculation ribbon to see where the error stems from,

Re: Solve Block - Now a function of solving variable, too many arguments

A picture of the physical configuration might be useful.

TTFN

Re: Solve Block - Now a function of solving variable, too many arguments

How do I use the error tracing? It is 'grayed out' for me, i.e. I'm not able to press any buttons.

Re: Solve Block - Now a function of solving variable, too many arguments

I don't have access to a scanner currently (I'll try to upload on later).

I have a flow inside of a pipe. I want to know the outlet temperature at the end of some run. However, the heat transfer depends on the average properties (more specifically local properties), so I am calculating the heat transfer from the fluid to the pipe, the transfer of energy across the pipe, and the transfer of energy from the pipe to the ambient outside air/fluid.

Essentially, the energy lost by the fluid is equal to the energy given off to the environment for a hot flow in a pipe.

But, as i mentioned, we don't know the inside wall temperature of the pipe, nor the outside wall temperature of the pipe. If we guess the Temperature final out, we should be able to solve for the inner wall temperature of the pipe, then the outter wall temperature of the pipe, and then the ambient air. But as we know the ambient air temperature, we continue to guess the outlet fluid temperature until we have a solution, and there can only be one solution.

This is why I figured the solve block would work well for it.

Re: Solve Block - Now a function of solving variable, too many arguments

I would also like to ask, why this doesn't work, but the following version (my simplier trial of getting this to work) did.

Re: Solve Block - Now a function of solving variable, too many arguments

Open your sheet, chose ribbon Calculate, click in the expression which throws the error and type F9 for recalculate. Now you should be able to use the error tracing. When you press "First" the tracing buttons are greyed out again (which should not happen) and the cursor jumps to the region I showed in my previous post.

Re: Solve Block - Now a function of solving variable, too many arguments

Yes, it should. You probably have too many variables defined. Given set convection and conduction, there is only one unknown, which is the surface temperature. The continuity relationship ensures that energy is conserved, so the delta temperatures across each interface are strictly determined by the amount of heat transferred.

TTFN

To clarify, given the thermal conductivity between the fluid and the ambient, there can only be one value of heat that simultaneously satisfies all of the individual heat flows so that the sum of the delta Ts equals the delta between the fluid and the ambient. This would be the way I would solve the problem.

Re: Solve Block - Now a function of solving variable, too many arguments

It seems to work because this time you used different function names - h() for the function with 3 paraneters and h.i for the function with just one.

In the former sheet you used h.i for both.

Highlighted

Re: Solve Block - Now a function of solving variable, too many arguments

Ok, let me take a 360 on this and use the programming features in mathcad. I have redone the function and now I have the "must be a function" error again.

It is my impression that in Mathcad the while loop should repeat while the condition is true, and stop when it is false. So I go through the system by feeding an initial condition of Tfo (fluid outlet temperature). I then solve backwards through my system until I find the resulting Ambient Temperature that makes this Tfo true (there is only one answer). I then compare this calculated Ambient Temperature to my known ambient temperature condition. Then I use an if statment to feed/calculate a new outlet fluid temperature and as well sending the solution to a convergence. I also update the while loop condition. The while loop should then check this new condition and if it is true, go through again, but with now the new Tfo, (which is should be an increment of 0.001K larger or smaller). Once the while loop is satisfied, it should end, and then return my required values.

Announcements