- **FLUENT**
(*https://www.cfd-online.com/Forums/fluent/*)

- - **udf gradient
**
(*https://www.cfd-online.com/Forums/fluent/48823-udf-gradient.html*)

udf gradient
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". |

Re: udf gradient
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 |

Re: udf gradient
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) } |

Re: udf gradient
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: () |

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