|
[Sponsors] |
problem in definition of secondary phase volume fraction in UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 17, 2016, 13:00 |
problem in definition of secondary phase volume fraction in UDF
|
#1 |
New Member
hadi
Join Date: Aug 2015
Posts: 8
Rep Power: 11 |
Dear my friends, I have problem in definition of secondary phase volume fraction in UDF for using in 2-phase mixture model in fluent. UDF is as follows. it is interpreted successfully by fluent but after iteration fluent report this error: (FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: ()). how I can define secondary phase volume fraction in source term and slip velocity? Please help me!! /************************************************** ************* UDF for a defining a custom slip velocity in a 2-phase mixture problem ************************************************** **************/ #include "udf.h" #define M0 1e-6 #define xw 0.1 #define yw -0.005 #define con 5213.0 #define dp 0.00000001 #define muf 8.55e-4 DEFINE_SOURCE(x_mom,c,t,dS,eqn) { real x[ND_ND]; real x1, y1, Temp, phi, term, source; x1 = x[0]; y1 = x[1]; C_CENTROID(x,c,t); Temp = C_T(c,t); phi = C_VOF(c,t);/*phi=volume fraction of secondary phase*/ term = (pow((x1-xw),2.)+pow((y1-yw),2.))*(pow((x1-xw),2.)+pow((y1-yw),2.)); source = -0.001648*con*(x1-xw)*phi/(term*Temp); dS[eqn] = 0.; return source; } DEFINE_SOURCE(y_mom,c,t,dS,eqn) { real x[ND_ND]; real x1, y1, Temp, phi, term, source; x1 = x[0]; y1 = x[1]; C_CENTROID(x,c,t); Temp = C_T(c,t); phi = C_VOF(c,t);/*phi=volume fraction of secondary phase*/ term = (pow((x1-xw),2.)+pow((y1-yw),2.))*(pow((x1-xw),2.)+pow((y1-yw),2.)); source = -0.001648*con*(y1-yw)*phi/(term*Temp); dS[eqn] = 0.; return source; } /************************************************** ************* UDF for defining a custom slip velocity in a 2-phase mixture problem ************************************************** **************/ DEFINE_VECTOR_EXCHANGE_PROPERTY(custom_slip,c,mixt ure_thread, second_column_phase_index,first_column_phase_index ,vector_result) { real x[ND_ND]; real x1 = x[0]; real y1 = x[1]; real Temp=C_T(c,mixture_thread); real phi = C_VOF(c,mixture_thread);/*phi=volume fraction of secondary phase*/ real term= (pow((x1-xw),2.)+pow((y1-yw),2.))*(pow((x1-xw),2.)+pow((y1-yw),2.)); real fx = -0.001648*con*(x1-xw)*phi/(term*Temp); real fy = -0.001648*con*(y1-yw)*phi/(term*Temp); vector_result[0] = fx*pow(dp,3)/(3.0*muf*dp); vector_result[1] = fy*pow(dp,3)/(3.0*muf*dp); } |
|
July 17, 2016, 18:02 |
|
#2 |
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 11 |
Access violation tells you that you are trying to access a variable that is not available. I think that in your case the problem is that you are trying to access VOF on the mixture level but the volume fraction will be much more likely defined on the phase level. So I would recommend to try to get sub-thread of the mixture thread and access the VOF through these.
|
|
July 18, 2016, 04:08 |
|
#3 | |
New Member
hadi
Join Date: Aug 2015
Posts: 8
Rep Power: 11 |
Quote:
Dear Zbyenk thanks for your quick reply. I would be very grateful if you mention how I can define secondary phase volume fraction by get sub-thread of the mixture thread? |
||
July 18, 2016, 12:55 |
|
#4 |
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 11 |
What you are looking for is the macro THREAD_SUB_THREAD(args). Just have a look in the Fluent Customization (UDF) Manual. There are a lot of examples of the procedure. Even directly in the section of the macro you used, DEFINE_VECTOR_EXCHANGE_PROPERTY, there is an example that uses the definition of sub-threads to obtain density of the phases. The approach to obtain the phase volume fractions is the same.
Code:
Thread *pt, *st; pt = THREAD_SUB_THREAD(mixture_thread, second_column_phase_index); st = THREAD_SUB_THREAD(mixture_thread, first_column_phase_index); |
|
July 18, 2016, 16:52 |
|
#5 |
New Member
hadi
Join Date: Aug 2015
Posts: 8
Rep Power: 11 |
Dear Zbynek
how I can define secondary void fraction in source terms where define_source macro [DEFINE_SOURCE(x_mom,c,t,dS,eqn)] dose not allow to define extra arguments such as : Thread *pt, *st; pt = THREAD_SUB_THREAD(mixture_thread, second_column_phase_index); st = THREAD_SUB_THREAD(mixture_thread, first_column_phase_index); Thanks again |
|
July 18, 2016, 17:27 |
|
#6 |
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 11 |
If the passed thread t in the DEFINE_SOURCE macro is the mixture thread, then the secondary phase sub-thread should be:
Code:
ts = THREAD_SUB_THREAD(t,1); |
|
July 19, 2016, 05:38 |
|
#7 |
New Member
hadi
Join Date: Aug 2015
Posts: 8
Rep Power: 11 |
Dear Zbynek; based on your comment I defined a sub-domain to specify secondary phase but after interpretation of UDF, Fluent reports these errors:
line 10: parse error. line 11: parse error. line 12: x1: undeclared variable @@@@@@@@@@@@@@@@@@@@@@@@@@ #include "udf.h" #define xw 0.1 #define yw -0.005 #define con 5213.0 DEFINE_SOURCE(ymom, c, t, dS, eqn) { real source; Thread *ts; ts = THREAD_SUB_THREAD(t,1); real x[ND_ND]; /*line10*/ real x1, y1, Temp, phi, term, source; /*line11*/ x1 = x[0]; /line12*/ y1 = x[1]; C_CENTROID(x,c,t); Temp = C_T(c,t); phi = C_VOF(cell,ts); term = (pow((x1-xw),2.)+pow((y1-yw),2.))*(pow((x1-xw),2.)+pow((y1-yw),2.)); source = -0.001648*con*(x1-xw)*phi/(term*Temp); dS[eqn] = 0.; return source; } |
|
July 19, 2016, 07:43 |
|
#8 |
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 11 |
Cannot see any problem on those lines. On line 16 change cell to c. Simple approach how to find a problem is to comment out all lines that you can except the return value and its declaration. Then add line by line and you will see exactly what the problem is.
|
|
July 19, 2016, 10:46 |
|
#9 |
New Member
hadi
Join Date: Aug 2015
Posts: 8
Rep Power: 11 |
Those errors are due to definition of subdomain for secondary phase i.e. Thread *ts;
ts = THREAD_SUB_THREAD(t,1); when I remove it works. |
|
July 20, 2016, 05:46 |
|
#10 |
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 11 |
No, that's not the problem. First of all, you declare source twice. Remove one of the declarations.
Code:
#include "udf.h" #define xw 0.1 #define yw -0.005 #define con 5213.0 DEFINE_SOURCE(ymom, c, t, dS, eqn) { Thread *ts; ts = THREAD_SUB_THREAD(t,1); real x[ND_ND]; real x1, y1, Temp, phi, term, source; C_CENTROID(x,c,t); x1 = x[0]; y1 = x[1]; Temp = C_T(c,t); phi = C_VOF(c,ts); term = (pow((x1-xw),2.)+pow((y1-yw),2.))*(pow((x1-xw),2.)+pow((y1-yw),2.)); source = -0.001648*con*(x1-xw)*phi/(term*Temp); dS[eqn] = 0.; return source; } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
multiphase turbulance case floating error | harsha_kulkarni | OpenFOAM Running, Solving & CFD | 3 | February 18, 2016 06:06 |
Finding Volume fraction at outlet when it changes its phase. | praveen.jpk | Main CFD Forum | 1 | August 18, 2014 08:18 |
On the damBreak4phaseFine cases | paean | OpenFOAM Running, Solving & CFD | 0 | November 14, 2008 22:14 |
Differences between serial and parallel runs | carsten | OpenFOAM Bugs | 11 | September 12, 2008 12:16 |
How to set volume fraction in two phase flow | Kamel | FLUENT | 2 | March 23, 2007 01:06 |