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

error in DEFINE PROPERTY UDF for multiphase flow

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 1 Post By pakk
  • 4 Post By CMIUCBS
  • 1 Post By CMIUCBS

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 11, 2021, 08:11
Default error in DEFINE PROPERTY UDF for multiphase flow
  #1
New Member
 
Babak
Join Date: Oct 2021
Posts: 12
Rep Power: 4
CMIUCBS is on a distinguished road
Hi everyone.
I'm Trying to simulate a boiling flow with water based nanofluid as the Primary phase and vapor as the secondary phase; therefore I'm trying to write a define property and define specific heat udf for the primary phase.


The problem is that after I gave the code to fluent and initialized, I get this error:

"received signal sigsegv fluent"


I read somewhere that it's because the code is written wrong.

here is my udf:


#include"udf.h"


DEFINE_PROPERTY(conductivity, c, thread)
{
Thread *thread_liq = THREAD_SUB_THREAD(thread,0);
Thread *thread_vap = THREAD_SUB_THREAD(thread,1);



real k_eff,ks,kf,kh,kl,Tw,vf;



Tw = C_T(c,thread_liq);


vf=0.001; /*volume fraction of the nano particles */
kl=0.664;
kh=0.5928;
kf=(((kh-kl)/70)*(Tw-473.15)+kl); /*Conductivity Base Fluid*/

ks=32.9; /*Conductivity Nanoparticle*/

k_eff=(((1-vf)*(ks+2*kf)+3*vf*(ks))/((1-vf)*(ks+2*kf)+3*vf*(kf)))*kf;

return k_eff;
}



DEFINE_SPECIFIC_HEAT(specficheat,T, Tref, h, yi)
{
cell_t c;
Thread *thread;
Thread *thread_liq = THREAD_SUB_THREAD(thread,0);
Thread *thread_vap = THREAD_SUB_THREAD(thread,1);
real cp_f,cp_nf,cp_s,ro_f,ro_s,ro_nf,roh,rol,ch,cl,Tw,v f;
Tw = C_T(c,thread_liq);
vf=0.001; /*volume fraction of the nano particles */
rol=864.7;
roh=770.6;
ro_f=(((roh-rol)/70)*(T-473.15)+rol);
ro_s=6310;
ro_nf=(1-vf)*(ro_f)+vf*(ro_s);
cl=4494;
ch=5067;
cp_f=(((ch-cl)/70)*(T-473.15)+cl);
cp_s=550.3;
cp_nf=(((1-vf)*(ro_f*cp_f)+vf*(ro_s*cp_s))/((1-vf)*(ro_f)+vf*(ro_s)));

*h = cp_nf*(T-Tref);
return cp_nf;
}






can anybody help me?
CMIUCBS is offline   Reply With Quote

Old   December 12, 2021, 03:02
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
To find out where the problem is, you should simplify your UDF. Remove lines until you find the line that gives the error.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   December 12, 2021, 03:36
Default
  #3
New Member
 
Babak
Join Date: Oct 2021
Posts: 12
Rep Power: 4
CMIUCBS is on a distinguished road
thank you for your reply.
I had simplified the code and I think the problem is in the way I use phase threads in my code.
I want to use my primary phase cell temperature in the code and i simplified it to this but it's still wrong.
can you help me figure out where i'm writing it wrong? I think it's the bold words that causing the problem.

Here is my code:


#include"udf.h"

DEFINE_PROPERTY(density, c, thread)
{
real ro_nf,ro_f,ro_s,roh,rol,vf;
real Tw;
Thread *thread_liq;
thread_liq = THREAD_SUB_THREAD(thread,0);
Tw = C_T(c,thread_liq);

vf=0.001; /* volume fraction of the nano particles */
rol=864.7;
roh=770.6;
ro_f=(((roh-rol)/70)*(Tw-473.15)+rol);
ro_s=6310;
ro_nf=(1-vf)*(ro_f)+vf*(ro_s);

return ro_nf;
}
CMIUCBS is offline   Reply With Quote

Old   December 12, 2021, 06:06
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
You should simplify to the extreme, see below. Do both give errors?

Code:
#include"udf.h"

DEFINE_PROPERTY(density, c, thread)
{
Thread *thread_liq;
thread_liq = THREAD_SUB_THREAD(thread,0);
}
Code:
#include"udf.h"

