TAGGED: udf-complier-problem, udf-error
-
-
April 28, 2021 at 4:02 am
HenanCui
SubscriberHello everyone!nI'm trying to compile my UDF code to define the AC current density and Joule heat source term in an Electric Arc Furnace.nThe macros used include DEFINE_PROFILE、DEFINE_SOURCE and DEFINE_EXECUTE_AT_END. nAll these macros worked well until yesterday. But after the computer experienced an unexpected power outage, the UDF code can't work anymore.nWhen I compile the source file of the UDF, something goes wrong. I get some errors from the console(see below)nSetting Post Processing and Surfaces information ... Done.nCopied F:\_ThreePhaseCurrent\ReadyToGO_6_current_equation_4_14_LittlePoint_aircond_sourceterm.c to libudf\srcnCreating user_nt.udf file for 3ddp_host ...n(system copy \ANSYS\ANSYSI~1\v180\fluent\fluent18.0.0\src\udf\makefile_nt.udf libudf\win64\3ddp_host\makefile )nÒѸ´ÖÆ 1 ¸öÎļþ¡£n(chdir libudf)(chdir win64\3ddp_host)# Generating ud_io1.hnReadyToGO_6_current_equation_4_14_LittlePoint_aircond_sourceterm.cn..\..\src\ReadyToGO_6_current_equation_4_14_LittlePoint_aircond_sourceterm.c : warning C4819: ¸ÃÎļþ°üº¬²»ÄÜÔÚµ±Ç°´úÂëÒ³(936)ÖбíʾµÄ×Ö·û¡£Ç뽫¸ÃÎļþ±£´æÎª Unicode ¸ñʽÒÔ·ÀÖ¹Êý¾Ý¶ªÊ§n# Generating udf_names.c because of makefile ReadyToGO_6_current_equation_4_14_LittlePoint_aircond_sourceterm.objnudf_names.cnudf_names.c(18) : error C2085: ¡°JouleHeat2¡±: ²»ÔÚÐβαíÖÐnudf_names.c(19) : error C2085: ¡°CathCurrJ1_LittlePoint_test¡±: ²»ÔÚÐβαíÖÐnudf_names.c(20) : error C2085: ¡°CathCurrJ2_LittlePoint_test¡±: ²»ÔÚÐβαíÖÐnudf_names.c(21) : error C2085: ¡°CathCurrJ3_LittlePoint_test¡±: ²»ÔÚÐβαíÖÐnudf_names.c(22) : error C2085: ¡°AY_DIRICHLET_CLOSE¡±: ²»ÔÚÐβαíÖÐnudf_names.c(23) : error C2085: ¡°Calc1¡±: ²»ÔÚÐβαíÖÐnudf_names.c(24) : error C2085: ¡°Calc2¡±: ²»ÔÚÐβαíÖÐnudf_names.c(25) : error C2085: ¡°udf_data¡±: ²»ÔÚÐβαíÖÐnudf_names.c(25) : error C2143: Óï·¨´íÎó : ȱÉÙ¡°;¡±(ÔÚ¡°=¡±µÄÇ°Ãæ)nudf_names.c(46) : error C2065: ¡°udf_data¡±: δÉùÃ÷µÄ±êʶ·ûnCreating user_nt.udf file for 3ddp_node ...n(system copy \ANSYS\ANSYSI~1\v180\fluent\fluent18.0.0\src\udf\makefile_nt.udf libudf\win64\3ddp_node\makefile )nÒѸ´ÖÆ 1 ¸öÎļþ¡£n(chdir libudf)(chdir win64\3ddp_node)# Generating ud_io1.hnReadyToGO_6_current_equation_4_14_LittlePoint_aircond_sourceterm.cn..\..\src\ReadyToGO_6_current_equation_4_14_LittlePoint_aircond_sourceterm.c : warning C4819: ¸ÃÎļþ°üº¬²»ÄÜÔÚµ±Ç°´úÂëÒ³(936)ÖбíʾµÄ×Ö·û¡£Ç뽫¸ÃÎļþ±£´æÎª Unicode ¸ñʽÒÔ·ÀÖ¹Êý¾Ý¶ªÊ§n# Generating udf_names.c because of makefile ReadyToGO_6_current_equation_4_14_LittlePoint_aircond_sourceterm.objnudf_names.cnudf_names.c(18) : error C2085: ¡°JouleHeat2¡±: ²»ÔÚÐβαíÖÐnudf_names.c(19) : error C2085: ¡°CathCurrJ1_LittlePoint_test¡±: ²»ÔÚÐβαíÖÐnudf_names.c(20) : error C2085: ¡°CathCurrJ2_LittlePoint_test¡±: ²»ÔÚÐβαíÖÐnudf_names.c(21) : error C2085: ¡°CathCurrJ3_LittlePoint_test¡±: ²»ÔÚÐβαíÖÐnudf_names.c(22) : error C2085: ¡°AY_DIRICHLET_CLOSE¡±: ²»ÔÚÐβαíÖÐnudf_names.c(23) : error C2085: ¡°Calc1¡±: ²»ÔÚÐβαíÖÐnudf_names.c(24) : error C2085: ¡°Calc2¡±: ²»ÔÚÐβαíÖÐnudf_names.c(25) : error C2085: ¡°udf_data¡±: ²»ÔÚÐβαíÖÐnudf_names.c(25) : error C2143: Óï·¨´íÎó : ȱÉÙ¡°;¡±(ÔÚ¡°=¡±µÄÇ°Ãæ)nudf_names.c(46) : error C2065: ¡°udf_data¡±: δÉùÃ÷µÄ±êʶ·ûnnDone.nI have no idea the meaning of these errors such as C2085.nI also searched the udf_names.c file in my \libudf\win64\3ddp_host catalog, the content from line 18-line 25 is shown belownextern DEFINE_PROFILE(CathCurrJ2_LittlePoint_test,ft,i);nextern DEFINE_PROFILE(CathCurrJ3_LittlePoint_test,ft,i);nextern DEFINE_PROFILE(CathCurrJ1,ft,i);nextern DEFINE_PROFILE(CathCurrJ2,ft,i);nextern DEFINE_PROFILE(CathCurrJ3,ft,i);nextern DEFINE_PROFILE(AY_DIRICHLET_CLOSE,ft,i);nextern DEFINE_EXECUTE_AT_END(Calc1); nextern DEFINE_EXECUTE_AT_END(Calc2); nI can't understand why it goes wrong suddenly while I didn't change the code.nHow come I get this error and how can I solve it?nThanks a lot! nHenann -
April 28, 2021 at 6:22 am
DrAmine
Ansys EmployeeIf you copy the source files (you check them) to another folder, and you try to compile them (without loading any case file) will it work?n -
April 28, 2021 at 7:35 am
HenanCui
SubscriberThank you for your reply!nI used Workbench to do my simulation and I tried as you said just now.nI add a new Fluent in my former Workbench and compile the UDF without loading any mesh or case, the error is still there;nI build a new Workbench project in another folder and copy my UDF files into this folder, and then compile it as you say, but it still can't work.nWill the file path be the key to the problem?n -
April 28, 2021 at 8:19 am
HenanCui
SubscriberI made a mistake when I paste the content of my udf_name.c in the beginning.
besides the line 46 also has an error, which is called C2065
The correct code of line 18-46 is list below
extern DEFINE_SOURCE(JouleHeat2,c,ct,dS,eqn);
extern DEFINE_PROFILE(CathCurrJ1_LittlePoint_test,ft,i);
extern DEFINE_PROFILE(CathCurrJ2_LittlePoint_test,ft,i);
extern DEFINE_PROFILE(CathCurrJ3_LittlePoint_test,ft,i);
extern DEFINE_PROFILE(AY_DIRICHLET_CLOSE,ft,i);
extern DEFINE_EXECUTE_AT_END(Calc1);
extern DEFINE_EXECUTE_AT_END(Calc2);
__declspec(dllexport) UDF_Data udf_data[] = {
{"Loading", (void (*)(void))Loading, UDF_TYPE_EXECUTE_ON_LOADING},
{"Initialize", (void (*)(void))Initialize, UDF_TYPE_INIT},
{"B_calc", (void (*)(void))B_calc, UDF_TYPE_ADJUST}, /*to adjust or modify ANSYS FLUENT variables that are not passed as arguments.*/
{"conductivity", (void (*)(void))conductivity, UDF_TYPE_DIFFUSIVITY},
{"xLorentz", (void (*)(void))xLorentz, UDF_TYPE_SOURCE},
{"yLorentz", (void (*)(void))yLorentz, UDF_TYPE_SOURCE},
{"zLorentz", (void (*)(void))zLorentz, UDF_TYPE_SOURCE},
{"phiSource", (void (*)(void))phiSource, UDF_TYPE_SOURCE},
{"Ax", (void (*)(void))Ax, UDF_TYPE_SOURCE},
{"Ay", (void (*)(void))Ay, UDF_TYPE_SOURCE},
{"Az", (void (*)(void))Az, UDF_TYPE_SOURCE},
{"JouleHeat1", (void (*)(void))JouleHeat1, UDF_TYPE_SOURCE},
{"JouleHeat2", (void (*)(void))JouleHeat2, UDF_TYPE_SOURCE}, //Q=j^2/conductivity 对温度求导得到dS[eqn]=0
{"CathCurrJ1_LittlePoint_test", (void (*)(void))CathCurrJ1_LittlePoint_test, UDF_TYPE_PROFILE},
{"CathCurrJ2_LittlePoint_test", (void (*)(void))CathCurrJ2_LittlePoint_test, UDF_TYPE_PROFILE},
{"CathCurrJ3_LittlePoint_test", (void (*)(void))CathCurrJ3_LittlePoint_test, UDF_TYPE_PROFILE},
{"AY_DIRICHLET_CLOSE", (void (*)(void))AY_DIRICHLET_CLOSE, UDF_TYPE_PROFILE},
{"Calc1", (void (*)(void))Calc1, UDF_TYPE_EXECUTE_AT_END},
{"Calc2", (void (*)(void))Calc2, UDF_TYPE_EXECUTE_AT_END},
};
__declspec(dllexport) int n_udf_data = sizeof(udf_data)/sizeof(UDF_Data);
Sorry about the mistake! -
April 28, 2021 at 9:14 am
DrAmine
Ansys EmployeeAgain: Open Fluent in Standalone (not workbench), Go to an empty folder where you copied the UDF's and try to compile.n
-
Viewing 4 reply threads
- The topic ‘UDF compile Error in udf_names.c’ is closed to new replies.
Innovation Space
Trending discussions
Top Contributors
-
5969
-
1906
-
1420
-
1307
-
1021
Top Rated Tags
© 2026 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.