CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   flux/value for UDS (https://www.cfd-online.com/Forums/fluent/32058-flux-value-uds.html)

 Andrew Garrard August 30, 2003 10:12

flux/value for UDS

Hello CFD People, I have a question: When creating a UDS one may specify the flux at one boundary and the value at the other and the solver will produce the distribution in between. One can then extract the value of the UDS at the boundary where the flux is specified using a UDF or using the GUI. Is it possiable to do this the other way around? Whereby one sets the value of the UDS on two walls, the distribution is calculated and a UDF extract the value of the flux that would be needed to produce the same value on either of the walls. Any thoughts on this would be apprecited

 Greg Perkins September 1, 2003 03:12

Re: flux/value for UDS

I can't see why you cn't do this so long as your problem is well-posed.

Most times I do use a combination of flux and specified bcs. But there's no reason you can't use just fixed if that makes sense.

Have you tried?? What problem did you have?

Greg

 Andrew Garrard September 1, 2003 08:21

Re: flux/value for UDS

Sorry, I don't really understand what you mean. I have tried using the F_UDSI_G funciton, but then you have to specify the direction vectors and unit vectors and it all gets rather complicated. If there is a UDF command to do this I would be very happy: say, for example, you have a square box with two oppostie edges, say face 1 and face 2. You specity the boundary conditons as UDS value for both. Is there a UDF command that you can use to extract the FLUX at the walls where the value boundary condition has been speicfied.

If you specify the flux at a wall and solve, you can extract the UDS value with F_UDSI. I want to know if you can do it the other way around?

 Greg Perkins September 1, 2003 09:31

Re: flux/value for UDS

I see what you mean - by flux you really mean the gradient f the scalar at the boundary (since the flux may be this multiplied by some other scalar, ie density).

OK, off the top of my head I'd do somethign like (if its a bit worng it cos I just typed in here and not my C compiler...)

give face,f_thread for face and thread for face at boundary...for the flux perpendicular to the boundary: uds is uds you are using...

#define Distance_h(a,b,n) (pow(a[n]-b[n],2.0)) #if ND_ND==2 #define Distance(a,b) (pow(Distance_h(a,b,0)+Distance_h(a,b,1),0.5)) #else #define Distance(a,b) (pow(Distance_h(a,b,0)+Distance_h(a,b,1)+Distance_ h(a,b,2),0.5)) #endif

dn = Distance(xc,xf);

You can work out right the sign.

Greg

 Greg Perkins September 1, 2003 09:33

Re: flux/value for UDS

There's a few typos above but I'll assume you can work those out without any probs.

Greg

 Andrew Garrard September 4, 2003 10:42

Re: flux/value for UDS

Hi, thanks for your help with this, I have been using a C_UDSI fuction so far which has not been producing very helpful resutls, so I am very keen to give your suggestions a try. I am a little busy at the moment but I will get onto it in a few weeks. I have never used a #if and #else function before. Did the forum reproduce the UDF accuratly and the # lines should all be on one line or should these be seperated? I think that this forum has a few bugs when it comes to displaying line breaks. If it would be easier, I would appreciate a .txt file containg the UDF. my actual e-mail address is a.garrard@sheffield.ac.uk Thanks again.

 Greg Perkins September 4, 2003 20:32

Re: flux/value for UDS

Hi

yeah the formatting gets scrambled in the forum, but you can just paste it inot your compiler and reformat.

The #if defines are useful for doing different things and specifying them on the command line at compile time.

In the code I check for either a 2D or 3D version of FLUENT and calculate the distance using either 2 or 3 components of the vector.

I wrote that code in the forum so it might have some typos or small bugs. See how it goes...

Greg

 All times are GMT -4. The time now is 08:49.