CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF saturation temperature (evaporation model Fluent)

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

Like Tree1Likes
  • 1 Post By bbarbier07

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 18, 2019, 04:24
Default UDF saturation temperature (evaporation model Fluent)
  #1
New Member
 
Join Date: May 2019
Posts: 6
Rep Power: 4
bbarbier07 is on a distinguished road
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!
bbarbier07 is offline   Reply With Quote

Old   June 19, 2019, 00:03
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,723
Rep Power: 28
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
you should hook your UDF
change constant 373.15K to your UDF function

best regards
AlexanderZ is offline   Reply With Quote

Old   June 19, 2019, 03:28
Default
  #3
New Member
 
Join Date: May 2019
Posts: 6
Rep Power: 4
bbarbier07 is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
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.
bbarbier07 is offline   Reply With Quote

Old   June 20, 2019, 00:45
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,723
Rep Power: 28
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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
AlexanderZ is offline   Reply With Quote

Old   June 20, 2019, 03:30
Default
  #5
New Member
 
Join Date: May 2019
Posts: 6
Rep Power: 4
bbarbier07 is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
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
bbarbier07 is offline   Reply With Quote

Old   June 20, 2019, 21:19
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,723
Rep Power: 28
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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
AlexanderZ is offline   Reply With Quote

Old   June 21, 2019, 03:44
Default
  #7
New Member
 
Join Date: May 2019
Posts: 6
Rep Power: 4
bbarbier07 is on a distinguished road
I tried it, it works well so UDF works but not the one function of pressure...
Best regards
bbarbier07 is offline   Reply With Quote

Old   June 21, 2019, 05:03
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,723
Rep Power: 28
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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
AlexanderZ is offline   Reply With Quote

Old   June 21, 2019, 05:54
Default
  #9
New Member
 
Join Date: May 2019
Posts: 6
Rep Power: 4
bbarbier07 is on a distinguished road
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.
bbarbier07 is offline   Reply With Quote

Old   June 23, 2019, 22:02
Default
  #10
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,723
Rep Power: 28
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
when you start fluent in double precision regime all "reals" are double

best regards
AlexanderZ is offline   Reply With Quote

Old   June 12, 2021, 23:35
Default
  #11
New Member
 
Stanlee
Join Date: Aug 2017
Location: New Zealand
Posts: 15
Rep Power: 5
stanlee8 is on a distinguished road
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!!
stanlee8 is offline   Reply With Quote

Old   June 15, 2021, 04:18
Default
  #12
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,723
Rep Power: 28
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
most likely you didn't put correct operating pressure
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 16 October 22, 2019 04:07
UDF for temperature initialization in FLUENT Ami24 FLUENT 0 February 25, 2016 08:27
Evaporation heat loss modelling (water temperature below saturation)? ahmedmmx Fluent Multiphase 1 June 19, 2015 06:35
solving a conduction problem in FLUENT using UDF Avin2407 Fluent UDF and Scheme Programming 1 March 13, 2015 02:02
Inlet won't apply UDF and has temperature at 0K! tccruise Fluent UDF and Scheme Programming 2 September 14, 2012 06:08


All times are GMT -4. The time now is 00:24.