CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

DEFINE_ADJUST question

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 22, 2010, 18:13
Default DEFINE_ADJUST question
  #1
ljp
New Member
 
Join Date: Apr 2010
Posts: 15
Rep Power: 16
ljp is on a distinguished road
Hi,

I need to define a variable using DEFINE_ADJUST macro, looping over all cells in all cell threads. Also I want to monitor another variable on a certain face, which requires to loop over the faces on only one face thread. I understand that if I only have the first part, then I only need to define one t and c, which will represent all cell threads. But since I also need to operate on a single face thread, can I just define two threads, one for the general thread and one for the specific face thread? Will that cause conflict during calculation?

I tried the following code, but I can't tell whether the result is right or not, since I'm not sure how to check the solutions, and the F_UDMI couldn't be displayed. Could anyone please tell me whether this is the correct way to do it? Thank you very much!

DEFINE_ADJUST(my_adjust, domain)
{
Thread *t;
cell_t c;

thread_loop_c(t,domain)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,0) = C_T(c,t);
}end_c_loop(c,t)
}

Thread *tf = Lookup_Thread (domain, 3);
face_t f;
begin_f_loop(f, tf)
{
F_UDMI(f,tf,1) = Dm; //a constant
}
end_f_loop(f,tf)
}

thank you,
ljp
ljp is offline   Reply With Quote

Old   June 22, 2010, 18:40
Default
  #2
New Member
 
omid
Join Date: Mar 2010
Posts: 17
Rep Power: 16
om1234 is on a distinguished road
hi
u can use this one but as i know u need to change the number of udm memory in fluent.because as i know in each memory only one scaler value is stored.define>user define>memory
u can use both of them and it's not important to use single define_adjust,but u must write them in one udf like this:
no of memory=n_udm+1
#include "udf.h"
DEFINE_ADJUST(cells, domain)
{
Thread *t;
cell_t c;

thread_loop_c(t,domain)
{
begin_c_loop(c,t)
{
for(k=0;k<n_udm;k++)
C_UDMI(c,t,k) = C_T(c,t);
printf("vvvvvvvv:%f\n",C_UDMI(c,t,k));/*this is used to define values in graph window)
}
end_c_loop(c,t)
}

DEFINE_ADJUST(one face, domain)
{
face_t f;
int ID=3;
Thread *t = Lookup_Thread (domain, ID);

begin_f_loop(f, t)
{
F_UDMI(f,t,number of used memory in above udf) = Dm; //a constant
printf("name:%f\n",F_UDMI(f,t,number of used memory in above udf+1) );
}
end_f_loop(f,tf)
}

Last edited by om1234; June 22, 2010 at 20:36.
om1234 is offline   Reply With Quote

Old   June 23, 2010, 10:51
Default
  #3
ljp
New Member
 
Join Date: Apr 2010
Posts: 15
Rep Power: 16
ljp is on a distinguished road
Thank you so much for your reply, Omid. But I'm still not very clear. You used two DEFINE_ADJUST macro, but there's only one place to hook this udf, (or, only one adjust_udf can be hooked during the calculation), is that right? If I put these two parts of code into one adjust_udf, then will the two threads, t and tf, cause any conflict?

ljp
ljp is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
question about uds tanven FLUENT 2 July 5, 2015 12:22
Unanswered question niklas OpenFOAM 2 July 31, 2013 17:03
Question about Table applicaiton. universez OpenFOAM Running, Solving & CFD 0 January 12, 2010 21:31
CHANNEL FLOW: a question and a request Carlos Main CFD Forum 4 August 23, 2002 06:55
question K.L.Huang Siemens 1 March 29, 2000 05:57


All times are GMT -4. The time now is 01:24.