Fluids

Fluids

UDF calling the right vector

    • Diogo Martinho
      Subscriber

      Dear all, 

      I've been trying to change a parameter, and I was trying to find the error. So, I was trying to check how these two lines would work (one is commented out)     

      /* real x[ND_ND]; */
          real NV_VEC(x);

      But I dont know why, x[0] = 0 and I thought it would be somehow changing along the x-direction. In order those three conditions would be met. It seems only the first one runs.

       

       

      DEFINE_ADJUST(my_adjust, d)
      {
          Thread* t;
          cell_t c;
         /* real x[ND_ND]; */
          real NV_VEC(x);
          thread_loop_c(t, d)
          {
              begin_c_loop(c, t)

                          if (x[0] <= 0.003 && x[0] >= -0.008) {
                              /*previously -> val = 0.5;*/
                              C_UDMI(c,t,0) = x[0];

                          }
                          else if (x[0] <= 0.008 && x[0] > 0.003) {
                              /* val = 222 * x[0] + 0.333;*/
                              C_UDMI(c, t, 0) = 1.2;
                          }
                          else {
                              C_UDMI(c, t, 0) = 1.5;
                          }
                  
              end_c_loop(c, t)
          }

      }

    • DrAmine
      Ansys Employee

      Your vector "x" (please user better other naming) is not defined at all: it is just defined as vector but not "filled" with any particular values.

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