DEFINE_PROPERTY(density, c, thread)
{
real Tw;
Thread *thread_liq;
thread_liq = THREAD_SUB_THREAD(thread,0);
Tw = C_T(c,thread_liq);
}
CMIUCBS likes this.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   December 12, 2021, 16:27
Default
  #5
New Member
 
Babak
Join Date: Oct 2021
Posts: 12
Rep Power: 4
CMIUCBS is on a distinguished road
Thank You for your respond. I managed to find the problem and rewrite the code.
The problem was that i didn't properly introduced the domain and sub threads in the udf.

Here's the code if anyone had a similar problem in the future:


#include"udf.h"

DEFINE_PROPERTY(density, c, thread)
{
Domain *mixture_domain = Get_Domain(1);
Thread *mixture_thread = Lookup_Thread(mixture_domain,8);
Thread *Primary_phase_thread = THREAD_SUB_THREAD(mixture_thread,0);
Thread *Secondary_phase_thread = THREAD_SUB_THREAD(mixture_thread,1);


real ro_nf,ro_f,ro_s,roh,rol,vf;
real Tw;
Tw = C_T(c,Primary_phase_thread);
vf=0.001; /* volume fraction of the nano particles */
rol=864.7;
roh=770.6;
ro_f=(((roh-rol)/70)*(Tw-473.15)+rol);
ro_s=6310;
ro_nf=(1-vf)*(ro_f)+vf*(ro_s);

return ro_nf;
}
pakk, air, Severin FENG and 1 others like this.
CMIUCBS is offline   Reply With Quote

Old   August 19, 2022, 01:06
Default
  #6
Member
 
xingangzheng
Join Date: Jul 2009
Posts: 37
Rep Power: 16
ustbdynamic is on a distinguished road
Dear friend,
what's the meaning of the number 8 in Lookup_Thread(mixture_domain, 8); it is a cell zone ID or phase ID.

thank you very much.

Quote:
Originally Posted by CMIUCBS View Post
Thank You for your respond. I managed to find the problem and rewrite the code.
The problem was that i didn't properly introduced the domain and sub threads in the udf.

Here's the code if anyone had a similar problem in the future:


#include"udf.h"

DEFINE_PROPERTY(density, c, thread)
{
Domain *mixture_domain = Get_Domain(1);
Thread *mixture_thread = Lookup_Thread(mixture_domain,8);
Thread *Primary_phase_thread = THREAD_SUB_THREAD(mixture_thread,0);
Thread *Secondary_phase_thread = THREAD_SUB_THREAD(mixture_thread,1);


real ro_nf,ro_f,ro_s,roh,rol,vf;
real Tw;
Tw = C_T(c,Primary_phase_thread);
vf=0.001; /* volume fraction of the nano particles */
rol=864.7;
roh=770.6;
ro_f=(((roh-rol)/70)*(Tw-473.15)+rol);
ro_s=6310;
ro_nf=(1-vf)*(ro_f)+vf*(ro_s);

return ro_nf;
}
ustbdynamic is offline   Reply With Quote

Old   August 19, 2022, 02:26
Default
  #7
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
its zone ID (comes from the logic of code which I can see)
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   August 19, 2022, 05:24
Default
  #8
New Member
 
Babak
Join Date: Oct 2021
Posts: 12
Rep Power: 4
CMIUCBS is on a distinguished road
Quote:
Originally Posted by ustbdynamic View Post
Dear friend,
what's the meaning of the number 8 in Lookup_Thread(mixture_domain, 8); it is a cell zone ID or phase ID.

thank you very much.
It's the fluid domain ID which you can obtain in Cell Zone Condition. you have to change it for your case.
air likes this.
CMIUCBS is offline   Reply With Quote

Reply

Tags
eulerian multiphase, udf


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
Errors in melting of ice-particles in ice-slurry flow UDF devshi Fluent UDF and Scheme Programming 3 November 28, 2016 12:45
UDF for Mass Flow at the Outlet: ERROR ACCESS VIOLATION I-mech Fluent UDF and Scheme Programming 1 May 23, 2014 12:37
UDF problems with porous flow Nicolastheterminator Fluent UDF and Scheme Programming 0 April 8, 2014 09:12
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23
UDF FOR UNSTEADY TIME STEP mayur FLUENT 3 August 9, 2006 10:19


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