Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

UDF error in population balance modeling

    • Vikas_Vashisth
      Subscriber
      Following errors are being faced during the compiling the UDF in Fluent even already available UDF in fluent user manuals for break-up frequencynn# Generating udf_names.c because of makefile freq1.objnudf_names.cnudf_names.c(: error C2065: 'break_up_freq_tav:undeclared identifiernudf_names.c(: warning C4312: 'type cast:conversion from 'int' to 'void (*)(void)' of greater sizenudf_names.c(: error C2065: 'UDF_TYPE_PB_BREAKUP_RATE_FREQ:undeclared identifiernudf_names.c(: error C2099: initializer is not a constantnnPlease suggest a solution.nnRegardsnVikasn
    • Vikas_Vashisth
      Subscriber
      The UDF is as followsnn/************************************************************************nUDF that computes the particle breakage frequencyn*************************************************************************/nn#include udf.hn#include sg_pb.hn#include sg_mphase.hnnDEFINE_PB_BREAKUP_RATE_FREQ(break_up_freq_tav, cell, thread, d_1)n{nreal epsi, alpha, f1, f2, rho_d;nreal C1 = 0.00481, C2 = 0.08, sigma = 0.07;n/* Thread *tm = THREAD_SUPER_THREAD(thread); /*passed thread is phase*/ nepsi = 0.5;n/* alpha = C_VOF(cell, thread); */nalpha = 0.12;nrho_d = 1000;nf1 = pow(epsi, 1./3.)/((1.+epsi)*pow(d_1, 2./3.));nf2 = -(C2*sigma*(1.+epsi)*(1.+epsi))/(rho_d*pow(epsi,2./3.)*pow(d_1, 5./3.));nreturn C1*f1*exp(f2);n}nn
    • Amine Ben Hadj Ali
      Ansys Employee
      Ensure that DEFINE macro is in the same line and no line breaks there. Which version are you using?n
    • Vikas_Vashisth
      Subscriber
      Ansys 19.2n
    • Vikas_Vashisth
      Subscriber
      Above macro is from the fluent user guide and we are using the same without any change, even now I got the same errors.n
    • Rob
      Forum Moderator
      You've commented out the line /* Thread *tm = THREAD_SUPER_THREAD(thread); /*passed thread is phase*/ so there's no definition for Thread *tm but you're also not using it. Did you copy any of it out of the manual (eg CTRL+C) or type from scratch? For the former check for white space characters.
    • Vikas_Vashisth
      Subscriber
      Yes, I copied (CTRL+C) it from the manual of Ansys and trying to compile it in Ansys 19.2.n
    • Rob
      Forum Moderator
      Use an editor that you can show command/white space characters and delete the ones that aren't supposed to be there. n
    • Vikas_Vashisth
      Subscriber
      I am using Visual Studio 17 (Professional) and please check the imagenI just copied the code that's it and trying to compile in Fluentnn
    • Rob
      Forum Moderator
      Please show the white space characters as asked. n
    • Amine Ben Hadj Ali
      Ansys Employee
      Also with just copying the code and compiling it: no issues.nCheck the white spaces mentioned by nI do not have 19.2 anymore on my windows machine and is anyway not supported anymore. n
    • Vikas_Vashisth
      Subscriber
      Please checknnn
    • Amine Ben Hadj Ali
      Ansys Employee
      Looks okay.nnPlease go to udf_names.c on line 6, 7 and 8 what do you see? or post it the whole content.n
    • Vikas_Vashisth
      Subscriber
      ****************************************************************************n****************************************************************************n** WARNING: Automatically switched to run in parallel -t1 mode. **n** Detected non-parallelized UDF usage, enabling parallel usage. **n** If you encounter any issues, please re-run with -t0 flag. **n****************************************************************************n****************************************************************************user_nt.udf file is outdated. So, recreating the file for 3ddp_node ...n(chdir libudf\win64\3ddp_node)(system copy C:\PROGRA~1\ANSYSI~1\v192\fluent\fluent19.2.0\src\udf\makefile_nt.udf libudf\win64\3ddp_node\makefile )n1 file(s) copied.n(chdir libudf)(chdir win64\3ddp_node)# Generating ud_io1.hnfreq1.cn# Generating udf_names.c because of makefile freq1.objnudf_names.cnudf_names.c: error C2065: 'break_up_freq_tav:undeclared identifiernudf_names.c: warning C4312: 'type cast:conversion from 'int' to 'void (*)(void)' of greater sizenudf_names.c: error C2065: 'UDF_TYPE_PB_BREAKUP_RATE_FREQ:undeclared identifiernudf_names.c: error C2099: initializer is not a constantnnDone.n
    • Amine Ben Hadj Ali
      Ansys Employee
      I said content of udf_names.c Check your working directory.n
    • Vikas_Vashisth
      Subscriber
      /* This file generated automatically. */ n/* Do not modify. */ n#include "udf.h" n#include "prop.h" n#include "dpm.h" nextern DEFINE_PB_BREAKUP_RATE_FREQ(break_up_freq_tav, cell, thread, d_1);n__declspec(dllexport) UDF_Data udf_data[] = { n{"break_up_freq_tav", (void (*)(void))break_up_freq_tav, UDF_TYPE_PB_BREAKUP_RATE_FREQ},n}; n__declspec(dllexport) int n_udf_data = sizeof(udf_data)/sizeof(UDF_Data); n#include "version.h" n__declspec(dllexport) void UDF_Inquire_Release(int *major, int *minor, int *revision) n{ n*major = RampantReleaseMajor; n*minor = RampantReleaseMinor; n*revision = RampantReleaseRevision; n} nyou are asking for this?
    • Amine Ben Hadj Ali
      Ansys Employee
      Yes. Asking for this and it looks okay. I do not see an issue here. nIs it possible to launch Fluent in other directory, and just compile again. You do not require a case.n
    • Vikas_Vashisth
      Subscriber
      Compiled the same UDF without case in different directory but still getting the same error.nn# Generating udf_names.c because of makefile freq1.objnudf_names.cnudf_names.c(: error C2065: 'break_up_freq_tav:undeclared identifiernudf_names.c(: warning C4312: 'type cast:conversion from 'int' to 'void (*)(void)' of greater sizenudf_names.c(: error C2065: 'UDF_TYPE_PB_BREAKUP_RATE_FREQ:undeclared identifiernudf_names.c(: error C2099: initializer is not a constantnnDone.nn
    • Amine Ben Hadj Ali
      Ansys Employee
      Please attach the udf you are compiling. I have a feeling that is related to your system /compiler.n
    • Amine Ben Hadj Ali
      Ansys Employee
      I was asking for the C file and not for a word document. Can you just try compiling a dummy UDF likenn#include udf.hnDEFINE_ON_DEMAND(dummy)n{nMessage0(Testing
      );n}nIs it possible that you use one of the last versions?n
    • Vikas_Vashisth
      Subscriber
      Dummy version is working fine.nnvik.cn# Generating udf_names.c because of makefile vik.objnudf_names.cn# Linking libudf.dll because of makefile user_nt.udf udf_names.obj vik.objnMicrosoft (R) Incremental Linker Version 14.16.27043.0nCopyright (C) Microsoft Corporation. All rights reserved.nnCreating library libudf.lib and object libudf.expnnDone.nnOpening library \\libudf...nLibrary \\libudf\win64\3ddp_host\libudf.dll openednOpening library \\libudf...nLibrary \\libudf\win64\3ddp_node\libudf.dll openedndummynDone.n
    • Vikas_Vashisth
      Subscriber
      This is my casenn/************************************************************************nUDF that computes the particle breakage frequencyn*************************************************************************/nn#include udf.hn#include sg_pb.hn#include sg_mphase.hnnDEFINE_PB_BREAKUP_RATE_FREQ(break_up_freq_tav, cell, thread, d_1)n{nreal epsi, alpha, f1, f2, rho_d;nreal C1 = 0.00481, C2 = 0.08, sigma = 0.07;n/* Thread *tm = THREAD_SUPER_THREAD(thread); /*passed thread is phase*/ nepsi = 0.5;n/* alpha = C_VOF(cell, thread); */nalpha = 0.12;nrho_d = 1000;nf1 = pow(epsi, 1./3.)/((1.+epsi)*pow(d_1, 2./3.));nf2 = -(C2*sigma*(1.+epsi)*(1.+epsi))/(rho_d*pow(epsi,2./3.)*pow(d_1, 5./3.));nreturn C1*f1*exp(f2);n}n
    • Vikas_Vashisth
      Subscriber
      I am not able to attached the C file here, here is the text file for same UDFnnn
    • Rob
      Forum Moderator
      I can see the dots for spaces in your code, but not the carriage return symbols (looks like backwards P| ) .n
    • Vikas_Vashisth
      Subscriber
      What should I do now?n
    • Amine Ben Hadj Ali
      Ansys Employee
      It is working for me on with 19 2 but Linux. Please try using a short name like nDEFINE_PB_BREAKUP_RATE_FREQ(dummy, cell, thread, d_1)nnAnd remove all content and let it return 1.0nn
    • Vikas_Vashisth
      Subscriber
      Still not working!n
    • Amine Ben Hadj Ali
      Ansys Employee
      Okay. There is no issue with the release and with your compiler. The only test I was not doing was with old version on Windows. I cannot do that. Try compiling another define pbe macro from the manual on your machine and let us know.n
    • Vikas_Vashisth
      Subscriber
      UDF for breakup rate pdf (used from user manual)nn/************************************************************************nUDF that computes the particle breakage PDFn*************************************************************************/nn#include udf.hn#include sg_pb.hn#include sg_mphase.hnnDEFINE_PB_BREAKUP_RATE_PDF(break_up_pdf_par, cell, thread, d_1, d_2)n{nreal pdf;nreal kv = M_PI/6.;nnreal C = 1.0;nnreal f_2, f_3, f_4;nreal V_prime = kv*pow(d_1,3.);nreal V = kv*pow(d_2,3.);nnf_2 = 24.*pow(V/V_prime,2.);nf_3 = -24.*(V/V_prime);nf_4 = 6.;nnpdf = (C/V_prime) + ((1.-C/2.)/V_prime)*(f_2 + f_3 + f_4);n  nreturn 0.5*pdf;n}Same errornn# Generating udf_names.c because of makefile pdf.objnudf_names.cnudf_names.c: error C2065: 'break_up_pdf_par:undeclared identifiernudf_names.c: warning C4312: 'type cast:conversion from 'int' to 'void (*)(void)' of greater sizenudf_names.c: error C2065: 'UDF_TYPE_PB_BREAKUP_RATE_PDF:undeclared identifiernudf_names.c: error C2099: initializer is not a constantnnDone.n
    • Amine Ben Hadj Ali
      Ansys Employee
      I recommend two things:n1/To test on another computer and another platform.n2/To test with newer versionsnnOut tests are showing that with the release you are using no issues are occurring.n
    • Rob
      Forum Moderator
      Which suggests something screwy in the UDF you copied. Open the UDF in Word, turn on the paragraph makes (CTRL+ *) and post a screen grab.As a programming tip, if you define a number as real always add a decimal place, so nrho_d = 1000. and not rho_d = 1000 nIt may not cause a problem with more modern compilers (I learnt programming with Visual Basic and FORTRAN 77) but it won't hurt. n
    • Rob
      Forum Moderator
      Following comments, I've copied & compiled the above in R19.2 with no errors. nAre you checking the problem UDF compilation in the same folder as the test you tried (that worked)?n
    • Vikas_Vashisth
      Subscriber
      As per comment I may not be needed an test file to compile the UDF in Fluent!nPlease suggest, which compiler should I try other than Visual Studio for Fluent 19.2.0?n
    • Amine Ben Hadj Ali
      Ansys Employee
      We do not support any other compiler on Windows. With release 2020R2 no compiler is required anymore on Windows.nYou might try another version of Visual Studio (2015) or retry installing the VS Studio version you are now using.nn
    • Amine Ben Hadj Ali
      Ansys Employee
      I would like that you look ino the header file sg_pb.h and check if you find the DEFINE PB related macros there. Check that file please.nn
    • Vikas_Vashisth
      Subscriber
      Ok, I will try to run the run my UDF on 2020R2 and let you know.nnPlease check if the environment is OK and my working directory for UDF is D-drive. UDF is saved as def_pdf.cn nThank you very much for your kind help!n
    • Rob
      Forum Moderator
      Looks fine, but as some UDFs work and others don't the environment must be OK. I assume all the files are in the same location?n
    • Amine Ben Hadj Ali
      Ansys Employee
      Looks okay. Test with 2020R2 built-in compiler. Are you using university licences?n
    • Vikas_Vashisth
      Subscriber
      Yes, we have research license at the university!n
    • Vikas_Vashisth
      Subscriber
      Compiled the UDF in 2020R2 and still same errornnnFiles udf_names.c and user_nt.udf in 3ddp_host are up-to-date.n(system copy C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\udf\makefile_nt.udf libudf\win64\3ddp_host\makefile )n1 file(s) copied.n(chdir libudf)(chdir win64\3ddp_host)udf_names.cnudf_names.c: error C2065: 'break_up_freq_tav:undeclared identifiernudf_names.c: warning C4312: 'type cast:conversion from 'int' to 'void (*)(void)' of greater sizenudf_names.c: error C2065: 'UDF_TYPE_PB_BREAKUP_RATE_FREQ:undeclared identifiernudf_names.c: error C2099: initializer is not a constantnFiles udf_names.c and user_nt.udf in 3ddp_node are up-to-date.n(system copy C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\udf\makefile_nt.udf libudf\win64\3ddp_node\makefile )n1 file(s) copied.n(chdir libudf)(chdir win64\3ddp_node)udf_names.cnudf_names.c: error C2065: 'break_up_freq_tav:undeclared identifiernudf_names.c: warning C4312: 'type cast:conversion from 'int' to 'void (*)(void)' of greater sizenudf_names.c: error C2065: 'UDF_TYPE_PB_BREAKUP_RATE_FREQ:undeclared identifiernudf_names.c: error C2099: initializer is not a constantnnDone.n
    • Amine Ben Hadj Ali
      Ansys Employee
      Can you please use the built-in compiler? n
    • Vikas_Vashisth
      Subscriber
      I used the built-in compiler n
    • Amine Ben Hadj Ali
      Ansys Employee
      Things getting weird. You can imagine that it is hard for us now to debug further. Either there is an issue on your computer which is not allowing to compile this simple kind of UDF's or the compiler installation you have is spoiling everything.nMy last comment here is to uninstall VS Studio (not required with 20R2), clean-up everything, verify if the sg_pb contains the required macros and try again.n
    • Vikas_Vashisth
      Subscriber
      I tried to run other UDF (my previous work) and its working fine in the same system with 19.2 and 2020R2 bothn
    • Vikas_Vashisth
      Subscriber
      See, everything seems fine here for another UDF for multiphase systemnnuser_nt.udf file is outdated. So, recreating the file for 3ddp_node ...n(chdir libudf\win64\3ddp_node)(system copy C:\PROGRA~1\ANSYSI~1\v202\fluent\fluent20.2.0\src\udf\makefile_nt.udf libudf\win64\3ddp_node\makefile )n1 file(s) copied.n(chdir libudf)(chdir win64\3ddp_node)# Generating ud_io1.hnGLdrag.cn# Generating udf_names.c because of makefile GLdrag.objnudf_names.cn# Linking libudf.dll because of makefile user_nt.udf udf_names.obj GLdrag.objnMicrosoft (R) Incremental Linker Version 14.16.27043.0nCopyright (C) Microsoft Corporation. All rights reserved.nnCreating library libudf.lib and object libudf.expnnDone.nn
    • Amine Ben Hadj Ali
      Ansys Employee
      Yes that is fine but it working on our side for the PB macros. Trust us!nDid you check the sg_pb header file? Can you see the macros there? n
    • Rob
      Forum Moderator
      Can you compile the code on a colleague's computer? I suppose you could have a corrupted header file somehow. n
    • Vikas_Vashisth
      Subscriber
      I have compiled the these UDFs on same computer and different computers. nWhat should I do if header file got corrupt?n
    • Amine Ben Hadj Ali
      Ansys Employee
      either you re-install properly (unisntall, install with admin rights) or check the header file in question vs the one of a computer with same release version and compare both.n
Viewing 48 reply threads
  • The topic ‘UDF error in population balance modeling’ is closed to new replies.