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

Segmentation Error in Compiling UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 28, 2019, 06:32
Unhappy Segmentation Error in Compiling UDF
  #1
New Member
 
Shakib
Join Date: Mar 2019
Posts: 10
Rep Power: 7
shakib is on a distinguished road
Hello every one

I wanna see the concentration of bacterial particles as a water species ( like pressure and velocity ) in contours. my system is just in 1 phase.

I used to write a UDF. After I build and load the library and hook it and allocate the number of UDM locations, unfortunately when I try to start the calculation, segmentation fault will appear.

Please help me get rid of this problem.

My UDF code is:


#include <udf.h>
DEFINE_ADJUST(bacterial_growth, d)
{
Domain *domain;/*domain points to domain Thread*/
int ID = 9;/*Number of interior (Fluid) zone*/
Thread *t = Lookup_Thread(domain, ID);/*t points to Thread*/
cell_t c;/*An integer data type that identifies a particular cell within a cell thread that names "c"*/
real s1 = 2, s2 = 3;
const real ks1 = 1, ks2 = 2, mumax = 3;/*Using These 3 Orders to declare consistent*/
thread_loop_c(t, domain)/*Looping over Cell threads (e.g. fluid and solid) in Domain*/
{
{
begin_c_loop(c, t)/*Loops Over Cells in a Cell Thread*/
{
C_UDMI(c, t, 0) = mumax * (s1 / (ks1 + s1)) * (s2 / (ks2 + s2));
}
end_c_loop(c, t)
}
}
}




Thanks in advance.
shakib is offline   Reply With Quote

Old   May 29, 2019, 04:12
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
#include <udf.h>
DEFINE_ADJUST(bacterial_growth, d)
{
int ID = 9;/*Number of interior (Fluid) zone*/
Thread *t = Lookup_Thread(d, ID);/*t points to Thread*/
cell_t c;/*An integer data type that identifies a particular cell within a cell thread that names "c"*/
real s1 = 2, s2 = 3;
const real ks1 = 1, ks2 = 2, mumax = 3;/*Using These 3 Orders to declare consistent*/
thread_loop_c(t, d)/*Looping over Cell threads (e.g. fluid and solid) in Domain*/
	{
		begin_c_loop(c, t)/*Loops Over Cells in a Cell Thread*/
			{
				C_UDMI(c, t, 0) = mumax * (s1 / (ks1 + s1)) * (s2 / (ks2 + s2));
			}
		end_c_loop(c, t)
	}
}
best regards
AlexanderZ is offline   Reply With Quote

Old   June 1, 2019, 05:50
Thumbs up
  #3
New Member
 
Shakib
Join Date: Mar 2019
Posts: 10
Rep Power: 7
shakib is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
Code:
#include <udf.h>
DEFINE_ADJUST(bacterial_growth, d)
{
int ID = 9;/*Number of interior (Fluid) zone*/
Thread *t = Lookup_Thread(d, ID);/*t points to Thread*/
cell_t c;/*An integer data type that identifies a particular cell within a cell thread that names "c"*/
real s1 = 2, s2 = 3;
const real ks1 = 1, ks2 = 2, mumax = 3;/*Using These 3 Orders to declare consistent*/
thread_loop_c(t, d)/*Looping over Cell threads (e.g. fluid and solid) in Domain*/
	{
		begin_c_loop(c, t)/*Loops Over Cells in a Cell Thread*/
			{
				C_UDMI(c, t, 0) = mumax * (s1 / (ks1 + s1)) * (s2 / (ks2 + s2));
			}
		end_c_loop(c, t)
	}
}
best regards
Thank you sir, it works fine.

Best regards.
shakib is offline   Reply With Quote

Reply

Tags
segmentation fault, udf code


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
Compiling the customized UDF code for PEMFC dmfo Fluent UDF and Scheme Programming 2 October 1, 2017 19:30
Error when compiling UDF bobdorm14 Fluent UDF and Scheme Programming 1 September 19, 2016 07:03
DPM Segmentation Fault in UDF jhlee9622 FLUENT 0 July 1, 2016 04:21
compiling udf at window Nt(64BIT) noa FLUENT 3 July 30, 2014 00:01
ERROR in compiling UDF stefanos Fluent UDF and Scheme Programming 1 April 25, 2012 08:37


All times are GMT -4. The time now is 14:02.