CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   An UDF programming problem (

lihongyang0 March 10, 2013 00:45

An UDF programming problem
I am an UDF new learner. I am dealing with a 2D, transient, two-phase, cavitation problem. I need to capture the interface between the two phase every iteration. And make the heat flux through a part of the interface constant. The following is my code:
#include "udf.h"
Domain *mixture_domain;
cell_t c;
int phase_domain_index=1;
int temp1;
int temp2;
int K;
face_t f;
Thread *mixture_thread;
Thread *subthread=THREAD_SUB_THREAD(mixture_thread,phase_ domain_index);
real xc[ND_ND];


The code has been interpreted. But FLUENT cannot go on the calculation. Please help me correct the code. Thank you very much!!!

vasava March 13, 2013 05:34

Did you try compiling the code instead of interpret?

The fluent manual suggest that UDF with DEFINE_ADJUST works only after compiling.

beer March 20, 2013 18:40

I will try to help a little bit.
First, mixture thread is the thread you should use for your loop. The THREAD_SUB_THREAD have to be inside this looping operation. In this case you give subthread a phase-level thread of a mixture thread which isn't defined.
Second, I'm not 100% sure about this, but I think it isn't possible to set a temperature gradient, because it is a derived value in your flow field.
At least your looping macro uses the wrong input and you have to loop over the cells in every thread, too. (Domain->Loop Thread-> Loop Cells -> Cell Operations). Check out the UDF Manual about this.
However good luck with your solution.

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