CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   udf problem (https://www.cfd-online.com/Forums/fluent/41285-udf-problem.html)

jim June 7, 2006 03:20

udf problem
 
hi Using UDF, I try to calculate the accumulated concentration of species. but I have some problem. What kind of UDF do i use?


cax June 7, 2006 05:37

Re: udf problem
 
hi Can you tell us more abot the system you are modelling? what do you want to know about the species? if you want to know their mass fractions you should use the C_YI macro have a look in the fluent manual see you

jim June 7, 2006 20:23

Re: thanks..but...
 
thanks your answer I hope you understand that I can't speak English well. I want to know the accumulated mass fraction data in fluent. 1) unsteady solver 2) nh3 species 3) using UDF, I want to accumulate the mass fraction data each time step 4) I want to see the contour of accumulated value in fluent Is it possible?


Amr June 9, 2006 16:41

Sorry for intervention
 
I noticed your posts about that UDF. I posted since a while, a request of help in a heat source UDF that is going to be represented in trasient simulation of fire in a room. The UDF should supply heat source from zero to 6 MW in 100 seconds. Could any body help me how to write it?. I am not good with C++.

Cheers, Amr

jim June 9, 2006 20:31

Re: Sorry for intervention
 
I am not good with C++,too I hope you understand me that I can't speak English well. I think you can use the DEFINE_SOURCE macro and RP_Get_Real.

First you must define the "flow-time"... then..you can define the MW - value of fire souce according "flow-time"

DEFINE_SOURCE(Energy, cell, thread, dS, eqn ) { real flow_time = RP_Get_Real("flow-time");

cell_t c;

begin_c_loop (c,thread)

{

if(flow_time >= 100)dS[eqn] = " " ;

else

dS[eqn] =" " ;

}

end_c_loop (c,thread)

return dS[eqn];

}

I write the UDF simply

you must input the value between " "... except "flow_time"

I hope you understand my explanation. If I can speak English well, I will help you more...I am sorry..good luck!

Amr June 10, 2006 19:38

Re: Sorry for intervention
 
Hi Jim:

Thanks much for your post. Anyways, I really don't get what you mean by RP_Get_Real. Also, why do I use a macro instead of a simple profile file or UDF to give the transient MW's values?.

In your last message, do I only write in between the " "? What does dS eqn means?.

Thanks so much. I owe you.

Cheers, Amr

jim June 11, 2006 19:42

Re: Sorry for intervention
 
Hi Amr

you're look in fluent manual about my answer.

1) RP_Get_Real....is returns current simulation time

2) because you want to input the value of heat source from zero to 6 MW in 100 seconds, UDF is more useful than simple profile file (... I think so)

3) According your volum of source term, MW's values are different. you must input the value between quotation marks

4) DEFINE_SOURCE macro

There are five arguments to DEFIEN_SOURCE....DEFINE_SOURCE(name,c,t,dS,eqn)

dS specifies the derivative of the source term with respect to the dependent variable of the transport equation

Amr June 11, 2006 21:05

Re: Sorry for intervention
 
Thanks again Jim !.

One more question here: Do I need to specify something in "eqn" or it is only a programming symbol?. Same question applies to c and t symbols.

Cheers, Amr


jim June 12, 2006 03:05

Re: Sorry for intervention
 
Your thinking is right. "eqn","c","t" are programming symbols.


Swarup June 12, 2006 23:41

Re: Sorry for intervention
 
Hi all,

Just a couple of things to note!

You should have a "Source" equation for which to write its derivative dS. First comes source, then its derivative. Check UDF manual.

I guess you are talking about ramping up your heat source (from 0 to 6 MW in 100 s). This should give you a clue about your Source equation.

Swarup.


Amr June 14, 2006 01:32

Re: Sorry for intervention
 
Hi Swarup,

Could you illustrate this in the udf? Thanks much for your input. Have you been into heat generation problems before???

Cheers, Amr

Swarup June 14, 2006 23:06

Re: Sorry for intervention
 
You may have already done that. I will tell in short.

You need your current flow time. Access it using CURRENT_TIME.

you then write a simple equation source=coeffi*CURRENT_TIME such that when your CURRENT_TIME is 100 s you get the final value. your dS[eqn]=0.0 since it does not depend upon any primitive variable. eqn is the number provided by solver once you hook your UDF in appropriate zone and variable. Energy source UDF hook is at the end of list of possible hooks.

I have not tried heat generation problems before.

Swarup


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