Fluids

Fluids

UDF problems defining a function

    • Naiara
      Subscriber

      Hello!


      I am trying to write a UDF in order to read a table, and then to find the index of the table. I was able to write the programme to read the table by DEFINE_ON_DEMAND macro, but then when I try to write a function to find the index in the table I have the following error message during compilation:


      "read_Table_indexRev00.c


      ....srcread_Table_indexRev00.c(80): error C2143: error de sintaxis: falta ')' delante de 'constante'


      ....srcread_Table_indexRev00.c(80): error C2143: error de sintaxis: falta '{' delante de 'constante'


      ....srcread_Table_indexRev00.c(80): error C2059: error de sintaxis: 'constante'


      ....srcread_Table_indexRev00.c(80): error C2059: error de sintaxis: ')'"


       


      Line 80 corresponds to the function definition to find the index, I am not able to see the error, I enclosure to the email the code.


      Thank you!


       Regards,


      Naiara

    • DrAmine
      Ansys Employee

      Hi,


      Please write debugging message which might help you to identify the root of the error. For more information about reading files please check the customization manual and any C programming Ressource.


       


      A.

    • Naiara
      Subscriber

      Hi,


      I write some "printf" to output some values and the table is wrote correctly, but when I try to find the intex of the table for doing a linear interpolation latter, I get that error. I have been checking the construction of a function in the customization manual and I think that I am writing correctly, but then it does not work...


      Thank you.


      Regards,


      Naiara

    • DrAmine
      Ansys Employee

      Hi,


       


      Your function uses N1 which has been already defined as constant in the pre-processor. Moreover I won't try to declare variables several times like you do in the definitions and then in the function itself. 


       


      A.

    • Naiara
      Subscriber

      Hi,


      Thank you, I change function to the following one: 


      void find_index(int *i0, double x0, double *x, int n)


      and then I call the function inside a FLuent macro by:


      find_index(q0, varZ0, varZ, N1);


      and now it works,


      Thank you!


       

    • DrAmine
      Ansys Employee

       Hi,


       


      Good to know that everything is working as it should.


       


      A.

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