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

udf gradient

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 21, 2008, 05:32
Default udf gradient
  #1
isabel
Guest
 
Posts: n/a
Hello everybody,

I want to impose as a boundary condition a shear dTdx*T. I have written the following code but I have a violation error. Does somebody know why?

DEFINE_PROFILE (shear_x, thread, position) { real T; real dTdx; real shear; face_t f;

begin_f_loop(f, thread) { T = C_T(f, thread); dTdx = C_T_G(f, thread)[0]; shear = dTdx*T; F_PROFILE(f, thread, position) = shear; } end_f_loop(f, thread); }

I have tipped "yes" to "solve->set->expert -> set temporary solver memory from being freed".

  Reply With Quote

Old   July 21, 2008, 08:12
Default Re: udf gradient
  #2
max
Guest
 
Posts: n/a
Hello Isabel,

you are looping over faces of a wall boundary I guess but your code is asking for cell-values (C_T !!). That won't work, until your retrieve the corresponding cells and cell thread adjacent to your wall. Have a look at the UDF-manuel chapter 3.2.5.

cheers Max
  Reply With Quote

Old   July 22, 2008, 05:44
Default Re: udf gradient
  #3
krishna
Guest
 
Posts: n/a
Hi, Please go through the below UDF. It will be helpful to you. Regards,

The UDF below (to be used with FLUENT 6.3.26) shows a strategy to compute and use wall shear stresses. It loops over all the faces of the wall boundary on which the wall shear stress has to be obtained. The wall shear stress is stored inside a UDM at the cell next to the wall.

/* ************************************************** */ /* Please make sure that at least 1 UDM is define */ #include "udf.h"

DEFINE_ON_DEMAND(wall_shear_calc) { Domain *d; real wall_shear_force, area; face_t f; real A[ND_ND]; cell_t c, c0; Thread *t,*t0, *c_thread; int Zone_ID=6; /* Zone ID of the wall on which shear stress has to be calculated */ /* It can be obtained from the boundary condition panel.*/ d=Get_Domain(1);

/* Initialize the UDM value to zero in complete domain */ thread_loop_c(c_thread,d) { begin_c_loop(c, c_thread) { C_UDMI(c,c_thread,0)= 0; } end_c_loop(c, c_thread) }

/* Calculate wall shear stress and store them in UDM */

t=Lookup_Thread(d,Zone_ID); begin_f_loop(f, t) { F_AREA(A,f,t); area = NV_MAG(A); wall_shear_force = NV_MAG(F_STORAGE_R_N3V(f,t, SV_WALL_SHEAR)); c0 = F_C0(f,t); t0 = THREAD_T0(t); C_UDMI(c0,t0,0)= wall_shear_force/area; } end_f_loop(f, t) }

  Reply With Quote

Old   July 22, 2008, 06:06
Default Re: udf gradient
  #4
isabel
Guest
 
Posts: n/a
I donīt know what is a UDM.

I have tried the following but i have error:

#include "udf.h"

DEFINE_ON_DEMAND(wall_shear_calc)

{

Domain *d;

real wall_shear_force, area;

face_t f;

real A[ND_ND];

cell_t c, c0;

Thread *t,*t0, *c_thread;

int Zone_ID=6; /* Zone ID of the wall on which shear stress has to be calculated */

/* It can be obtained from the boundary condition panel.*/ d=Get_Domain(1);

/* Initialize the UDM value to zero in complete domain */

thread_loop_c(c_thread,d)

{

begin_c_loop(c, c_thread)

{

C_UDMI(c,c_thread,0)= 0;

}

end_c_loop(c, c_thread) }

/* Calculate wall shear stress and store them in UDM */

t=Lookup_Thread(d,Zone_ID);

begin_f_loop(f, t)

{

F_AREA(A,f,t);

area = NV_MAG(A);

wall_shear_force = NV_MAG(F_STORAGE_R_N3V(f,t, SV_WALL_SHEAR));

c0 = F_C0(f,t);

t0 = THREAD_T0(t);

C_UDMI(c0,t0,0)= wall_shear_force/area;

}

end_f_loop(f, t)

}

The error is:

Error: CAR: invalid argument [1]: wrong type [not a pair] Error Object: ()
  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
Gradient selim CFX 1 July 13, 2007 03:17
------gradient help mech FLUENT 0 May 6, 2006 02:28
for help about gradient of UDM Hanxsi FLUENT 0 April 28, 2006 02:42
UDS gradient Giordano Bruno FLUENT 4 December 17, 2004 17:32
How to add the second gradient of UDS zhou FLUENT 1 September 4, 2003 06:32


All times are GMT -4. The time now is 02:28.