THREAD-ID in UDF
I would be grateful if someone could help me to fix the problem.
I am using THREAD_ID(t) in if statement to set different visosities in different zones. But it does not work in " if (Thread_ID(t)==...) " statement in my UDF. Whe I run fluent with this UDF, it does not distingush between zones. It is a very simple code, what could be wrong here?: PHP Code:
|
Hi,
for simple debugging, would you use a Message command to check whether it enters a if statement or not? |
Quote:
|
I have checked it without message: I have just removed "if(THREAD_ID...) statements and everything works fine, as seen from postprocessing, except it chooses one viscousity function for all zones, so it does not enter "if(THREAD_ID...) statements
|
And there is another strange thing: when I put "Message" or "Error" statement, interpretor says:
function "CX_Message" not founs (pc=80) or function "CX_Primitive_Error" not found (pc=80) |
Quote:
do not introduce idtop & idbot as: Code:
#define idtop 11 Code:
int idtop=11 |
Quote:
I have already tried this: it does not help. I am wanderin, could it be an interpretor problem, since it does not recognize commands like "Message" and "Error" |
Quote:
|
Thanks Amir,
I have tried with other udf Message and Error macros do not work, so there is something wrong with an interpretter indeed. |
I have solved the problem: it turns out that zone ID numbers must be taken as assigned by gambit (as in mesh file) and not as shown by fluent!
As for "Error" and "Message" makros they do not work, but can be replaced by "printf". |
really? I've used ID's that FLUENT shows for my UDFs before and they've worked.
would you please also checked that with other versions of FLUENT? |
Hi
I've got the same problem with my UDF to define different diffusivities for different zones , did you solve this? I appreciate your suggestions. Did you define the zone ID from boundary box or cell zone box? Quote:
|
Hello Nathan,
Yes I have solved the problem but it was a long time ago: I remember that it turns out that zone ID numbers must be taken as assigned by gambit (as in mesh file) and not as shown by fluent! That is why my procedure was not working. So, in file I have presented above, it was necessary to change values of idtop and idbottom to those given by gambit in mesh file. Truffaldino |
Quote:
I was not aware of your messge, sorry for late responce. Unfortunately I have no access to different versions of Fluent, so I cannot check it. Truffaldino |
Hi, I have problem to save mass flow rate at outlet
I did following udf but it seems UDMI doesnt work because it is always zero. is there anyone who can help me? thanks in advance! here is my code: #include "udf.h" DEFINE_EXECUTE_AT_END(measure_mass_flow) { real mass_flow; Domain *d=Get_Domain(1); cell_t c; face_t f; Thread *mixture_thread = Lookup_Thread(d,4); Thread **pt = THREAD_SUB_THREADS(mixture_thread); Thread *tp = pt[0]; Thread *ts = pt[1]; mass_flow=0.; mp_thread_loop_f(mixture_thread,d,pt) if( THREAD_ID(mixture_thread) == 4 ) { begin_f_loop(f,mixture_thread) { F_UDMI(f,mixture_thread,0)+= F_FLUX(f,tp); } end_f_loop(f,mixture_thread) } } |
Hi, I also have this problem and fix it by using the ID provided by FLUENT, which can be found in BC panel.
|
hi Zwbmimi,
thanks for the answer! I did it as well. But now i have problem to use it in parallel. Can you use it in parallel..? best regards Quote:
|
Yes, my UDF works in parallel.
Quote:
|
for what kind of application are you using it?
can you help me to make it parallel? thanks in advance... Quote:
|
Hi, i include the thread id in source terms of my uds. Does your code work well in parallel without the tread id? I'm happy to help.
Quote:
|
All times are GMT -4. The time now is 21:03. |