CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT

setting UDS Flux

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

LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2003, 06:15
Default setting UDS Flux
Andrew Garrard
Posts: n/a
Can anyone help me with this one. I have been using a UDS with a mass flow flux funciton to model species concentration. So far I have been setting the UDS value at the reaction surface which works well. I am now trying to specify a molar rate of production/consumption. Is it possiable to do this by specifying a UDS FLUX at the boundary. The fluent manual is not too clear about what you are specifying when you set the FLUX. If you re-arrange the standard fluent species conservation equation it looks like the molar rate of producion/consumption is a source term.

-grad(rho D grad(Yi)) + grad(rho v Yi) = Ri

But I don't know how to set a UDS source at a face.

Any help
  Reply With Quote

Old   August 6, 2003, 01:49
Default Re: setting UDS Flux
Greg Perkins
Posts: n/a
Certainly you can specify the flux at the boundary for the UDS. You will need to wirte a UDS_FLUX_FUNCTION or whatever its called, and return the flux (without being multiplied by the value at the face - if thatmakes sense).

For example if the flux = rho*v*Yi at the face you need to return a flux rho*v through the UDS and set Yi which is your scalar to a fixed value boundary condition at the surface in question. You can use macros in your udf to determine which face thread you are on, so you can have different bcs at different faces. If I remember a positive flux is into the domain - this is needed in order to set the sign of your flux.

Of course, as you point out, a flux can always be transformed into a source term (see Gauss divergence theorem) and so you can add a source term in the near wall cell if you like. This source will be rho*v*Yi*Aface/Vcell where Aface = area of face and Vcell is volume of cell. The disadvantage here is you have to test that you are on a boundary cell - thes easiest way to do that is to use a thread_face_loop and check for your face thread and then use C_F0 macro to get the adjacent cell - you'd probably do this in an adjust function and store the source terms in a user memory to be returned by a DEFINE_SOURCE udf connected to your UDS. In this case, you would set the scalar bc to be fixed flux = 0 in FLUENT gui.

Either way will work - and I've used both in the past. I'd go with writing the flux function myself since this is really what you want to do, but it will take some time to get it working - it did for me.

A question - why are you using scalars to model species concentration when FLUENT has this built in????


  Reply With Quote

Old   August 6, 2003, 08:37
Default Re: setting UDS Flux
Posts: n/a
Thankyou for your insight into this problem. I will start by answering your last equation. I am using a UDS to repeat species concentration because I don't think that fluent gives you access to a) the units of concentration and b) allows you to alter the flux function.

I am not sure if the method you suggested is correct for what I am trying to achieve. I have defined a flux function in my USD so the subdomain will solve the following equation for species transport. That is nice and simple using the DEFINE_UDS_FLUX macro.


Where Yi is my scalar. The fluent manual says that the reaction model that it uses is as follows


Where Ri is the molar rate of destruction and creation. I wish to specify this Ri value in my UDS as a boundary condition. Fluent allows you to set the UDS value and flux at any boundary. The value is easy and set the value of Yi. However in the manual it says that setting the flux specifies the dot product of the (D*grad(Yi)) term in my first equation, but what about the grad(v*Yi) term in that equation.

As you say you can set a source term in the cells adjcent to the face, but I am reluctant to do that becuse it is as physically realistic as setting a B.C. and I don't think it is what fluent executes a surface reaction. Also it wants a dS term which I am not user that I know. All I have is a reaction rate.

Any thoughts on this would be greatly apprecited.

  Reply With Quote

Old   August 6, 2003, 10:19
Default Re: setting UDS Flux
Greg Perkins
Posts: n/a
Ok, I can help you alot with this since I've developed my own models for all these things.

First I'm not sure you need to be doing this at all. What do you want to solve and why can't you use the internal species transport model??

Firstly for solving it doesn't matter what units are used - only that it gives you a consistent solution - so you should be able to reformulate your reaction rate in terms of a molar rate for use in a user reaction rate udf - if that's your problem. You can always post-process the results into a different unit system without too much trouble. Certainly this is easier than rewriting the solver parts.

You mention you want to alter the flux function - why do you want to do this. Species are convected with the flow according to the mass flux - this is a physical reality of the NS equations, does it make sense to change this?? Why??

If you want to compensate for diffusion or something then modify the species diffusivity model, else you can always species a source term. Remember that all these processes convection, difussion etc., can be related to either surface fluxes and/or source terms through use of divergence theorem, so you can always modify the equation being solved by applying a source term.

You mention you have your reaction rate - the easiest way to use this will be to reformulate it in molar units (not too hard) and then write a volumetric reaction rate udf for this. Then FLUENT will handle all the source terms. Otherwise if you do it yourself, you will find it best to specify the gradients in the dS term - ie the Jacobian of your chemical system.

For more info on this stuff, I suggest you read Patankar, Numerical Heat Transfer 1980 - its a populat book on the finite volume method.

