CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Two questions on Fluent UDF (http://www.cfd-online.com/Forums/fluent-udf/31123-two-questions-fluent-udf.html)

Steven March 20, 2003 11:27

Two questions on Fluent UDF
 
Hi, everyone,

I have two questions about Fluent UDF when I was using it. I would like to share them with you, and hopefully someone can help me out.

The first question is about the diffusivity (diffusion coefficient) of UDF.

As you know, Fluent UDF can let you define diffusivities for user defined scalar equations. My question is: how to activate these user defined diffusivities properly and let Fluent know which one applies to which UDS equation.

In Fluent, define->materials->diffusivity you will see two options: 'UDS' and 'user defined'. If you choose UDS, it looks that you may assign a constant value or polynomial as the diffusivity for each user defined scalar. But how to apply user defined diffusivities to UDS?

If you select 'user defined', you can only pick one of those user defined diffusivities.my understanding is Fluent will then use this one for all the conservation equations and user defined scalars. I am confused here, and could not figure out how Fluent actually handle the diffusivities.

The other question is related to species transfer. If you are going to implement a species transfer problem, but do not want to use the Fluent default species transfer model, because the reaction in your case has ions involved that Fluent cannot handle. So you have to define the concentration of each species as UDS to solve for concentration distribution over the whole region. Then there come a few problems. 1. How to make sure materials balance in Fluent? 2. How to model species transfer under this circumstance?

If you do not select species transfer, you can only define one material in that region, instead of all the species that actually exist in that region. My solution is using a material that can approximate the properties of the actual mixture for conservation equations. Is it a proper way for this problem? Any suggestion or comment is welcome and will be greatly appreciated.

Steven

Murali March 21, 2003 14:50

Re: Two questions on Fluent UDF
 
<font face = "courier new">

Hi steven,

I infer that you are trying to model electrochemical systems where you will encounter all such problems. This is something I have been fighting for a long time.

When you are confronted with the problem of solving for ions, I know you would want to use a "special flux-equation" with the migration term implemented too. This extra migration term can be implemented, as you would have inferred, only through the "J" - user defines flux term for the scalars in FLUENT 6. but believe me, inspite of using that J term in F6, you will NOT be able to model electrochemical migration using user-defined scalars.

The reason is simply that, the user-defined scalars, atleast from my knowledge, are not solved the way the species equations are solved in FLUENT 6. For example, suppose there is a parallel plate electrochemical reactor which sports two reactions at the the two electrodes and the electrolyte flows through it. Since ions are involved in the reactions, you would normally be tempted to use UDS equations instead of the species equations for modelign the species, but as far as my experience goes, it does not work that way.

When you model the species equations, the concentration at the outlet is determined by the "shooting-correcting" method of FLUENT. Refer to the modeling of species examples in FLUENT 6 manuals. It is evident from the F6 manuals that there is "no - need" to mention "any" boundary condition for the species at the outlet. But for the UDS, you are required to mention the boundary conditions and this "forces" a wrong solution for the problem.

An example of how various diffucivity values could be assigned to different scalars is given below:

/**************** DIFFUSIVITY *****************/


DEFINE_DIFFUSIVITY(scalar_diff, c, t, i)
{

real D;

// Define all scalars

real phi,C1,C2,C3,C4;




switch (i)
{

case 0:

C1 = C_UDSI(c,t,1) ;
C2 = C_UDSI(c,t,2) ;
C3 = C_UDSI(c,t,3) ;
C4 = C_UDSI(c,t,4) ;

D = F*F/(R*T)*(z1*z1*C1 + z2*z2*C2 + z3*z3*C3 + z4*z4*C4);
break;

case 1:

D = D1;
break;

case 2:

D = D2;
break;

case 3:

D = D3;
break;

case 4:

D = D4;
break;



}

return D;
}

***********************************

In the above code the "case 0" corresponds to potential equation and all the others are species equations. D1..D4 are globally defined constants.

Hope this helps.

Murali</font>

Steven March 27, 2003 13:00

Re: Two questions on Fluent UDF
 
Thank you, Murali, Your information is really helpful.

Actually, I am working on the modeling of a PEM fuel cell. I think I did not really understand the exact meaning of the index "i", which corresponds to each UDS. Now things become clear to me.

As you mentioned, it seems infeasible to model the ion transport by UDS, then do you have any idea if there is any other way to do that?

Also, my understanding of how Fluent calculate conservation equations and UDSs is that: first, it will solve continuity and momentum (no energy analysis involved) with the properties of materials you have specified for each zone. then, it will calculate UDS based on used-defined diffusivity and source term,etc.

Because you are not using species transfer model, instead, you define each species you're interested with UDS; you cannot define the material in each zone with any mixture, you can only approximate it with a single substance. Therefore, your solution seems to be an approximate one, and the mass balance is not garanteed here. How to solve this problem? Thank you.

Steven

bouabidiabdallah September 20, 2013 05:14

UDS concentration
 
hi
how i can defined the concentration as uds in fluent. my problem that the density depend of concentration so i will use uds for the concentration and udf for the density.
plz help me

A CFD free user September 20, 2013 16:30

@ bouabidi abdallah
You can define mass fraction transport equation of species using UDS and then whenever you need them, just convert it to concentration.


All times are GMT -4. The time now is 13:05.