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

Issues with UDF for velocity components: the fluent process could not be started

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 24, 2021, 04:54
Default Issues with UDF for velocity components: the fluent process could not be started
  #1
New Member
 
Join Date: Jul 2019
Posts: 14
Rep Power: 7
usr0830 is on a distinguished road
Hello everyone,
I am new to Fluent and UDFs and c. I hope the community can help me with fixing the errors in my first UDF.

I am trying to sample the components of velocity at two points close to a rotating airfoil at every timestep. Firstly, I find the location of the sampling points in global coordinates as a function of theta (which is dependent on time). Then, I use CX_Find_Cell_With_Point to find the cells with these points. Once the cells are found, the centroid is calculated and the velocities are extracted.

I have compiled the udf successfully in Fluent but when I start the simulation, at the end of the first timestep, I get an error message saying the fluent process could not be started. I have already tried checking it with both single and parallel processing and also with and without double precision as suggested by some on this forum with no success.
I have attached the udf and the error message here. Kindly help me resolve this issue.
Thank you.

Code:
Code:
#include "udf.h"
#include "cxndsearch.h"
static ND_Search *domain_table1 = NULL;
static ND_Search *domain_table2 = NULL;
static float c_centroid1[2];
static float c_centroid2[2];
static int starting_dt = 200; /* Setting the starting time step. */
static float R = 0.25; /* Radius */
static cell_t c1;
static cell_t c2;
static Thread *t1;
static Thread *t2;
static CX_Cell_Id *cx_cell1;
static CX_Cell_Id *cx_cell2;
real pt1[3];
real pt2[3];
real U_vel1;
real V_vel1;
real U_vel2;
real V_vel2;
real xTheory;
real yTheory;
real theta;
FILE *velocity_t1;
FILE *velocity_t2;
real current_dt;

DEFINE_EXECUTE_AT_END(execute)
{
#if !RP_HOST
        Message("UDF begin execution");
	current_dt = CURRENT_TIMESTEP;
	Message("Current timestep acquired");
	if (current_dt <=starting_dt)
	{
		theta = 0;
	}
	else
	{
	  theta = (current_dt - starting_dt)* 0.004363323; /* dtheta = 0.004363323 rad. Change if dt changes)*/
	}
	xTheory = 0 - R * sin(theta); /* Point at the mounting point of the airfoil */
	yTheory = 0 + R * cos(theta);

/* Evaluation point near the LE*/
	if (theta <= M_PI) 
	{
		pt1[0] = xTheory - 0.0375; 
	} 
	else
	{
		pt1[0] = xTheory + 0.0375;
	}
	if (yTheory >= 0)
	{
		pt1[1] = yTheory + 0.05;
	}
	else 
	{
		pt1[1] = yTheory - 0.05;
	}
	
	pt1[2] = 0.0;

	/* Evaluation point near the TE*/
	if (theta <= M_PI) 
	{
		pt2[0] = xTheory - 0.0375;
	} 
	else
	{
		pt2[0] = xTheory + 0.0375;
	}
	if (yTheory >= 0)
	{
		pt2[1] = yTheory - 0.05;
	}
	else 
	{
		pt2[1] = yTheory + 0.05;
	}
	
	pt2[2] = 0.0;

	domain_table1 = CX_Start_ND_Point_Search(domain_table1,TRUE,-1); 
	cx_cell1 = CX_Find_Cell_With_Point(domain_table1,pt1,0.0);

	if (cx_cell1) {
		c1 = RP_CELL(cx_cell1);
		t1 = RP_THREAD(cx_cell1);
		C_CENTROID(c_centroid1,c1,t1);
		U_vel1 = C_U(c1,t1);
		V_vel1 = C_V(c1,t1);
	} else {
		Message("Could not find cell!\n"); 
	}
	domain_table1= CX_End_ND_Point_Search(domain_table1);

	domain_table2 = CX_Start_ND_Point_Search(domain_table2,TRUE,-1); 
	cx_cell2 = CX_Find_Cell_With_Point(domain_table2,pt2,0.0);
	if (cx_cell2) {
		c1 = RP_CELL(cx_cell2);
		t1 = RP_THREAD(cx_cell2);
		C_CENTROID(c_centroid2,c2,t2);
		U_vel2 = C_U(c2,t2);
		V_vel2 = C_V(c2,t2);
	} else {
		Message("Could not find cell!\n"); 
	}
	domain_table2 = CX_End_ND_Point_Search(domain_table2);
	Message("UDF run finished");
#endif


#if !RP_HOST
velocity_t1=fopen("velocity1.txt","ab+");
fprintf(velocity_t1,"%15.4f\t%15.6f\t%15.6f\t%15.6f\t%15.6f\t%15.6f\t%15.6f\t%15.6f\t\n",CURRENT_TIMESTEP,theta,xTheory,yTheory,c_centroid1[0],c_centroid1[1],U_vel1,V_vel1);
fclose(velocity_t1);

velocity_t2=fopen("velocity2.txt","ab+");
fprintf(velocity_t2,"%15.4f\t%15.6f\t%15.6f\t%15.6f\t%15.6f\t%15.6f\t%15.6f\t%15.6f\t\n",CURRENT_TIMESTEP,theta,xTheory,yTheory,c_centroid2[0],c_centroid2[1],U_vel2,V_vel2);
 fclose(velocity_t2);
#endif
}
Error message:
Node 0: Process 48048: Received signal SIGSEGV.

================================================== ============================

The fluent process could not be started.
usr0830 is offline   Reply With Quote

Old   August 25, 2021, 03:43
Default Managed to fix it after debugging the commands in UDF.
  #2
New Member
 
Join Date: Jul 2019
Posts: 14
Rep Power: 7
usr0830 is on a distinguished road
As mentioned in the title, I managed to fix the issue. It was because of the wrong use of CURRENT_TIME macro.
usr0830 is offline   Reply With Quote

Reply

Tags
starting udf, udf, velocity components


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
Parallel fluent process exiting before reading the mesh file harsha2398 FLUENT 3 December 29, 2020 01:58
About UDF compiling issues: 'nmake' Haoyin Shan Fluent UDF and Scheme Programming 15 November 4, 2019 19:05
Passing udf value to fluent durg Fluent UDF and Scheme Programming 2 February 11, 2019 13:55
Two questions on Fluent UDF Steven Fluent UDF and Scheme Programming 7 March 23, 2018 04:22
The fl process could not be started because of UDF majid_kamyab Fluent UDF and Scheme Programming 6 December 15, 2015 09:42


All times are GMT -4. The time now is 04:59.