Compiling FreeCAD for FEM in Mac OS

I always like to take the latest FreeCAD version to check out new features that are coming along.

Since I use a Mac operating system things aren’t the same as using a Windows or Linux system.

Some software is useful to have already installed to help in the compiling process:

Latest python, Xcode and homebrew should be installed.

Then in a terminal window type:

brew tap homebrew/science
brew tap freecad/freecad
brew install eigen
brew install --only-dependencies freecad --with-packaging-utils

(Repeat again the same instruction it seems that not everything is installed at first run)

brew install --only-dependencies freecad --with-packaging-utils
brew install gmsh --with-opencascade
Brew install netgen
brew install homebrew/science/nglib --with-opencascade

Dependencies X-Code:

xcode-select --install

After setting up all the necessary content it’s time to compile!

The source and build folders are created side-by-side under username. This will change from system to system (it’s your home folder name)

Create a folder named FreeCAD

mkdir ~/FreeCAD
cd ~/FreeCAD

You will get the following folder configuration:

/Users/username/FreeCAD

The following command will clone the FreeCAD git repository into a directory called FreeCAD-git.

git clone https://github.com/FreeCAD/FreeCAD FreeCAD-git

Go back

cd ..

Create the build folder.

mkdir ~/FreeCAD/build
cd build

Now we need to configure (this part can change with time depending of path locations and versions):

cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_QT5=1 \
-DCMAKE_PREFIX_PATH="/usr/local/Cellar/qt@5.6/5.6.2/lib/cmake" \
-DFREECAD_USE_EXTERNAL_KDL=1 \
-DBUILD_FEM_NETGEN=1 \
-DFREECAD_CREATE_MAC_APP=1 \
-DCMAKE_INSTALL_PREFIX="./.." \
-OCC_INCLUDE_DIR="/usr/local/Cellar/opencascade/7.1.0_1/include/opencascade/" \
../FreeCAD-git/

Compiling: use -j and a number (for 4 cores I use 4 + 1)

make -j5 install

Playing a bit with the results in the Brompton bike handlebar case

On my previous post I got to discover that the new design for the 2017 Brompton bike model is much more robust. Didn’t get to understand if it was designed on purpose or was a technical difficulty. My hunch was that they enjoyed the design and it made construction simple. However with experience they concluded that it was a problematic design and went for a new design. They could have just reduced the central bar length but instead almost removed it to a more challenging design at least for manufacturing.

Bent and unbent version
Bent and unbent version

FreeCAD produces nice images and this one is an undeformed vs deformed shape. Here I think it is visible that near the stem is where most of the stresses will be generated. So if you have a handlebar from a bellow 2017 model take special care to not pressure in an exaggerated manner the handlebar down.

Special thanks: I would like to thank the FreeCAD forum team and in particular Bernd for providing troubleshooting for FreeCAD  and showing how to do the deformed and undeformed image.

The Brompton Handlebar Case II

While browsing the Internet I found some past references to Brompton Handlebar cracks near the bending elbows. I noticed my colleague Brompton had a different design and thus concluded that probably the Brompton bike team, decided to turn the  handlebar more robust.

Brompton handlebar
Brompton handlebar

Check out my previous post to know what I am talking about. Click here

I notice that I make some force to the ground direction when pedalling and curving, special when the road has bumps.

HandleBar model constraints
HandleBar model constraints

In wich elbow will the stress higher and the cracks be formed? I will be continuing on this subject, so please stay tuned.

So what’s out there again?

I always get confused with the quantity of file types there are. FreeCAD, Salome, Code_Aster, Salome Meca, Calculix, Elmer, Gmsh, NetGen, ParaView, Python, OpenFOAM, … So how can one understand how each of these work and connect to each other?

We divide the file types in 5 categories:
• Geometry
• Mesh / Model
• Boundary Conditions + Model
• Solver
• Solution

Since these softwares can do a mixture of these 5 elements it’s not that easy to keep up with so many software and so many interconnections.

• Gemetry
○ FreeCAD
○ Salome
○ Salome Meca
○ Gmsh
○ Elmer

• Mesh/Model
○ Salome
○ Salome Meca
○ Gmsh
○ NetGen
○ Elmer

• Boundary Conditions
○ FreeCAD
○ Salome-Meca
○ Gmsh
○ Elmer

• Solver
○ Code_Aster
○ Calculix
○ OpenFOAM
○ Elmer

• Solution
○ FreeCAD
○ Salome
○ Salome Meca
○ ParaViewer
○ Elmer

FreeCAD 0.17 another good step forward

