1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how can I sum this function

Discussion in 'Meet and Greet' started by hrenolino, May 9, 2011.

  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
     

Share This Page