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 SIGSEGV error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 12, 2023, 14:31
Default Fluent UDF SIGSEGV error
  #1
New Member
 
Navarag KK
Join Date: Jun 2023
Posts: 4
Rep Power: 3
navarag is on a distinguished road
Hey all, thanks for helping with my previous doubt and currently

I need the torque_p value to be read in the second Macro, hence using C_UDMI function.


I am getting the segmentation error and fluent crashes even though I allocated the memory.

(the reason i looped C_UDMI is because i dont want fluent to take the value from other cells)

the UDF code is

#include "udf.h"
#include <mem.h>
static real omega_calc = 0.0;
static real theta=0.0;/*need to check*/
/*extern real omega_out=0.0; */
real torque_p;
Thread* thread;
cell_t cell;
face_t face;


DEFINE_ADJUST(torque_cal,domain)
{
/* Variables used by serial, host, node versions */
int surface_thread_id=9;/*door surface id from fluent*/
real total_area=0.0;
torque_p=0.0;



real area[ND_ND];
real NV_VEC(A);
real w[ND_ND];
thread = Lookup_Thread(domain,surface_thread_id);
real prep;
begin_f_loop(face,thread)
/* If this is the node to which face "officially" belongs,*/
/* get the area vector and pressure and increment */
/* the total area and total force values for this node */

{
F_AREA(area,face,thread);
total_area += NV_MAG(area);
F_AREA(A,face,thread);
F_CENTROID(w,face,thread);
torque_p += F_P(face,thread)*NVD_DOT(A,w[1],-w[0],0);/*need to check -w[1],w[0] as per geometry*/
Message ("\npressure = %f,", prep);
Message ("\ntorque = %f,", torque_p);

}
end_f_loop(face,thread)
begin_c_loop(cell,thread);
{
C_UDMI(cell,thread,1)=torque_p;
}
end_c_loop(cell,thread);
Message ("\ntorque in cell = %f,", torque_p);
}



DEFINE_CG_MOTION(door_move,dt,vel,omega,time,dtime )
{
Message ("\ntorque in 2nd udf = %f,", torque_p);
begin_c_loop(cell,thread);
{
torque_p=C_UDMI(cell,thread,1);
}
end_c_loop(cell,thread);
Message ("\ntorque = %f,", torque_p);
NV_S(omega, =, 0.0);
real torque, domega, omega_prev, omega_dot, omega_out;


real inertia = 2.4;
/* Compute the torque due to pressure P and weight W */
/*-----------------------------------------------------------------------*/

torque= -torque_p ;
domega = dtime * torque / inertia;
omega_dot= torque / inertia;
/* Calculate the angular velocity */
/*-----------------------------------------------------------------------*/
omega_prev = omega_calc;
omega_calc = omega_calc + domega;
omega_out = omega_calc;
omega[0]=0;
omega[1]=omega_out;
/* Calculate the angle theta (Taylor expansion) */
/*-----------------------------------------------------------------------*/
theta=theta - 0.5*dtime*(omega_prev+omega_calc);
#if !RP_NODE
Message ("\ntorque_p = %f,", torque_p);

Message ("\ntorque = %f,", torque);
Message ("\ndomega = %f,", domega);
Message ("\nomega_calc: %f\n", omega_calc);
Message ("\n---------------------------------------");
Message ("\ntheta: %f\n", theta);
#endif
}

The error is



> /solve dual-time-iterate 2000 10


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

Node 999999: Process 7834: Received signal SIGSEGV.

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

===============Message from the Cortex Process================================

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

Node 6: Process 8145: Received signal SIGSEGV.

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

What can I do to avoid this error or is there anyother way to transfer data from one udf to another?

Attached Images
File Type: png alocation.PNG (14.5 KB, 4 views)
navarag is offline   Reply With Quote

Reply

Tags
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
[swak4Foam] swak4foam openfoam 7 installation problem Andrea23 OpenFOAM Community Contributions 1 February 17, 2020 19:11
UDF for DPM particle deposition modelingpa haghshenasfard Fluent UDF and Scheme Programming 10 September 15, 2019 03:03
DPM udf error haghshenasfard FLUENT 0 April 13, 2016 07:35
Mesquite - Adaptive mesh refinement / coarsening? philippose OpenFOAM Running, Solving & CFD 94 January 27, 2016 10:40
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh gschaider OpenFOAM Community Contributions 300 October 29, 2014 19:00


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