The new FreeCad version that will be out, will introduce quite a few big improvements on many areas, however I will be focusing on the FEM toolbar since this version has a great number of changes. Still I have to comment that when we now go to the Part design drop down menu I saw something which made me happy. I got a strange feeling that I was working with CREO or Unigraphics where we see the base planes and can start a sketch on any one of these. This little change is a huge step forward in making it easier to work with FreeCAD.

FreeCad 0.17 Geometry
FreeCad 0.17 Geometry
FreeCad 0.16 Geometry
FreeCad 0.16 Geometry

Going now to the FEM menu. What is different can you spot it?

FreeCad 0.17 FEM Toolbar
FreeCad 0.17 FEM Toolbar
FreeCad 0.16 FEM Toolbar
FreeCad 0.16 FEM Toolbar

More icons certainly are noticiable. Fluid dynamics seems to be integrated aswell as Non linear material behaviour (looks like strain hardening tangent method), part to part contact definition and thermal boundary conditions.
We can use two meshing applications just by clicking a button for NetGen or Gmsh.

FreeCad 0.17 Meshing Options
FreeCad 0.17 Meshing Options

The boundary conditions are easy to make just like before you select a specific entity and define it. This time around we get more types of boundaryconditions for structural, thermal and fluidic problems.

FreeCad 0.17 Boundary Conditions
FreeCad 0.17 Boundary Conditions

The NetGen mesh worked smoothly, got no issues.

FreeCad 0.17 NetGen Meshing
FreeCad 0.17 NetGen Meshing

The Gmsh mesh was also easy to use and generated a tet mesh with no issues.

FreeCad 0.17 Gmsh Meshing
FreeCad 0.17 Gmsh Meshing

There are more options to explore like mesh boundary layer which I haven’t tried it yet on this new version.

FreeCad 0.17 FEM mesh boundary layer
FreeCad 0.17 FEM mesh boundary layer

This version also boost result viewing with more result types and scoping zones.

FreeCAD 0.17 FEM Results
FreeCAD 0.17 FEM Results
FreeCad 0.17 Improved solution scoping
FreeCad 0.17 Improved solution scoping

Where to get freeCAD 0.17 with FEM? You can get binaries here:

https://github.com/FreeCAD/FreeCAD/releases/

And here more specifically here
https://github.com/FreeCAD/FreeCAD/releases/tag/0.17_pre

If you use a Ubuntu distribution I recomend adding a repository which makes everything som uch easyier!

Daily updated 0.17
https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-daily

The side leg shape seat

Previously I discussed two design approaches, a tilted leg design and a straight leg design. These designs were very so, much different. The tilted legs showed some harmony on the design and looks great, the straight legs log resistant but no so much beautiful.

Today I will analyse the side leg shape seat.

L shape seat
L shape seat

From all this approach looks more stressed. The problem is that the table is supported by two legs instead of four plus it is taking all the torsional stresses generated by the table and weight. In regards to the design it looks that it will fall apart and challenges hour notion of safety. From all the designs this will be the most demanding regarding the material strengths.

Side Legs Chair
Side Legs Chair

Using a steel shaft unibody to support the upper seat table. The seat table is where we sit on. In order to make this type of approach it’s very important to use a very resistant material that will not break, can flex and is light weight. Not any wood could be used for this design since it is heavily stressed compared to the other two alternatives.

 

 

Straight leg seat design for a bit of fun

Remembering when I was small, where i played countless hours with lego. Built many interesting constructions and tested the strength of many designs. That was a form of modeling the behaviour of a bridge, house or any structural  analysis that I could think of at that time. We all model things every day since we need to live in this world and figure out even if very basically the behaviour of objects. Think that when you hold an object you use the right force to hold it. Some how we know exactly the necessary configuration to execute physical task even without any though what so ever. When we look at a design and it challenges our notation that it will work it is because our underlaying protective system already is calculating and giving us feedback that it is dangerous to use. However this feeling can be wrong and the structure can be very safe, however most of the time our body is wright :).

I tested two designs on the simple table to understand what would happen.

Straight leg table
Straight leg table

This design present complete load transfer to the legs. The connection between table and leg is compress. Very little to none torsion is present. This design looks very stable, simple and is the classic, maybe the only simpler alternative is to use a solid cylinder instead, but that would make the seat very heavy. This design probably will hold as much as what the material used (wood, iron) can handle.

Table with tilted legs
Table with tilted legs

Comparing one design with another we can see that the behaviour to pressure  is completely different. The straight legs approach is stronger and would deal better with increased weight on top.

The table case and the open source quest

On a previous post http://numerica.pt/2017/07/31/chair-legs-and-ikea/ I introduced the table/chair dilemma, a thing I looked at on a  trip did,  I found a very nice table that I wondered if I could use it as a decorative seat (http://numerica.pt/2017/07/21/tilted-leg-table-curiosity/). I showed that there  are a big variety of leg supporting types (leg configuration) for seats and that this arrangement was just one of many.

