# UDF saturation temperature (evaporation model Fluent)

 Register Blogs Members List Search Today's Posts Mark Forums Read

 June 18, 2019, 04:24 UDF saturation temperature (evaporation model Fluent) #1 New Member   Join Date: May 2019 Posts: 6 Rep Power: 4 Hi everyone, I want to simulate the evaporation of water with VOF model (water-liquid to water-vapor). I am using the evaporation-condensation model. In this model, we can put the desired saturation temperature (373.15 K for water). However this value is not always constant because it can change with pressure. I want to evaporate water by decreasing the pressure. That's why I want to create a UDF to compute this saturation temperature in function of pressure (if pressure decreases, the saturation temperature decreases too...). Here what I wrote (but nothing happens) : #include "udf.h" DEFINE_PROPERTY(saturation_temp,c,t) { real sat_t; real vapor_p; real static_p = C_P(c,t); real operating_p = RP_Get_Float("operating-pressure"); vapor_p = static_p + operating_p; // absolute pressure = static pressure + operating pressure sat_t = (1723.6425/(8.05573-log(vapor_p/133.322))-233.08)+273.15; // Pressure in Pa to mmHg (Yaws) return sat_t; } I cannot find something about it, I do not know if I have to use DEFINE_PROPERTY... Can anyone help me? Thanks in advance!

 June 19, 2019, 00:03 #2 Senior Member   Alexander Join Date: Apr 2013 Posts: 1,723 Rep Power: 28 you should hook your UDF change constant 373.15K to your UDF function best regards

June 19, 2019, 03:28
#3
New Member

Join Date: May 2019
Posts: 6
Rep Power: 4
Quote:
 Originally Posted by AlexanderZ you should hook your UDF change constant 373.15K to your UDF function best regards
Hi AlexanderZ, thank you for your answer but I forgot to say that I have compiled and hooked my UDF to the saturation temperature...
So the problem is still here. Do you think a DEFINE_PROPERTY is ok to define the temperature?

Last edited by bbarbier07; June 19, 2019 at 04:28.

 June 20, 2019, 00:45 #4 Senior Member   Alexander Join Date: Apr 2013 Posts: 1,723 Rep Power: 28 yes it is OK try this Code: ```#include "udf.h" DEFINE_PROPERTY(saturation_temp,c,t) { real sat_t; real vapor_p; real static_p; real operating_p; static_p=C_P(c,t); operating_p = RP_Get_Float("operating-pressure"); vapor_p = static_p + operating_p; // absolute pressure = static pressure + operating pressure sat_t = (1723.6425/(8.05573-log(vapor_p/133.322))-233.08)+273.15; // Pressure in Pa to mmHg (Yaws) return sat_t; }``` best regards

June 20, 2019, 03:30
#5
New Member

Join Date: May 2019
Posts: 6
Rep Power: 4
Quote:
 Originally Posted by AlexanderZ yes it is OK try this Code: ```#include "udf.h" DEFINE_PROPERTY(saturation_temp,c,t) { real sat_t; real vapor_p; real static_p; real operating_p; static_p=C_P(c,t); operating_p = RP_Get_Float("operating-pressure"); vapor_p = static_p + operating_p; // absolute pressure = static pressure + operating pressure sat_t = (1723.6425/(8.05573-log(vapor_p/133.322))-233.08)+273.15; // Pressure in Pa to mmHg (Yaws) return sat_t; }``` best regards
I tried it and it is the same result, nothing happens.
Actually I want to evaporate water liquid (to water vapor) in a 2D container by warming the bottom wall. I did it correctly with the saturation temperature as a constant but when I replace with my UDF nothing happens, there is no water vapor. I should get the same result as the case with a constant...
If you have another idea thanks in advance...
Best regards

 June 20, 2019, 21:19 #6 Senior Member   Alexander Join Date: Apr 2013 Posts: 1,723 Rep Power: 28 Code: ```#include "udf.h" DEFINE_PROPERTY(saturation_temp,c,t) { return 373.15; }``` try this, if it works, than you'll get the same result as before -> which means UDF works well best regards

 June 21, 2019, 03:44 #7 New Member   Join Date: May 2019 Posts: 6 Rep Power: 4 I tried it, it works well so UDF works but not the one function of pressure... Best regards

 June 21, 2019, 05:03 #8 Senior Member   Alexander Join Date: Apr 2013 Posts: 1,723 Rep Power: 28 1. try with othe temperature 300, 400 2. try this Code: ```#include "udf.h" DEFINE_PROPERTY(saturation_temp,c,t) { real sat_t; real vapor_p; vapor_p = C_P(c,t) + op_pres; // absolute pressure = static pressure + operating pressure sat_t = (1723.6425/(8.05573-log(vapor_p/133.322))-233.08)+273.15; // Pressure in Pa to mmHg (Yaws) return sat_t; }``` best regards

 June 21, 2019, 05:54 #9 New Member   Join Date: May 2019 Posts: 6 Rep Power: 4 I have found the solution! Actually, there were 2 problems in my UDF. The first one was the operating pressure: change Float to Real. The second was with the "log": the correct formulation for a variable is "double log10 (double x)". You can find the final code: #include "udf.h" DEFINE_PROPERTY(saturation_temp,c,t) { real sat_t; real vapor_p; real static_p = C_P(c,t); real operating_p = RP_Get_Real ("operating-pressure"); vapor_p = static_p + operating_p; // absolute pressure = static pressure + operating pressure sat_t = (1723.6425/(8.05573-((double)log10((double)vapor_p/133.322)))-233.08)+273.15; // Pressure in Pa to mmHg (Yaws) return sat_t; } mattshifantastic likes this.

 June 23, 2019, 22:02 #10 Senior Member   Alexander Join Date: Apr 2013 Posts: 1,723 Rep Power: 28 when you start fluent in double precision regime all "reals" are double best regards

 June 12, 2021, 23:35 #11 New Member   Stanlee Join Date: Aug 2017 Location: New Zealand Posts: 15 Rep Power: 5 Hi Sir, Could you please help? I used your code and it goes "The computed saturation temperature <=0.0. What should I do? it has already driven me crazy!!

 June 15, 2021, 04:18 #12 Senior Member   Alexander Join Date: Apr 2013 Posts: 1,723 Rep Power: 28 most likely you didn't put correct operating pressure __________________ best regards ****************************** press LIKE if this message was helpful