-
-
October 31, 2018 at 10:02 am
MohAgha1
SubscriberDear All;
Can anybody show me the fault in the setup of a user-defined function for calculation of the mesoscopic mixing index of gas-solid flow in fluent;
hint: mesoscopic mixing index: define mixing status (mixed/not mixed) based on the volume fraction of solids in the computational cell
my udf is attached
-
October 31, 2018 at 11:58 am
Keyur Kanade
Ansys EmployeeHi,
As ANSYS employee, we can not download attachments. Can you please insert image.
Regards,
Keyur
-
October 31, 2018 at 12:18 pm
MohAgha1
Subscriber/********************************************************************
UDF for calculatin of solids mixing index of two-solid phases in a multifluid model
*********************************************************************/
#include "udf.h"
real mix_index=0., Nt, Ni;
DEFINE_EXECUTE_AT_END(execute_at_end)
{
Domain *d, *ds1, *ds2;
Thread *t;
cell_t c;
d = Get_Domain(1); /* mixture domain if multiphase */
ds1 = Get_Domain(3); /* solid-1 domain if multiphase */
ds2 = Get_Domain(4); /* solid-2 domain if multiphase */
thread_loop_c(t,ds1)
{
{
begin_c_loop(c,t)
/*Thread **pt; /* initialize pt */
/* pt = THREAD_SUB_THREADS(t); */
C_UDMI(c,t,0) = C_VOF(c,t); /* storing the void fraction of the solid-1 phase for all domain cells in a user-defined memory */
end_c_loop(c,t)
}
}
thread_loop_c(t,ds2)
{
{
begin_c_loop(c,t)
C_UDMI(c,t,1) = C_VOF(c,t); /* storing the void fraction of the solid-2 phase for all domain cells in a user-defined memory */
end_c_loop(c,t)
}
}
thread_loop_c(t,d)
{
{
begin_c_loop(c,t)
printf("vof_s1: %fn", C_UDMI(c,t,0));
printf("vof_s2: %fn", C_UDMI(c,t,1));
if(C_UDSI(c,t,0) >=0.01)
{
Nt = Nt +1; /* total number of solid-1 cells */
if(ABS(C_UDMI(c,t,0) - C_UDMI(c,t,1))/C_UDMI(c,t,0) <= 0.1) /* condition of mixing */
{
Ni = Ni +1; /* cells of mixing status */
}
}
end_c_loop(c,t)
}
}
if(Nt > 0)
{mix_index = Ni/Nt;} /* meso-scopic mixing index */
printf("MI: %fn", mix_index);
}
-
October 31, 2018 at 12:34 pm
MohAgha1
Subscriber -
October 31, 2018 at 4:47 pm
Rob
Ansys EmployeeThere should be a more useful error message at the start of the repeated 999999: mpt_accept lines. I assume you've assigned the UDM storage in Fluent?
Note, as staff we're unable to debug UDF's, so you'll need to (very carefully) read the manual and/or come for training.
-
October 31, 2018 at 5:00 pm
MohAgha1
SubscriberDear Sir;
I read the related lines in the manual and I don't understand how to refer to the phases threads within the mixture loop in multiphase problems like the present one
I saw this image can clearly illustrate my problem
Now, I want to access the interaction domain and do some processes on the subdomain phases-threads
Can anybody guide me to find the missing circle?
Mohamed
-
October 31, 2018 at 5:04 pm
MohAgha1
Subscriber
There should be a more useful error message at the start of the repeated 999999: mpt_accept lines.
Yes, you are right, but the fluent closes by this error before I can copy the full error specification
-
November 1, 2018 at 3:22 am
Keyur Kanade
Ansys EmployeeWhen you open Fluent, please use File - Start Transcript. Then after doing operations in Fluent, again use File - Stop Transcript. This will record all transcript and you will be able to see any errors.
As rwoolhou already mentioned as staff we're unable to debug UDF's, so you'll need to (very carefully) read the manual and/or come for training.
Regards,
Keyur
-
November 1, 2018 at 11:44 am
MohAgha1
Subscriber
Dear All;
Thanks for your interest in solving my problem, I succeeded to solve the problem here below attached my working-well udf to anyone who wants to use it
/********************************************************************
UDF for calculatin of solids mixing index of two-solid phases in a multifluid model
*********************************************************************/
#include "udf.h"
real mix_index=0., Nt=0.0, Ni=0.0;
DEFINE_EXECUTE_AT_END(execute_at_end)
{
cell_t cell;
Thread **pt;
Thread *cell_threads;
Domain *mixture_domain;
mixture_domain=Get_Domain(1);
mp_thread_loop_c(cell_threads,mixture_domain,pt)
{
begin_c_loop(cell,cell_threads)
{
if(C_VOF(cell,pt[1]) >=0.05) /* Vol. fraction of the solid-1 phase */
{
Nt = Nt +1; /* total number of solid-1 cells */
if(ABS(C_VOF(cell,pt[1]) - C_VOF(cell,pt[2]))/C_VOF(cell,pt[1]) <= 0.1) /* condition of mixing */
{
Ni = Ni +1; /* cells of mixing status */
}
}
}
end_c_loop(cell,cell_threads)
printf("Nt : %fn",Nt );
printf("Ni : %fn",Ni );
}
if(Nt > 0)
{mix_index = Ni/Nt;} /* meso-scopic mixing index */
Ni = 0.0;Nt=0.0;
printf("MI: %fn", mix_index);
}
Regards;
Mohamed
-
November 1, 2018 at 1:12 pm
Keyur Kanade
Ansys EmployeeGlad that it is solved. Can you please mark this as 'Is Solution' to benefit others on forum.
Regards,
Keyur
-
- You must be logged in to reply to this topic.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
-
2524
-
2066
-
1279
-
1096
-
457
© 2023 Copyright ANSYS, Inc. All rights reserved.