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

Two questions on Fluent UDF

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

Like Tree3Likes
  • 2 Post By Murali
  • 1 Post By A CFD free user

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 20, 2003, 11:27
Default Two questions on Fluent UDF
  #1
Steven
Guest
 
Posts: n/a
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
  Reply With Quote

Old   March 21, 2003, 14:50
Default Re: Two questions on Fluent UDF
  #2
Murali
Guest
 
Posts: n/a
<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>
  Reply With Quote

Old   March 27, 2003, 13:00
Default Re: Two questions on Fluent UDF
  #3
Steven
Guest
 
Posts: n/a
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
  Reply With Quote

Old   September 20, 2013, 06:14
Default UDS concentration
  #4
New Member
 
bouabidi abdallah
Join Date: Sep 2013
Posts: 1
Rep Power: 0
bouabidiabdallah is on a distinguished road
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
bouabidiabdallah is offline   Reply With Quote

Old   September 20, 2013, 17:30
Default
  #5
Senior Member
 
A CFD free user's Avatar
 
A-A Azarafza
Join Date: Jan 2013
Posts: 226
Rep Power: 14
A CFD free user is on a distinguished road
@ bouabidi abdallah
You can define mass fraction transport equation of species using UDS and then whenever you need them, just convert it to concentration.
bouabidiabdallah likes this.
__________________
Regard yours
A CFD free user is offline   Reply With Quote

Old   March 22, 2018, 14:40
Default
  #6
Member
 
Join Date: Oct 2017
Posts: 52
Rep Power: 8
gouravjee is on a distinguished road
Quote:
Originally Posted by Murali
;105007
<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>
i am working on a UDSI and, i have also used UDM for storing those values, but i am stuck in problem that my all udms are showing zero value
can you tell me where might be the problem?
gouravjee is offline   Reply With Quote

Old   March 22, 2018, 21:30
Default
  #7
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 33
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
looks like your udms are not changing

best regards
AlexanderZ is offline   Reply With Quote

Old   March 23, 2018, 04:22
Default
  #8
Member
 
Join Date: Oct 2017
Posts: 52
Rep Power: 8
gouravjee is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
looks like your udms are not changing

best regards
could you suggest a way to fix this problem?
gouravjee is offline   Reply With Quote

Reply

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
A Problem of Fluent Interpreted UDF: parse error knight Fluent UDF and Scheme Programming 25 August 16, 2018 11:26
Please, Help with linking UDF precompiled outside fluent to fluent!!! gracerlima Fluent UDF and Scheme Programming 1 May 4, 2010 08:19
Fluent 6.1/6.2 UDF compatability Allan Walsh FLUENT 1 April 29, 2005 12:49
UDF of Zimont model in fluent Z Main CFD Forum 0 February 17, 2005 04:07
UDF in parallel version of fluent yobee FLUENT 2 August 5, 2004 01:36


All times are GMT -4. The time now is 07:03.