|
[Sponsors] |
January 4, 2012, 05:01 |
Plz help me, FLUENT received fatal signal
|
#1 |
New Member
Join Date: Jan 2012
Posts: 10
Rep Power: 14 |
Hi!
There is error as followed when I try to add the UDF boundary condition: 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: () I can't figure out what's the problem. I want to calculate the total heat added to the model by the function: Q=cp*density*volume*(tempn-templ); Q_tot +=Q; Here's my UDF code, plz help me with that.. Thank you!! #include "udf.h" real Q_tot=0; DEFINE_PROFILE (unsteady_heatflux, thread, position) { Domain *d; real cp=880; real density=2180; real tempn, templ, volume, Q; Thread *t; cell_t c; d= Get_Domain(2); /*Get the domain using Fluent utility *//*Loop over all cell threads in the domain*/ thread_loop_c(t,d) /*Compute Q */ /*Loop over all cells */ begin_c_loop(c,t) { real time= RP_Get_Real("flow-time"); real b=(int)(time/3600)+1; int i=(int)((b-1)/24); real Heat[4]={278.5, 280.7, 278.5, 280.5}; volume=C_VOLUME(c,t); /* get cell volume */ templ=C_T_M1(c,t); ; /*Get cell tempertuare of previous step*/ tempn=C_T(c,t); /*Get cell tempertuare*/ Q=cp*density*volume*(tempn-templ); Q_tot +=Q; if (Q_tot<= Heat[i]) F_PROFILE(c,t,position)=60; else F_PROFILE(c,t,position)=0; } end_c_loop(c,t) } Last edited by molixu; January 4, 2012 at 07:40. |
|
January 4, 2012, 10:45 |
|
#2 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
Code:
... d= Get_Domain(2); ... Code:
... d= Get_Domain(1); ... Code:
... if(NULL == (d= Get_Domain(1))) Error("NULL pointer assignment!\n"); ... |
|
January 4, 2012, 10:49 |
|
#3 | |
New Member
Join Date: Jan 2012
Posts: 10
Rep Power: 14 |
Thank you for your reply.
I've noticed that and changed to d= Get_Domain(1);but it still doesn't work. I can't even initialize...the same error.. Quote:
|
||
January 4, 2012, 11:07 |
|
#4 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
Ok, now I see few mistakes more:
1. You don't need the domain pointer since you already have the face thread "thread" given by the solver. 2. You're looping over the cell threads but what you need is a face thread, and when you mix them, you get an error (F_PROFILE(c,t,position) will give you a segmentation violation if you don't use a face thread). So, remove Code:
d= Get_Domain(2); /*Get the domain using Fluent utility *//*Loop over all cell threads in the domain*/ thread_loop_c(t,d) /*Compute Q */ /*Loop over all cells */ begin_c_loop(c,t) Code:
begin_f_loop(f,thread) ... F_PROFILE(f,thread,position) = ... ... |
|
January 8, 2012, 04:18 |
|
#5 | |
New Member
Join Date: Jan 2012
Posts: 10
Rep Power: 14 |
domoroian,
I've changed my codes as follows. My case is a simple one about heat transfer in solid,2D model. What I want to realize is: get the temperature of recent step and previous step of all the cells in the X-Y face, using them to calculate the heat obtained of the domain,(Q=c*m*delt(T) )and accumulate the value of Q for each day (real time in interation). Once the Q reach a certain value, the BC of imposed temperature 333K was changed to equaling the temp of the adjacent cell temperature. How can I store the value Q after each interation? is my codes correct? And there'are some errors when compiling. 1.udf_names.c(7) : error C2059: syntax error : “}” 2.udf_names.c(8) : warning C4034: sizeof return 0 Code:
#include "udf.h" Code:
#define cp 800 #define density 2180 DEFINE_PROFILE (unsteady_temp,t,index) { float tempn,templ,volume,Q,Q_tot,time,a,b,tempad; int i; float Heat[5]={278.5, 280.7, 278.5, 280.5, 285.2}; Domain *d; Thread *ct,*t0; cell_t c,c0; face_t f; time = RP_Get_Real("flow-time"); a =time/3600; b =a/24; d = Get_Domain(1); i=(int)(((int)a)/24); if (b==(int)b) Q_tot=0; thread_loop_c(ct,d) /*Compute Q */ /*Loop over all threads in the domain */ { begin_c_loop(c,ct) /*Loop over all cells */ { volume=C_VOLUME(c,ct); /* get cell volume */ templ=C_T_M1(c,ct); /*Get cell tempertuare of previous step*/ tempn=C_T(c,ct); /*Get cell tempertuare*/ Q=cp*density*volume*(tempn-templ); Q_tot +=Q; } end_c_loop(c,ct) } if (Q_tot<= Heat[i]) begin_f_loop(f,t) { F_PROFILE(f,t,index)=333; /*BC:Temp=333K*/ } end_f_loop(f,t) else begin_f_loop(f,t) { c0 = F_C0(f,t); t0 = THREAD_T0(t); tempad=C_T(c0,t0); /*temperature of adjacent cell*/ F_PROFILE(f,t,index)=tempad; } end_f_loop(f,t) } Quote:
Last edited by molixu; January 8, 2012 at 06:10. |
||
January 8, 2012, 13:21 |
|
#6 |
Senior Member
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16 |
Molixu,
Please see the reply here: http://www.cfd-online.com/Forums/flu...tion-rate.html Please stop posting the same question to several threads. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
SOFC fatal signal (ACCESS_VIOLATION) | inoxrocks | FLUENT | 2 | January 22, 2015 10:20 |
A fatal signal (segmentation violation) | sutthinan | Fluent UDF and Scheme Programming | 6 | March 16, 2011 19:35 |
fatal signal (ACCESS_VIOLATION) | manu | FLUENT | 0 | December 10, 2007 07:10 |
FLUENT received fatal signal (ACCESS_VIOLATION) | samy | FLUENT | 0 | November 10, 2007 14:09 |
Fluent.6.2.received a fatal signal (SEGMENTATION ) | Jungfeng | FLUENT | 0 | October 8, 2007 12:05 |