CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   setting UDS Flux (http://www.cfd-online.com/Forums/fluent/31943-setting-uds-flux.html)

 Andrew Garrard August 5, 2003 06:15

setting UDS Flux

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.

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

Any help

 Greg Perkins August 6, 2003 01:49

Re: setting UDS Flux

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????

Greg

 andrew_garrard August 6, 2003 08:37

Re: setting UDS Flux

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.

 Greg Perkins August 6, 2003 10:19

Re: setting UDS Flux

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??

Greg

 Andrew Garrard August 6, 2003 10:51

Re: setting UDS Flux

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

 Greg Perkins August 6, 2003 11:02

Re: setting UDS Flux

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

Greg

 Andrew Garrard August 7, 2003 09:38

Re: setting UDS Flux

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.

 Peter August 16, 2003 00:13

Re: setting UDS Flux

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.

Peter

 ashar_md2001 February 14, 2013 13:45

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
Bacl2+Na2So4------»BaSO4.

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.
Regards
Ashar

 tguozden February 10, 2015 14:26

Editting species flux

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?:confused:

[QUOTE=Greg Perkins
;107333]

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??

 All times are GMT -4. The time now is 23:04.