Find answers, ask questions, and connect with our <br>community around the world.

Home Forums OpenFOAM Programming Course OpenFOAM Programming

  • OpenFOAM Programming

    Posted by Imani on March 31, 2024 at 2:52 am

    Hello, I am Gloire Imani and I am encountering this error in Visual Studio Code. Would you mind offering a help on how to solve that.

    Andrew replied 6 days, 7 hours ago 2 Members · 5 Replies
  • 5 Replies
  • Andrew

    Member
    March 31, 2024 at 11:18 am

    Hi Gloire Imani,

    I think the problem is with the path that you have specified your OpenFOAM installation directory to.

    So I think one immediate issue might be is after your first line:

    “${workspaceFolder}/**”

    You have /Home with a capital “H” and then the following lines have /home

    However I suspect that that wouldn’t cause the other include paths to give you an error as well.

    Normally on linux systems, you have the /home directory and then the username directory so for mine its:

    /home/flowthermolab/openfoam/OpenFOAM-v2306/**

    Can you double check you are not missing your username in the path.

    One quick check would be to run the following commands to verify where your openfoam installation actually is. So in your terminal with openfoam sourced type:

    1) src

    2) pwd

    That should give you your src directory, note you could also do “cd $FOAM_SRC” for example. See the picture attached.

    Let me know if any of that helps. Thanks,

    Andrew

    • Imani

      Member
      April 2, 2024 at 2:40 am

      Thank you for this. I found that it is installed on OpenFOAM-9 which I use for other purpose. But for this lesson I added v2306. Should I use the OpenFOAM-9 as include path or I should change that?

      • Andrew

        Member
        April 2, 2024 at 6:17 am

        I probably wouldn’t recommend carrying on with OpenFOAM-9 for the rest of this course, its defintely possible but you’ll probably run into some minor code inconsistencies that may cause you problems when running through some of the tutorials.

        All thats happened is that you probably have OpenFOAM-9 automatically sourced in your ~/.bashrc (which is part of the install instructions) so that when you launch your VM, OpenFOAM-9 is ready to go, hence why you can call commands like src.

        When you have multiple builds of OF, what I like to do is have alias’ set up in my ~/.bashrc so that I can swap and change between them easily. So for example if I open up my bashrc using:

        vim ~/.bashrc

        I then have this line of code:

        alias of=’source ~/openfoam/OpenFOAM-v2306/etc/bashrc’

        So when I type “of” into the console it sources that version of v2306. So for you it looks like you could have two alias’, something along the line of:

        alias of-9=’source ~/OpenFOAM/OpenFOAM-9/etc/bashrc’

        alias of-v2306=’source ~/OpenFOAM/OpenFOAM-v2306/etc/bashrc’

        So to use OpenFOAM-9, you’d type “of-9” in the console at the start of your session, and for V2306 you’d type “of-v2306”. This method is something you’ll notice I do quite a lot when you get to the OF-specific lectures in the course.

        Also then going back to your vscode, make sure you are using the right path for you includes, which would be something like:

        /home/dyfluid/OpenFOAM/OpenFOAM-v2306

        Based on your username and what looks like your install path for v2306.

        Thanks,

        Andrew

  • Imani

    Member
    April 11, 2024 at 10:49 am

    Dear Teacher,

    Thank you so much for your response, I have done so. Now I’m using v2306

    I’m facing another problem that is I’m trying to compile the DEBUG version, but ./Allwmake says that there is no such file or directory. I will appreciate your help.

    • Andrew

      Member
      April 11, 2024 at 11:23 am

      Hi Imani,

      Good to hear you have that working for v2306 and looks like you setup the alias as well for the debug build as well – good job!

      Can you make sure for me when you are trying to compile the debug version, are you inside the correct folder, it looks like you ran ./Allwmake from your home directory (~)

      So first off source your debug, bashrc script like you have done in the picture (this makes sure that we do not have say your other version of OpenFOAM v2306 sourced). i.e.:

      source ~/OpenFOAM/OpenFOAM-v2306-DEBUG/etc/bashrc
      or using your alias which I think is the same thing “of2306-debug”

      So then can you do:
      cd OpenfOAM/OpenFOAM-v2306-DEBUG

      then run
      ./Allwmake

      Thanks,

      Andrew

      • This reply was modified 6 days, 7 hours ago by  Andrew.

Log in to reply.

error: Content is protected !!