Fluids

Fluids

UDF source file/UDF compiling error

Tagged: ,

    • Asim10S
      Subscriber

      when i try to load this sandia lab UDF it give error

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

      /* UDF for computing the UV dosage along a particle trajectory     */

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


      #include "udf.h"

      #include "dpm.h"

      #include "sg_disco.h" 


      #define fileuv "output.dpm"

      #define C_DO(c,t)C_STORAGE_R_XV(c,t,SV_DO_IRRAD,0)


      static real uv_intensity_0;

      static real x0, y00, z0;


      FILE *fuv;


      DEFINE_DPM_SCALAR_UPDATE(uv_dosage, cell, thread, initialize, p)

      {

       cphase_state_t *c = &(p->cphase);

       if (initialize)

        {

         p->user[0] = 0.;

         uv_intensity_0 = C_DO(cell,thread);

         x0=p->state.pos[0];

         y00=p->state.pos[1];

         z0=p->state.pos[2];

        }


       else

        {

         p->user[0] += P_DT(p) * .5 * (uv_intensity_0 + C_DO(cell,thread));

         uv_intensity_0 = C_DO(cell,thread);

        }

      }    


      DEFINE_DPM_OUTPUT(uv_output, header, fp, p, thread, plane)

      {

        

      char name[100];



      if (header)

          {    

        fuv = fopen(fileuv,"w");

          if (NNULLP(thread))

              {

              fprintf(fuv,"(%s %d) ",thread->head->dpm_summary.sort_file_name,14);

              }

              else

          fprintf(fuv,"(%s %d) ",plane->sort_file_name,14);

          fprintf(fuv,"(%10s %10s %10s %10s %10s %10s %10s"

               " %10s %10s %10s %10s %10s %10s %10s %s) ",

                "X0","Y0","Z0",

                "X","Y","Z","U","V","W","diameter","T","mass-flow",

                "time","UV-Dosage","name");

         fclose(fuv);

          }

      else

          {

         fuv = fopen(fileuv,"a");

           sprintf(name,"%s:%d",p->injection->name,p->part_id);

         fprintf(fuv, 

              "((%10.6g %10.6g %10.6g %10.6g %10.6g %10.6g "

              "%10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g) %s) ",

              x0,y00,z0,

              p->state.pos[0], p->state.pos[1], p->state.pos[2],

              p->state.V[0], p->state.V[1], p->state.V[2],

              p->state.diam, p->state.temp, p->flow_rate, p->state.time,

              p->user[0], name);

         fclose(fuv);

        }

      }


      below error shows

      (system "copy "C:PROGRA~1ANSYSI~1v202fluent"fluent20.2.0srcudfsconstruct.udf "libudfwin643ddp_nodeSConstruct" ")

      1 file(s) copied.

      (system "copy "C:PROGRA~1ANSYSI~1v202fluent"fluent20.2.0srcudfscons_test.bat "libudfwin643ddp_nodescons_test.bat" ")

      1 file(s) copied.

      (chdir "libudf")(chdir "win643ddp_node")

      C:UsersHPDesktop est2libudfwin643ddp_node>set PYTHONHOME=C:PROGRA~1ANSYSI~1v202fluent/../commonfiles/CPython/3_7/winx64/Release/python


      C:UsersHPDesktop est2libudfwin643ddp_node>set PYTHONPATH=C:PROGRA~1ANSYSI~1v202fluent/../commonfiles/CPython/3_7/winx64/Release/python


      C:UsersHPDesktop est2libudfwin643ddp_node>C:PROGRA~1ANSYSI~1v202fluent/../commonfiles/CPython/3_7/winx64/Release/python/scons

      scons: Reading SConscript files ...

      Compiler used is C:PROGRA~1ANSYSI~1v202fluent tbinclanginclang-cl

      Linker used is C:PROGRA~1ANSYSI~1v202fluent tbinclanginlld-link

      Copy("C:UsersHPDesktop est2libudfwin643ddp_node esolve.exe", "C:PROGRA~1ANSYSI~1v202fluent tbinwin64 esolve.exe")

      Copy("C:UsersHPDesktop est2libudfwin643ddp_nodedemand2.c", "C:UsersHPDesktop est2libudfsrcdemand2.c")

      c_sources ['demand2.c', 'udf_names.c']

      c_sources_ ['demand2.c']

      scons: done reading SConscript files.

      scons: Building targets ...

      resolve.exe -udf demand2.c -head_file ud_io1.h

      C:PROGRA~1ANSYSI~1v202fluent tbinclanginclang-cl /c /Za /DUDF_EXPORTING /DUDF_NT /DWIN64 /EHa /wd4224 -Wno-return-type -Wno-implicit-function-declaration -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0win643ddp_node -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcmain -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcaddon-wrapper -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcio -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcspecies -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcpbns -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0src umerics -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcsphysics -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcstorage -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcmphase -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcc -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcmodels -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcmaterial -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcamg -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcutil -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcmesh -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcudf -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcht -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcdx -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0src urbulence -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcacoustics -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcparallel -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcetc -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcue -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcdpm -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcdbns -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0cortexsrc -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0clientsrc -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0 gridsrc -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0PRIME gridsrc -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0multiportsrc -I C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0multiportmpi_wrappersrc -I C:PROGRA~1ANSYSI~1v202fluentinclude -I C:UsersHPDesktop est2libudfwin643ddp_node -I C:PROGRA~1ANSYSI~1v202fluent tbinclangVCinclude -I C:PROGRA~1ANSYSI~1v202fluent tbinclangkitincludeshared demand2.c

      clang-cl: warning: argument unused during compilation: '/Za' [-Wunused-command-line-argument]

      In file included from demand2.c:5:

      In file included from C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcudfudf.h:22:

      In file included from C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcmainglobal.h:249:

      In file included from C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcstoragevar.h:10:

      C:PROGRA~1ANSYSI~1v202fluent tbinclangkitincludesharedasetsd.h(317,12): warning: cast to 'void * __ptr32' from smaller integer type 'unsigned long' [-Wint-to-void-pointer-cast]

      return((void * POINTER_32) (unsigned long) (ULONG_PTR) p);

      ^

      In file included from demand2.c:5:

      In file included from C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcudfudf.h:22:

      In file included from C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0srcmainglobal.h:251:

      C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0cortexsrccx.h(167,5): warning: incompatible redeclaration of library function 'strncasecmp' [-Wincompatible-library-redeclaration]

      int strncasecmp (const char *, const char *, int);

      ^

      C:PROGRA~1ANSYSI~1v202fluentfluent20.2.0cortexsrccx.h(167,5): note: 'strncasecmp' is a builtin with type 'int (const char *, const char *, unsigned long long)'

      demand2.c(19,19): warning: incompatible pointer types initializing 'cphase_state_t *' (aka 'struct cphase_state_struct *') with an expression of type 'cphase_state_t **' (aka 'struct cphase_state_struct **'); remove & [-Wincompatible-pointer-types]

      cphase_state_t *c = &(p->cphase);

      ^ ~~~~~~~~~~~~

      demand2.c(47,53): error: member reference base type 'void' is not a structure or union

      fprintf(fuv,"(%s %d) ",thread->head->dpm_summary.sort_file_name,14);

      ~~~~~~~~~~~~^ ~~~~~~~~~~~

      demand2.c(61,51): warning: format specifies type 'int' but the argument has type 'int64_t' (aka 'long long') [-Wformat]

      sprintf(name,"%s:%d",p->injection->name,p->part_id);

      ~~ ^~~~~~~~~~

      %lld

      4 warnings and 1 error generated.

      scons: *** [demand2.obj] Error 1

      scons: building terminated because of errors.


      Done.


      can anyone help in this regard.

      why this error is shown. kindly help in this regard. Thank You

    • Keyur Kanade
      Ansys Employee
      Duplicate of
      So closing this one.
Viewing 1 reply thread
  • You must be logged in to reply to this topic.