4 Straight Leg Chair Design
4 Straight Leg Chair Design
Side Legs Chair
Side Legs Chair

My initial target design was as follows:

Tilted table
Tilted table

I modelled the behaviour of this table to understand possible weaknesses. The model was as simplified as possible. Also material properties used were very far from the real behaviour of my target subject.

Table with tilted legs
Table with tilted legs

The weight support on this design is concentrated on the center. However I can imagine if we lean forward the bulk of our weight shift to the front and produces a bending effect on the table this in turn will stress highly the leg to table connective zone since it has liberty to rotate in that direction. For this design the top location of the legs are more stressed due to their angled design.

My conclusions: To use this table as a seat the material used in the legs should be very strong specially to deal with the bending moment generated due to the tilted angle and centered position of the connection table to leg. The connection interface between legs and table is a critical interface for this design since it will have to deal with the torsional moment that we generate when we lean front, back, left and right.

Remarks: This analysis was performed with FreeCAD and images were retouched with imaging software like gimp. Although these open source tools don’t allow for major analysis we can still learn something. If I were to study this in detail, commercial software would be much easier and powerful to use and understand exactly what was going on with the design.

Open source or Proprietary software

Life could be so easy, we get an application install it and it works out of the box. Then we use it without reading the instructions and the end result is what we wanted. We save and use the work we produced with no compatibility issues and with the quality we envisioned. This is a perfect scenario.

Now a reality check:

  • Comercial packages (proprietary) can do what we wan’t them to do, they can have a easy install too. But there will always be compatibility issues with app A and B or we need to read the manual for something specific. And some other problems will appear in the way almost definitely.
  • But of course things can get even more dirty. Open source software either is super easy to install or super difficult, they can be super static and hard to change or very flexible.

To install these types of software it will depend mostly in what operating system you use and if it already has some binaries that you can double click and install, or if there is a repository with everything you need to have the selected program to work. And here comes the installation roller coster….  No repository for your linux distro, or the specific function isn’t compiled to your version yet, there is no binary file for your OS. These are examples to name a few. When you finally solve all the installation problems, then comes using the app you so passionately managed to install through some nights of hard work. Many open source projects are under active development and the user interface may seem unfinished and difficult to use and understand or although the application works it is cumbersome to use.

Not all is about pain, after the birth and maturation of specific open source softwares comes a stage where you see that everything is as it should have been from the beginning. Good examples are Gimp or Inkscape. You get them practically in any OS and relatively easy to install for most users. Open source software takes it’s time to develop and mature but in no way we can say that it is useless or serves only the need of the home user to play around with.

Many open source project when they reach maturity off good quality are very usable, being open source may not mean the software is free for comercial purposes so special careful should be taking when using for comercial purposes.

There is no good and bad but often open source software give me insight to what communities are building but require hands on effort to make everything work.  Commercial software are traditionally easier to use and well documented or no one will buy it and if they do buy it and it doesn’t work we complain about it.

Commercial companies like Ansys are starting to have entry level products for the starter companies to try and compete with competing software adoption. Until now I haven seen much competition from the open source communities since every one was happy in their niche, developing a solver, or a mesher but no or very bad integration. This fragmation and the lack of focus and mature hindered adoption.

A positive evolution from FreeCad that aggregates at least to projects Calculix and Netgen to create an integrated simulation environment as I described on a previous post.

A integrated approach will gain adoption and with it new users that will push interest in development and will motive community effort from individuals, universities, and others…

An also positive shift in FEM integration is CAD evolution from the traditional sketch/feature driven modelling to direct modelling. This is important since it breaks a big barrier in geometry design increasing adoption. (Google summer code project direct modelling for FreeCad)

Not all is just about freecad. A good project needs a good rival and my focus on the next weeks is in presenting you Salome.

Salome 2016
Salome 2016

Using LSPP as STEP viewer

I have talked previously about free CAD editors and one of the big winners was DesignSpark Mechanical 2, where FreeCad was close. These two software packages are very good but also very different. DS Mechanical 2 is a direct modeller and FreeCad isn’t (yet). Basically DS Mechanical 2 works like moulding clay where you push and pull surfaces. On the other hand FreeCad requires a sketch, dimensions defining the sketch, and everything is linked together through actions history. These are real editing softwares and require installation and are heavy…. But if you just want to see a STEP file or a IGES file?

You can use LSTC LSPP. It’s available in all the major flavours (including MAC).

Here is an example:

Clip Pins in LSPP
Clip Pins in LSPP