cfdOF install not detecting OpenFOAM install

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

justJETZ
Posts: 9
Joined: Tue Jun 15, 2021 8:21 pm

cfdOF install not detecting OpenFOAM install

Post by justJETZ »

Hello everyone

Before getting to FreeCAD, I would like to say I have installed OpenFOAM-v2012 and OpenFOAM v8 in their respective install folders and I can access both environments through the terminal with no issues. This is all on Ubuntu 20.04 LTS.

I installed FreeCAD 0.19 from the Ubuntu Software app, The store lists it as a developer build so I am not sure if this adds to the problem or not.
The details of the install are as follows:
OS: Ubuntu Core 20 (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git)
Build type: Unknown
Branch: releases/FreeCAD-0-19
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.5
Qt version: 5.12.8
Coin version: 4.0.0
OCC version: 7.5.0
Locale: English/United States (en_US)

I followed the install instructions for CfdOF listed on the Git page by jaheyns at https://github.com/jaheyns/CfdOF.
I first installed Plot and then CfdOF. Paraview is also installed(done with OpenFOAM).

I go to the preferences section of FreeCAD and under CfdOF I try to list my install directory for openfoam8 (I work better with the OpenFOAM foundation version, I know it's weird). This directory would be /opt/openfoam8. However, when selecting the browse function to go to this directory, FreeCAD does not show any folders inside the opt directory. So I tried to manually just type /opt/openfoam8 in the text field and thought would work. No it does not.

When I run the dependency checker FreeCAD says:

Code: Select all

Checking dependencies...
Could not find OpenFOAM installation: The directory /opt/openfoam8 is not a recognised OpenFOAM installation
gmsh not found (optional)
  • Issue 1: openfoam8 is in the opt directory So I don't know why it gives me that error..
  • Issue 2: gmsh is installed but for some reason does not detect it.
  • Issue 3: I try to install cfMesh using the preferences/CfdOF button, I get this error (same applies for HiSA

Code: Select all

22:36:46  Traceback (most recent call last):
22:36:46    File "/home/jitish/snap/freecad/22/.FreeCAD/Mod/CfdOF/CfdPreferencePage.py", line 271, in downloadInstallCfMesh
22:36:46      runtime = self.testGetRuntime(False)
22:36:46    File "/home/jitish/snap/freecad/22/.FreeCAD/Mod/CfdOF/CfdPreferencePage.py", line 171, in testGetRuntime
22:36:46      runtime = CfdTools.getFoamRuntime()
22:36:46    File "/home/jitish/snap/freecad/22/.FreeCAD/Mod/CfdOF/CfdTools.py", line 419, in getFoamRuntime
22:36:46      raise IOError("The directory {} is not a recognised OpenFOAM installation".format(installation_path))
22:36:46  OSError: The directory /opt/openfoam8 is not a recognised OpenFOAM installation
For HiSA

Code: Select all

22:52:08  Traceback (most recent call last):
22:52:08    File "/home/jitish/snap/freecad/22/.FreeCAD/Mod/CfdOF/CfdPreferencePage.py", line 292, in downloadInstallHisa
22:52:08      runtime = self.testGetRuntime(False)
22:52:08    File "/home/jitish/snap/freecad/22/.FreeCAD/Mod/CfdOF/CfdPreferencePage.py", line 171, in testGetRuntime
22:52:08      runtime = CfdTools.getFoamRuntime()
22:52:08    File "/home/jitish/snap/freecad/22/.FreeCAD/Mod/CfdOF/CfdTools.py", line 419, in getFoamRuntime
22:52:08      raise IOError("The directory {} is not a recognised OpenFOAM installation".format(installation_path))
22:52:08  OSError: The directory /opt/openfoam8 is not a recognised OpenFOAM installation
So naturally, the simulation that I just carried on with (tried my luck), crashes at the meshing stage with the following errors as I click the "Write Mesh Case" button

Code: Select all

22:38:20  Populating mesh dictionaries in folder /tmp/meshCase
22:38:20  Traceback (most recent call last):
22:38:20    File "/home/jitish/snap/freecad/22/.FreeCAD/Mod/CfdOF/_TaskPanelCfdMesh.py", line 212, in writeMesh
22:38:20      FreeCADGui.doCommand("cart_mesh.writeMeshCase()")
22:38:20    File "<string>", line 1, in <module>
22:38:20    File "/home/jitish/snap/freecad/22/.FreeCAD/Mod/CfdOF/CfdMeshTools.py", line 699, in writeMeshCase
22:38:20      'FoamRuntime': CfdTools.getFoamRuntime(),
22:38:20    File "/home/jitish/snap/freecad/22/.FreeCAD/Mod/CfdOF/CfdTools.py", line 419, in getFoamRuntime
22:38:20      raise IOError("The directory {} is not a recognised OpenFOAM installation".format(installation_path))
22:38:20  OSError: The directory /opt/openfoam8 is not a recognised OpenFOAM installation
It is evident I did something wrong and I have checked various CfdOF install threads on this forum like:
https://forum.freecadweb.org/viewtopic.php?t=30718,
https://forum.freecadweb.org/viewtopic. ... 1&p=451780, and others.

  • Issue 4: When starting up FreeCAD, I get the error below (not sure if this is what is causing all the other errors)

Code: Select all

22:54:23  /home/jitish/snap/freecad/22/.FreeCAD/Mod/Plot/freecad/plot/init_gui.py:28: MatplotlibDeprecationWarning: 
The MATPLOTLIBDATA environment variable was deprecated in Matplotlib 3.1 and will be removed in 3.3.
  import matplotlib

I am somewhat of a newbie to FreeCAD so I am not sure if installing from the Ubuntu Software store was the best idea.

Any help is greatly appreciated.
User avatar
oliveroxtoby
Posts: 811
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: cfdOF install not detecting OpenFOAM install

Post by oliveroxtoby »

justJETZ wrote: Tue Jun 15, 2021 8:59 pm
I go to the preferences section of FreeCAD and under CfdOF I try to list my install directory for openfoam8 (I work better with the OpenFOAM foundation version, I know it's weird). This directory would be /opt/openfoam8. However, when selecting the browse function to go to this directory, FreeCAD does not show any folders inside the opt directory.
This suggests to me there might be some permissions issue preventing you from seeing the /opt/openfoam8 directory as an ordinary user. Until this step works, there is probably no point carrying on. Check permissions on that folder and make sure you can see its contents in the files app. If everything seems fine it might be worth trying an alternative FreeCAD installation such as the daily build or the appimage.
PoLu
Posts: 1
Joined: Fri Jun 18, 2021 9:53 am

Re: cfdOF install not detecting OpenFOAM install

Post by PoLu »

I am getting exactly the same problem.
Access permissions on the folder do not seem to be the problem.
Do you have any other suggestions?
User avatar
oliveroxtoby
Posts: 811
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: cfdOF install not detecting OpenFOAM install

Post by oliveroxtoby »

PoLu wrote: Fri Jun 18, 2021 10:00 am I am getting exactly the same problem.
Access permissions on the folder do not seem to be the problem.
Do you have any other suggestions?
This seems to be a problem with the 'Snap' installation, which I wasn't aware of before. It seems to be a containerised install which doesn't appear to allow access to system directories, which creates a few problems for CfdOF. I'll look into it but for now I would suggest using the PPAs here or the AppImages here.
justJETZ
Posts: 9
Joined: Tue Jun 15, 2021 8:21 pm

Re: cfdOF install not detecting OpenFOAM install

Post by justJETZ »

Accessing permissions on the folder \opt\openfoam8 in the permissions tab actually just gives the warning that "You are not the owner, so you cannot change these permissions."

Is there no way to get FreeCAD 0.19 on Ubuntu besides the AppImage, because it will be a permanent app on the system I wanted to mount it to favourites. If we use

Code: Select all

sudo apt-get install freecad
It installs FreeCAD 0.18.4.
From what I have seen and read 0.19 is much better than 0.18, so I would prefer that, and that has been my somewhat limited experience as well.

The best "compromise" is making the 0.19 AppImage appear as an icon in the App list or something similar.
Can this be done?
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: cfdOF install not detecting OpenFOAM install

Post by adrianinsaval »

yes it can be done, create a .desktop file in /home/$USER/.local/share/applications with the Exec= line pointing to the path to your appimage, you can see examples of the structure of .desktop files either in the previously mentioned path or on /usr/share/applications
instead of that you could use AppImageLauncher to automate the process

Or you could add the freecad ppa and install the latest stable through apt or maybe the flatpak version could work too.
justJETZ
Posts: 9
Joined: Tue Jun 15, 2021 8:21 pm

Re: cfdOF install not detecting OpenFOAM install

Post by justJETZ »

I decided to use the AppImage launcher. Thank you for the link.

It is still not ideal, as when I click on the shortcut in my favourites it opens a new instance of the FreeCAD app on the taskbar.
However, it is definitely better than going through various folders to execute the appimage.

Now back to the main problem and the issues I was experiencing with OpenFOAM. I will give the simulation another go, (this time I will try running the first tutorial case on the cfdOF help.
Will report back soon.
david69
Veteran
Posts: 1773
Joined: Wed Jan 01, 2014 7:48 pm

Re: cfdOF install not detecting OpenFOAM install

Post by david69 »

to install ppa either the stable or dev version, check this page of wiki, dedicated to linux
https://wiki.freecadweb.org/Installing_on_Linux
justJETZ
Posts: 9
Joined: Tue Jun 15, 2021 8:21 pm

Re: cfdOF install not detecting OpenFOAM install

Post by justJETZ »

Ok

FreeCAD is detecting both OpenFOAM installations, and I have successfully installed cfMesh and HiSA. Running the dependency checker yields no errors.

Not sure if I can ask this here or if I should open another thread.
When clicking "Run" for the solver I get the following output in the Report view.

Code: Select all

13:57:24  Solver run command: bash -c cd "/tmp/case" && ./Allrun
13:57:24  bash -c cd "/tmp/case" && ./Allrun
13:57:24  Raw command:  ['bash', '-c', 'cd "/tmp/case" && ./Allrun']
13:57:24  /*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2012                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _e91649cfd8-20210420 OPENFOAM=2012 patch=210414
Arch   : "LSB;label=32;scalar=64"
Exec   : createPatch -overwrite
Date   : Jun 20 2021
Time   : 13:57:24
Host   : jitish-linux
PID    : 32400
13:57:24  I/O    : uncollated
Case   : /tmp/case
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

13:57:24  Reading "system/createPatchDict"

Adding new patch inlet1 as patch 1 from 
{
    type            patch;
}

Adding new patch inlet2 as patch 2 from 
{
    type            patch;
}

Adding new patch outlet as patch 3 from 
{
    type            patch;
}

Adding new patch pipeWalls as patch 4 from 
{
    type            wall;
}

Adding new patch slipWalls as patch 5 from 
{
    type            wall;
}

Adding new patch defaultFaces as patch 6 from 
{
    type            patch;
}


--> FOAM Warning : 
    From Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
    in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 896
    Cannot find any patch or group names matching "patch_1_.*"
--> FOAM Warning : 
    From Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
    in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 896
    Cannot find any patch or group names matching "patch_2_.*"
--> FOAM Warning : 
    From Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
    in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 896
    Cannot find any patch or group names matching "patch_3_.*"
--> FOAM Warning : 
    From Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
    in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 896
    Cannot find any patch or group names matching "patch_4_.*"
--> FOAM Warning : 
    From Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
    in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 896
    Cannot find any patch or group names matching "patch_5_.*"
Moving faces from patch patch_0_0 to patch 6

Doing topology modification to order faces.

Not synchronising points.

Removing patches with no faces in them.

Removing zero-sized patch patch_0_0 type patch at position 0
Removing patches.
Writing repatched mesh to 0

13:57:24  End

13:57:24  /*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2012                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _e91649cfd8-20210420 OPENFOAM=2012 patch=210414
Arch   : "LSB;label=32;scalar=64"
Exec   : potentialFoam -initialiseUBCs -pName p -writep
Date   : Jun 20 2021
Time   : 13:57:24
Host   : jitish-linux
PID    : 32407
13:57:24  I/O    : uncollated
Case   : /tmp/case
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

13:57:24  
potentialFlow: Operating solver in PISO mode

Reading velocity field U

Constructing pressure field p

Constructing velocity potential field Phi

No MRF models present


Calculating potential flow
GAMG:  Solving for Phi, Initial residual = 0, Final residual = 0, No Iterations 0
GAMG:  Solving for Phi, Initial residual = 0, Final residual = 0, No Iterations 0
GAMG:  Solving for Phi, Initial residual = 0, Final residual = 0, No Iterations 0
GAMG:  Solving for Phi, Initial residual = 0, Final residual = 0, No Iterations 0
13:57:24  GAMG:  Solving for Phi, Initial residual = 0, Final residual = 0, No Iterations 0
GAMG:  Solving for Phi, Initial residual = 0, Final residual = 0, No Iterations 0
GAMG:  Solving for Phi, Initial residual = 0, Final residual = 0, No Iterations 0
GAMG:  Solving for Phi, Initial residual = 0, Final residual = 0, No Iterations 0
GAMG:  Solving for Phi, Initial residual = 0, Final residual = 0, No Iterations 0
Continuity error = 0
Interpolated velocity error = 0

Calculating approximate pressure field
13:57:24  #0  Foam::error::printStack(Foam::Ostream&) at ??:?
13:57:24  #1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in /lib/x86_64-linux-gnu/libpthread.so.0
13:57:24  #3  ? in /usr/lib/openfoam/openfoam2012/platforms/linux64GccDPInt32Opt/bin/potentialFoam
#4  ? in /usr/lib/openfoam/openfoam2012/platforms/linux64GccDPInt32Opt/bin/potentialFoam
#5  ? in /usr/lib/openfoam/openfoam2012/platforms/linux64GccDPInt32Opt/bin/potentialFoam
#6  __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
13:57:24  #7  ? in /usr/lib/openfoam/openfoam2012/platforms/linux64GccDPInt32Opt/bin/potentialFoam
13:57:24  ./Allrun: line 4: 32407 Floating point exception(core dumped) "$@" > >(tee -a log."$sol") 2> >(tee -a log."$sol" >&2)
All the text under the "Calculating approximate pressure field" should be in red.

I did notice the 5 FOAM Warnings above as well, but I am not sure how to fix this.
User avatar
oliveroxtoby
Posts: 811
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: cfdOF install not detecting OpenFOAM install

Post by oliveroxtoby »

justJETZ wrote: Sun Jun 20, 2021 12:03 pm Ok

FreeCAD is detecting both OpenFOAM installations, and I have successfully installed cfMesh and HiSA. Running the dependency checker yields no errors.

Not sure if I can ask this here or if I should open another thread.
When clicking "Run" for the solver I get the following output in the Report view.
Please provide all the information requested in this post before reporting problems with CfdOF.
Post Reply