|
[Sponsors] |
September 9, 2018, 23:16 |
The simplest way to debug Fluent UDF
|
#1 |
Senior Member
Join Date: Feb 2010
Posts: 164
Rep Power: 17 |
Debugging Fluent UDF is always the pain point for users. Intermediate variables can't be inspected and the source can't be traced step by step. User's progress remains stagnant especially because of inexplicable errors. Here, we recommend a UDF debugging tool that can directly inspect intermediate variables and trace the UDF source step by step.
https://vcudfstudio.bitbucket.io/dow...uent%20UDF.pdf |
|
October 5, 2019, 06:11 |
|
#2 | |
New Member
Join Date: Oct 2019
Posts: 3
Rep Power: 8 |
Quote:
For those of you who would prefer not to pay for shady additional software and would like to keep information free, I am proposing the following following GENUINELY-FREE-OF-CHARGE approach, which I find even simpler than your FREE-TO-TRY slash GIVE-ME-YOUR-MONEY solution: - Remember to back original files up before you make any changes. - Change the makefile template makefile_nt.udf (in one of the Fluent installation folders): CFLAGS = /c /Za /Zi /DUDF_EXPORTING /DUDF_NT /DWIN64 /EHa /wd4224 link $(LIBS) /dll /debug /assemblydebug /out:$(TARGET) In words, you add the compiler flag /Zi and linker flags /debug /assemblydebug, nothing else. These options generate the program database (.pdb) files that you'll later find in the binary output folders. - Compile the UDF code in Fluent GUI and load the libudf library. This seems to be the best (most stable and universal) approach for compilation these days, earlier you had to run nmake in command prompt. - Open the source file in the "libudf/src" folder in Visual Studio (a free Express version will do fine). - In Visual Studio, attach the code to fl_mpi1950.exe (Fluent 2019R3). This works in serial mode, in parallel you may have to attach to all Fluent processes (haven't used in years, don't remember anymore). You should see debug symbols loaded in VS. - Try adding a breakpoint on a code row. The red circle on the left hand side should be filled, if the attach was successful. - When you run the simulation, whenever the code with the breakpoint is called within Fluent, you should now break in Visual Studio and be able to see the variable content and track program flow. Please see https://ibb.co/K2pPh6K for a screenshot. No need to extend your wallet. Cheers, Eero Last edited by eeroi; October 6, 2019 at 05:35. |
||
October 9, 2019, 01:05 |
|
#3 | |
Senior Member
Join Date: Feb 2010
Posts: 164
Rep Power: 17 |
Please do not disparage a car just because you have a pair of muscular legs. Not everyone master or prefer "Marathon" like you. Quite a few people enjoy the convenience even if cars "extend their wallet".
Quote:
|
||
October 10, 2019, 01:45 |
|
#4 | |
New Member
Join Date: Oct 2019
Posts: 3
Rep Power: 8 |
Quote:
What really bothers me is that you pretend to be helpful while promoting your commercial stuff. Nothing wrong with being a vendor, but you should say it openly. Forum rules (I quote): State your affiliation explicitly in your message if you: Recommend a product sold by your employer. Write bad things about a product and you are employed by a company selling similar products. Forbidden content: Advertising, both commercial and personal |
||
October 10, 2019, 02:43 |
|
#5 | |
Senior Member
Join Date: Feb 2010
Posts: 164
Rep Power: 17 |
Quote:
|
||
October 10, 2019, 04:00 |
|
#6 |
New Member
Join Date: Oct 2019
Posts: 3
Rep Power: 8 |
||
October 10, 2019, 04:21 |
|
#7 |
Senior Member
Join Date: Feb 2010
Posts: 164
Rep Power: 17 |
||
August 10, 2020, 11:08 |
|
#8 | |
New Member
Rodolfo
Join Date: Jun 2020
Location: Brazil
Posts: 2
Rep Power: 0 |
Hello, could you provide the screenshots of the step-by-step procedure, please?
Quote:
|
||
August 5, 2021, 07:42 |
|
#9 | |
New Member
Nam
Join Date: Jan 2021
Posts: 16
Rep Power: 5 |
Quote:
|
||
September 15, 2021, 11:41 |
|
#10 | |
New Member
Kaicheng Chen
Join Date: May 2019
Posts: 4
Rep Power: 7 |
Quote:
- Try adding a breakpoint on a code row. The red circle on the left hand side should be filled, if the attach was successful. The error is "The breakpoint will not currently be hit, no symbols have been loaded for this document". I have attached to all Fluent processes named fl_mpi2020.exe. Does anyone have an idea how to solve this? Thank you in advance In the end I have solved the problem, everything is working after following the guideline from erroi. Thank you!!!! Just some comments: For parallel simulation we need to hook the code to all processes named with fl_mpixxxx.exe, and it is highly recommended to debug with serial mode. Last edited by kaicheng; September 23, 2021 at 08:21. Reason: Found solution for the question post before |
||
December 18, 2023, 09:41 |
|
#11 |
New Member
Join Date: Feb 2023
Posts: 2
Rep Power: 0 |
Do you know how to change these flags for built-in compiler? Because these steps
affect only MSVC compiler |
|
January 6, 2024, 17:39 |
Video instructions using VSCode on windows
|
#12 |
New Member
Abdullah Al Amin
Join Date: Oct 2011
Posts: 3
Rep Power: 15 |
I have prepared a video instruction for those who are struggling. The youtube video is here: https://www.youtube.com/watch?v=sK7u416BOas and the github repo link is here: https://github.com/neoceph/Fluent-UDF
|
|
Tags |
debug, fluent, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Two questions on Fluent UDF | Steven | Fluent UDF and Scheme Programming | 7 | March 23, 2018 04:22 |
Problem running fluent with udf on batch | tobi b. | Fluent UDF and Scheme Programming | 3 | April 14, 2016 14:54 |
Running UDF with Supercomputer | roi247 | FLUENT | 4 | October 15, 2015 14:41 |
fluent UDF external library lapack problem | Rick | FLUENT | 0 | May 7, 2008 11:16 |
UDF problem caused by various version of Fluent | Yurong | FLUENT | 3 | January 15, 2006 11:57 |