CfdOF unable to run command in OpenFOAM

This subforum is specifically to discuss packaging issues on different platforms (windows, mac, linux), and using different packaging systems (conda, etc...)
Post Reply
bryan._.
Posts: 1
Joined: Wed Mar 01, 2023 11:21 am

CfdOF unable to run command in OpenFOAM

Post by bryan._. »

This is the error message

Code: Select all

subprocess.CalledProcessError: Command 'echo $WM_PROJECT_VERSION' returned non-zero exit status 1.
Full error message:

Code: Select all

13:06:49  Executing: echo $WM_PROJECT_VERSION in None
13:06:49  /bin/bash: line 1: \wsl.localhost\Ubuntu-20.04\opt\OpenFOAM\OpenFOAM-v2012/etc/bashrc: No such file or directory
13:06:49  OpenFOAM installation found, but unable to run command: Command 'echo $WM_PROJECT_VERSION' returned non-zero exit status 1.
13:06:49  Traceback (most recent call last):
13:06:49    File "C:\Users\wong2\AppData\Roaming\FreeCAD\Mod\CfdOF\.\CfdOF\CfdPreferencePage.py", line 276, in runDependencyChecker
13:06:49      CfdTools.checkCfdDependencies(lambda msg:  (print(msg), self.consoleMessage(msg)))
13:06:49    File "C:\Users\wong2\AppData\Roaming\FreeCAD\Mod\CfdOF\.\CfdOF\CfdTools.py", line 1074, in checkCfdDependencies
13:06:49      foam_ver = runFoamCommand("echo $WM_PROJECT_VERSION")[0]
13:06:49    File "C:\Users\wong2\AppData\Roaming\FreeCAD\Mod\CfdOF\.\CfdOF\CfdTools.py", line 929, in runFoamCommand
13:06:49      raise subprocess.CalledProcessError(exit_code, cmdline)
13:06:49  subprocess.CalledProcessError: Command 'echo $WM_PROJECT_VERSION' returned non-zero exit status 1.

What I did previously:

Followed https://www.openfoam.com/download/openf ... windows-10.

Set the path to \\wsl.localhost\Ubuntu-20.04\opt\OpenFOAM\OpenFOAM-v2012

I also tried setting the path to bryann@DESKTOP-PB3S3DT:/opt/OpenFOAM/OpenFOAM-v2012/etc$ echo $WM_PROJECT_DIR
/opt/OpenFOAM/OpenFOAM-v2012
, but it told me it couldn't find the installation directory

I also verified that the bashrc file was there but CfdOF could not find it.

This was what I got when I ran the echo $WM_PROJECT_VERSION command from the terminal

Code: Select all

 /opt/OpenFOAM/OpenFOAM-v2012$ echo $WM_PROJECT_VERSION
v2012 
This is what I got from the "Check that everything is OK" part

Code: Select all


Time = 0.495

Courant Number mean: 0.222158 max: 0.852134
smoothSolver:  Solving for Ux, Initial residual = 2.43518e-07, Final residual = 2.43518e-07, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 5.33314e-07, Final residual = 5.33314e-07, No Iterations 0
DICPCG:  Solving for p, Initial residual = 5.25763e-07, Final residual = 5.25763e-07, No Iterations 0
time step continuity errors : sum local = 6.11228e-09, global = 1.51821e-18, cumulative = 1.09644e-17
DICPCG:  Solving for p, Initial residual = 7.01015e-07, Final residual = 7.01015e-07, No Iterations 0
time step continuity errors : sum local = 7.5484e-09, global = -4.1723e-19, cumulative = 1.05471e-17
ExecutionTime = 0.78 s  ClockTime = 4 s

Time = 0.5

Courant Number mean: 0.222158 max: 0.852134
smoothSolver:  Solving for Ux, Initial residual = 2.3091e-07, Final residual = 2.3091e-07, No Iterations 0
smoothSolver:  Solving for Uy, Initial residual = 5.0684e-07, Final residual = 5.0684e-07, No Iterations 0
DICPCG:  Solving for p, Initial residual = 8.63844e-07, Final residual = 8.63844e-07, No Iterations 0
time step continuity errors : sum local = 8.8828e-09, global = 4.94571e-19, cumulative = 1.10417e-17
DICPCG:  Solving for p, Initial residual = 9.59103e-07, Final residual = 9.59103e-07, No Iterations 0
time step continuity errors : sum local = 9.66354e-09, global = 1.13175e-18, cumulative = 1.21735e-17
ExecutionTime = 0.81 s  ClockTime = 4 s

End

It looks like everything is installed, but CfdOF cannot find the files.
carel
Posts: 1
Joined: Sun Sep 17, 2023 4:56 am

Re: CfdOF unable to run command in OpenFOAM

Post by carel »

Hi
I have the exact same issue on Ubuntu 22.04.3 LTS running openFoam 11. Paraview is included in this install and the paraFoam examples runs when executed.

Code: Select all

06:47:56  OpenFOAM installation found, but unable to run command: Command 'echo $WM_PROJECT_VERSION' returned non-zero exit status 1.
06:47:56  Traceback (most recent call last):
06:47:56    File "/home/carel/snap/freecad/common/Mod/CfdOF/./CfdOF/CfdPreferencePage.py", line 272, in runDependencyChecker
06:47:56      CfdTools.checkCfdDependencies(lambda msg:  (print(msg), self.consoleMessage(msg)))
06:47:56    File "/home/carel/snap/freecad/common/Mod/CfdOF/./CfdOF/CfdTools.py", line 1079, in checkCfdDependencies
06:47:56      foam_ver = runFoamCommand("echo $WM_PROJECT_VERSION")[0]
06:47:56    File "/home/carel/snap/freecad/common/Mod/CfdOF/./CfdOF/CfdTools.py", line 934, in runFoamCommand
06:47:56      raise subprocess.CalledProcessError(exit_code, cmdline)
06:47:56  subprocess.CalledProcessError: Command 'echo $WM_PROJECT_VERSION' returned non-zero exit status 1.
I suspect that it is a permission issue as FreeCAD was installed by the GUI and openFoam by 'sudo apt install'.
Post Reply