CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > CONVERGE

how to debugg example UDFs

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 29, 2021, 08:57
Default how to debugg example UDFs
  #1
New Member
 
Join Date: May 2021
Location: Tianjin,China
Posts: 10
Rep Power: 5
HengLiu is on a distinguished road
Hi, everyone,

I'm using Visual Studio 2022 for debugging CONVERGE 3.0 udf example codes which contain code like "CONVERGE_logger_debug("Setting user absorbtion coefficient")". I know this API means logging a message to be printed when logging in a debug build. After loading my working directory into Microsoft Visual Studio 2022, and I try to debug(not compile to converge_udf.dll library) the example code, there will be errors shown in the picture. I think I have built the environment successfully and included everything in the installation directory.Could anyone point the mistake or show me the correct workflow for debugging example udf codes?

PS: I can compile udf codes successfully and execute my desired udfs in CONVERGE simulation by learning from advanced videos named "User-Defined Functions" at the URL: "https://hub.convergecfd.com/training". However I want to know how to debug "absorption_coef.c" and see the printed log message like "Calling user_output_setup" or "Setting user absorbtion coefficient".

Thanks for your response.
HengLiu
Attached Images
File Type: jpg debugUDF.jpg (119.5 KB, 25 views)
HengLiu is offline   Reply With Quote

Old   December 30, 2021, 19:15
Default
  #2
New Member
 
Yu Zhang
Join Date: Oct 2021
Location: Madison
Posts: 15
Rep Power: 5
alexzhangyu is on a distinguished road
Hi Hengliu,

I can compile and build the same example UDF (v3.0.23 solver) using Visual Studio 2019 in both "debug" and "release" modes, and generate the corresponding "converge_udf.dll" library.

Regarding the error message, I am wondering if you copied the required "CMakeLists" file (and correcting the path in the file) into your working directory? To see more details about how to compile the CONVERGE UDF in Windows, please go to "https://hub.convergecfd.com/training" and review the "CONVERGE 3.0 UDF manual".

In general, to see the log message like "Calling user_output_setup" specified with the "CONVERGE_logger_debug" API, you need to "debug" build the "converge_udf.dll" library, run the CONVERGE solver with the UDF library, and those messages will be printed out in the log file.

Besides, since you cannot run a dll directly and it must be called by an application (e.g. a .exe), therefore, to debug a UDF, you need to compile and build the UDF in "debug" mode, run the CONVERGE solver with the UDF and attach the debugger to the solver (or launching the solver using the debugger).

Hope it helps to clarify some of your concerns. If you have any further concerns, please contact your local CONVERGE support team.

——————————————————
Yu Zhang, Ph.D.
Research Engineer - Applications
CONVERGECFD
alexzhangyu is offline   Reply With Quote

Old   January 1, 2022, 05:05
Default
  #3
New Member
 
Join Date: May 2021
Location: Tianjin,China
Posts: 10
Rep Power: 5
HengLiu is on a distinguished road
Thanks for your relpy,

I added "set(CMAKE_BUILD_TYPE "Debug”)" in "CMakeLists" files and built the "converge_udf.dll" in "debug" mode successfully. After running the CONVERGE solver with that library, there isn't any log message like "Calling user_output_setup" in the "converge.log" file while my udf codes can run and write the "user_smd_inj0.out" file normally.

Besides, could you show more details about how to "attach the debugger to the solver (or launching the solver using the debugger)".

Thanks for your response.
HengLiu
HengLiu is offline   Reply With Quote

Old   January 3, 2022, 14:59
Default
  #4
New Member
 
Yu Zhang
Join Date: Oct 2021
Location: Madison
Posts: 15
Rep Power: 5
alexzhangyu is on a distinguished road
Hi,

Regarding the output, can you set "output_control > log_level " to 3 in inputs.in and re-run the case? If your "log_level" is 1, then the log message will not be printed out.

Regarding your second question, it depends on which debugger you are using. If you were using Visual Studio, I found this tutorial is quite useful
"https://docs.microsoft.com/en-us/visualstudio/debugger/debugging-dll-projects?view=vs-2022#vxtskdebuggingdllprojectsthecallingapplicatio n"

I hope it helps. If you have any further concerns, please contact your local CONVERGE support team.
_______________________________________________
Yu Zhang, Ph.D.
Research Engineer - Applications
CONVERGECFD

Last edited by alexzhangyu; January 4, 2022 at 18:45.
alexzhangyu is offline   Reply With Quote

Reply

Tags
debug, udfs


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fluent crashing with no error message when initialising simulation with new UDF's ham551 Fluent UDF and Scheme Programming 1 October 27, 2021 14:54
problem using property udfs in parallel mode EllenW Fluent UDF and Scheme Programming 5 July 10, 2009 05:31
problem using property udfs in parallel mode EllenW FLUENT 0 June 23, 2009 18:18
Unsteady and Flux UDFs for UDSs tom FLUENT 0 February 13, 2009 11:27
Experimental Repository for UDFs, Journal Files and Scheme Scripts Jonas Larsson FLUENT 0 March 5, 2000 16:36


All times are GMT -4. The time now is 16:29.