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

Fluent crashes with error using C_W, F_W in UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 3, 2021, 04:59
Default Fluent crashes with error using C_W, F_W in UDF
  #1
New Member
 
Ho Chee Hong
Join Date: Mar 2021
Location: Malaysia
Posts: 1
Rep Power: 0
HoCH_10 is on a distinguished road
Hi guys, I am a university student and are new to UDF. I am trying to model a filter DPM boundary condition using UDF.

Simulation runs well until DPM iteration. Fluent then crashes with errors.
'F1 process could not be started' is the last message I saw in the console before the window closed.

Part of the error log from fluent-0-error.log:
Code:
Node 0 Fatal signal raised sig = Segmentation fault
 2bde0330 CX_Primitive_Error
 27600cc0 seh_filter_exe
 2be83730 logical_right_shift
 e38e2f0 _C_specific_handler
 297b1e50 _chkstk
 29761020 RtlRaiseException
 297b0a70 KiUserExceptionDispatcher
 e1650000 Ordinal0
 2b4c6b80 check_dpm_bc_udf
 2b4c0b30 FindNeighbour
 2b4a5510 Deposit_Cache_Sources
 2b4a5510 Deposit_Cache_Sources
 2b4a5510 Deposit_Cache_Sources
 2b4a5510 Deposit_Cache_Sources
 2b4a5510 Deposit_Cache_Sources
 2b4a0760 DPM_Compute_Pathlines
 2b4998b0 DPM_Iteration
 2b563420 sort_to_file_header
 2be6ecf0 eval
 299837d0 PRF_Command_Start
 29985fb0 PRF_Node_repl
 29986870 init_rsubrs
 2be83730 logical_right_shift
 29397020 BaseThreadInitThunk
 29762630 RtlUserThreadStart

Error [node 0] [time 3/3/21 16:6:14] Abnormal Exit!
I believe that the error is associated with the usage of C_W and F_W in my expression to calculate fluid velocity. There is another expression (commented off in the code) using particle velocity instead of fluid velocity, works fine.

I am trying to obtain fluid velocity for my calculation of particle efficiency.
I use C_W and F_W at the moment since these are the only function I found in UDF manual related to fluid velocity, also the filter face I have is normal to z-direction. I have plan to use looping to get the average fluid velocity in front of filter surface.

I welcome and appreciate any suggestion/solution/feedback.

p/s: I also wish to know what calcFaceEquations(tp) does since I am not able to find any documentation on it in UDF manual or online. I found its usage in a sample filter UDF in ANSYS UDF manual.

UDF:
Code:
/* UDF for MERV13 */

#include "udf.h"
#include "random.h"
#include "mem.h"

/* Tracked_Particle *tp = Pointer to the particle's data structure being tracked. */
/* Thread *t = Pointer to the face thread the particle is currently hitting. */
/* face_t f = Index of the face that the particle is hitting. */
/* real f_normal[] = Array that contains the unit vector normal to the face. */
/* int dim = Dimension of the flow problem: 2D = 2, 3D = 3/ */

#define AREA 0.1015		//area of filter (m^2) */
#define K_1_2 -0.0750692	//coefficient of v^2, polynomial k1(v)
#define K_1_1 0.34703522	//coefficient of v, polynomial k1(v)
#define K_2_2 0.00432755	//coefficient of v^2, polynomial 1/k2 (v)
#define K_2_1 0.03135811	//coefficient of v, polynomial 1/k2 (v)
#define K_3_2 0.00573440	//coefficient of v^2, polynomial 1/k3 (v)
#define K_3_1 0.01218403	//coefficient of v, polynomial 1/k3 (v)

DEFINE_DPM_BC(dpm_bc_filter, tp, t, f, f_normal, dim)
{
	//filter particles by size and face velocity
	real eff;
	real vel;
	cell_t c0 = F_C0(f,t);
	Thread *t0 = F_C0_THREAD(f,t);

	//velocity normal to face
	/* vel = fabs( f_normal[0] * P_VEL(tp)[0] + f_normal[1] * P_VEL(tp)[1] + f_normal[2] * P_VEL(tp)[2] ); */
	
	if (BOUNDARY_FACE_THREAD_P(t)) //if external face
	{
		vel = F_W(f,t);
	}
	else //if internal face
	{
		vel = C_W(c0,t0);
	}
	
	//efficiency based on particle diameter
	if (P_DIAM(tp) > 3.0e-6)
	{
		eff = 1.0 - exp( -1.0 / ( K_3_2 * vel * vel + K_3_1 * vel ) * AREA * vel );
	} 
	else if (P_DIAM(tp) > 1.0e-6) 
	{
		eff = 1.0 - exp( -1.0 / ( K_2_2 * vel * vel + K_2_1 * vel ) * AREA * vel );
	}
	else if (P_DIAM(tp) > 0.3e-6)
	{
		eff = 1.0 - exp( -1.0 * ( K_1_2 * vel * vel + K_1_1 * vel ) * pow(AREA * vel, -2.0 / 3.0) );
	}
	else
	{
		eff = 0; //let all particle <=0.3 micron pass
	}
	if (eff > cheap_uniform_random())
		return PATH_ABORT;
	
	/* determine switch side of the face the particle is currently in */
	/* and move it to the other side of the face */
	if ( (P_CELL_THREAD(tp)->id == THREAD_T0(t)->id) && (P_CELL(tp) == F_C0(f, t)) )
	{
		STORE_TP_CELL(tp, F_C1(f, t), THREAD_T1(t));
	}
	else
	{
		STORE_TP_CELL(tp, F_C0(f, t), THREAD_T0(t));
	}
	calcFaceEquations(tp);
	
	return PATH_ACTIVE;   
}

Last edited by HoCH_10; March 3, 2021 at 05:02. Reason: additonal question
HoCH_10 is offline   Reply With Quote

Reply

Tags
dpm, 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
Problem running fluent with udf on batch tobi b. Fluent UDF and Scheme Programming 3 April 14, 2016 14:54
implementing UDF for fluent in workbench for running multiple simulations faizan_habib7 Fluent UDF and Scheme Programming 0 March 18, 2016 23:29
Running UDF with Supercomputer roi247 FLUENT 4 October 15, 2015 14:41
fluent UDF external library lapack problem Rick FLUENT 0 May 7, 2008 11:16
UDF of Zimont model in fluent Z Main CFD Forum 0 February 17, 2005 04:07


All times are GMT -4. The time now is 03:44.