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

UDF for Interface Tracking between Phases

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 4, 2022, 15:00
Default UDF for Interface Tracking between Phases
  #1
New Member
 
Katie
Join Date: Oct 2022
Posts: 1
Rep Power: 0
katie13 is on a distinguished road
Hi All,

I am working on a UDF to facilitate evaporation between two layers. One is a liquid (water) and the other is a vapor(water vapor). My goal is to track the interface as the water evaporates.

I have a model built in ANSYS fluent, real simple, just a two zone 2D rectangle with half patched to liquid and the primary phase being water vapor.

Now, I've tried using ANSYS' built in evaporation-condensation Lee model to evaporate the water layer into the gas vapor. This results in the liquid layer dispersing upward which makes no sense. My understanding is that their model applies the evaporation mass flux to all cells that satisfy T>Tsat and thus it doesn't care where the interface is.

So, I need a UDF instead. I want the UDF to 1. find the interface and 2. apply an evaporative mass flux to the cells there so they will 3. show the interface "receding" from the vapor.

My UDF uses DEFINE_MASS_TRANSFER (and is very similar to the sample UDF ANSYS provides for this macro). I have an if-statement that checks the VOF and then if that indicates that I'm at the interface it calculates the mass flux.

The Problem when I run the below code I never enter the if-statement ie, it doesn't think there is an interface. However, as I said before, this is a two-zone model with vapor the primary (default) and then I patch half the domain to liquid so there is definitely an interface at the start of the analysis.

My questions are: 1. Does my approach make sense and 2. Any idea why the if-statement would not be executing?

Thanks in advance for any help on this!

My UDF: (I've removed the energy equations for ease of reading)
------------------------------------------------------------------------------

// UDF to define a simple mass transfer based on VOF.The "TO" phase is the gas and the "FROM" phase is the liquid phase

#include "udf.h"
#include "sg_mphase.h"

DEFINE_MASS_TRANSFER(liq_gas_source, cell, thread, from_index, from_species_index, to_index, to_species_index)
{
real m_lg;
real T_SAT = 373.15;
Thread* liq = THREAD_SUB_THREAD(thread, from_index);
Thread* gas = THREAD_SUB_THREAD(thread, to_index);
Message("\n \n UDF IS DOING SOMETHING");
m_lg = 0.;
face_t f;

if ((C_VOF(cell, liq) > 0.05) && (C_VOF(cell, liq) <= 0.95))
{
Message("\n \n I found the interface!");

if (C_T(cell, liq) > T_SAT)
{ /* Evaporating */
}
else if (C_T(cell, gas) < T_SAT)
{ /* Condensing */
}


}
return (m_lg);
}
katie13 is offline   Reply With Quote

Old   October 14, 2022, 11:37
Default
  #2
Member
 
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6
Cooper24 is on a distinguished road
Writing a UDF for interface tracking is really challenging. The method(CVOF range between 0 and 1) you are using is more of a Layman's approach and does not yield accurate results. To track the interface at every iteration or time-step, you need to use DEFINE_ADJUST or DEFINE_EXECUTE_AT_END and write a code which will track the cells with volume fraction between 0 and 1. You can store the cell data in a UDMI and use it somewhere else in your UDF.
Cooper24 is offline   Reply With Quote

Old   December 26, 2023, 05:20
Default
  #3
New Member
 
Bidax
Join Date: Dec 2023
Posts: 10
Rep Power: 2
bidax is on a distinguished road
hi! have you been solve the problem?
bidax is offline   Reply With Quote

Old   January 8, 2024, 04:53
Smile hi would you mind see my udf,in my blogs. im write a udf for evaporation
  #4
New Member
 
Bidax
Join Date: Dec 2023
Posts: 10
Rep Power: 2
bidax is on a distinguished road
Quote:
Originally Posted by Cooper24 View Post
Writing a UDF for interface tracking is really challenging. The method(CVOF range between 0 and 1) you are using is more of a Layman's approach and does not yield accurate results. To track the interface at every iteration or time-step, you need to use DEFINE_ADJUST or DEFINE_EXECUTE_AT_END and write a code which will track the cells with volume fraction between 0 and 1. You can store the cell data in a UDMI and use it somewhere else in your UDF.
hi would you ming see my udf ,in my blogs. im write a udf for eva
bidax is offline   Reply With Quote

Reply

Tags
define macro, evaporation condensation, vof model


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 example for multi reaction in phases error3361 Fluent UDF and Scheme Programming 1 September 23, 2019 10:55
Replicating Scalable Wall Function with a UDF yousefaz FLUENT 0 August 4, 2017 03:30
Udf to define new mixing law between properties of different phases in Mixture model saurabhg2014 Fluent UDF and Scheme Programming 0 February 24, 2015 04:23
Ubuntu 12.10 + openfoam2.2.0 ==> paraview error message peteryuan OpenFOAM Installation 6 August 18, 2013 19:00
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03


All times are GMT -4. The time now is 19:12.