# Mixing Index of Multi-phase gas-solid flow

• 203 Views
• Last Post 01 November 2018
• Topic Is Solved
MohAgha1 posted this 31 October 2018

Dear 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

it gives wrong results as shown in the following image

Attached Files

kkanade posted this 01 November 2018

Glad that it is solved. Can you please mark this as 'Is Solution' to benefit others on forum.

Regards,

Keyur

• Liked by
MohAgha1 posted this 01 November 2018

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;

Domain *mixture_domain;

mixture_domain=Get_Domain(1);

{

{

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 */

}

}

}

printf("Nt : %f\n",Nt );

printf("Ni : %f\n",Ni );

}

if(Nt > 0)

{mix_index = Ni/Nt;} /* meso-scopic mixing index */

Ni = 0.0;Nt=0.0;

printf("MI: %f\n", mix_index);

}

Regards;

Mohamed

kkanade posted this 01 November 2018

When 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

• Liked by
MohAgha1 posted this 31 October 2018

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

MohAgha1 posted this 31 October 2018

Dear 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

rwoolhou posted this 31 October 2018

There 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.

• Liked by
MohAgha1 posted this 31 October 2018

I think the problem is because of the phases thread-identifiers

and referring to the solid phase threads by pt[3], pt[4]

but it results in the following error after successful interpretation of the udf

MohAgha1 posted this 31 October 2018

/********************************************************************

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;

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 */

{

{

begin_c_loop(c,t)

/*Thread **pt;   /* initialize pt   */

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)

}

}

{

{

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)

}

}

{

{

begin_c_loop(c,t)

printf("vof_s1: %f\n", C_UDMI(c,t,0));

printf("vof_s2: %f\n", 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: %f\n", mix_index);

}

kkanade posted this 31 October 2018

Hi,