Making FEM run on linux fedora 21

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Making FEM run on linux fedora 21

Post by PrzemoF »

It's complicated, but doable (see attachement). Step by step:
1. Get CalculiX binary: http://www.dhondt.de/ccx_2.8p2.tar.bz2
2. Untar: tar xf ccx_2.8p2.tar.bz2
3. Rename file CalculiX/ccx_2.8p2 to ccx and move to the same directory as FreeCAD executable. I operate from build directory, so it's build/bin
4. Test if ccx has all libraries:

Code: Select all

$ ldd ccx
	linux-vdso.so.1 =>  (0x00007fff9802d000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00000035de800000)
	libgfortran.so.2 => /lib64/libgfortran.so.2 (0x00007fd70d5a3000)
	libm.so.6 => /lib64/libm.so.6 (0x00000035df000000)
	libc.so.6 => /lib64/libc.so.6 (0x00000035de400000)
	libgomp.so.1 => /lib64/libgomp.so.1 (0x00000035fd600000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000035df800000)
	/lib64/ld-linux-x86-64.so.2 (0x00000035de000000)
Fedora 21 does _not_ have libgfortran.so.2, so it has to be "implanted"
5. Get libgfortran2 from rpmfind. I use x86_64, so it's
wget ftp://rpmfind.net/linux/Mandriva/offici ... x86_64.rpm
6. Install it: sudo yum install libgfortran2-4.2.3-6mnb2.x86_64.rpm
7. Install brilliant FreeCAD macro provided by psicofil: download/file.php?id=12095
8. Start FreeCAD
9. Make/load a part for FEM analysis and switch to FEM workbench
10. Run the macro by psicofil GMSH mesh (gmsh has to be installed, but it's in fedora official repo)
11. Select "Algorithm: tetgen" - (I get crash on netgen and some other problems with iso)
12. Select the part and click OK in the macro window to create mesh
13. Select the mesh in project tree an click "Create a new mechanical analysis" (icon is a yellow letter A)
14. Click "Material definition" (icon: yellow sphere)
15. Select material and click OK
16. Select the mesh and _hide it_
17. Add constrains and forces to the _part_ (not to the macro-generated mesh) - that part works really nice
18. Click icon "Start calculation" (icon: yellow bending rectangle)
19. Click "Write CalculiX input file" and "Run Calculix"
Proper output in fem console looks like this: 20. Close fem console
21. Hide the part and unhide the macro generated mesh
22.Click the rainbow coloured icon to show the results. Select stress type/displacement etc.

The whole process is still not reliable if not started from scratch tower i.e. re-running calculix might not work, even reloading the file with already defined analysis might not allow to run calculix, but I found it very reliable if started from point 9 above.

Any feedback will be very appreciated - I might make a video or an installation script for CalculiX if there is any interest.
Attachments
FreeCAD_FEM_on_linux_2.png
FreeCAD_FEM_on_linux_2.png (208.97 KiB) Viewed 5449 times
FreeCAD_FEM_on_linux.png
FreeCAD_FEM_on_linux.png (212.89 KiB) Viewed 5449 times
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Making FEM run on linux fedora 21

Post by bernd »

PrzemoF wrote: ... The whole process is still not reliable if not started from scratch tower i.e. re-running calculix might not work, even reloading the file with already defined analysis might not allow to run calculix, but I found it very reliable if started from point 9 above....
Would you post your problems. I have been able to reload files, change force objects, fixed objects force values and so on without any problems.
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Making FEM run on linux fedora 21

Post by PrzemoF »

OK, I'll try to track them down.
1. Removing non-existing constaraint always crashes FreeCAD. Try to right click on empty constraint list and selecd "Delete". The problem can be caught here:

https://github.com/FreeCAD/FreeCAD_sf_m ... d.cpp#L167

row is -1, yet delete goes on and crashes. The same is in ConstraintForce and Bearing.

2. Selecting Material i.e. ABS sets Young modulus to 2.32e+03 MPa.After clicking OK and double clicking to edit material again the modulus is 2,000 kPa (2.00e+03 MPa) and the drop down list shows again "Choose material" - I'm not sure which value is used for calculations.

3. "Edit CalculiX input file" does nothing on fedora (probably works on ubuntu). Underlying python code uses

Code: Select all

webbrowser.open(self.Basename + '.inp')
I think there should be a fallback mechanism with xdg-open, $EDITOR environment variable, simple opening gedit/nano or opening directory containing the input file with file manager. I couldn't find anything that works on all platforms and is simple to code.
https://github.com/FreeCAD/FreeCAD_sf_m ... is.py#L527
4. Double click on a constraint opens edit window. The constraint can be deleted (right click - delete), but if it was the last constraint there is no way to confirm delete - FreeCAD shows "You must specify at least on reference". Removing a last constraint from combo view works OK.

Not easily replicable problems:
1. Once in a while "Run Calculix" does nothing. FEM console shows:

Code: Select all

0.0: Check dependencies...
0.0: /tmp/FreeCAD_Doc_d204390e-28d6-4a65-87f7-60fbb8bc4402_fb47cd_3573/FemAnl_0b66/Chamfer021_Mesh
0.0: Write mesh...
0.0: Write loads & Co...
0.0: ccx
0.0: Run Calculix...
Terminal shows:

Code: Select all

X Error: BadCursor (invalid Cursor parameter) 6
  Major opcode: 2 (X_ChangeWindowAttributes)
  Resource id:  0x3
X Error: BadCursor (invalid Cursor parameter) 6
  Major opcode: 2 (X_ChangeWindowAttributes)
  Resource id:  0x3
X Error: BadCursor (invalid Cursor parameter) 6
  Major opcode: 2 (X_ChangeWindowAttributes)
  Resource id:  0x3
X Error: BadCursor (invalid Cursor parameter) 6
  Major opcode: 95 (X_FreeCursor)
  Resource id:  0x3
Re running Calculix helps, but it generates empty results. An example here (too big for forum):
http://firszt.eu/FreeCAD/occ_base_empty.fcstd
I successfully calculated that model on a fresh FreeCAD start.
2. Temporary directory in /tmp/FreeCAD_Doc_*/Fem* was created with no search/execute attribute, so navigating to it to see the input file was impossible without changing the attribute however it seems to be OK now - I'll be watching it. I think it's related to read only attribute here:
https://github.com/FreeCAD/FreeCAD_sf_m ... t.cpp#L674

Please let me know if you need more details.
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Making FEM run on linux fedora 21

Post by PrzemoF »

If you're working on the FEM code there are two typos:
$ git grep "Van Mises" (should be Von Mises)
src/Mod/Fem/MechanicalAnalysis.py: self.form.comboBox_Type.addItem("Sabs (Van Mises Stress)")
fedora-lan:/home/przemo/fedora/FreeCAD/freecad
$ git grep machanical
src/Mod/Fem/MechanicalAnalysis.py: 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_JobControl","Dialog to start the calculation of the machanical anlysis")}
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Making FEM run on linux fedora 21

Post by bernd »

Wow this is a lot of stuff ...

May be some informations. Fem has been laying around for years.Especially the gui needs some love. A few weeks ago I started to fix the most critical stuff in the interface to CalculiX to get to the point we are just now. It's possible to run a calculation. My knowledge is not much more than yours.

See viewtopic.php?f=18&t=10144&p=82001#p82001 for your points 1. and 3.
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Making FEM run on linux fedora 21

Post by PrzemoF »

I have a solution for the cursor error and I know why there is a problem with reading calculix results (string replace for \n --> <br> in standard output read from QProcess sometimes silently crashes), but I don't have a solution yet. I also have patches for the typos, so please ignore it for now - I'll send a pull request when I have it all ready.

P.S. bernd, I thought you're the maintaner of FEM wb :-)
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Making FEM run on linux fedora 21

Post by bernd »

PrzemoF wrote:I have a solution for the cursor error and I know why there is a problem with reading calculix results (string replace for \n --> <br> in standard output read from QProcess sometimes silently crashes), but I don't have a solution yet. I also have patches for the typos, so please ignore it for now - I'll send a pull request when I have it all ready.
Cool!
PrzemoF wrote:P.S. bernd, I thought you're the maintaner of FEM wb :-)
AFAIK most of the Fem module was written by Juergen Riegel the founder of FreeCAD but he has stoped development of FemWB around 2 years ago due to get the Assembly Brunch ready to use.
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Making FEM run on linux fedora 21

Post by PrzemoF »

OK, so we can take over FEM ;)

I just confirmed the access rights problem:

Code: Select all

$ LC_ALL=C ls -l
total 0
drw-------. 2 przemo przemo 140 Mar 19 19:37 FemAnl_0b66
fedora-lan:/tmp/FreeCAD_Doc_d204390e-28d6-4a65-87f7-60fbb8bc4402_79b7e4_6369
$ LC_ALL=C cd FemAnl_0b66/
bash: cd: FemAnl_0b66/: Permission denied
fedora-lan:/tmp/FreeCAD_Doc_d204390e-28d6-4a65-87f7-60fbb8bc4402_79b7e4_6369
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Making FEM run on linux fedora 21

Post by bernd »

@Przemo: Is cgx running on your fedora 21 as well ?
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Making FEM run on linux fedora 21

Post by PrzemoF »

As an independent from FreeCAD software - yes. But I'm using pre-compiled binary. I had a plan to setup ccx/cgx repository on github and convert it to autotools to make compilation accessible to normal people, but more important things took over.

That's how it looks: http://firszt.eu/FreeCAD/cgx_animation.webm
Post Reply