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

Error when using OSI UDF in multiphase simulation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2023, 08:35
Default Error when using OSI UDF in multiphase simulation
  #1
New Member
 
-
Join Date: Mar 2023
Posts: 1
Rep Power: 0
fluent_cfd is on a distinguished road
I am trying to calculate the oscillatory shear index using an UDF. However, when I switch from single phase to multiphase the UDF gives me SIGSEGV errors. The first UDF is:

/* Initialize the UDM value to zero in complete domain */
DEFINE_INIT(meminit,domain)
{
Thread *c_thread;
cell_t c;

thread_loop_c(c_thread,domain)
{
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;
}
end_c_loop(c, c_thread)
}
}

Which I adjusted to:

DEFINE_ON_DEMAND(meminit)
{
Thread **pt;
Thread *c_thread;
cell_t c;
Domain *d;
d = Get_Domain(domain_ID);

mp_thread_loop_c(c_thread,d,pt)
{
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;
}
end_c_loop(c, c_thread)
}
}

This seems to work (at least it does not give me errors anymore). The adjustment of thread_loop_c to mp_thread_loop_c was the fix. But if I try to do the same for the second UDF, it keeps giving me errors. Does anyone have an idea how I should adjust this UDF to prevent errors in multiphase flow? Thank you!

/* Calculate wall shear stress and store them in UDM */
DEFINE_EXECUTE_AT_END(OSI)
{
Domain *domain;
real area;
face_t f;
real A[ND_ND];
cell_t c, c0;
Thread *t,*t0, *c_thread;
real wallshear [ND_ND];

domain = Get_Domain(domain_ID);
t = Lookup_Thread(domain,zone_ID);

begin_f_loop(f, t)
{
F_AREA(A,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;
}
end_f_loop(f,t)
}
fluent_cfd is offline   Reply With Quote

Reply

Tags
multiphase, osi, udf, udmi


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
UDF + multiphase or UDF + UDS/UDM rkadlof CFD Freelancers 0 July 30, 2022 08:28
Which Multiphase Model Should be selected in Fluent for my below described simulation oberstar Fluent Multiphase 0 September 28, 2017 12:05
UDF in DPM+Eulerian multiphase CeesH Fluent UDF and Scheme Programming 3 June 27, 2015 04:38
about Lagrangian Multiphase Simulation jhlee9622 STAR-CCM+ 0 March 18, 2015 01:38
Simulation multiphase airlift reactor with Eulerian multiphase model question???? dilok.kumyoo FLUENT 0 January 28, 2015 02:15


All times are GMT -4. The time now is 15:31.