TAGGED: #fluent-#cfd-#ansys, cfd-udf-fleunt
-
-
July 12, 2023 at 5:43 pmnavarag kkSubscriber
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
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;
torque_p = F_UDMI(face,thread,0);
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? -
July 13, 2023 at 9:47 amAtharva NagarkarAnsys Employee
Hello,
SIGSEGV error is not a specific error and is generally related to storage and memory issues or when data is received by the solver but is missing/incorrectly specified.
There are 2 things to note here. One is that the vector defined as NV_VEC(A) is defined as (A[0], A[1], A[2]). NVD_DOT function creates a product as A[0]*w[1] + A[1]*-w[0] + A[2]*0 as per your definition in the udf. You might want to check this definition as you are multiplying X face area vector by Y coordinate of centroid for first term and Y face area vector by -X coordinate of centroid for second term.
The second thing and is likely the main issue might be related to the macro C_UDMI. C_UDMI can be used to allocate up to 500 memory locations in order to store and retrieve the values of cell field variables computed by UDFs. The total number of memory locations is limited to 500. For large numbers of memory locations, system memory requirements will increase. It is likely that this is where there is an issue related to memory storage resulting in a SIGSEGV error.Â
Here is the link for the C_UDMI macro in the Ansys User Manual: 3.2. Data Access Macros (ansys.com)
If you are not able to access the link, please refer to this forum discussion: Using Help with links (ansys.com)
Thanks!
-
- The topic ‘Fluent UDF SIGSEGV error’ is closed to new replies.
- How do I get my hands on Ansys Rocky DEM
- Non-Intersected faces found for matching interface periodic-walls
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Facing trouble regarding setting up boundary conditions for SOEC Modeling
- Script Error
- convergence issue for transonic flow
- RIBBON WINDOW DISAPPEARED
- Running ANSYS Fluent on a HPC Cluster
-
1762
-
635
-
599
-
591
-
366
© 2025 Copyright ANSYS, Inc. All rights reserved.