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

Plz help me, FLUENT received fatal signal

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 4, 2012, 04:01
Default Plz help me, FLUENT received fatal signal
  #1
New Member
 
Join Date: Jan 2012
Posts: 10
Rep Power: 4
molixu is on a distinguished road
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 06:40.
molixu is offline   Reply With Quote

Old   January 4, 2012, 09:45
Default
  #2
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 644
Rep Power: 10
dmoroian is on a distinguished road
Code:
...
d= Get_Domain(2);
...
Are you computing a multiphase model? If not, then this is an error, and 2 should be replaced with 1:

Code:
...
d= Get_Domain(1);
...
In any case it is a good practice to check for NULL pointer:
Code:
...
if(NULL == (d= Get_Domain(1)))
   Error("NULL pointer assignment!\n");
...
dmoroian is offline   Reply With Quote

Old   January 4, 2012, 09:49
Default
  #3
New Member
 
Join Date: Jan 2012
Posts: 10
Rep Power: 4
molixu is on a distinguished road
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:
Originally Posted by dmoroian View Post
Code:
...
d= Get_Domain(2);
...
Are you computing a multiphase model? If not, then this is an error, and 2 should be replaced with 1:

Code:
...
d= Get_Domain(1);
...
In any case it is a good practice to check for NULL pointer:
Code:
...
if(NULL == (d= Get_Domain(1)))
   Error("NULL pointer assignment!\n");
...
molixu is offline   Reply With Quote

Old   January 4, 2012, 10:07
Default
  #4
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 644
Rep Power: 10
dmoroian is on a distinguished road
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)
and replace it with:
Code:
begin_f_loop(f,thread)
...
F_PROFILE(f,thread,position) = ...
...
You will still need the cell id and cell thread. Check section 2.3.26.4 in the fluent 13 udf manual to see how is done.
dmoroian is offline   Reply With Quote

Old   January 8, 2012, 03:18
Default
  #5
New Member
 
Join Date: Jan 2012
Posts: 10
Rep Power: 4
molixu is on a distinguished road
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)
}
Could you give me some advise? Many thanks!

Quote:
Originally Posted by dmoroian View Post
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)
and replace it with:
Code:
begin_f_loop(f,thread)
...
F_PROFILE(f,thread,position) = ...
...
You will still need the cell id and cell thread. Check section 2.3.26.4 in the fluent 13 udf manual to see how is done.

Last edited by molixu; January 8, 2012 at 05:10.
molixu is offline   Reply With Quote

Old   January 8, 2012, 12:21
Default
  #6
Senior Member
 
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 178
Rep Power: 6
ComputerGuy is on a distinguished road
Molixu,

Please see the reply here: udf for heat generation rate


Please stop posting the same question to several threads.
ComputerGuy is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A fatal signal (segmentation violation) sutthinan Fluent UDF and Scheme Programming 6 March 16, 2011 19:35
SOFC fatal signal (ACCESS_VIOLATION) inoxrocks FLUENT 1 August 5, 2009 14:18
fatal signal (ACCESS_VIOLATION) manu FLUENT 0 December 10, 2007 06:10
FLUENT received fatal signal (ACCESS_VIOLATION) samy FLUENT 0 November 10, 2007 13:09
Fluent.6.2.received a fatal signal (SEGMENTATION ) Jungfeng FLUENT 0 October 8, 2007 11:05


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