Topics relate to Fluent, CFX, Turbogrid and more

Fluent UDF SIGSEGV error

    • navarag kk

      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"
      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;

      /* Variables used by serial, host, node versions */
      int surface_thread_id=9;/*door surface id from fluent*/
      real total_area=0.0;

      real area[ND_ND];
      real NV_VEC(A);
      real w[ND_ND];
      thread = Lookup_Thread(domain,surface_thread_id);
      real prep;
      /* 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 */

      total_area += NV_MAG(area);
      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);

      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);
      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;
      /* 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);

      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?

    • Atharva Nagarkar


      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)


Viewing 1 reply thread
  • You must be logged in to reply to this topic.