Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

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.hn#include dpm.hn#include sg_disco.h nn#define fileuv output.dpmn#define C_DO(c,t)C_STORAGE_R_XV(c,t,SV_DO_IRRAD,0)nnstatic real uv_intensity_0;nstatic real x0, y00, z0;nnFILE *fuv;nnDEFINE_DPM_SCALAR_UPDATE(uv_dosage, cell, thread, initialize, p)n{n cphase_state_t *c = &(p->cphase);n if (initialize)n  {n   p->user[0] = 0.;n   uv_intensity_0 = C_DO(cell,thread);n   x0=p->state.pos[0];n   y00=p->state.pos[1];n   z0=p->state.pos[2];n  }nn elsen  {n   p->user[0] += P_DT(p) * .5 * (uv_intensity_0 + C_DO(cell,thread));n   uv_intensity_0 = C_DO(cell,thread);n  }n}    nnDEFINE_DPM_OUTPUT(uv_output, header, fp, p, thread, plane)n{n  nchar name[100];if (header)n    {    n  fuv = fopen(fileuv,"w);n    if (NNULLP(thread))n        {n        fprintf(fuv,"(%s %d)\,thread->head->dpm_summary.sort_file_name,14);n        }n        elsen    fprintf(fuv,"(%s %d)\,plane->sort_file_name,14);n    fprintf(fuv,"(%10s %10s %10s %10s %10s %10s %10sn          %10s %10s %10s %10s %10s %10s %10s %s)\,n          X0","Y0","Z0,n          X","Y","Z","U","V","W","diameter","T","mass-flow,n          time","UV-Dosage","name);n   fclose(fuv);n    }nelsen    {n   fuv = fopen(fileuv,"a);n     sprintf(name,"%s:%d,p->injection->name,p->part_id);n   fprintf(fuv, n        ((%10.6g %10.6g %10.6g %10.6g %10.6g %10.6g n        %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g) %s)\,n        x0,y00,z0,n        p->state.pos[0], p->state.pos[1], p->state.pos[2],n        p->state.V[0], p->state.V[1], p->state.V[2],n        p->state.diam, p->state.temp, p->flow_rate, p->state.time,n        p->user[0], name);n   fclose(fuv);

      below error shows

      (system copy C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\udf\\sconstruct.udf libudf\\win64\\3ddp_node\\SConstruct )n1 file(s) copied.n(system copy C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\udf\\scons_test.bat libudf\\win64\\3ddp_node\\scons_test.bat )n1 file(s) copied.n(chdir libudf)(chdir win64\\3ddp_node)nC:\\Users\\HP\\Desktop\\test2\\libudf\\win64\\3ddp_node>set PYTHONHOME=C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent/../commonfiles/CPython/3_7/winx64/Release/pythoC:\\Users\\HP\\Desktop\\test2\\libudf\\win64\\3ddp_node>set PYTHONPATH=C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent/../commonfiles/CPython/3_7/winx64/Release/pythoC:\\Users\\HP\\Desktop\\test2\\libudf\\win64\\3ddp_node>C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent/../commonfiles/CPython/3_7/winx64/Release/python/sconsnscons: Reading SConscript files ...nCompiler used is C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\tbin\\clang\\bin\\clang-clnLinker used is C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\tbin\\clang\\bin\\lld-linknCopy(C:\\Users\\HP\\Desktop\\test2\\libudf\\win64\\3ddp_node\\resolve.exe, C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\tbin\\win64\\resolve.exe)nCopy(C:\\Users\\HP\\Desktop\\test2\\libudf\\win64\\3ddp_node\\demand2.c, C:\\Users\\HP\\Desktop\\test2\\libudf\\src\\demand2.c)nc_sources ['demand2.c', 'udf_names.c']nc_sources_ ['demand2.c']nscons: done reading SConscript files.nscons: Building targets ...nresolve.exe -udf demand2.c -head_file ud_io1.hnC:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\tbin\\clang\\bin\\clang-cl /c /Za /DUDF_EXPORTING /DUDF_NT /DWIN64 /EHa /wd4224 -Wno-return-type -Wno-implicit-function-declaration -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\win64\\3ddp_node -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\main -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\addon-wrapper -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\io -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\species -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\pbns -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\umerics -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\sphysics -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\storage -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\mphase -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\bc -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\models -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\material -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\amg -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\util -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\mesh -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\udf -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\ht -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\dx -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\turbulence -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\acoustics -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\parallel -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\etc -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\ue -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\dpm -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\dbns -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\cortex\\src -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\client\\src -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\tgrid\\src -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\PRIME\\tgrid\\src -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\multiport\\src -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\multiport\\mpi_wrapper\\src -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\include -I C:\\Users\\HP\\Desktop\\test2\\libudf\\win64\\3ddp_node -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\tbin\\clang\\VC\\include -I C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\tbin\\clang\\kit\\include\\shared demand2.cnclang-cl: warning: argument unused during compilation: '/Za' [-Wunused-command-line-argument]nIn file included from demand2.c:5:nIn file included from C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\udf\\udf.h:22:nIn file included from C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\main\\global.h:249:nIn file included from C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\storage\\var.h:10:nC:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\tbin\\clang\\kit\\include\\shared\\basetsd.h(317,12): warning: cast to 'void * __ptr32' from smaller integer type 'unsigned long' [-Wint-to-void-pointer-cast]nreturn((void * POINTER_32) (unsigned long) (ULONG_PTR) p);n^nIn file included from demand2.c:5:nIn file included from C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\udf\\udf.h:22:nIn file included from C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\src\\main\\global.h:251:nC:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\cortex\\src\\cx.h(167,5): warning: incompatible redeclaration of library function 'strncasecmp' [-Wincompatible-library-redeclaration]nint strncasecmp (const char *, const char *, int);n^nC:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0\\cortex\\src\\cx.h(167,5): note: 'strncasecmp' is a builtin with type 'int (const char *, const char *, unsigned long long)'ndemand2.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]ncphase_state_t *c = &(p->cphase);n^ ~~~~~~~~~~~~ndemand2.c(47,53): error: member reference base type 'void' is not a structure or unionnfprintf(fuv,"(%s %d)\,thread->head->dpm_summary.sort_file_name,14);n~~~~~~~~~~~~^ ~~~~~~~~~~~ndemand2.c(61,51): warning: format specifies type 'int' but the argument has type 'int64_t' (aka 'long long') [-Wformat]nsprintf(name,"%s:%d,p->injection->name,p->part_id);n~~ ^~~~~~~~~~n%lldn4 warnings and 1 error generated.nscons: *** [demand2.obj] Error 1nscons: building terminated because of errors.nnDone.nncan anyone help in this regard.nwhy this error is shown. kindly help in this regard. Thank You

    • Keyur Kanade
      Ansys Employee
      Duplicate of n

      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~1\ANSYSI~1\v202\fluent"\fluent20.2.0\src\udf\sconstruct.udf "libudf\win64\3ddp_node\SConstruct" ")1 file(s) copied.(system "copy "C:\PROGRA~1\ANSYSI~1\v202\fluent"\fluent20.2.0\src\udf\scons_test.bat "libudf\win64\3ddp_node\scons_test.bat" ")1 file(s) copied.(chdir "libudf")(chdir "win64\3ddp_node")C:\Users\HP\Desktop\test2\libudf\win64\3ddp_node>set PYTHONHOME=C:\PROGRA~1\ANSYSI~1\v202\fluent/../commonfiles/CPython/3_7/winx64/Release/pythonC:\Users\HP\Desktop\test2\libudf\win64\3ddp_node>set PYTHONPATH=C:\PROGRA~1\ANSYSI~1\v202\fluent/../commonfiles/CPython/3_7/winx64/Release/pythonC:\Users\HP\Desktop\test2\libudf\win64\3ddp_node>C:\PROGRA~1\ANSYSI~1\v202\fluent/../commonfiles/CPython/3_7/winx64/Release/python/sconsscons: Reading SConscript files ...Compiler used is C:\PROGRA~1\ANSYSI~1\v202\fluenttbin\clang\bin\clang-clLinker used is C:\PROGRA~1\ANSYSI~1\v202\fluenttbin\clang\bin\lld-linkCopy("C:\Users\HP\Desktop\test2\libudf\win64\3ddp_node\resolve.exe", "C:\PROGRA~1\ANSYSI~1\v202\fluenttbin\win64\resolve.exe")Copy("C:\Users\HP\Desktop\test2\libudf\win64\3ddp_node\demand2.c", "C:\Users\HP\Desktop\test2\libudf\src\demand2.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.hC:\PROGRA~1\ANSYSI~1\v202\fluenttbin\clang\bin\clang-cl /c /Za /DUDF_EXPORTING /DUDF_NT /DWIN64 /EHa /wd4224 -Wno-return-type -Wno-implicit-function-declaration -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\win64\3ddp_node -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\main -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\addon-wrapper -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\io -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\species -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\pbns -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\srcumerics -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\sphysics -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\storage -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\mphase -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\bc -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\models -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\material -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\amg -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\util -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\mesh -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\udf -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\ht -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\dx -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\turbulence -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\acoustics -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\parallel -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\etc -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\ue -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\dpm -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\dbns -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\cortex\src -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\client\src -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\tgrid\src -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\PRIME\tgrid\src -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\multiport\src -I C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\multiport\mpi_wrapper\src -I C:\PROGRA~1\ANSYSI~1\v202\fluent\include -I C:\Users\HP\Desktop\test2\libudf\win64\3ddp_node -I C:\PROGRA~1\ANSYSI~1\v202\fluenttbin\clang\VC\include -I C:\PROGRA~1\ANSYSI~1\v202\fluenttbin\clang\kit\include\shared demand2.cclang-cl: warning: argument unused during compilation: '/Za' [-Wunused-command-line-argument]In file included from demand2.c:5:In file included from C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\udf\udf.h:22:In file included from C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\main\global.h:249:In file included from C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\storage\var.h:10:C:\PROGRA~1\ANSYSI~1\v202\fluenttbin\clang\kit\include\shared\basetsd.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~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\udf\udf.h:22:In file included from C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\main\global.h:251:C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\cortex\src\cx.h(167,5): warning: incompatible redeclaration of library function 'strncasecmp' [-Wincompatible-library-redeclaration]int strncasecmp (const char *, const char *, int);^C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\cortex\src\cx.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 unionfprintf(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);~~ ^~~~~~~~~~%lld4 warnings and 1 error generated.scons: *** [demand2.obj] Error 1scons: building terminated because of errors.Done.can anyone help in this regard.why this error is shown. kindly help in this regard. Thank You/forum/discussion/21510/udf-issue-sandia-lab-uv-dose-udf

      So closing this one. n
Viewing 1 reply thread
  • The topic ‘UDF source file/UDF compiling error’ is closed to new replies.