fcFEM - FEA from start to finish

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: fcFEM - FEA from start to finish

Post by Kunda1 »

Awesome!!!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
johnwang
Veteran
Posts: 1382
Joined: Sun Jan 27, 2019 12:41 am

Re: fcFEM - FEA from start to finish

Post by johnwang »

Tried on Win10.

First it needs numba.
Then It needs sksparse. I found https://scikit-sparse.readthedocs.io/en ... olmod.html#
It is hosted at https://github.com/scikit-sparse/scikit-sparse.
scikit-sparse needs suite-sparse.

Tried to install suite-sparse as admin like this and the error is:

Code: Select all

D:\FreeCAD_weekly-builds-29485-2022-07-11-conda-Windows-x86_64-py38\bin>python -m pip install suite-sparse
ERROR: Could not find a version that satisfies the requirement suite-sparse (from versions: none)
ERROR: No matching distribution found for suite-sparse
Then tried to install scikit-sparse and the error is:

Code: Select all

D:\FreeCAD_weekly-builds-29485-2022-07-11-conda-Windows-x86_64-py38\bin>python -m pip install scikit-sparse
Collecting scikit-sparse
  Using cached scikit-sparse-0.4.6.tar.gz (209 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.13.3 in d:\freecad_weekly-builds-29485-2022-07-11-conda-windows-x86_64-py38\bin\lib\site-packages (from scikit-sparse) (1.22.4)
Requirement already satisfied: scipy>=0.19 in d:\freecad_weekly-builds-29485-2022-07-11-conda-windows-x86_64-py38\bin\lib\site-packages (from scikit-sparse) (1.8.1)
Building wheels for collected packages: scikit-sparse
  Building wheel for scikit-sparse (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for scikit-sparse (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-38
      creating build\lib.win-amd64-cpython-38\sksparse
      copying sksparse\test_cholmod.py -> build\lib.win-amd64-cpython-38\sksparse
      copying sksparse\__init__.py -> build\lib.win-amd64-cpython-38\sksparse
      creating build\lib.win-amd64-cpython-38\sksparse\test_data
      copying sksparse\test_data\illc1033.mtx.gz -> build\lib.win-amd64-cpython-38\sksparse\test_data
      copying sksparse\test_data\illc1033_rhs1.mtx.gz -> build\lib.win-amd64-cpython-38\sksparse\test_data
      copying sksparse\test_data\illc1850.mtx.gz -> build\lib.win-amd64-cpython-38\sksparse\test_data
      copying sksparse\test_data\illc1850_rhs1.mtx.gz -> build\lib.win-amd64-cpython-38\sksparse\test_data
      copying sksparse\test_data\well1033.mtx.gz -> build\lib.win-amd64-cpython-38\sksparse\test_data
      copying sksparse\test_data\well1033_rhs1.mtx.gz -> build\lib.win-amd64-cpython-38\sksparse\test_data
      copying sksparse\test_data\well1850.mtx.gz -> build\lib.win-amd64-cpython-38\sksparse\test_data
      copying sksparse\test_data\well1850_rhs1.mtx.gz -> build\lib.win-amd64-cpython-38\sksparse\test_data
      running build_ext
      building 'sksparse.cholmod' extension
      creating build\temp.win-amd64-cpython-38
      creating build\temp.win-amd64-cpython-38\Release
      creating build\temp.win-amd64-cpython-38\Release\sksparse
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Isksparse -IC:\Users\Pete\AppData\Local\Temp\pip-build-env-hgja2bc3\overlay\Lib\site-packages\numpy\core\include -ID:\FreeCAD_weekly-builds-29485-2022-07-11-conda-Windows-x86_64-py38\bin/include -I/usr/include/suitesparse -ID:\FreeCAD_weekly-builds-29485-2022-07-11-conda-Windows-x86_64-py38\bin\include -ID:\FreeCAD_weekly-builds-29485-2022-07-11-conda-Windows-x86_64-py38\bin\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /Tcsksparse/cholmod.c /Fobuild\temp.win-amd64-cpython-38\Release\sksparse/cholmod.obj
      cholmod.c
      sksparse/cholmod.c(32): fatal error C1083: Cannot open include file: 'Python.h': No such file or directory
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.33.31629\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for scikit-sparse
Failed to build scikit-sparse
ERROR: Could not build wheels for scikit-sparse, which is required to install pyproject.toml-based projects

D:\FreeCAD_weekly-builds-29485-2022-07-11-conda-Windows-x86_64-py38\bin>
The main error above is:

Code: Select all

sksparse/cholmod.c(32): fatal error C1083: Cannot open include file: 'Python.h': No such file or directory
Is this Python.h file from Python?

Anyone has an idea to install scikit-sparse?
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
HarryvL
Veteran
Posts: 1332
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

Should all be included in PPD snap:

https://github.com/FreeCAD/FreeCAD-snap
User avatar
HarryvL
Veteran
Posts: 1332
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

johnwang wrote: Mon Aug 22, 2022 11:27 am Anyone has an idea to install scikit-sparse?
No responses yet. Assuming this is still a problem, from memory, I just got it from https://libraries.io/pypi/scikit-sparse with

Code: Select all

 pip install scikit-sparse==0.4.6
.

This worked for me out of the box (but I am on Ubuntu)
User avatar
johnwang
Veteran
Posts: 1382
Joined: Sun Jan 27, 2019 12:41 am

Re: fcFEM - FEA from start to finish

Post by johnwang »

scikit-sparse not working under Windows.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
HarryvL
Veteran
Posts: 1332
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

I will make a version that does not depend on it.
User avatar
johnwang
Veteran
Posts: 1382
Joined: Sun Jan 27, 2019 12:41 am

Re: fcFEM - FEA from start to finish

Post by johnwang »

HarryvL wrote: Sat Aug 27, 2022 7:22 am I will make a version that does not depend on it.
Thank you very much.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
HarryvL
Veteran
Posts: 1332
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

HarryvL wrote: Sat Aug 27, 2022 7:22 am I will make a version that does not depend on it.
I tried numpy.linalg.solve(matrix,vector) instead and find that in a simple elastic analysis the solution time increases by a factor 120.

So, we really need to use Cholesky decomposition of the stiffness matrix with forward/back substitution in subsequent iterations. I looked around but can't find any ready-made libraries apart from CHOLMOD, which unfortunately requires SCIKIT-SPARSE. There are some helpful websites that explain how to build this for Windows, but I can't try those because I don't have a Windows machine (anymore).

Alternatively, you could run this on a Linux emulator for Windows. That's how I used to work before I switched to a Linux machine.

Sorry, not much else I can do to remedy this.
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: fcFEM - FEA from start to finish

Post by heda »

hm, is there not a conda fc-version also for windows?
that should make it possible to install the sparse with conda-forge channel.
gbParametric
Posts: 23
Joined: Wed Apr 20, 2022 9:06 pm

Re: fcFEM - FEA from start to finish

Post by gbParametric »

I would be interested in testing this on Windows as well, if someone manages to get this working, any tips will be apriciated. :)
Post Reply