|
[Sponsors] |
October 24, 2023, 04:08 |
How To Debug SU2 Code
|
#1 |
New Member
Liming Yang
Join Date: Sep 2023
Posts: 29
Rep Power: 3 |
Hello SU2 community,
I have compiled on ubuntu using the methods given on the website, and I would like to learn more about SU2 implementation by debugging the code. I have no experience debugging such large code, how can I debug and learn this code? Thank you for the help! |
|
October 24, 2023, 17:43 |
|
#2 |
Senior Member
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 674
Rep Power: 21 |
Hi,
I am very happy with visual studio code, which you can download for free here: https://code.visualstudio.com/download vscode will definitely help in debugging. If you have no experience with debugging or vscode, you can start with a very small c++ program that you have written and play with that, and you can follow some of the documentation on the visualstudio website. When you are ready to play with su2 in vscode, just recompile it with debugging support and start a debugging session for a simple test case inside vscode. Hope this helps. |
|
October 28, 2023, 11:10 |
|
#3 |
New Member
Liming Yang
Join Date: Sep 2023
Posts: 29
Rep Power: 3 |
Hello, I am also trying to debug su2 code using VS code recently. I can debug a simple program like “Hello world”, but I still have some confusion debugging su2:
1.I have compiled according to the method of the official website, do I need to debug again in VS code? 2.I understand that debugging must start with a certain part (class), so where should I debug and learn the code, or can I debug it as a whole? 3.Should I write the tasks.json file during my specific operation? Or is it automatically generated? 4.Since I am new to CFD, which part would you recommend to start reading and learning? Some of the questions may be obvious, but your advice will be of great importance to me, and I would be grateful if you could give me some experience. |
|
October 28, 2023, 14:15 |
|
#4 |
Senior Member
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 674
Rep Power: 21 |
Hi, When compiling with meson, just add -Ddebug=true --optimization=0 and switch off mpi if you do not specifically want to debug mpi stuff: -Dwith-mpi=disabled
In vscode, just choose 'open folder' and select the main SU2 folder containing everything. Then go to "Run and Debug", choose "add configuration" and choose "C/C++ (GDB) Launch". Then add in the configuration the program name 'folder/to/su2/SU2_CFD' and the arguments 'config.cfg' and the working directory 'folder/to/setup', and then click the 'play' icon to start debugging. If you do not set any breakpoints, your test case should simply run until the end or until an error occurs. First start with a small working testcase to see if it works. Then, you could go to e.g. SU2_CFD.cpp and place some breakpoints there. Depending on where you would like to do some debugging, just go to that specific file and place the breakpoints. If you would like to get some idea of where you end up in the code, you can also inspect the definitions of the functions, e.g. StartSolver() and see what they do. |
|
November 4, 2023, 08:37 |
|
#5 | |
New Member
Liming Yang
Join Date: Sep 2023
Posts: 29
Rep Power: 3 |
Quote:
I have successfully compiled with meson as shown in Figure 1. Then I debug in vscode, I opened the folder called SU2-master that containing the main SU2 folder like Figure 2. Next I create the launch file like Figure 3, I think the setting method in the figure can achieve the same result as the setting method described by you. If I misunderstand something, please advise me. But the results were not good; 1.Error like Figure 4. My file location is shown in the figure, so how should my program name be set? 2.Vscode does not seem to support CLI11, have you encountered this problem? How was it resolved? Thanks a lot. |
||
November 5, 2023, 03:43 |
|
#6 | |
New Member
Liming Yang
Join Date: Sep 2023
Posts: 29
Rep Power: 3 |
Quote:
|
||
November 5, 2023, 05:58 |
|
#7 |
Senior Member
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 674
Rep Power: 21 |
You should compile it with meson, also inside vscode. And you already compiled it, so now you just need to launch the debugger.
|
|
November 5, 2023, 07:29 |
|
#8 |
New Member
Liming Yang
Join Date: Sep 2023
Posts: 29
Rep Power: 3 |
I did compile with meson, but I'm not sure if it's related to vscode. Also, when I use debug directly, I get an error like the one shown in the figure, is this normal?
|
|
September 7, 2024, 06:49 |
|
#9 | |
New Member
Jimin.Zhang
Join Date: May 2024
Posts: 8
Rep Power: 2 |
Quote:
|
||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
3D Windturbine simulation in SU2 | k.vimalakanthan | SU2 | 15 | October 12, 2023 06:53 |
Fortran->Assembly : How to remove redundant non-vectorized code? | aerosayan | Main CFD Forum | 6 | November 20, 2020 06:37 |
Damper in aeroelastic NACA64A010 SU2 testcase: need to access the source code? | kiloWatt | SU2 | 3 | November 11, 2020 04:23 |
SU2 7.0.7 Built on CentOS 7, parallel computation pyscript mpi exit error? | EternalSeekerX | SU2 | 3 | October 9, 2020 19:28 |
The FOAM Documentation Project - SHUT-DOWN | holger_marschall | OpenFOAM | 242 | March 7, 2013 13:30 |