TAGGED: #fluent-#cfd-#ansys, cfd-udf-fleunt
-
-
July 12, 2023 at 5:43 pm
navarag kk
SubscriberHey 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 am
Atharva Nagarkar
SubscriberHello,
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!
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Difference between K-epsilon and K-omega Turbulence Model
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Suppress Fluent to open with GUI while performing in journal file
- Mesh Interfaces in ANSYS FLUENT
- Time Step Size and Courant Number
- error: Received signal SIGSEGV
-
7808
-
4508
-
2979
-
1453
-
1322
© 2023 Copyright ANSYS, Inc. All rights reserved.