|
[Sponsors] |
error in DEFINE PROPERTY UDF for multiphase flow |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 11, 2021, 09:11 |
error in DEFINE PROPERTY UDF for multiphase flow
|
#1 |
New Member
Babak
Join Date: Oct 2021
Posts: 12
Rep Power: 5 |
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? |
|
December 12, 2021, 04:02 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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". |
|
December 12, 2021, 04:36 |
|
#3 |
New Member
Babak
Join Date: Oct 2021
Posts: 12
Rep Power: 5 |
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; } |
|
December 12, 2021, 07:06 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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); }
__________________
"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". |
|
December 12, 2021, 17:27 |
|
#5 |
New Member
Babak
Join Date: Oct 2021
Posts: 12
Rep Power: 5 |
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; } |
|
August 19, 2022, 02:06 |
|
#6 | |
Member
xingangzheng
Join Date: Jul 2009
Posts: 40
Rep Power: 17 |
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:
|
||
August 19, 2022, 03:26 |
|
#7 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
its zone ID (comes from the logic of code which I can see)
__________________
best regards ****************************** press LIKE if this message was helpful |
|
August 19, 2022, 06:24 |
|
#8 |
New Member
Babak
Join Date: Oct 2021
Posts: 12
Rep Power: 5 |
||
Tags |
eulerian multiphase, udf |
|
|
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 13:45 |
UDF for Mass Flow at the Outlet: ERROR ACCESS VIOLATION | I-mech | Fluent UDF and Scheme Programming | 1 | May 23, 2014 13:37 |
UDF problems with porous flow | Nicolastheterminator | Fluent UDF and Scheme Programming | 0 | April 8, 2014 10:12 |
REAL GAS UDF | brian | FLUENT | 6 | September 11, 2006 09:23 |
UDF FOR UNSTEADY TIME STEP | mayur | FLUENT | 3 | August 9, 2006 11:19 |