CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   UDF for Species mass fraction (

daniel June 6, 2005 04:07

UDF for Species mass fraction
Hi everyone! Im solving flow in a artificial heart and need to "reset" mass fraction of a species at certain times during the simulation. I,ve written a DEFINE_ADJUST UDF for the mass fraction, C_YI. But nothing really happens in Fluent. No errors, but the UDF doesnt effect the solution.

Has someone else experienced the same?

What to do? Please help.

Allan Walsh June 6, 2005 13:44

Re: UDF for Species mass fraction
Not sure what you mean by "nothing really happens in Fluent".

Have you checked that the DEFINE_ADJUST UDF runs? To check it, I would put a dummy print statement in your UDF and make sure you have it hooked up properly.

The only times I've used DEFINE_ADJUST, I've had to manually specify the thread_id to perform D_A on. (This can be found by looking at a list of boundaries and domains in Fluent).

I've used C_YI several times. I would suggest that you print the initial values of C_YI one time and then print the values of C_YI again once you have changed them in your D_A UDF. Could be that they are changed somewhere else in Fluent, especially if your "reset" doesn't physically make sense.

kyung June 8, 2005 15:55

Re: UDF for Species mass fraction
I have the same problem, I need someone's help for writing the UDF. Can Daniel or Allan help me out in this? I'll be happy to talk to you guys in email. Thank you.

daniel June 22, 2005 08:40

Re: UDF for Species mass fraction
Hi! I believe that define adjust would work. To reset the mass fraction, one should just loop over all threads and cells:

Domain *d = Get_Domain(1); Thread *t; cell_t c;

/*Loop over Thread and cell*/ C_YI(c,t,0) = 0.; /*End Thread and cell loop*/

where C_YI(c,t,0) is the species mass fraction. Since I have had other, more severe problems, I have not tried it. I get convergence problems related to the spcies transport equation. If you have any general guidelines for this I'd be happy to hear them. /Daniel I

All times are GMT -4. The time now is 15:47.