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 setting interface concentration

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

Like Tree3Likes
  • 1 Post By Jehosh
  • 2 Post By `e`

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 8, 2016, 23:52
Default UDF for setting interface concentration
  #1
New Member
 
Mark Schulte
Join Date: Dec 2015
Posts: 19
Rep Power: 7
Jehosh is on a distinguished road
I am new to writing udfs and am trying to model mass transfer from the gas to liquid phase in a vertical falling film with VOF. First, I would like to just set the concentration (or mass fraction) at the interface to some value. could someone please comment on which is the best macro for doing that? I have seen people do it in a number of different ways and was hoping for a best practice tip.

Thanks
yifang likes this.
Jehosh is offline   Reply With Quote

Old   February 9, 2016, 00:56
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 15
`e` is on a distinguished road
You could force a specified mass fraction of your species at an internal boundary using the DEFINE_PROFILE macro (typically used for inlet conditions).
`e` is offline   Reply With Quote

Old   February 9, 2016, 04:52
Default
  #3
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 9
hwet is on a distinguished road
Didn't know you could use DEFINE_PROFILE on interfaces
interfaces tend to move all the time
hwet is offline   Reply With Quote

Old   February 9, 2016, 13:13
Default
  #4
New Member
 
Mark Schulte
Join Date: Dec 2015
Posts: 19
Rep Power: 7
Jehosh is on a distinguished road
My plan was to use a loop to pick all the cells on the Gas/Liquid interface in my VOF model, then apply the concentration there. Is there a better was to do it hwet? I have seen examples using DEFINE_ADJUST and DEFINE_SOURCE. This is the first time I have seen DEFINE_PROFILE. in order to apply this, would I need to enable a UDS?
Jehosh is offline   Reply With Quote