Also if your chemical system is stiff, then I don't think you'll be able to do it thorugh udfs at all - well it will be hard. Best to use the internal coupled solver and stiff chemsirty option. Don't use a segregated solver since the SIMPLE type methods are crap for stiff chemical systems - unless they have turbulence acting to limit the reaction rates.

I think you need to answer these questions before worrying about a UDS.

I would use a UDS for species transport onyl when you have a phase which FLUENT knows nothing about and which can act as a carrier of your species. Otherwise the internal species model should work fine. Alternatively it may be necessary to do this in some models which are incompatible with the species trnasport model - maybe some multiphase models have this restriction.

What's your problem and is it necessary to use a UDS??

  Reply With Quote

Old   August 6, 2003, 10:51
Default Re: setting UDS Flux
Andrew Garrard
Posts: n/a
I will take your suggestions on board and attempt try re-running the model using he internal model. The reason I was using a UDF was to run comparison with other computational work and the UDS allows more control over the flux fuction vairables...etc. I will let you know how it works out
  Reply With Quote

Old   August 6, 2003, 11:02
Default Re: setting UDS Flux
Greg Perkins
Posts: n/a
No worries Andrew - I don't mean to be disparaging - but I know from experience these things can consume a lot of time and maybe not for much gain.

I would imagine you should be able to reproduce other peoples work - even if they used say mass concentration as a reported variable etc. Of course I don't know for sure....

Hope it works out

  Reply With Quote

Old   August 7, 2003, 09:38
Default Re: setting UDS Flux
Andrew Garrard
Posts: n/a
For anybody following this thread I have managed to answer my own question.

Under advisement from a colleague I ran a few tests with similar boundary conditions to compare the internal fluent species model with a hand written UDS. For the internal fluent species model I created a DEFINE_SR_RATE UDF so set the reaction rate R (molar rate of destruction/creation) to be 0.02 and the inlet mass fraction to 1. For the UDS model I set all the same boundary condition except the reaction surface UDS boundary condition to the -0.02. In conclusion, if you wish to specify the molar rate of destruction/creation using a UDS this can be done at the boundary by specifying the UDS flux. However, it is necessary to take care making sure your molecular weights are consistent.
  Reply With Quote

Old   August 16, 2003, 00:13
Default Re: setting UDS Flux
Posts: n/a
Dear Andrew:

I suggest you to reference Fluent UDF Manual of DEFINE_UDS_FLUX Macro which have an example also. I hope it is useful for you.

  Reply With Quote

Old   February 14, 2013, 12:45
New Member
Mohamed Ashar
Join Date: Feb 2011
Posts: 13
Rep Power: 14
ashar_md2001 is on a distinguished road
Can anyone of you help me with this one.

I am working on CFD coupled with Population balance modelling to study the size distribution in the Precipitation process namely

I have chosen Bacl2 as primary phase and Na2So4 as secondary phase as i have two inlets one inlet with Bacl2 and other inlet with Na2So4. It is a kind of T-reactor with two inlets and the two reactant impinging at the center of the reactor.

I have doubt regarding Volume fraction, as I want to simulate for example equimolar 0.1 M (molar concentration or kmol/m3) of Bacl2 in one inlet and 0.1 M Na2So4 in other inlet. To work with Population balance model any one of the model namely Mixture model or Eulerian model must be enabled. As in Multiphase model we have volume fraction but i need to have Molar concentration in terms of Volume fraction or vice versa. What is the right way to input 0.1 M of both the reactant in terms of volume fraction. The Molecular wight of Bacl2 is 208 and rho is 3856 kg/m3; similarly Na2so4 Mw is 142.0412 rho is 2664 kg/m3.
Any kind of help or suggestion will be highly appreciated.
Thanks in advance.
ashar_md2001 is offline   Reply With Quote

Old   February 10, 2015, 13:26
Default Editting species flux
New Member
Join Date: Feb 2015
Posts: 4
Rep Power: 10
tguozden is on a distinguished road
Hello Greg,

I have a problem involving a gas mixture and pressure gradients, and I want to solve its concentration. Species would sound as the choice, but it would require to add the pressure diffusion term as a source. Why would I do this, since I know the flux, so I went for UDS. Now I have considerable molar masses variations, so I need to activate species. How would you add the pressure diffusion term to the flux of each of the species?

[QUOTE=Greg Perkins

You mention you want to alter the flux function - why do you want to do this. Species are convected with the flow according to the mass flux - this is a physical reality of the NS equations, does it make sense to change this?? Why??
tguozden is offline   Reply With Quote


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
UDS Flux Function Choice Yang Chung FLUENT 1 November 17, 2015 01:14
Cells with t below lower limit Purushothama Siemens 2 May 31, 2010 21:58
Doubts UDS Flux, UDS Unsteady for VOF model kel85uk FLUENT 0 March 17, 2010 08:53
Help with UDS FLUX Andrew Garrard FLUENT 2 February 14, 2005 05:47
Warning 097- AB Siemens 6 November 15, 2004 04:41

All times are GMT -4. The time now is 19:25.