Ubuntu Repository

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Ubuntu Repository

Postby NormandC » Sat Apr 11, 2015 4:07 pm

wmayer wrote:
Maybe I should not expect it working in the releases/FreeCAD-0-15 branch? You guys have made a lot of changes to the FEM wb since then.
I don't know what you have changed but according to the commit link above the fix is pretty simple. Before running the ccx executable I save the current working directory (cwd) in a class variable "self.ccx" and then set it to the home directory. There the user should have write permission so that ccx shouldn't crash any more. As soon as ccx has finished I restore the old cwd.
sgrogan wrote:The error at the bottom of your code tag relates to the horizontal scroll bar. This was changed after 0.15.4761, it was vertical scroll bar in 0.15.4671. It looks like when you applied the patch it picked up some (but not all) code from a later commit.
I only patched git commit e18796e to the releases/FreeCAD-0-15 branch. And the patch was not applied directly to the source, but done at building so the source was not changed in any way.

But was there more changes to src/Mod/Fem/MechanicalAnalysis.py between the last commit in the releases/FreeCAD-0-15 branch (git commit 244b3ae) and the e18796e commit? If so that could explain the error.
User avatar
sgrogan
Posts: 6166
Joined: Wed Oct 22, 2014 5:02 pm

Re: Ubuntu Repository

Postby sgrogan » Sat Apr 11, 2015 4:11 pm

NormandC wrote: But was there more changes to src/Mod/Fem/MechanicalAnalysis.py between the last commit in the releases/FreeCAD-0-15 branch (git commit 244b3ae) and the e18796e commit? If so that could explain the error.
Yes, see this pull request that was merged after 0.15.4671
viewtopic.php?f=27&t=10439
Specifically
FEM: replace vertical factor scroll bar with a (sic)horizonal one
and
src/Mod/Fem/MechanicalAnalysis.py | 241 +++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------
"fight the good fight"
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Ubuntu Repository

Postby NormandC » Sat Apr 11, 2015 4:29 pm

Aw crap. So I need to cherry-pick the changes in the commit to only the change to fix the directory where the calculix file is saved.

Honestly since I have near no understanding of python I don't trust myself to do that. :?
User avatar
sgrogan
Posts: 6166
Joined: Wed Oct 22, 2014 5:02 pm

Re: Ubuntu Repository

Postby sgrogan » Sat Apr 11, 2015 4:35 pm

NormandC wrote:Aw crap. So I need to cherry-pick the changes in the commit to only the change to fix the directory where the calculix file is saved.

Honestly since I have near no understanding of python I don't trust myself to do that. :?
Neither do I, but hopefully one of the git guru's will see this as a "teaching opportunity" for the git literate amongst us :geek: .
"fight the good fight"
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Ubuntu Repository

Postby NormandC » Sun Apr 12, 2015 7:06 am

OK, reading Werner's reply more carefully this time I think I patched the MechanicalAnalysis.py file properly.

Basically I'm patching the file in the releases/FreeCAD-0-15 branch for the 0.15.4671 package: https://sourceforge.net/p/free-cad/code ... nalysis.py
(or in master https://github.com/FreeCAD/FreeCAD_sf_m ... nalysis.py)

I'm quite proud of my ability to fake it when I have no idea what I'm doing! :D

Code: Select all

--- freecad-0.15.4671.orig/src/Mod/Fem/MechanicalAnalysis.py	2015-04-05 13:25:02.000000000 -0400
+++ freecad-0.15.4671/src/Mod/Fem/MechanicalAnalysis.py	2015-04-12 01:11:23.474619000 -0400
@@ -270,6 +270,10 @@
     def calculixFinished(self,exitCode):
         print "calculixFinished()",exitCode
         print self.Calculix.state()
+
+        # Restore previous cwd
+        QtCore.QDir.setCurrent(self.cwd)
+
         out = self.Calculix.readAllStandardOutput()
         print out
         if out:
@@ -534,8 +538,11 @@
         self.femConsoleMessage(self.CalculixBinary)
         self.femConsoleMessage("Run Calculix...")
 
-        # run Claculix
-        print 'run Calclulix at: ', self.CalculixBinary , '  with: ', self.Basename
+        # run Calculix
+        print 'run Calculix at: ', self.CalculixBinary , '  with: ', self.Basename
+        # change cwd because ccx may crash if directory has no write permission
+        self.cwd = QtCore.QDir.currentPath()
+        QtCore.QDir.setCurrent(QtCore.QDir.homePath())
         self.Calculix.start(self.CalculixBinary, ['-i',self.Basename])
I got no more error following Bernd's mini-tutorial...

But when I execute "Show result", I do not get any red arrows. How do you get them?
Attachments
FC_FEM_sample01-cantilever-01.png
FC_FEM_sample01-cantilever-01.png (105.05 KiB) Viewed 1888 times
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Ubuntu Repository

Postby NormandC » Sun Apr 12, 2015 7:13 am

By the way Werner, I found a neat trick to speed up debian package building by using multiple processes. When I tested building a local binary package of oce-0.17, I noticed it used all my 4 cores. So I had a look at the debian/rules file I copied from the debian-science oce git repo:

Code: Select all

ifeq ($(findstring parallel=,$(DEB_BUILD_OPTIONS)),)
	export DEB_BUILD_OPTIONS+=parallel=$(shell getconf _NPROCESSORS_ONLN)
endif
I added this code snippet just under the first line (on top of %:) of my own rules file and bam, debuild used my 4 cores and took about 12 minutes to build the packages instead of more than 40. :geek:
User avatar
bernd
Posts: 10997
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Ubuntu Repository

Postby bernd » Sun Apr 12, 2015 4:04 pm

Congratulations norm and sgrogan :)
NormandC wrote:...But when I execute "Show result", I do not get any red arrows. How do you get them?
The arrows are independent from geometry in mm. If the model is big there are thousands. We are working on a solution for such big geometry.In the example they are hided because of performance reasons. See FemConstraintFixed and FemConstraintForce in TreeView. They are grey. Just use space to make them visible and wait.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Ubuntu Repository

Postby NormandC » Sun Apr 12, 2015 5:32 pm

Thanks Bernd! I was toggling the visibility on/off without noticing the arrows because they were so small.

And thanks to everyone's help here, I certainly couldn't have succeeded alone on this.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Ubuntu Repository

Postby NormandC » Sun Apr 19, 2015 8:34 pm

Well, I'll be...

If I had searched Launchpad, I would have found someone else had already packaged calculix for Ubuntu!!! :roll:

https://launchpad.net/~cae-team/+archive/ubuntu/ppa
But their calculix package is copied from https://launchpad.net/~gabriel1984sibiu ... aplicatii3

They've named their package calculix-ccx. Wish I had though of that. I have half a mind of copying their package and deleting my own "ccx" one... If they could only update their package to the last version 2.8p2.
User avatar
sgrogan
Posts: 6166
Joined: Wed Oct 22, 2014 5:02 pm

Re: Ubuntu Repository

Postby sgrogan » Tue Apr 21, 2015 11:12 pm

NormandC wrote:I have half a mind of copying their package and deleting my own "ccx" one..
Would you mind waiting just a bit. Your build supports multi-threading (I just got it working reliably for me) I not sure if the others do. Could you suggest which to test? Are they exact copies? (Pardon my linux ignorance)

If they both support multi-threading, I don't know that you have to copy the build at all, we can point the user to their PPA (otherwise you may inherit it)

Thank You for expending the massive effort to make FEM more easily functional on Ubuntu!

BTW: The Win cygwin build bundled with 0.15 release is 2.6.x
"fight the good fight"