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

FLUENT received fatal signal (ACCESS_VIOLATION)

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 21, 2013, 19:39
Default FLUENT received fatal signal (ACCESS_VIOLATION)
  #1
New Member
 
Join Date: Aug 2013
Posts: 12
Rep Power: 12
vExus is on a distinguished road
Hi,
I wrote an UDF which fluent interprets without any errors but when initializing the solution i get:
Code:
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: #f
I found that
Code:
C_T(cell, thread)
is the reason. I dont undestand why this happens because i used this macro while defining 3 different properties and only one time it couse this kind of problem.
Energy equation is turned on.
Whole code:
Code:
#include "udf.h"	

DEFINE_PROPERTY(gestosc_miesa, cell, thread)

{
	

	real rom;
	real t = C_T(cell, thread);
	
	
		rom = 1226 - 0,56 * t;

		return rom;
}




DEFINE_PROPERTY(wsp_przew_ciepla_mieso, cell, thread)

{
	

	real km;
	real t = C_T(cell, thread);
	
	
		km = 0,044 + t * 1,56 * 10^-3;

		return km;
}




DEFINE_PROPERTY(cp_miesa, cell, thread)

{
	real cpm;
	real m;
	real t = C_T(cell, thread); //here is the problem
	m = 0,7;
	
	if (t < 303.)
    		cpm = 1675 + 2510 * m;
  
  	else
    		cpm = 3000.;
		

		return cpm;
}










DEFINE_PROPERTY(gestosc_tluszczu, cell, thread)

{
	

	real rot;
	real t = C_T(cell, thread);
	
	
		rot = 1052 - 0,377 * t;

		return rot;
}
What should I do?
vExus is offline   Reply With Quote

Old   August 21, 2013, 21:10
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
It does not hurt to check the pointer before accessing it
Code:
real t;
if (NNULLP(THREAD_STORAGE(thread, SV_T))) 
  t = C_T(cell, thread);
else
  t = 300.0; /* or whatever appropriate */
blackmask is offline   Reply With Quote

Old   August 22, 2013, 07:51
Default
  #3
New Member
 
Join Date: Aug 2013
Posts: 12
Rep Power: 12
vExus is on a distinguished road
It doesnt help...
I even tried this:
Code:
#include "udf.h"	
DEFINE_PROPERTY(cp_miesa, cell, thread)

{
	real t;

if (NNULLP(THREAD_STORAGE(thread, SV_T))) 
  t = C_T(cell, thread);

else
  t = 300.0; /* or whatever appropriate */
	

	return t;
}
just to check if it works and I got the same error.
What else can cause such an error?

Deleting "C_T(cell, thread)" from code makes error disappear.
vExus is offline   Reply With Quote

Old   August 22, 2013, 09:25
Default
  #4
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
It does not make sense to me. Could you post your full code with the non-null-pointer checking?
blackmask is offline   Reply With Quote

Old   August 22, 2013, 14:36
Default
  #5
New Member
 
Join Date: Aug 2013
Posts: 12
Rep Power: 12
vExus is on a distinguished road
Everything but
Code:
DEFINE_PROPERTY(cp_miesa, cell, thread)

{
	real cpm;
	real m;
	real t;
	m = 0,7;
	
	if (NNULLP(THREAD_STORAGE(thread, SV_T))) 
	{ 
		t = C_T(cell, thread);
		if (t < 303.)
    		cpm = 1675 + 2510 * m;
	}
	else
	{
			cpm = 3000.;
	}

	return cpm;
}
works fine.


Whole code:
Code:
#include "udf.h"	

DEFINE_PROPERTY(gestosc_miesa, cell, thread)

{
	

	real rom;
	real t = C_T(cell, thread);
	
	
		rom = 1226 - 0,56 * t;

		return rom;
}



DEFINE_PROPERTY(wsp_przew_ciepla_mieso, cell, thread)

{
	

	real km;
	real t = C_T(cell, thread);
	
	
		km = 0,044 + t * 1,56 * 10^-3;

		return km;
}



DEFINE_PROPERTY(cp_miesa, cell, thread)

{
	real cpm;
	real m;
	real t;
	m = 0,7;
	
	if (NNULLP(THREAD_STORAGE(thread, SV_T))) 
	{ 
		t = C_T(cell, thread);
		if (t < 303.)
    		cpm = 1675 + 2510 * m;
	}
	else
	{
			cpm = 3000.;
	}

	return cpm;
}




DEFINE_PROPERTY(gestosc_tluszczu, cell, thread)

{
	

	real rot;
	real t = C_T(cell, thread);
	
	
		rot = 1052 - 0,377 * t;

		return rot;
}




DEFINE_PROFILE (T_ot, thread, index)
{
	int s;
	real tval;
	double tab[8547]={}; 
	face_t f;
	
	s=RP_Get_Real("flow-time");
	tval = s < 8547 ? tab[s] : tab[8546];
	
	begin_f_loop(f, thread)
	{
		F_PROFILE(f, thread, index) = tval;
	}
	end_f_loop(f, thread);
}
vExus is offline   Reply With Quote

Old   August 22, 2013, 21:23
Default
  #6
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
You have several "C_T" in your code and only this one is wrapped by pointer-checking. When you said that the error disappear after deleting the "C_T" line, did you delete this specific "C_T" line or did you delete all the occurrence of "C_T"? If this specific line caused segmentation fault, I have no idea what is going on but I doubt it should happen.

You are French, right? Note that 0,56 1,56 0,377 should be changed to 0.56, 1.56 and 0.377, respectively. The expression "1,56 * 10^-3" should be changed to "1.56e-3".

"
blackmask is offline   Reply With Quote

Old   August 23, 2013, 04:39
Default
  #7
New Member
 
Join Date: Aug 2013
Posts: 12
Rep Power: 12
vExus is on a distinguished road
I know it seems strange but only this specific C_T couse trouble.

I am from Poland. Thanks for your advice.
vExus is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
FLUENT received fatal signal (ACCESS_VIOLATION) CHAKER FLUENT 4 December 11, 2015 04:20
FLUENT received fatal signal (ACCESS_VIOLATION) Mike Wong FLUENT 7 October 17, 2014 14:17
FLUENT received fatal signal (ACCESS_VIOLATION) rubis Fluent UDF and Scheme Programming 6 April 22, 2014 16:42
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


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