Is there any easier way to compile OpenLB in Windows?
July 18, 2022 at 7:37 am #6725
I’m a newbie of LBM and just began my courses in a somewhere no-one-knows university. I want to find a way to simulate the phenomena of phase change. And I heard that OpenLB is the best app in this field (even more it is open source).
But the source code seems like only runs in Linux. I downloaded the source and try to compile it in Visual Studio 2022 in Windows. It occurred many errors, such as many keywords didn’t be recognized, seems like the suffix “any_platform” (which seems like a special keyword relying on GCC and Linux, not belonging to the standard C++).
So, I dared to beg if there is any easier way to compile OpenLb in Windows? Or I must install Linux on my computer? I’m so retarded that I can’t program and debug without the help of IDEs, (even hope the execute file can run in Windows), because I really know nothing about Linux.
If this question is thought ridiculous and unimplementable, please just ignore this.July 18, 2022 at 11:26 am #6726
Yes, OpenLB is primarily developed on and targeted at Linux (although you can also use it on other Unix-like systems)
In general there is not that much platform-specific implementation. The main requirements are full C++17 support and the declaration of various preprocessor flags to select the parallelization modes and so on (this is why you get the
There are many people working on OpenLB under Windows using the WSL system. You can check out the corresponding tech report (although it may be out of date by now, in general you only need to enable WSL and install a Linux distribution of your choice under Windows. There is also a video guide linked).
I hope this helps.July 18, 2022 at 3:30 pm #6727
Thank you very much for your support. I read the document and it seems to make help to compile it under Windows. I hope to learn OpenLB and debug it in my familiar IDEs. These days, I tried to convert it to a VS project or a Qt Creator project, but it seems impossible.
So, I thought that if it’s possible? to provide a CMake file (“CMakeLists.txt”). Based on CMake, the source code could be transformed into any popular IDE project easily, as many IDEs support CMake. Anyway, not every researcher is a programming specialist who is familiar with any OS’s details. It’s a big obstacle for those newbies who want to get in touch with such excellent open-source software.July 19, 2022 at 9:52 am #6728
The project structure is quite simple at its core: We have the
src/folder containing all the headers and implementations to be included into the application. The “build system” mainly precompiles some embedded dependencies (optional, you can also link system provided tinyxml and zlib) and applies the flags defined in
config.mk(relating to parallelization mode and so on). Many of my colleagues work with basic bindings to compile and debug cases in Visual Studio Code and some also use full IDEs such as CLion in the same fashion.
To compile and debug a simulation case in an IDE you roughly need to open the corresponding cpp file (e.g.
examples/laminar/cylinder2d/cylinder2d.cpp) and define the compiler and compilation flags to use. Altough it probably will be the easiest to just use an (possibly IDE-embedded) terminal to run the
makecommand. For debugging you should be able to select the created executable (compiled with debug flags set in
config.mk). I just want to reiterate the the build structure really is not that complex (OpenLB is basically a header only library).
As for OS details (assuming you mean the focus on Linux / Unit-likes): I understand that all of this can seem overhelming at first. However it quickly pays of as basic knowledge of this will likely become important to you when wanting to run the simulation with realistic resolutions and parameters on a HPC cluster – basically all of them use some form of Linux.
You definitely do not need to know all OS’s details to work with OpenLB, most difficulties are probably with modifying the C++ code making up the entire software (which you will need to do when modifying any existing case or creating your own).
I hope that this can alleviate some of your concerns. In any case, please feel free to ask further questions. We are also happy about concrete suggestions on how to make it easier get started.
July 20, 2022 at 4:53 am #6730
- This reply was modified 3 weeks, 5 days ago by Adrian.
Thank you very much for these advises and so much detailed description. All these helped me a lot.
I will try to download Visual Studio Code and search more information to compile it. Anyway, I don’t hope that the keywords in the code I’ve never seen become the barrier I learn LBM, with which I want to solve my research problems.July 20, 2022 at 1:49 pm #6731
If you mean the
any_platform“keyword”: This is not a C++ language keyword but a specific macro we define in OpenLB. (For the CPU-only code it is simply replaced by nothing. Only for the GPU code it is replaced by the CUDA-specific
__host__ __device__declarators. i.e. you can ignore it – it is only used to mark functions that need to be executable on the GPU.)
- You must be logged in to reply to this topic.