Old   February 9, 2016, 19:05
Default
  #5
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 15
`e` is on a distinguished road
I assumed you have an internal boundary where the interface between your phases are (I haven't used the VOF model and interpreted your question like that). If the interface is unknown (which might normally be the case for VOF simulations) then you can find all cells with a volume fraction between zero and unity, then apply your concentration. Here's a thread on this topic and the key line of code is:

Code:
if ((C_VOF(cell,phase_thread) != 0) && (C_VOF(cell,phase_thread) !=1))
where phase_thread is one of the phase threads (found with the THREAD_SUB_THREADS function).

However, wouldn't Fluent calculate the concentration and volume fraction across the domain (including the interface)? Why are you wanting to change this value and is it physically valid?
`e` is offline   Reply With Quote

Old   February 9, 2016, 19:34
Default
  #6
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 9
hwet is on a distinguished road
The interface in VOF is the boundary between two phases. It is constructed with one of the interface construction schemes you have available in Ansys Fluent based on the momentum change of the secondary phase.

It is merely a representation of the volume fractions at the boundary cells of the two phases with a continuous boundary shown as the "interface".

Quote:
Is there a better was to do it hwet?
I am stuck in a similar situation. I did post a somewhat related question yesterday but it did not get any replies, take a look at that and see if my question makes sense to you (i know it sounds a bit vague)

'e' would you be able to tell if with the C_VOF macro, is it possible to dig out the volume fractions in specific cells? for e.g cells where the interface lies and distinguish between a set of adjoining cells from another similar set?

or the maximum extent to what this macro can be utilized is to get the volume fractions at specific walls/faces alone?
hwet is offline   Reply With Quote

Old   February 10, 2016, 00:09
Default
  #7
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 15
`e` is on a distinguished road
Quote:
Originally Posted by hwet View Post
'e' would you be able to tell if with the C_VOF macro, is it possible to dig out the volume fractions in specific cells? for e.g cells where the interface lies and distinguish between a set of adjoining cells from another similar set?

or the maximum extent to what this macro can be utilized is to get the volume fractions at specific walls/faces alone?
The C_VOF(c,t) macro retrieves the volume fraction of a particular cell ("c") within a phase thread ("t"). The F_VOF(f,t) macro is similar and can be used for retrieving the volume fraction at faces.

You could loop through all cells and use a conditional statement as they have used in the thread I posted earlier.
Tleja and Jehosh like this.
`e` is offline   Reply With Quote

Old   February 10, 2016, 00:20
Default
  #8
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 9
hwet is on a distinguished road
Thanks, all my recent posts were related; which you answered. The confusion was due to not understanding where the data is actually stored. Makes more sense now. Thanks again.
hwet is offline   Reply With Quote

Old   February 10, 2016, 22:24
Default
  #9
New Member
 
Mark Schulte
Join Date: Dec 2015
Posts: 19
Rep Power: 7
Jehosh is on a distinguished road
thank you for your detailed replies. First, 'e', I am able to mark the interface as I was using that thread you pointed me to. Glad to know others think it is correct. The udf and results are in a thread I just started, as they are a little odd. I would love you comments. For the other things you said:

Quote:
Originally Posted by `e` View Post
However, wouldn't Fluent calculate the concentration and volume fraction across the domain (including the interface)? Why are you wanting to change this value and is it physically valid?
This is really the crux of the question I started this thread with. there are the mass transfer macros, but as far as I understand, you set the mass transfer rate. Commonly in free surfaces, people set the interface concentration to the saturation value and let diffusion and convection do their thing. A more turbulent film will have a higher mass transfer. This is unphysical, true, as the disappearance of gas from the gas phase is not tracked. However, I don't know how to match the diffusion/convection away from the interface in the liquid phase with what disappears from the gas phase. At this point I really only care about the liquid phase so setting the interface to a value is all I need at present. That is what I don't know how to do: Is that with a UDS? which macro is most appropriate?

Is that more clear?

hwet, I think 'e' crushed all your questions, so I won't add to them, but I would appreciate you feedback on the above or the thread I just started.

Cheers.
Jehosh is offline   Reply With Quote

Old   February 11, 2016, 06:01
Default
  #10
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 15
`e` is on a distinguished road
I'm not familiar with these VOF simulations so I won't comment on the validity of your approach (I recommend reading what others have done in the literature and be careful of introducing mass into the system without considering the balances). The species mass fraction can be modified using the C_YI macro (UDS are not applicable as Fluent is already solving the mass fractions).
`e` is offline   Reply With Quote

Old   March 5, 2019, 15:08
Default
  #11
New Member
 
Join Date: Jul 2018
Posts: 24
Rep Power: 4
aminhgn is on a distinguished road
Quote:
Originally Posted by Jehosh View Post
I am new to writing udfs and am trying to model mass transfer from the gas to liquid phase in a vertical falling film with VOF. First, I would like to just set the concentration (or mass fraction) at the interface to some value. could someone please comment on which is the best macro for doing that? I have seen people do it in a number of different ways and was hoping for a best practice tip.

Thanks
Hi Jehosh,

I want to do the same thing as you. I was wondering, can you find the solution for this?

Thanks,
Amin
aminhgn is offline   Reply With Quote

Old   March 6, 2019, 12:42
Default
  #12
New Member
 
Join Date: Jul 2018
Posts: 24
Rep Power: 4
aminhgn is on a distinguished road
Quote:
Originally Posted by `e` View Post
I'm not familiar with these VOF simulations so I won't comment on the validity of your approach (I recommend reading what others have done in the literature and be careful of introducing mass into the system without considering the balances). The species mass fraction can be modified using the C_YI macro (UDS are not applicable as Fluent is already solving the mass fractions).

Hi,

I am trying to simulate the falling film flow. I have water and humid air. I want to define a constant value for the mass fraction of water vapor in air at the interface. I wrote the UDF based on Define_adjust. But every time I try to run it I got an error. Can you help me with it?
#include "udf.h"
#include "sg_mphase.h"

DEFINE_ADJUST(vol_frac, domain)
{

Thread *t;

cell_t c;
double Y_h2o;
Y_h2o = 0.02;
begin_c_loop(c,t)

{

if(C_VOF(c,t)>0. && C_VOF(c,t)<1.)

C_UDSI(c,t,0)=Y_h2o;

}

end_c_loop(c,t);

}
aminhgn is offline   Reply With Quote

Reply

Tags
interface, mass transfer, multiphase, udf

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
obtain species concentration in every time step to use in a udf solmaz aryafar Fluent UDF and Scheme Programming 0 April 8, 2015 11:52
UDF and DPM concentration caroline Fluent UDF and Scheme Programming 5 January 27, 2015 16:02
Radiation interface hinca CFX 15 January 26, 2014 18:11
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44
UDF :Unsteady concentration profile umesh FLUENT 4 July 13, 2003 18:07


All times are GMT -4. The time now is 22:39.