CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDS Flux function (https://www.cfd-online.com/Forums/fluent/31791-uds-flux-function.html)

Andrew Garrard July 8, 2003 09:22

UDS Flux function
 
Hello everyone. I have a qestion regarding fluent UDS's. am trying to use a UDS to model species concentration. My question is this: do you have to specify the same flux function for all your uds's.

Any help would be appreciated. Regards

ap July 8, 2003 19:31

Re: UDS Flux function
 
No, you can specify a different flux function for every UDS you define.

In the flux definition

DEFINE_UDS_FLUX ( name, f, t, i)

i refers to the number of the UDS. If you have to define more than one scalar, using different flux expressions, you can use a conditional if statement in your UDF to define a different flux function for each i. i = 0 is associated with scalar-0 (the first scalar equation being solved).

See FLUENT UDF manual: look for DEFINE_UDS_FLUX in the Index.

Hi

ap

Andrew Garrard July 9, 2003 05:28

Re: UDS Flux function
 
Thanks for the help. I was hoping there was a simple way of doing it within the FLUENT GUI without having to write a UDF. I have been looking throught the documentation. I only wish to invoke the flux function that appears on as mass flow on the UDS menu drop down. Is it possiable so simply do something like: DEFINE_USD_FLUX(f,t, i) { if i=1 return F_FLUX(f, t); }

Also, if I wish to return no flux function, as in none on the USD drop down, how should I code this: if i=0 return(void); ???

ap July 9, 2003 18:00

Re: UDS Flux function
 
From the UDS drop down menu you can select a global option for the flux (mass flow or none) for all UDS you defined. If you need an individual flux for your UDS, you need to use DEFINE_UDS_FLUX.

Yes, you can define your flux like

DEFINE_USD_FLUX(f,t, i)

{

if i=1 return F_FLUX(f, t);

}

if this is what you need.

I think return(void) or return 0 should work for the null flux, but I never tried.

Hi

ap

Andrew Garrard July 10, 2003 10:09

Re: UDS Flux function
 
I have created a small test simulation in fluent to try and get two different uds's to solve with two different flux funciotns. I have created two differnt UDS's with exactly the same boundary conditons and the same diffusivity. When I select none for flux function they solve one way and when I select mass flow rate they solve a compleatly different way. When I select UDF I cannot get my conditional if statement to make them solve differently. I am trying several permuatation all a bit like:

DEFINE_UDS_FLUX(all_udf_flux, f, t, i) { if (i = 0) return F_FLUX(f, t); else return 0; }

But nothing seems to work and I cannot see any logic in how the code is accessing and running my UDF. It either solves with mass flow or without for both. Am I missing something obvious?


ap July 10, 2003 18:19

Re: UDS Flux function
 
If convective terms of your equations are relevant, it's not strange you have different solutions if you consider (mass flow) or don't consider (none) them.

Regarding the definition of your flux, in the function you posted, the comparison in the if statement is made using = instead of = =. The compiler should show an error message for this.

The right sintax should be:

DEFINE_UDS_FLUX(all_udf_flux, f, t, i)

{

if (i = = 0)

{

return F_FLUX(f, t);

}

else return 0;

}

This function defines a convective flux in the form rho * v for the first UDS (0) and a zero convective flux for others UDS.

Tell me if you solved your problem.

Hi

ap

Andrew Garrard July 11, 2003 04:09

Re: UDS Flux function
 
I have not tried your suggestion yet, but reading what you wrote, I think I know what the problem is. I forgot my basic c programming and used the assign i=0 rather than the is equel to i==0 statement. I suspected that I was missing something simple. Thanks for your help. I will try and be less stupid in the future.

ap July 11, 2003 16:59

Re: UDS Flux function
 
You're welcome :)

Hi

ap


All times are GMT -4. The time now is 09:59.