CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF for setting interface concentration (https://www.cfd-online.com/Forums/fluent-udf/166406-udf-setting-interface-concentration.html)

Jehosh February 8, 2016 22:52

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

`e` February 8, 2016 23:56

You could force a specified mass fraction of your species at an internal boundary using the DEFINE_PROFILE macro (typically used for inlet conditions).

hwet February 9, 2016 03:52

Didn't know you could use DEFINE_PROFILE on interfaces :eek:
interfaces tend to move all the time :confused:

Jehosh February 9, 2016 12:13

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?

`e` February 9, 2016 18:05

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?

hwet February 9, 2016 18:34

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?

`e` February 9, 2016 23:09

Quote:

Originally Posted by hwet (Post 584432)
'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.

hwet February 9, 2016 23:20

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.

Jehosh February 10, 2016 21:24

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` (Post 584430)
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.

`e` February 11, 2016 05:01

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).

aminhgn March 5, 2019 14:08

Quote:

Originally Posted by Jehosh (Post 584274)
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 March 6, 2019 11:42

Quote:

Originally Posted by `e` (Post 584650)
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);

}


All times are GMT -4. The time now is 09:37.