Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hello,
I'm wondering if it is possible to set up a function to calculate the density from the Beattie Bridgeman Equation. The equation is pressure as a function of the specific volume and temperature. P(T,v). However, the answer I want is the density. I can solve it using a solve block, but would like to be able to express the solution as funtion. I.e; rho(T,P) = answer, where I just need to input the Temperature and Pressure. But as seen, the pressure is a function of the density.
I have attached the MathCad 15 sheet that has the function, but I'm unsure if I will need to use the mathcad programming to get an answer back in the way I would like. I don't know if there is a way to set up the solve block or solution such that I can have the expression be as above.
Solved! Go to Solution.
Alan,
Thank you for the response. As a question of how it is working; is the program making a loop in the definition? Are we circularly defining both the density(T,P) and P(T,density), but we are just giving it a starting place with the density?
If we are, I didn't know that would work.
You have defined the Pressure function above the Given ... Find solve block, so there is no need to define it again within the block. All we are doing is making sure it equates to the specified value, Pin.
The solve block uses an iterative method to find density, so it needs a starting value. This is the value of 1 kg/m^3 defined immediately above the word Given. Here, the same initial value is used whatever the conditions you are considering; however, this is probably ok for your application. If this restriction causes problems you could include the initial guess as an input argument to the function (but then you would need to call rho with rho(initial rho, T,P)
Basically, the solve block uses the intial value of rho and the input Temperature to calculate P(T,1/rho). It then compares this value with the input pressure, Pin. If they agree (to within a tolerance) then the block returns that value of rho. if it doesn't agree, it changes the value of rho and tries again. It repeats this process until it gets agreement.
Alan