CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Compute OSI and RRT

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

LinkBack Thread Tools Search this Thread Display Modes
Old   April 20, 2023, 05:52
Default Compute OSI and RRT
New Member
fgs gs
Join Date: Apr 2023
Posts: 2
Rep Power: 0
2022821110240 is on a distinguished road
I want to compute OSI and RRT by udf in the fluent. I use the code which writed by the khuti in this forum, However, the influence of initial conditions on the calculation results must be taken into account, I need to compute the OSI and RRT for the second artery cycle. In my compute model, the pysical time step is 0.005s, the total compute time is 1s, arterial cycle is 0.5s. the code can work, but the results of OSI and RRT is not the results for the second cycle, any suggestions/helps will appreciate. the code is following:

/************************************************** ****
Oscillatory shear index
************************************************** ****/
#include "udf.h"
#include "math.h"
#include "storage.h"
#include "sg_udms.h"

#define domain_ID 1
#define zone_ID 16

/* Define Names for the WSS UDMI and its components */
Set_User_Memory_Name(0, "uWSS");
Set_User_Memory_Name(1, "uWSSx");
Set_User_Memory_Name(2, "uWSSy");
Set_User_Memory_Name(3, "uWSSz");
Set_User_Memory_Name(4, "OSI");
Set_User_Memory_Name(5, "Timme0");
Set_User_Memory_Name(6, "Timme1");
Set_User_Memory_Name(7, "Timme2");
Set_User_Memory_Name(8, "RRT");
Set_User_Memory_Name(9, "area");

/* Initialize the UDM value to zero in complete domain */
Thread *c_thread;
cell_t c;

begin_c_loop(c, c_thread)
C_UDMI(c,c_thread,0)= 0;
C_UDMI(c,c_thread,1)= 0;
C_UDMI(c,c_thread,2)= 0;
C_UDMI(c,c_thread,3)= 0;
C_UDMI(c,c_thread,4)= 0;
C_UDMI(c,c_thread,5)= 0;
C_UDMI(c,c_thread,6)= 0;
C_UDMI(c,c_thread,7)= 0;
C_UDMI(c,c_thread,8)= 0;
end_c_loop(c, c_thread)

/* Calculate wall shear stress and store them in UDM */
Domain *domain;
real area;
face_t f;
real A[ND_ND];
cell_t c, c0;
Thread *t,*t0, *c_thread;
real wallshear [ND_ND];
real Timme [ND_3], Timme0,Timme1,Timme2;
domain = Get_Domain(domain_ID);
Timme0 = 0;
Timme1 = 0;
Timme2 = 0;
Timme0= RP_Get_Real("flow-time");
Timme1= RP_Get_Real("physical-time-step");
Timme2= RP_Get_Integer("time-step");
t = Lookup_Thread(domain,zone_ID);
if (Timme0 >=0.5)
begin_f_loop(f, t)
area = NV_MAG(A);
NV_V(wallshear,=,F_STORAGE_R_N3V(f,t, SV_WALL_SHEAR));
c0 = F_C0(f,t);
t0 = THREAD_T0(t);
C_UDMI(c0,t0,0) += NV_MAG(wallshear)/area;
C_UDMI(c0,t0,1) += -wallshear[0]/area;
C_UDMI(c0,t0,2) += -wallshear[1]/area;
C_UDMI(c0,t0,3) += -wallshear[2]/area;
C_UDMI(c0,t0,4) = (1 - sqrt(C_UDMI(c0,t0,1)*C_UDMI(c0,t0,1) + C_UDMI(c0,t0,2)*C_UDMI(c0,t0,2) + C_UDMI(c0,t0,3)*C_UDMI(c0,t0,3))/C_UDMI(c0,t0,0))/2;
C_UDMI(c0,t0,5) = Timme0;
C_UDMI(c0,t0,6) = Timme1;
C_UDMI(c0,t0,7) = Timme2;
C_UDMI(c0,t0,8) = Timme0/sqrt(C_UDMI(c0,t0,1)*C_UDMI(c0,t0,1) + C_UDMI(c0,t0,2)*C_UDMI(c0,t0,2) + C_UDMI(c0,t0,3)*C_UDMI(c0,t0,3));
C_UDMI(c0,t0,9) = area;
end if
2022821110240 is offline   Reply With Quote

Old   September 3, 2023, 01:46
Default Regarding RRT
New Member
Md Asif Equbal
Join Date: Aug 2022
Location: India
Posts: 14
Rep Power: 3 is on a distinguished road
I have checked your code the RRT not gives accurate results even for one cycle. It gives value under 0.5 only. I think the expression of RRT which you stored in UDM 8 is not correct. Please check.
C_UDMI(c0,t0,8) = Timme0/sqrt(C_UDMI(c0,t0,1)*C_UDMI(c0,t0,1) + C_UDMI(c0,t0,2)*C_UDMI(c0,t0,2) + C_UDMI(c0,t0,3)*C_UDMI(c0,t0,3));

If you solve your problem. please post updated code.

Thanking you
Asif is offline   Reply With Quote


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
Help needed regarding calculation of OSI, RRT Noushin FLUENT 0 April 4, 2019 01:39

All times are GMT -4. The time now is 08:32.