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

[FLUENT UDF] Received signal SIGSEGV

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 17, 2023, 12:49
Default [FLUENT UDF] Received signal SIGSEGV
  #1
New Member
 
Join Date: Mar 2021
Posts: 25
Rep Power: 5
Jack0210Jack is on a distinguished road
Hi all,

Recently I was trying to run a simulation with UDF. The UDF contains 4 functions as below:

Code:
 #include "udf.h"

 DEFINE_MASS_TRANSFER(ammonia_con, cell, thread, from_index, from_species_index, to_index, to_species_index)
 {
	real rate;
	Thread *gas = THREAD_SUB_THREAD(thread, from_index);
	Thread *liquid = THREAD_SUB_THREAD(thread, to_index);
	real temp = C_T(cell, gas);

	rate = 0.;
	if (temp >= -20.0 && temp <= 20.0)
		{
			rate = -0.2056*temp*temp - 0.5981*temp + 9.9534;
		}
	if ((rate == 0. ) && (temp > 20.0))
		{
			rate = 0;
		}
 return (rate);
 } 

 DEFINE_MASS_TRANSFER(ammonia_eva, cell, thread, from_index, from_species_index, to_index, to_species_index)
 {
	real rate;
	Thread *liq = THREAD_SUB_THREAD(thread, from_index);
	Thread *gas = THREAD_SUB_THREAD(thread, to_index);
	real temp = C_T(cell, liq);

	rate = 0.;
	if (temp >= 25.0 && temp <= 140.0)
		{
			rate = 0.0173*temp*temp + 1.931*temp + 3.5726;
		}
	if ((rate == 0. ) && (temp < 25.0))
		{
			rate = 0;
		}
 return (rate);
 } 

 DEFINE_MASS_TRANSFER(water_con, cell, thread, from_index, from_species_index, to_index, to_species_index)
 {
	real rate;
	Thread *gas = THREAD_SUB_THREAD(thread, from_index);
	Thread *liq = THREAD_SUB_THREAD(thread, to_index);
	real temp = C_T(cell, gas);

	rate = 0.;
	if (temp >= -20.0 && temp <= 20.0)
		{
			rate = 0.3435*temp*temp + 6.9549*temp + 78.262;
		}
	if ((rate == 0. ) && (temp > 20.0))
		{
			rate = 0;
		}
 return (rate);
 } 

 DEFINE_MASS_TRANSFER(water_eva, cell, thread, from_index, from_species_index, to_index, to_species_index)
 {
	real rate;
	Thread *liq = THREAD_SUB_THREAD(thread, from_index);
	Thread *gas = THREAD_SUB_THREAD(thread, to_index);
	real temp = C_T(cell, liq);

	rate = 0.;
	if (temp >= 25.0 && temp <= 140.0)
		{
			rate = 0.0195*temp*temp + 0.5216*temp;
		}
	if ((rate == 0. ) && (temp < 25.0))
		{
			rate = 0;
		}
 return (rate);
 }
After compiling using built-in compiler, I tried to run the simulation (single process), but it gives this error:

Code:
Node 0 Fatal signal raised sig = Segmentation fault
 aa053010 CX_Primitive_Error
 9c08b8f0 log2f
 aa0f5a20 logical_right_shift
 98f6ec30 _C_specific_handler
 9ecb3bd0 _chkstk
 9ec2d9c0 RtlFindCharInUnicodeString
 9ecb2cc0 KiUserExceptionDispatcher
 a8c061b0 init_cell_vector
 aa0f5a20 logical_right_shift
 a7d48550 Calculate_Mass_Transfer
 a79fea10 Init_Face_Flux
 a7a10c00 Init_Flow
 a72b5fc0 Delay_Error
 aa0e0250 eval
 a72a7e50 PRF_Command_Start
 a72aa570 PRF_Node_repl
 a72b5fc0 Delay_Error
 aa0f5a20 logical_right_shift
 9d3b2690 BaseThreadInitThunk
 9ec6a9d0 RtlUserThreadStart
Node 0 Fatal signal raised sig = Segmentation fault
 2e673010 CX_Primitive_Error
 6473b8f0 log2f
 2e715a20 logical_right_shift
 4782ec30 _C_specific_handler
 670d3bd0 _chkstk
 6704d9c0 RtlFindCharInUnicodeString
 670d2cc0 KiUserExceptionDispatcher
 2d2261b0 init_cell_vector
 2e715a20 logical_right_shift
 2c368550 Calculate_Mass_Transfer
 2c01ea10 Init_Face_Flux
 2c030c00 Init_Flow
 2b8d5fc0 Delay_Error
 2e700250 eval
 2b8c7e50 PRF_Command_Start
 2b8ca570 PRF_Node_repl
 2b8d5fc0 Delay_Error
 2e715a20 logical_right_shift
 65f82690 BaseThreadInitThunk
 6708a9d0 RtlUserThreadStart

Error [node 0] [time 6/17/23 23:38:49] Abnormal Exit!
I'm not sure what are all these errors about. If anyone knows, please enlighten me.

Thanks in advance.
Jack0210Jack is offline   Reply With Quote

Old   July 3, 2023, 01:42
Default
  #2
Member
 
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6
Cooper24 is on a distinguished road
I think you have missing pre-processor directives. Check for what other pre-processor directives you need based on the models you are using.
Cooper24 is offline   Reply With Quote

Old   July 3, 2023, 01:44
Default
  #3
Member
 
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6
Cooper24 is on a distinguished road
Note one thing. Segmentation fault is due to something you are trying to retrieve from your UDF which is not available from your UDF.
Cooper24 is offline   Reply With Quote

Old   July 21, 2023, 06:56
Default
  #4
New Member
 
Join Date: Mar 2021
Posts: 25
Rep Power: 5
Jack0210Jack is on a distinguished road
Quote:
Originally Posted by Cooper24 View Post
I think you have missing pre-processor directives. Check for what other pre-processor directives you need based on the models you are using.
Thanks for your replies and sorry for such a late reply. Was working on other things and hardly able to work on this.

Are there any other pre-processor directives? I only found #udf.h. Do I need to prepare a separate file and include it in the UDF?

Thanks a bunch.
Jack0210Jack is offline   Reply With Quote

Old   July 22, 2023, 15:12
Default Seg fault
  #5
Member
 
thedal's Avatar
 
Thamilmani M
Join Date: Sep 2017
Location: IIT Bombay, Mumbai
Posts: 52
Rep Power: 9
thedal is on a distinguished road
Just like @Cooper24 said, you are getting Segmentation fault due to retrieving blank or arbitrary address. Try to initialize and run your simulation for some iterations and then hook your UDF and see if the segmentation error still continues.

I don't think any other preprocessor directives are needed for your code.
__________________
Always
Thedal
thedal is offline   Reply With Quote

Reply

Tags
fluent - udf


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
Node xx: Process: xx received signal SIGSEGV kds Fluent UDF and Scheme Programming 1 February 4, 2023 11:40
Received signal SIGSEGV and BAD TERMINATION ali.ashouri Fluent UDF and Scheme Programming 1 September 21, 2022 01:31
Process 10300: Received signal SIGSEGV metaliat93 FLUENT 2 January 28, 2020 01:53
error: Received signal SIGSEGV ianziti92 Fluent UDF and Scheme Programming 2 December 5, 2018 17:25
define_wall_functions density and dynamic viscosity Ionut G Fluent UDF and Scheme Programming 3 March 15, 2017 11:10


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