Fluids

Fluids

Node xx: Process xxx: Received signal SIGSEGV.

    • kds_ansys
      Subscriber

      Hello, 

      I am new to both UDF and Ansys and am currently using the following UDF code for my simulation. While the code compiles without any errors, when I try to initialize the model, I encounter an error and the simulation closes automatically.

      Node 6: process 13572: received signal sigsegv.

      Node 7: process 110688: received signal sigsegv.

      99999: mpt_accept: error : accept failed: No error

      99999: mpt_accept: error : accept failed: No error

      99999: mpt_accept: error : accept failed: No error

      99999: mpt_accept: error : accept failed: No error

      Bad termination of one of your application processes 

      Rank 0 PID 99524 Running at xxx

      Exit status: -1 (ffffffff) 

      ---------------------------------------------

      Here is my code

       

       

      /*************************************************/

      /*************************************************/ 
      /*************************************************/ 
      #include "udf.h" 
      #include "sg.h" 
      real m_sum=0; 
      real ar_sum=0; 
      real m_max=0; /*mass flux at the corner of meniscus: used for thin film region*/ 
      real h_ar_int=0; 
      real h_avg=0; 
       
      DEFINE_ADJUST(Get_q_V, d) 
      Thread *t; // thread pointer
      Domain *domain;    // domain pointer   
      cell_t c,c0;  // define cell
      face_t f,f2,f_face_l; //define face
      Thread *tf, *tf2; 
      int n,n2; // define n and n2
      real S=0; 
      int liquid_id=7; // the liquid zone's thread ID the domain ID
      /*real p, ps, Ts, hfg, M_bar, R_bar, M_air, p_l_sat;*/   
      //water properties
      real ps=3167.739; 
      real Ts= 298; 
      real hfg= 2270e3; 
      real M_bar=18.01; 
      real R_bar=8314.47; 
      real p_l_sat=0; 
      real cp = 4181.3;
         
      int liquid_inter_id1=12; // the liquid interface at the liquid/vapor interface
      real count=0; 
       
      real dr0[ND_ND];   // the vector that connects the centroid of cell c0 to the face centroid
      real dr1[ND_ND];   // the vector that connects the centroid of cell c1 to the face centroid
      real A[ND_ND];   // the area normal vector
      real es[ND_ND];  //the unit normal vector in the direction from cell c0 to c1
          
      real T;  // define the temperature
        
      real temp2;  // define the mass flow rate
      real cent1[3],cent2[3]; // the centroid of cell
          
      real ar; /* area of the face of the cell*/  
      real q, temp;    
      real q_conv;  
      real qd=0;         
       
      real ds, A_by_es;     // the value A.A/A.es
          
       
      real AA, B;    
       
      m_sum=0;   
      ar_sum=0;  
      m_max=0;  
      h_ar_int=0; 
       
      domain = Get_Domain(7);  // get the domain selected, put the liquid domain id inside 
      tf= Lookup_Thread(domain, liquid_inter_id1);   /* look up the face thread of the domain 
      liquid_inter_id1 which is the liquid vapor interface */
      begin_f_loop (f, tf)  
      {   
      c=F_C0(f,tf); // macros to identify adjacent faces  
      t=F_C0_THREAD(f,tf);        // macros to identify adjacent faces thread
       
      T=F_T(f,tf);   //get the temperature at the face
      F_AREA(A,f,tf);   // can be used to return the real face area vector
      ar=NV_MAG(A);    // get the area 
       
      p_l_sat=ps*exp((1/Ts-1/T)*hfg*M_bar/R_bar) ;   
      temp2 = .03*sqrt(M_bar/(2*3.1415*R_bar))*(p_l_sat/sqrt(T) - ps/sqrt(Ts)); /*evap mass flux from the face */   
      qd = temp2*ar*hfg;   
      F_UDMI(f,tf,1)= temp2;              
       
      S=qd/C_VOLUME(c,t); /*S is like energy source term*/ 
       
      if (S/hfg > m_max)      
      {            
      m_max=S/hfg; /*highest mass source term for any cell*/      
      }
                  
      C_UDMI(c, t, 0) = S;     // store or access the value of mass source
      C_UDMI(c, t, 1) = qd/(hfg*ar);
                  
      F_UDMI(f,tf,2) = temp2*hfg/(T-298);      
      C_UDMI(c,t,2) = temp2*hfg/(T-298);      
      h_ar_int = h_ar_int + F_UDMI(f,tf,2)*ar; 
              
      m_sum=m_sum+qd/hfg; /*total mass evaporated in Kg/s*/      
      ar_sum=ar_sum+ar;      
      count=count+1;  
      }  
      end_f_loop(f,tf)  
       
      h_avg = h_ar_int/ar_sum;  
          
      Message ("Total area of interface: %g\n", ar_sum);     
      Message ("Total mass evaporated (kg/s): %g\n", m_sum);     
      Message ("h integral on interface: %g\n", h_ar_int);     
      Message ("h Average on interface: %g\n", h_avg);     
      Message ("Total faces on the interface: %g\n", count);     
      Message("Highest mass source term for any cell: %g\n", m_max); } 
       
       
       DEFINE_SOURCE(Mass_liquid, c, t, dS, eqn) 
      {     
      Thread *c_thread;   
      face_t f;  
      Thread *tf;  
      int n;  
      real S=0;  
      //methanol  
      real hfg=2270e3;  
      //water 
      // real hfg = 2270e3;  
      real ar;    
       
      int liquid_id=7; /*liquid zone 's thread ID*/  
      int liquid_inter_id1=12; // the interface of the domain/ liquid vapor interface
       
      c_face_loop(c, t, n)  
      {   
      f = C_FACE(c,t,n);   // the face of the liquid
      tf = C_FACE_THREAD(c,t,n);   // the face thread of the liquid 
      /* looping through the face */   
      if(THREAD_ID(tf)==liquid_inter_id1 )         
      {     
      S=-1*C_UDMI(c,t,0)/hfg;   // store or access the value of mass source
      }  
      }  
      return S; 
      }  
       
      DEFINE_PROFILE(h_interface, thread, position)  
      {  
      face_t f;  
        
      real T_room=298;  
      real T;  /*wall temperature*/  
      real dT;/*dT=T-T_room*/  
      real k=0.68; 
      real Nu,h;  
      real hfg=2270e3;  
        
      begin_f_loop (f, thread)  
      {       
      T=F_T(f,thread);   
      dT=fabs(T-T_room);   
      h = F_UDMI(f, thread, 1)*hfg/dT; 
           
      F_PROFILE(f,thread,position)=h; 
         
      }  
      end_f_loop (f, thread)
          
      Message("dT: %g\n",dT);  
      Message("T :%g\n", T);   
      Message("h :%g\n", h);  
       
    • Rob
      Ansys Employee

      I'm not going to debug the code, but common issues include data being used that's not available and insufficient UDMs being assigned in Fluent (you do this manually). 

      As a more general comment, use indents to make blocks easier to read and be careful when assigning number types:

      real whatever = 0 ; 

      isn't great, 

      real whatever = 0.0 ; 

      is more appropriate. 

      • kds_ansys
        Subscriber

        Thank you Rob for the reply. I have assigned UDM manually in Fluent. To make sure I wouldn't assign a small UDM number, I assigned a big number (100). However, I am still seeing the same error. 

         

    • Rob
      Ansys Employee

      OK. Break the code down. If you don't use the source & profile what happens? Note, some single/few letter variables can clash with Fluent's built in functions: it's always best to use more descriptive variables. 100 UDMs may be a little excessive, I don't think it'll cause a problem but may result in data files that are a lot bigger than they need to be. 

      • kds_ansys
        Subscriber

        Thanks Rob. It is actually working now. I divided the file into two rather than one, and it worked. 

         

Viewing 2 reply threads
  • You must be logged in to reply to this topic.