|
[Sponsors] |
UDF saturation temperature (evaporation model Fluent) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 18, 2019, 05:24 |
UDF saturation temperature (evaporation model Fluent)
|
#1 |
New Member
Join Date: May 2019
Posts: 6
Rep Power: 7 |
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, 01:03 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
you should hook your UDF
change constant 373.15K to your UDF function best regards |
|
June 19, 2019, 04:28 |
|
#3 | |
New Member
Join Date: May 2019
Posts: 6
Rep Power: 7 |
Quote:
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 05:28. |
||
June 20, 2019, 01:45 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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; } |
|
June 20, 2019, 04:30 |
|
#5 | |
New Member
Join Date: May 2019
Posts: 6
Rep Power: 7 |
Quote:
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, 22:19 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Code:
#include "udf.h" DEFINE_PROPERTY(saturation_temp,c,t) { return 373.15; } best regards |
|
June 21, 2019, 04:44 |
|
#7 |
New Member
Join Date: May 2019
Posts: 6
Rep Power: 7 |
I tried it, it works well so UDF works but not the one function of pressure...
Best regards |
|
June 21, 2019, 06:03 |
|
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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; } |
|
June 21, 2019, 06:54 |
|
#9 |
New Member
Join Date: May 2019
Posts: 6
Rep Power: 7 |
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; } |
|
June 23, 2019, 23:02 |
|
#10 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
when you start fluent in double precision regime all "reals" are double
best regards |
|
June 13, 2021, 00:35 |
|
#11 |
New Member
Stanlee
Join Date: Aug 2017
Location: New Zealand
Posts: 19
Rep Power: 9 |
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, 05:18 |
|
#12 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
most likely you didn't put correct operating pressure
__________________
best regards ****************************** press LIKE if this message was helpful |
|
March 14, 2024, 08:29 |
|
#13 | |
New Member
Bidax
Join Date: Dec 2023
Posts: 10
Rep Power: 2 |
Quote:
Hiiiii what is the basis of this formula "sat_t" is there a detailed explanation thanks in advance |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF to get the average temperature of a face and use it to define a property | gdb | Fluent UDF and Scheme Programming | 19 | November 3, 2022 04:11 |
UDF for temperature initialization in FLUENT | Ami24 | FLUENT | 0 | February 25, 2016 09:27 |
Evaporation heat loss modelling (water temperature below saturation)? | ahmedmmx | Fluent Multiphase | 1 | June 19, 2015 07:35 |
solving a conduction problem in FLUENT using UDF | Avin2407 | Fluent UDF and Scheme Programming | 1 | March 13, 2015 03:02 |
Inlet won't apply UDF and has temperature at 0K! | tccruise | Fluent UDF and Scheme Programming | 2 | September 14, 2012 07:08 |