Manual:Creating FEM analyses/ru

FEM stands for Finite Element Method. It is a vast mathematical subject, but in FreeCAD we can resume it as a way to calculate propagations inside a 3D object, by cutting it into small pieces, and analyzing the impact of each small piece over its neighbours. This has several uses in the engineering and electomagnetism fields, but we will look here more in depth at one use that is already well developed in FreeCAD, which is simulating deformations in objects which are submitted to forces and weights.

Obtaining such simulation is done in FreeCAD with the FEM Workbench. It involves different steps: Preparing the geometry, setting its material, performing the meshing, division into smaller parts, like we did in the Preparing objects for 3D printing chapter, and finally calculating the simulation.



Preparing FreeCAD
The simulation itself is done by another piece of software, that is used by FreeCAD to obtain the results. As there are several interesting open-source FEM simulation applications available, the FEM Workbench has been made to be able to use more than one. However, currently only CalculiX is fully implemented. Another piece of software, called NetGen, which is responsible for generating the subdivision mesh, is also required. Detailed instructions to install these two components are provided in the FreeCAD documentation.

Preparing the geometry
We will start with the house we modelled in the BIM modeling chapter. However, some changes have to be made to make the model suitable for FEM calculations. This involves, basically, discarding the objects that we don't want to include in the calculaiton, such as the door and window, and joining all the remaining objects into one.


 * Load the house model we modeled earlier
 * Delete or hide the page object, the section planes and the dimensions, so we stay only with our model
 * Hide the window, the door and the ground slab
 * Also hide the metal beams from the roof. Since they are very different objects from the rest of the house, we will simplify our calculation by not including it. Instead, we will consider that the roof slab is directly placed on top of the wall.
 * Now move the roof slab down so it rests on top of the wall: Edit the Rectangle object that we used as a base of the roof slab, and change it's Placement->Position->X value from 3.18m to 3.00m
 * Our model is now clean:




 * The FEM Workbench can currently calculate deformations on one single object only. Therefore, we need to join our two objects (the wall and the slab). Switch to the Part Workbench, select the two objects, and press the [[Image:Part_Fuse.png|16px]] Fuse. We now have obtained one fused object:



Creating the analysis

 * We are now ready to start a FEM analysis. Let's switch to the FEM Workbench
 * Select the fusion object
 * Press the [[Image:Fem_Analysis.png|16px]] New Analysis button
 * A new analysis will be created and a settings panels opened. Here you can define the meshing parameters to be used to produce the FEM mesh. The main setting to edit is the Max Size which defines the maximum size (in millimeters) of each piece of the mesh. For now, we can leave the default value of 1000:




 * After pressing OK and a few seconds of calculaiton, our FEM mesh is now ready:




 * We can now define the material to be applied to our mesh. This is important because depending on the material strength, our object will react differently to forces applied to it. Select the analysis object, and press the [[Image:Fem_MechanicalMaterial.png|16px]] New Material button.
 * A task panel will open to allow us to choose a material. In the Material drop-down list, choose the Concrete-generic material, and press OK.




 * We are now ready to apply forces. Let's start by specifying which faces are fixed into the ground and can therefore not move. Press the [[Image:Fem_ConstraintFixed.png|16px]] Constraint fixed button.
 * Click on the bottom face of our building and press OK. The bottom face is now indicated as unmovable:




 * We will now add a load on the top face, that could represente, for example, a massive weight being spread on the roof. For this we will use a pressure constraint. Press the [[Image:Fem_ConstraintPressure.png|16px]] Constraint pressure button.
 * Click the top face of the roof, set the pressure to 10MPa (the pressure is applied by square millimeter) and click the OK button. Our force is now applied:




 * We are now ready to start the calculation. Select the CalculiX object in the tree view, and press the [[Image:Fem_ControlSolver.png|32px]] Start Calculation button.
 * In the task panel that will open, click first the Write .inp file button to create the input file for CalculiX, then the Run CalculiX button. A few moments later, the calculation will be done:




 * We can now look at the results. Close the task panel, and see that a new Results object has been added to our analysis.
 * Double-click the Results object
 * Set the type of result that you want to see on the mesh, for example "absolute displacement", tick the show checkbox under Displacement, and move the slider next to it. You will be able to see the deformation growing as you apply more force:



The results displayed by the FEM workbench are of course currently not enough to perform real-life decisions about structures dimensionning and materials. However, they can already give precious information about how the forces flow through a structure, and which are the weak areas that will bear the more stress.

Downloads


 * The file created during this exercise: https://github.com/yorikvanhavre/FreeCAD-manual/blob/master/files/fem.FCStd

Read more


 * The FEM Workbench
 * Installing required FEM components
 * CalculiX
 * NetGen