how can I sum this function

Discussion in 'C' started by hrenolino, May 9, 2011.

Thread Status:
Not open for further replies.
  1. hrenolino

    hrenolino New Member

    Joined:
    May 9, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    This function is prediction for erosion of cavitation. I am writing udf for fluent. To this point udf is working.
    How can I sum C_UDMI? I want to sum C_UDMI (erosion) for all time steps of calculation. Now it only gives me result of the last time step/iteration.

    Here is current udf:

    Code:
    /********************************************************************
       UDF for calculating something and printing it to     
       console window at the end of the current iteration or time step  
    *********************************************************************/
    
    #include "udf.h"
    
    /*************************************************************************************************************/
    /*definiramo novo spremenljivko C_UDMI(c,t,0), ki se zapise le ob koncu casovnega koraka in je enaka C_STRAIN_RATE_MAG(c,t);*/
    /*ne pozabi it v define-user defined-memory in dat prosto mesto!!!*/
    
    DEFINE_EXECUTE_AT_END(execute_at_end)
    {
    
      Domain *d;
      Thread *t;
      cell_t c;
      face_t f;
      d = Get_Domain(1);   /* mixture domain if multiphase */
    
    
    
    thread_loop_c (t,d)
    
    {
    if (FLUID_THREAD_P(t))
           {
    
    begin_c_loop(c,t)
      {
    if (8.97*pow(1.1,2)*sqrt(C_P(c,t)/0.5542) > 118.745878036397)
        C_UDMI(c,t,0) = 26.7*pow(10,-5)/1484*(8.97*pow(1.1,2)*sqrt(C_P(c,t)/0.5542)-sqrt((200000000/998.2)*(1-(pow((1+200/300),-1/7)))));
    else if (8.97*pow(1.1,2)*sqrt(C_P(c,t)/0.5542) <= 118.745878036397)
        C_UDMI(c,t,0) = 0.;
      }
    end_c_loop(c,t)
    
    }
    }
    
    }
    Thank you for helping
    Gašper
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice