Species mass fraction UDF

  • 52 Views
  • Last Post 12 March 2019
aminhgn posted this 07 March 2019

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);}

Order By: Standard | Newest | Votes
rwoolhou posted this 07 March 2019

Which multiphase model are you using? I suspect you need to look at mixture & phase domains: you've not set which phase to add the material. You're then setting a scalar value: this won't do anything to the model unless you're calling the scalar elsewhere. 

As an aside we can give you a few pointers, but don't support writing or debugging code. 

aminhgn posted this 07 March 2019

Which multiphase model are you using? I suspect you need to look at mixture & phase domains: you've not set which phase to add the material. You're then setting a scalar value: this won't do anything to the model unless you're calling the scalar elsewhere. 

As an aside we can give you a few pointers, but don't support writing or debugging code. 

Thank you for your kindly reply. This is the first time that i want to use UDF. I am using VOF because i have two immiscible fluid (water and humid air). I want to define a constant species mass fraction (water vapor) in air side at interface. can you help me about it?

abenhadj posted this 08 March 2019

Just use the fixed value option in Fluent to fix the specie mass fraction to the value you want.

Best regards,

Amine

aminhgn posted this 08 March 2019

Just use the fixed value option in Fluent to fix the specie mass fraction to the value you want.

Hi. 

I just used define profile and i used fixed value to define my mass fraction but this mass fraction is not diffused to my domain. It works which is 0.02 at the interface and 0.001 rest of domain. But there is no diffusion. Can you help me about it?

abenhadj posted this 08 March 2019

? Step back please: what do you want do? Please do not quote.

Best regards,

Amine

aminhgn posted this 08 March 2019

I want to simulate multiphase flow which is water and humid air (water vapor and air). At the interface, the mass fraction of water vapor in the air (saturated mass fraction) is higher than the far from the air. right now I just wrote a simple udf file with the constant value. It works which is mass fraction at the interface is different But there is nor diffusion from the interface to the whole domain.

#include "udf.h" 

DEFINE_PROFILE(species_profile, t, i)

{

 

face_t f;

double Y_h2o;

Y_h2o = 0.02;

 

begin_f_loop(f,t)

 

{

 

if(F_VOF(f,t)!=1. && F_VOF(f,t)!=0.)

 

F_PROFILE(f,t,i)=Y_h2o;

else 

{

F_PROFILE(f,t,i)=0.001;

}

 

}

end_f_loop(f,t);

 

}

abenhadj posted this 08 March 2019

Do you need as initialization or as boundary? Which multiphase model are you using.

Best regards,

Amine

aminhgn posted this 08 March 2019

The value of the mass fraction is a boundary but I want to diffuse this value to my domain which means that the value of 0.001 is just initialization. I am using VOF.

abenhadj posted this 08 March 2019

In VOF at inlet only one phase is entering so why you define profile for it? How does the initialization look a like? If fou have stratified flow at start just patch the VOF fields then initialize based on registers for the mass fraction or use DEFINE INIT.

Best regards,

Amine

aminhgn posted this 08 March 2019

Ok. In my case, I don't want to have a constant mass fraction in the whole domain. The air enters the duct at 0.001 mass fraction then, at the interface, the mass fraction becomes 0.02 and this value diffuse to the domain. 

abenhadj posted this 08 March 2019

Does not make sense  but okay I mentioned what you can do.

 

Best regards,

Amine

aminhgn posted this 12 March 2019

Hi Amine,

I think that i couldn't explain it very good for you. I want to simulate water and humid air through a duct. The mass fraction of water vapor at the interface always is the saturation mass fraction and it doesn't matter what is the mass fraction of water vapor at the inlet. Because this mass fraction is higher than other positions, is going to diffuse to the domain. Firstly, I want to define mass fraction at the interface, then i want to work with diffusion. So, this mass fraction is not just initialization.

I hope that you understand my situation and you can help me with it.

Thanks,

Amin

abenhadj posted this 12 March 2019

If you want to fix that at the interface you will require a moving fixed term. This can be done via DEFINE_SOURCE which needs to be active at the interface and the saturation mass fraction according to local pressure and temperature. 

But still not really clear: as the mass start to diffuse it would reduce at the interface. This would require to have a mass transfer from film to the wet mixture. So a mass transfer driven by the concentration gradient is required here. That is I still think that what you described is just an initialization or boundary condition.

Check with your Prof. or check the paper you  want to rerproduce.

 

Best regards,

Amine

aminhgn posted this 12 March 2019

Thank you for your reply, 

Can you explain more about the defined source and where i should active this function in fluent? which means that after i write code where should i apply this code to meet my requirement.

 

Regards,

Amin

abenhadj posted this 12 March 2019

You require User Defined Function (UDF) to do that. Check the book of Patankar. For mass transfer you require UDF too. 

After you write the coed you should compile it and hook it. Check the manual for that.

Best regards,

Amine

Close