Difference between pages "Spreadsheet Workbench" and "Post-Processing of FEM Results with Paraview"

From FreeCAD Documentation
(Difference between pages)
Jump to navigation Jump to search
(Marked this version for translation)
 
 
Line 1: Line 1:
<languages/>
+
{{TutorialInfo
<translate>
+
|Topic= Post-Processing of FEM Results with ParaView
<!--T:76-->
+
|Level= Intermediate
{{Docnav
+
|Time= 120 minutes
|[[Sketcher Workbench|Sketcher Workbench]]
+
|Author=[http://www.freecadweb.org/wiki/index.php?title=User: HarryvL]
|[[Start Workbench|Start Workbench]]
+
|FCVersion=0.19
|IconL=Workbench_Sketcher.svg
+
|Files=[https://forum.freecadweb.org/download/file.php?id=103403 beam] and [https://forum.freecadweb.org/download/file.php?id=103557 wall] found in this [https://forum.freecadweb.org/viewtopic.php?f=18&t=37253&start=10#p367734 FC forum thread]
|IconR=Workbench_Start.svg
 
 
}}
 
}}
  
</translate>
+
== Introduction ==
[[Image:Workbench_Spreadsheet.svg|240px|center]]
 
<translate>
 
<!--T:79-->
 
{{Caption|align=center|The FreeCAD Spreadsheet Workbench Icon}}
 
  
== Introduction == <!--T:6-->
+
Some forum posts and tutorials use Paraview (PV) to review and analyse FreeCAD [[Image: Workbench_FEM.svg|24px]] [[FEM Workbench]] (FEMWB) results. This tutorial explains the basics of transferring data from FEMWB to PV and shows some of the options and settings for displaying data.
The [[Image:Workbench_Spreadsheet.svg|24px]] [[Spreadsheet Workbench|Spreadsheet Workbench]] allows you to create and edit spreadsheets, use data from the spreadsheet as parameters in a model, fill the spreadsheet with data retrieved from a model, perform calculations, and export the data to other spreadsheet applications such as LibreOffice or Microsoft Excel.
 
  
<!--T:51-->
+
==Prerequisites==
The Spreadsheet Workbench has been available since FreeCAD 0.15.
 
  
<!--T:16-->
+
* FreeCAD using a version that is compatible with the designated version of this Tutorial.
{{TOCright}}
+
* [https://www.paraview.org Paraview] downloaded directly from it's [https://www.paraview.org/download/ website] or your preferred package manager.
[[File:Spreadsheet_screenshot.jpg|800px]]
+
** This tutorial is based on version Paraview 5.8.0 for Windows, which was the most recent version at the time of writing the tutorial.
 +
* The FreeCAD files used for this tutorial available in [https://forum.freecadweb.org/viewtopic.php?f=18&t=37253&start=10#p367734 this] and [https://forum.freecadweb.org/viewtopic.php?f=18&t=37253&p=368315#p368315 this] FC forum thread.
  
== Cell Expressions == <!--T:53-->
+
== Data Transfer from FEMWB ==
  
<!--T:54-->
+
In FEMWB highlight the CCX_Results object. Next, use menu option {{MenuCommand|File > Export > FEM result VTK (*.vtk *.vtu)}} to export the VTK data.
A spreadsheet cell may contain arbitrary text or an expression.
 
Technically, expressions must start with an equals '=' sign.
 
However, the spreadsheet attempts to be intelligent;
 
if you enter what looks like an expression without the leading '=',
 
one will be added automatically.
 
  
<!--T:55-->
+
== Data Import in Paraview ==
Cell expressions may contain numbers, functions, references to other cells, and references to properties of the model
 
(But see [[#Current_Limitations|Current Limitations]] below).
 
Cells are referenced by their column (CAPITAL letter) and row (number).
 
A cell may also be referenced by its [[#alias_name|alias-name]] (below).
 
Example: B4 + A6
 
  
<!--T:63-->
 
References to objects in the model are explained under [[#References_To_CAD-Data|References to CAD-Data]] below.
 
Using spreadsheet cell values to define model properties are explained under [[#Spreadsheet_Data_in_Expressions|Spreadsheet Data in Expressions]] below.
 
For more specifics on how expressions are formed, see [[Expressions|Expressions]].
 
  
== Supported Functions == <!--T:17-->
+
The start-up screen shows an empty Pipeline Browser. This is where the imported VTK data objects and applied filter objects (for geometry or data) will be visible.
  
<!--T:64-->
+
[[File:PVPic1.png|500px]]
Standard trigonometric and other common mathematical functions as well as statistical aggregation functions are supported (see [[Expressions|Expressions]]).
 
  
== Interaction between Spreadsheets and the CAD Model == <!--T:65-->
 
  
<!--T:66-->
+
Use menu option {{MenuCommand|File > Open > *.vtk}} to open the VTK file that was generated with FEMWB
Data in the cells of a spreadsheet may be used in CAD model parameter expressions.
 
Thus, a spreadsheet may be used as the source for parameter values used throughout a model,
 
effectively gathering the values in one place. 
 
When values are changed in the spreadsheet, they are propagated throughout the model.
 
  
<!--T:67-->
+
[[File:PVPic2.png|500px]]
Similarly, properties from CAD model objects may be used in expressions in spreadsheet cells.
 
This allows use of object properties like volume or area in the spreadsheet.
 
If the name of an object in the CAD model is changed,
 
the change will automatically be propagated to any references in spreadsheet expressions using the name which was changed.  
 
  
<!--T:68-->
 
More than one spreadsheet may be used in a document;
 
spreadsheets may be given a user-assigned name (rename) like any other object.
 
  
<!--T:69-->
+
Press {{Button|Apply}} on the properties tab. This will show a top view (looking down along z-axis) of the geometry by default
FreeCAD checks for cyclic dependencies.  See [[Spreadsheet_Workbench#Current_Limitations|Current Limitations]].
 
  
=== Cell Properties === <!--T:21-->
+
[[File:PVPic3.png|400px]] ... [[File:PVPic0.png|550px]]
  
<!--T:22-->
 
The properties of a spreadsheet cell can be edited with a right-click on a cell. The following
 
dialog pops up:
 
  
<!--T:23-->
+
The gray geometry can be inspected by rotating the view. The left mouse button makes the geometry swivel, but unfortunately in a difficult-to-control way (compared to FreeCAD). To get a predictable rotation hold the {{KEY|X}}, {{KEY|Y}} or {{KEY|Z}} key while dragging the mouse with left mouse button pressed to rotate the model around the X, Y or Z axis, respectively
[[File:SpreadsheetCellPropDialog.png]]
 
  
<!--T:24-->
+
[[File:PVPic5.png|500px]]
As indicated by the tabs, the following properties can be changed:
 
  
<!--T:25-->
+
== Saving/Loading State ==
* Color: Text color and background color
 
* Alignment: Text horizontal and vertical alignment
 
* Style: Text style: bold, italic, underline
 
* Units: <span id="units_tab"></span>Display units for this cell.  Please read the [[Spreadsheet_Workbench#Units|Units]] section below.
 
* Alias: <span id="alias_name"></span>Define an alias-name for this cell. This alias-name can be used in cell formulas and also in general FreeCAD Expressions.
 
While one may use the row and column number in an expression to reference a cell,
 
best practice is to give the cell an alias-name and use that.
 
For example, if the data in cell B1 contained the length parameter for an object,
 
an alias name of "MyObject_Length" would allow the value to be referred to as "Spreadsheet.MyObject_Length"
 
instead of "Spreadsheet.B1". {{Version|0.16}}
 
  
=== References To CAD-Data === <!--T:19-->
+
Rather than saving data, Paraview stores the status (state) of the actions performed on the imported VTK object. Therefore, to save your work use menu option {{MenuCommand|File > Save State}}. '''NOTE''': there will be no warning when leaving Paraview to save the state and all work may be lost when exiting the program.
  
<!--T:20-->
+
To continue where you left off in the previous session use {{MenuCommand|File > Load State}}. This prompts the user to specify a VTK file, which means that the actions performed in the last session can also be applied to a new VTK file. In this way, data from different FEMWB analyses can be displayed in exactly the same way, without any additional effort.
As indicated above, one can reference data from the CAD model in spreadsheet expressions.
 
  
<!--T:70-->
+
== Visualise FEMWB Results ==
Computed expressions in spreadsheet cells start with an equals ('=') sign.
 
However, the spreadsheet entry mechanism attempts to be smart.
 
An expression may be entered without the leading '=';
 
if the string entered is a valid expression,
 
an '=' is automatically added when the final {{KEY|Enter}} is typed.
 
If the string entered is not a valid expression
 
(often the result of entering something with the wrong case, e.g. "MyCube.length" instead of "MyCube.Length"),
 
no leading '=' is added and it is treated as simply a text string.
 
  
<!--T:71-->
+
Paraview has many options and settings for displaying results. We will first have a look at displaying base import data on the original geometry and thereafter see how to apply filters to modify the geometry. Finally, we will use the calculator and integration filters to derive new results by combining base import data.
Note: The above behavior (auto insert of '=') has some unpleasant ramifications:
 
* If you want to keep a column of names corresponding to the [[#alias_name|alias-names]] in an adjacent column of values, you must enter the name in the label column ''before'' giving the cell in the value column its alias-name. Otherwise, when you enter the alias-name in the label column the spreadsheet will assume it is an expression and change it to "=<alias-name>"; and the displayed text will be the value from the <alias-name> cell.
 
* If you make an error when entering the name in the label column and wish to correct it, you cannot simply change it to the alias-name. Instead, you must first change the alias-name to something else, then fix the text name in the label column, then change the alias-name in the value column back to its original.
 
  
<!--T:72-->
+
== Base Data Displayed on Original Geometry ==
One way to side-step these issues is to prefix text labels corresponding to alias-names with a fixed string,
 
thereby making them different.  Note that "_" will not work, as it is converted to "=".  However, a blank, while invisible, will work.
 
  
<!--T:73-->
+
As the pipeline browser can contain several VTK objects and filter objects, first confirm that the right VTK object is highlighted in the pipeline browser. The selections and settings for displaying this VTK object can now be found on the properties tab. To make sure all settings are visible and aligned with this tutorial press the Advanced Settings button (the gear wheel icon on the below picture).  
The following table shows some examples assuming the model has a feature named "MyCube":
 
{|{{Prettytable}}
 
!CAD-Data
 
!Cell in Spreadsheet
 
!Result
 
|-
 
|Parametric Length of a Part-Workbench Cube
 
|=MyCube.Length
 
|Length with units mm
 
|-
 
|Volume of the Cube
 
|=MyCube.Shape.Volume
 
|Volume  in mm&sup3; without units
 
|-
 
|Type of the Cube-shape
 
|=MyCube.Shape.ShapeType
 
|String: Solid
 
|-
 
|Label of the Cube
 
|=MyCube.Label
 
|String: MyCube
 
|-
 
|x-coordinate of center of mass of the Cube
 
|=MyCube.Shape.CenterOfMass.x
 
|x-coordinate in mm without units
 
|}
 
  
=== Spreadsheet Data in Expressions === <!--T:37-->
+
[[File:PVPic6.png|400px]]
  
<!--T:38-->
 
The usage of spreadsheet data in other parts of FreeCAD requires a fully defined name. Because it is possible to have
 
more than one spreadsheet in a document, the spreadsheet name together with the cell name or alias is required.
 
The following pictures show the usage of an alias "number" from a spreadsheet "MySheet" in an expression
 
in the PartDesign Workbench.
 
  
<!--T:78-->
+
The first setting that we can change is the way data is presented on the geometry. This is done on the Representation drop down menu. For now we will only use the Surface or Wireframe option.  
[[File:Expression usage1.png]]
 
  
<!--T:39-->
+
[[File:PVPic7.png|400px]]
Typing an "M" shows a list of available names (above).  
 
The arrow-keys allow one to move down to "MySheet" and select it;
 
{{KEY|Enter}} will cause it to be completed in the expression.
 
You can also continue typing or click the entry with the mouse.
 
  
<!--T:40-->
 
[[File:Expression usage2.png]]
 
  
<!--T:41-->
+
So far no results are displayed. For this we need to change the Coloring option. The default is Solid Color, but the drop down menu shows all the scalar data that is available in the imported VTK file.
Typing an "n" now shows the list of available alias names in MySheet starting with "n" (above).
 
"number" can now be selected as described above.
 
Once a valid name with usable content is entered,  
 
the result field will show the calculated value; in this case, the length (below).
 
  
<!--T:42-->
+
[[File:PVPic8.png|400px]]
[[File:Expression usage3.png]]
 
  
<!--T:74-->
+
[[File:PVPic9.png|400px]]
Further typing, such as adding a "+" sign, will result in an expression which is no longer valid
 
which will be indicated.
 
Continuing to complete the expression can again result in a valid expression.
 
  
== Units == <!--T:26-->
 
  
<!--T:27-->
+
For the purpose of this tutorial we choose ReinforcementRatio_x, but it is easy to change to any data type.
The Spreadsheet has a notion of dimension (units) associated with cell values.
 
A number entered without an associated unit has no dimension.
 
The unit should be entered immediately following the number value, with no intervening space.
 
If a number has an associated unit, that unit will be used in all calculations.
 
For example, the multiplication of two lengths with the unit mm gives an area with the unit mm&sup2;.
 
  
<!--T:75-->
+
The RenderView window will now show an iso-plot of the selected data type and a Color Legend of the data range.
If a cell contains a value which represents a dimension, it should be entered with its associated unit.
 
While in many simple cases one can get by with a dimensionless value,
 
it is unwise to not enter the unit.
 
If a value representing a dimension is entered without its associated unit, there are some sequences of operations which cause  FreeCAD to complain of incompatible units in an expression when it appears the expression should be valid.
 
(This may be better understood by viewing [https://forum.freecadweb.org/viewtopic.php?f=3&t=34713&p=292455#p292438 this thread] in the FreeCAD forums.)
 
  
<!--T:28-->
+
[[File:PVPic10.png|700px]]
You can change the units displayed for a cell value using the properties dialog [[#units_tab|units tab]] (above).
 
This does not change the value contained in the cell; it only converts the existing value for display.
 
The value used for calculations does not change,
 
and the results of formulas using the value do not change.
 
For example, a cell containing the value "5.08cm" can be displayed as "2in" by changing the units tab value to "in".
 
  
<!--T:29-->
 
A dimensionless number cannot be changed to a number with a unit by the cell properties dialog.
 
One can put in a unit string, and that string will be displayed; but the cell still contains a dimensionless number.  In order to change a dimensionless value to a value with a dimension, the value itself must be re-entered with its associated unit.
 
  
<!--T:30-->
+
The Color Legend can be dragged around the screen to a more convenient location and will change orientation when nearing any of the windows edges.
Occasionally it may be desirable to get rid of a dimension in an expression. This can be done by multiplying by 1 with a reciprocal unit.
 
  
== Importing and exporting == <!--T:44-->
+
[[File:PVPic11.png|700px]]
  
<!--T:45-->
 
Sheets can be imported and exported to the [https://en.wikipedia.org/wiki/Comma-separated_values csv] format which can also be read and written by most other spreadsheet applications such as Microsoft Excel or LibreOffice Calc. When importing files into FreeCAD, the delimiter (the character that is used to separate columns) must be the TAB character (this can be set when exporting from other applications). The import of a CSV-file is available from the menu {{MenuCommand|Spreadsheet → Import Spreadsheet}} or by clicking on the icon [[Image:SpreadsheetImport.svg|24px]]. This import function does not open Excel files or any other spreadsheet format.
 
  
<!--T:46-->
+
Alternatively, the settings of the color legend can be controlled in great detail by opening the Edit Color Legend Properties dialogue (press last Icon to the right)
Spreadsheets in Excel-format "xlsx" can be imported via the menu {{MenuCommand|File → Import...}}. Excel-spreadsheets can also be opened by clicking in the menu {{MenuCommand|File → Open...}} or by clicking on the icon [[Image:Document-open.svg|24px]]. In these cases
 
a new document with a spreadsheet inside is created. The following features are supported:
 
  
<!--T:47-->
+
[[File:PVPic12.png|400px]]
* all functions that are also available in the FreeCAD spreadsheet. Other functions give an error in the corresponding cell after the import.
 
* Alias names for cells
 
* More than one "Sheet" in the Excel-spreadsheet. In this case one FreeCAD spreadsheet is created for each Excel sheet.
 
  
<!--T:48-->
+
[[File:PVPic13.png|400px]]
Other functionality is not imported into the FreeCAD spreadsheet. The Excel-import is {{Version|0.17}} of FreeCAD.
 
  
== Current Limitations == <!--T:31-->
 
  
<!--T:43-->
+
The coloring of the iso map can be controlled through the Color Map Editor, which is activated by pressing the Edit button:
FreeCAD checks for cyclic dependencies.
 
By design, that check stops at the level of the spreadsheet object.
 
As a consequence, you should not have a spreadsheet which contains both
 
cells whose values are used to specify parameters to the model,
 
and cells whose values use output from the model.
 
For example, you cannot have cells specifying the length, width, and height of an object,
 
and another cell which references the total volume of the resulting shape.
 
This restriction can be surmounted by having two spreadsheets:
 
one used as a data-source for input parameters to the model
 
and the other used for calculations based on resultant geometry-data.
 
  
<!--T:32-->
+
[[File:PVPic12.png|text-top|300px]]  . [[File:PVPic15.png|text-top|300px]]
When cells are copied, only the content (expression/value) is copied.
 
The [[Spreadsheet_Workbench#Cell_Properties|Cell Properties]] described above are not copied.
 
  
<!--T:13-->
 
For earlier versions see [[Spreadsheet_legacy|Spreadsheet legacy]].
 
  
== Scripting Basics== <!--T:50-->  
+
The setting for Color Discretization is useful to limit the number of iso values, thus creating more practical ranges for design. The default number of ranges is 256, but here the number is set at 10.
</translate>
+
 
{{Code|code=
+
[[File:PVPic16.png|700px]]
import Spreadsheet
+
 
sheet = App.ActiveDocument.addObject("Spreadsheet::Sheet")
+
== Applying Filters to FEMWB results ==
sheet.Label = "Dimensions"
+
 
}}
+
 
<translate>
+
To modify the base data or geometry imported from FEMWB, filters can be applied.
 +
 
 +
Here only the Slice and Warp filters will be discussed. Filters for creating compound results from base data will be discussed in the next section.
 +
 
 +
To apply the Slice filter, highlight the VTK object that needs to be sliced and press the Slice Icon. Alternatively, find the Slice filter in the menu Filters > Alphabetical. This adds the Slice filter object to the Pipeline Browser and the location in the tree shows that it is applied to the VTK object. The position in the tree matters, because filters can be applied to different VTK objects or even to other filter objects. The filter object cannot be dragged around in the tree to change the object it is applied to. The target object can only be changed through the menu (or by right-clicking) option Edit > Change Input.
 +
 
 +
[[File:PVPic17.png|700px]]
 +
 
 +
 
 +
The location and orientation of the slice can be modified by dragging the slice and its normal vector with the mouse or through the Properties tab. In the below figure the origin of the slice has been placed at the center of the beam (over the central support) and the normal to the plane points in the x-direction.
 +
 
 +
[[File:PVPic18.png|400px]]
 +
 
 +
 
 +
To get rid of the bounding boxes deselect the Show Plane box at the top of the Plane Parameters dialogue.
 +
 
 +
[[File:PVPic19.png|700px]]
 +
 
 +
 
 +
The Warp by Vector filter can be used to display the deformed geometry. Highlight the VTK object and press the Warp by Vector Icon. This adds the filter to the Pipeline Browser. Alternatively look for the filter in the menu Filters > Alphabetical. Next select Displacement in the Vectors drop-down menu of the Properties tab and set an appropriate scale factor. Don’t forget to press the Apply button after changing the settings.
 +
 
 +
[[File:PVPic20.png|text-top|400px]] . [[File:PVPic21.png|text-top|700px]]
 +
 
 +
 
 +
The maximum displacement value is 0.98 mm.
 +
 
 +
To show the deformed geometry superimposed on the undeformed geometry, simply make both the VTK object and Warp filter object visible by clicking the eye icon next to it. In the following picture the Representation setting for the VTK object was changed to Wireframe and the Opacity reduced to 0.5 to prevent it from obscuring the Deformed geometry.
 +
 
 +
[[File:PVPic22.png|700px]]
 +
 
 +
 
 +
'''NOTE''': As more objects are added to the Pipeline Browser and more display windows are open, it becomes increasingly important to ensure that the right object is selected in the Pipeline Browser and the right Window has focus when making changes to the Properties Tab. Otherwise much time can be spent on finding the right property or changes to properties may not seem to take effect.
 +
 
 +
== Applying Filters to Derive Compound Results from Base Import Data ==
 +
 
 +
 
 +
If we want to know the amount of reinforcement steel in the beam as a whole or the amount passing though a particular cross section we need to perform integration (summation over the geometry) of the base data.
 +
 
 +
For example, the total volume of reinforcement bars in the beam running in x-direction is obtained from the integral {{incode|INTEGRATE(ReinforcementRatio_x * dx * dy * dz)}} over the full geometry and the total area of reinforcement steel running though a particular beam cross section is obtained from {{incode|INTEGRATE(ReinforcementRatio_x * dy * dz)}} over a slice.
 +
 
 +
In Paraview, integration can be done with an Integration Filter. This filter can be applied to the entire VTK object (the beam) or to a Slice (the cross section).
 +
 
 +
NOTE: due to a mismatch of node ordering between FCFEM and PV, integration over a volume renders negative results, i.e. {{incode|INTEGRATE( 1.0 * dx * dy *dz)}} = - Volume instead of + Volume.
 +
 
 +
To calculate integrals we need to apply an Integration Filter, which can be found in the menu item Filters > Alphabetical. Highlight the VTK object and apply the filter.
 +
 
 +
[[File:PVPic23.png|700px]]
 +
 
 +
 
 +
Press the {{Button|Apply}} button in the Properties tab and the results will open in a separate window to the right of the Renderview.
 +
 
 +
[[File:PVPic24.png|700px]]
 +
 
 +
 
 +
Before we tidy this up to find the desired result, i.e. {{incode|INTEGRATE(ReinforcementRatio_x * dx * dy * dz)}}, lets first see how we can control where the window is placed and what it contains.
 +
 
 +
First close the SpreadSheetView window that has opened to the right. Then press the horizontal split icon on the Renderview window and a new window will open with a menu of display options. Before selecting an option, make sure the Integration filter object is highlighted in the Pipeline Browser.
 +
 
 +
[[File:PVPic25.png|700px]]
 +
 
 +
 
 +
To display numerical results we need to select SpreadSheet View at the bottom of the Create View list. This generates a spreadsheet of all available results in the VTK object integrated over the volume.
 +
 
 +
[[File:PVPic26.png|400px]]
 +
 
 +
 
 +
To inspect {{incode|INTEGRATE(ReinforcementRatio_x * dx * dy * dz)}} we could scroll to the right through the table, but we can also remove all unwanted results by deselecting them, i.e. deselect All Columns and select '''ReinforcementRatio_x'''.
 +
 
 +
[[File:PVPic27.png|text-top|300px]] . [[File:PVPic28.png|text-top|500px]]
 +
 
 +
 
 +
Now we are left with just one value in the table of integration results
 +
 
 +
[[File:PVPic29.png|300px]]
 +
 
 +
 
 +
As explained before this is the negative value of the integral we are looking for. So the indicative total volume of steel required in x direction is 2.27e+06 mm3 (= 2272 cm3) or 2272 cm3  * 7.6 g/cm3 = 17267 g (= 17.3 kg). In practice the number will be higher due to practical considerations (e.g. anchoring requirements, minimum reinforcement requirements, etc.). Nevertheless, this result can be used to compare conceptual designs
 +
 
 +
The above was an example of the integration of a variable directly exported by FEMWB. In some cases we may want to combine VTK variables to obtain new results. This can be done in several ways, but here I will only discuss the simplest, i.e. with the Calculator Filter.
 +
 
 +
For example, if we want to know the total reinforcement requirement in all three coordinate directions we would have to sum  ReinforcementRatio_x,  ReinforcementRatio_y and  ReinforcementRatio_z.
 +
 
 +
The Calculator filter can be found as an icon on the left of the filter bar or via the menu Filters > Alphabetical. The name for the resulting variable can be entered in field Result Array Name. Here we name the result Total_Reinforcement_Ratio. The formula can be composed in the box below the Result Array Name field. Input values can be selected from the Scalars drop down menu and they can be combined into a formula for the result using the operators given. After pressing the Apply button, the result will be available as a new variable in any subsequent operations (e.g. an Integration Filter) or views (e.g. RenderView or SpreadSheetView, see below).
 +
 
 +
[[File:PVPic30.png|700px]]
 +
 
 +
 
 +
For example, we can now apply the integration filter to the new variable Total Reinforcement Ratio
 +
 
 +
[[File:PVPic31.png|700px]]
 +
 
 +
 
 +
This shows how the total reinforcement requirement compares to that in the individual coordinate directions.
 +
 
 +
== Integration over a Slice ==
 +
 
 +
In the previous section we discussed the Integration filter and its application to the entire VTK object. To demonstrate integration over a slice we will in this section determine the total reinforcement requirement and its center of gravity for the central cross section of the beam. The end result is shown in the picture below. The interaction of various objects can be inspected in the Pipeline Browser. The slice filter is applied to the beam VTK object and two Calculator filters are applied to the slice filter to derive the new variables “Reinforcement_ratio_x * z” and “Reinforcement_ratio_x * y” from the base data. These variables need to be integrated to determine the center of gravity of the reinforcement. Finally, Integration filters are applied to each Calculator to integrate results over the Slice. Please refer to the previous section for a general introduction of the Integration filter and its settings.
 +
 +
[[File:PVPicSlice1.png|700px]]
 +
 
 +
 
 +
Apply the following Settings in the Properties tab for the VTK object:
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Properties Tab Settings
 +
! Comment
 +
|-
 +
| Representation: Wireframe
 +
| So the Slice is visible
 +
|-
 +
| Coloring: ReinforcementRatio_x
 +
| Or any other color
 +
|-
 +
| Styling > Line Width: 2
 +
| Or any other setting that gives a pleasing result
 +
|}
 +
 
 +
[[File:PVPicSlice2.png|400px]]
 +
 
 +
 
 +
Next highlight the VTK object and apply a Slice filter with the following settings on the Properties tab:
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Properties Tab Settings
 +
! Comment
 +
|-
 +
| Plane Parameters > Show Plane: deselect
 +
| Remove the bounding boxes
 +
|-
 +
| Plane Parameters > Origin: 4000 / 100 / 200
 +
| Position of central section
 +
|-
 +
| Plane Parameters > Normal: 1 /0 /0
 +
| Normal of Slice points in x -direction
 +
|-
 +
| Coloring: ReinforcementRatio_x
 +
| Optional
 +
|-
 +
| Styling > Line Width: 2
 +
| Or any other setting that gives a pleasing result
 +
|}
 +
 
 +
[[File:PVPicSlice3.png|400px]]
 +
 
 +
 
 +
'''Settings Calculator 1
 +
 
 +
Calculator 1 computes the new variable ReinforcementRatio_x * y which needs to be integrated to obtain the y-coordinate of the reinforcement’s center of gravity.
 +
 
 +
[[File:PVPicSlice4.png|400px]]
 +
 
 +
 
 +
After pressing Apply, a new variable named “ReinforcementRatio_x * y” is available for display or further processing.
 +
 
 +
 
 +
'''Settings Calculator 2
 +
 
 +
Calculator 2 computes the new variable ReinforcementRatio_x * z which needs to be integrated to obtain the z-coordinate of the reinforcement’s center of gravity.
 +
 
 +
[[File:PVPicSlice5.png|400px]]
 +
 
 +
 
 +
After pressing Apply, a new variable named “ReinforcementRatio_x * z” is available for display or further processing.
 +
 
 +
Finally, two Integration filters are applied, one on Calculator1 to integrate variable  ReinforcementRatio_x * y and on Calculator2 to integrate  ReinforcementRatio_x * z. Each are displayed in their own window with SpreadSheetView selected. The way to deselect all other results is explained earlier.
 +
 
 +
[[File:PVPicSlice6.png|600px]]
 +
 
 +
 
 +
Finally the Center of Gravity can be calculated from the above results as:
 +
 
 +
CoG_y = 55744.2 / 556.277 = 100.2 mm (exact value: 100 mm)
 +
 
 +
CoG_z = 187144 / 556.277 = 336.4 mm (exact value: 5/6 * 400 mm)
 +
 
 +
== Integration over a Line ==
 +
 
 +
To demonstrate visualisation and integration of results over a line we use the 2D example of a heavy wall as introduced in [https://forum.freecadweb.org/viewtopic.php?f=18&t=33049 this FC forum thread]. The FreeCAD file for this example can be downloaded in [https://forum.freecadweb.org/viewtopic.php?f=18&t=37253&start=10#p367734 this FC forum thread]. The challenge is to visualise reinforcement ratio across various vertical cross sections and to determine the required area of steel from integration of those results.
 +
 
 +
Techniques introduced in previous sections of this tutorial will not be repeated here. It is also important to note again that as more objects are added to the Pipeline Browser and more display windows are open, it becomes increasingly important to ensure that the right object is selected in the Pipeline Browser and the right Window has focus when making changes to the Properties Tab. Otherwise much time can be spent on finding the right property or changes to properties may not seem to take effect.
 +
 
 +
Starting with the VTK object imported from FEMWB we note that the PV controls operate slightly differently on a 2 dimensional object. The left mouse button drags the geometry and the middle mouse button rotates it. To position the geometry in the plane of analysis (i.e. x-y), press the icon that puts the view along the negative z axis:
 +
 
 +
 
 +
[[File:PVPicLine1.png|75px]]
 +
 
 +
 
 +
For the picture below the Coloring property on the Properties tab for the VTK object was set to ReinforcementRatio_x.
 +
 
 +
The only additional object required to visualise a variable along a straight line is a Plot Over Line filter. This can be activated from the icon bar or the menu option Filters > Alphabetical.
 +
 
 +
We next want to display the horizontal reinforcement requirements in the vertical cross section under the column. To achieve this in the way shown below, the following settings need to be changed in the Properties tab of the Plot Over Line filter (make sure the LineChartView window and the Plot Over Line object both have the focus)
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Properties Tab Settings
 +
! Comment
 +
|-
 +
| Line Parameters > Point 1: 4000 / 0 / 0
 +
| Point at bottom of wall under the column
 +
|-
 +
| Line Parameters > Point 2: 4000 / 4000 / 0
 +
| Point at top of wall under the column
 +
|-
 +
| x Axis Parameters > x Array Name: ReinforcementRatio_x
 +
| Displays ReinforcementRatio_x on the horizontal axis
 +
|-
 +
| Series Parameters: tick “arc length” only
 +
| This is the length parameter along the line
 +
|-
 +
| Title > Chart Title: Mid Section
 +
|
 +
|-
 +
| Annotation > Show Legend: deselect
 +
| Meaningless for the current choice of vertical axis
 +
|-
 +
| Left Axis > Left Axis Title: Height Across Beam
 +
|
 +
|-
 +
| Left Axis Range > Use Custom Range: deselect
 +
| Deselect to maximise the data range along the axis
 +
|-
 +
| Bottom Axis > Bottom Axis Title: Reinforcement Ratio in x-Direction
 +
|
 +
|-
 +
| Bottom Axis Range > Use Custom Range: deselect
 +
| Deselect to maximise the data range along the axis
 +
|}
 +
 
 +
[[File:PVPicLine2.png|700px]]
 +
 +
 
 +
Note that the distance along the line (arc length) is usually on the horizontal axis and the variable that we want to display (here ReinforcementRatio_x) on the vertical axis. However, as the wall section in this example is vertical and we want to see the reinforcement requirement over the height of the wall, it is more natural to inverse the axes. This, however, comes at the expense of a lot more changes to the settings in the Properties tab for the Plot Over Line filter.
 +
 
 +
 
 +
In the next two picture only the location of the line was changed. Note however that this relocation will automatically change the Left Axis Range > Use Custom Range setting to “select”. This may mean that the graph does not properly fit in the LineChartView window. It is therefore necessary to deselect this option every time the position of the line is changed. Other settings are as per the above table.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Properties Tab Settings
 +
! Comment
 +
|-
 +
| Line Parameters > Point 1: 6700 / 0 / 0
 +
| Point at bottom of wall under left side of cut-out
 +
|-
 +
| Line Parameters > Point 2: 6700 / 4000 / 0
 +
| Point at top of wall above left side of cut-out
 +
|-
 +
| Title > Chart Title: Section left of Cut-out
 +
|
 +
|-
 +
| Left Axis Range > Use Custom Range: deselect
 +
| Deselect to maximise the data range along the axis
 +
|-
 +
| Bottom Axis Range > Use Custom Range: deselect
 +
| Deselect to maximise the data range along the axis
 +
|}
 +
 
 +
[[File:PVPicLine3.png|700px]]
 +
 
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Properties Tab Settings
 +
! Comment
 +
|-
 +
| Line Parameters > Point 1: 10950 / 0 / 0
 +
| Point at bottom of wall at right-hand support
 +
|-
 +
| Line Parameters > Point 2: 10950 / 4000 / 0
 +
| Point at top of wall at right-hand support
 +
|-
 +
| Title > Chart Title: Section at Support
 +
|
 +
|-
 +
| Left Axis Range > Use Custom Range: deselect
 +
| Deselect to maximise the data range along the axis
 +
|-
 +
| Bottom Axis Range > Use Custom Range: deselect
 +
| Deselect to maximise the data range along the axis
 +
|}
 +
 
 +
[[File:PVPicLine4.png|700px]]
 +
 
 +
 
 +
The total horizontal reinforcement requirement in the last cross section can now simply be obtained by applying an Integration filter to the Plot Over Line object, i.e. highlight the Plot Over Line object in the Pipeline Browser and add an Integration filter from the menu option Filters > Alphabetical.
 +
 
 +
[[File:PVPicLine5.png|700px]]
 +
 
 +
 
 +
In the usual way deselect all but the ReinforcementRatio_x result in the SpreadSheetView and read off the result as 23.11 mm2 / mm. To obtain the total cross sectional area of steel, we still need to multiply with the thickness of the wall, which in this example is (an impressive) 600 mm. So the total cross sectional area of steel running through the cross section near the right hand support is 23.11 * 600 = 13866 mm2 = 139 cm2
 +
 
 +
To achieve a more practical distribution of reinforcement we could integrate the above graph in parts. For example, if we want to know the required cross sectional area of steel in the top 400mm of the wall then we should adjust the properties of the Plot Over Line object as follows
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Properties Tab Settings
 +
! Comment
 +
|-
 +
| Line Parameters > Point 1: 10950 / 3600 / 0
 +
| Point near top of wall at right-hand support
 +
|-
 +
| Line Parameters > Point 2: 10950 / 4000 / 0
 +
| Point at top of wall at right-hand support
 +
|-
 +
| Left Axis Range > Use Custom Range: deselect
 +
| Deselect to maximise the data range along the axis
 +
|-
 +
| Bottom Axis Range > Use Custom Range: deselect
 +
| Deselect to maximise the data range along the axis
 +
|}
 +
 
 +
This yields the following result
 +
 
 +
[[File:PVPicLine6.png|700px]]
 +
 
 +
 
 +
The result for the top 400 mm of the wall is thus 8.436 mm2 / mm. So the top 10% of the wall requires 8.44 / 23.11 * 100% = 37% of the reinforcement steel.
 +
 
 +
This procedure could be repeated to divide the wall in zones of constant reinforcement.
 +
 
 +
== Representation of Vector Results with the Glyph 3D Filter ==
 +
 
 +
 
 +
So far we have only dealt with Scalar values, like reinforcement ratio and displacement magnitude. Visualization of vector results, like Principal Stress vectors, is done with Glyphs.
 +
 
 +
Let’s return to the VTK data object for the beam with central support and visualize maximum and minimum principal stress vectors.
 +
 
 +
Highlight the VTK data object in the Pipeline Browser and select the Glyph Filter from the Filter Icon bar or from the menu option Filter > Alphabetical. Then apply the following settings in the Properties tab of the Glyph Filter object (see table and picture):
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Properties Tab Settings
 +
! Comment
 +
|-
 +
| Glyph Source > Glyph Type: Line
 +
| Unfortunately there is no option for a double sided arrow
 +
|-
 +
| Orientation > Orientation: Major Principal Stress
 +
| The Glyph takes the principal stress direction
 +
|-
 +
| Scale > Scale Array: Major Principal Stress
 +
| The length of the line will represent the magnitude of the principal stress
 +
|-
 +
| Scale > Vector Scale Mode: Scale by Magnitude
 +
|
 +
|-
 +
| Scale > Scale Factor: 100
 +
| Or any other setting that gives a pleasing result
 +
|-
 +
| Masking > Glyph Mode: All Points
 +
| To make sure the stress in every node is displayed
 +
|-
 +
| Coloring > Solid Color
 +
| A single color gives greatest clarity of “stress flow”
 +
|-
 +
| Coloring > Edit > Green
 +
| Or any other setting that gives a pleasing result
 +
|-
 +
| Styling > Line Width > 2
 +
| Or any other setting that gives a pleasing result
 +
|}
 +
 
 +
 
 +
[[File:PVPic32.png|text-top|400px]]; [[File:PVPic33.png|text-top|400px]]
 +
 
 +
 
 +
If all goes well you should see the following result for the example file.
 +
 
 +
[[File:PVPic34.png|700px]]
 +
 
 +
 
 +
Next add another Glyph Filter with the following settings for the Minor Principal Stress (don’t forget to first highlight the VTK data object in the Pipeline Browser):
  
<!--T:14-->
+
{| class="wikitable"
{{Docnav
+
|-
|[[Sketcher Workbench|Sketcher Workbench]]
+
! Properties Tab Settings
|[[Start Workbench|Start Workbench]]
+
! Comment
|IconL=Workbench_Sketcher.svg
+
|-
|IconR=Workbench_Start.svg
+
| Glyph Source > Glyph Type: Line
}}
+
| Unfortunately there is no option for a double sided arrow
 +
|-
 +
| Orientation > Orientation: Minor Principal Stress
 +
| The Glyph takes the principal stress direction
 +
|-
 +
| Scale > Scale Array: Minor Principal Stress
 +
| The length of the line will represent the magnitude of the principal stress
 +
|-
 +
| Scale > Vector Scale Mode: Scale by Magnitude
 +
|
 +
|-
 +
| Scale > Scale Factor: 100
 +
| Or any other setting that gives a pleasing result
 +
|-
 +
| Masking > Glyph Mode: All Points
 +
| To make sure the stress in every node is displayed
 +
|-
 +
| Coloring > Solid Color
 +
| A single color gives greatest clarity of “stress flow”
 +
|-
 +
| Coloring > Edit > Red
 +
| Or any other setting that gives a pleasing result
 +
|-
 +
| Styling > Line Width > 2
 +
| Or any other setting that gives a pleasing result
 +
|}
  
<!--T:77-->
+
[[File:PVPic35.png|700px]]
{{Userdocnavi}}
 
  
<!--T:80-->
+
The final result shows the major and minor principal stress vectors superimposed on the beam with ReinforcementRatio_x.
[[Category:Spreadsheet]]
 
  
<!--T:81-->
+
== Export of Graphical Results ==
[[Category:Workbenches]]
 
  
 +
To export a RenderView window highlight the window and use menu option {{MenuCommand|File > Save Screenshot}}
  
</translate>
+
{{FEM Tools navi}}
 +
{{Userdocnavi}} <!-- Should be at the end of the file. Adds page to the User Documentation category and a nav bar. -->

Revision as of 07:55, 17 February 2020

Base ExampleCommandModel.png Tutorial
Topic
Post-Processing of FEM Results with ParaView
Level
Intermediate
Time to complete
120 minutes
Authors
HarryvL
FreeCAD version
0.19
Example files
beam and wall found in this FC forum thread


Introduction

Some forum posts and tutorials use Paraview (PV) to review and analyse FreeCAD Workbench FEM.svg FEM Workbench (FEMWB) results. This tutorial explains the basics of transferring data from FEMWB to PV and shows some of the options and settings for displaying data.

Prerequisites

  • FreeCAD using a version that is compatible with the designated version of this Tutorial.
  • Paraview downloaded directly from it's website or your preferred package manager.
    • This tutorial is based on version Paraview 5.8.0 for Windows, which was the most recent version at the time of writing the tutorial.
  • The FreeCAD files used for this tutorial available in this and this FC forum thread.

Data Transfer from FEMWB

In FEMWB highlight the CCX_Results object. Next, use menu option File > Export > FEM result VTK (*.vtk *.vtu) to export the VTK data.

Data Import in Paraview

The start-up screen shows an empty Pipeline Browser. This is where the imported VTK data objects and applied filter objects (for geometry or data) will be visible.

PVPic1.png


Use menu option File > Open > *.vtk to open the VTK file that was generated with FEMWB

PVPic2.png


Press Apply on the properties tab. This will show a top view (looking down along z-axis) of the geometry by default

PVPic3.png ... PVPic0.png


The gray geometry can be inspected by rotating the view. The left mouse button makes the geometry swivel, but unfortunately in a difficult-to-control way (compared to FreeCAD). To get a predictable rotation hold the X, Y or Z key while dragging the mouse with left mouse button pressed to rotate the model around the X, Y or Z axis, respectively

PVPic5.png

Saving/Loading State

Rather than saving data, Paraview stores the status (state) of the actions performed on the imported VTK object. Therefore, to save your work use menu option File > Save State. NOTE: there will be no warning when leaving Paraview to save the state and all work may be lost when exiting the program.

To continue where you left off in the previous session use File > Load State. This prompts the user to specify a VTK file, which means that the actions performed in the last session can also be applied to a new VTK file. In this way, data from different FEMWB analyses can be displayed in exactly the same way, without any additional effort.

Visualise FEMWB Results

Paraview has many options and settings for displaying results. We will first have a look at displaying base import data on the original geometry and thereafter see how to apply filters to modify the geometry. Finally, we will use the calculator and integration filters to derive new results by combining base import data.

Base Data Displayed on Original Geometry

As the pipeline browser can contain several VTK objects and filter objects, first confirm that the right VTK object is highlighted in the pipeline browser. The selections and settings for displaying this VTK object can now be found on the properties tab. To make sure all settings are visible and aligned with this tutorial press the Advanced Settings button (the gear wheel icon on the below picture).

PVPic6.png


The first setting that we can change is the way data is presented on the geometry. This is done on the Representation drop down menu. For now we will only use the Surface or Wireframe option.

PVPic7.png


So far no results are displayed. For this we need to change the Coloring option. The default is Solid Color, but the drop down menu shows all the scalar data that is available in the imported VTK file.

PVPic8.png

PVPic9.png


For the purpose of this tutorial we choose ReinforcementRatio_x, but it is easy to change to any data type.

The RenderView window will now show an iso-plot of the selected data type and a Color Legend of the data range.

PVPic10.png


The Color Legend can be dragged around the screen to a more convenient location and will change orientation when nearing any of the windows edges.

PVPic11.png


Alternatively, the settings of the color legend can be controlled in great detail by opening the Edit Color Legend Properties dialogue (press last Icon to the right)

PVPic12.png

PVPic13.png


The coloring of the iso map can be controlled through the Color Map Editor, which is activated by pressing the Edit button:

PVPic12.png . PVPic15.png


The setting for Color Discretization is useful to limit the number of iso values, thus creating more practical ranges for design. The default number of ranges is 256, but here the number is set at 10.

PVPic16.png

Applying Filters to FEMWB results

To modify the base data or geometry imported from FEMWB, filters can be applied.

Here only the Slice and Warp filters will be discussed. Filters for creating compound results from base data will be discussed in the next section.

To apply the Slice filter, highlight the VTK object that needs to be sliced and press the Slice Icon. Alternatively, find the Slice filter in the menu Filters > Alphabetical. This adds the Slice filter object to the Pipeline Browser and the location in the tree shows that it is applied to the VTK object. The position in the tree matters, because filters can be applied to different VTK objects or even to other filter objects. The filter object cannot be dragged around in the tree to change the object it is applied to. The target object can only be changed through the menu (or by right-clicking) option Edit > Change Input.

PVPic17.png


The location and orientation of the slice can be modified by dragging the slice and its normal vector with the mouse or through the Properties tab. In the below figure the origin of the slice has been placed at the center of the beam (over the central support) and the normal to the plane points in the x-direction.

PVPic18.png


To get rid of the bounding boxes deselect the Show Plane box at the top of the Plane Parameters dialogue.

PVPic19.png


The Warp by Vector filter can be used to display the deformed geometry. Highlight the VTK object and press the Warp by Vector Icon. This adds the filter to the Pipeline Browser. Alternatively look for the filter in the menu Filters > Alphabetical. Next select Displacement in the Vectors drop-down menu of the Properties tab and set an appropriate scale factor. Don’t forget to press the Apply button after changing the settings.

PVPic20.png . PVPic21.png


The maximum displacement value is 0.98 mm.

To show the deformed geometry superimposed on the undeformed geometry, simply make both the VTK object and Warp filter object visible by clicking the eye icon next to it. In the following picture the Representation setting for the VTK object was changed to Wireframe and the Opacity reduced to 0.5 to prevent it from obscuring the Deformed geometry.

PVPic22.png


NOTE: As more objects are added to the Pipeline Browser and more display windows are open, it becomes increasingly important to ensure that the right object is selected in the Pipeline Browser and the right Window has focus when making changes to the Properties Tab. Otherwise much time can be spent on finding the right property or changes to properties may not seem to take effect.

Applying Filters to Derive Compound Results from Base Import Data

If we want to know the amount of reinforcement steel in the beam as a whole or the amount passing though a particular cross section we need to perform integration (summation over the geometry) of the base data.

For example, the total volume of reinforcement bars in the beam running in x-direction is obtained from the integral INTEGRATE(ReinforcementRatio_x * dx * dy * dz) over the full geometry and the total area of reinforcement steel running though a particular beam cross section is obtained from INTEGRATE(ReinforcementRatio_x * dy * dz) over a slice.

In Paraview, integration can be done with an Integration Filter. This filter can be applied to the entire VTK object (the beam) or to a Slice (the cross section).

NOTE: due to a mismatch of node ordering between FCFEM and PV, integration over a volume renders negative results, i.e. INTEGRATE( 1.0 * dx * dy *dz) = - Volume instead of + Volume.

To calculate integrals we need to apply an Integration Filter, which can be found in the menu item Filters > Alphabetical. Highlight the VTK object and apply the filter.

PVPic23.png


Press the Apply button in the Properties tab and the results will open in a separate window to the right of the Renderview.

PVPic24.png


Before we tidy this up to find the desired result, i.e. INTEGRATE(ReinforcementRatio_x * dx * dy * dz), lets first see how we can control where the window is placed and what it contains.

First close the SpreadSheetView window that has opened to the right. Then press the horizontal split icon on the Renderview window and a new window will open with a menu of display options. Before selecting an option, make sure the Integration filter object is highlighted in the Pipeline Browser.

PVPic25.png


To display numerical results we need to select SpreadSheet View at the bottom of the Create View list. This generates a spreadsheet of all available results in the VTK object integrated over the volume.

PVPic26.png


To inspect INTEGRATE(ReinforcementRatio_x * dx * dy * dz) we could scroll to the right through the table, but we can also remove all unwanted results by deselecting them, i.e. deselect All Columns and select ReinforcementRatio_x.

PVPic27.png . PVPic28.png


Now we are left with just one value in the table of integration results

PVPic29.png


As explained before this is the negative value of the integral we are looking for. So the indicative total volume of steel required in x direction is 2.27e+06 mm3 (= 2272 cm3) or 2272 cm3 * 7.6 g/cm3 = 17267 g (= 17.3 kg). In practice the number will be higher due to practical considerations (e.g. anchoring requirements, minimum reinforcement requirements, etc.). Nevertheless, this result can be used to compare conceptual designs

The above was an example of the integration of a variable directly exported by FEMWB. In some cases we may want to combine VTK variables to obtain new results. This can be done in several ways, but here I will only discuss the simplest, i.e. with the Calculator Filter.

For example, if we want to know the total reinforcement requirement in all three coordinate directions we would have to sum ReinforcementRatio_x, ReinforcementRatio_y and ReinforcementRatio_z.

The Calculator filter can be found as an icon on the left of the filter bar or via the menu Filters > Alphabetical. The name for the resulting variable can be entered in field Result Array Name. Here we name the result Total_Reinforcement_Ratio. The formula can be composed in the box below the Result Array Name field. Input values can be selected from the Scalars drop down menu and they can be combined into a formula for the result using the operators given. After pressing the Apply button, the result will be available as a new variable in any subsequent operations (e.g. an Integration Filter) or views (e.g. RenderView or SpreadSheetView, see below).

PVPic30.png


For example, we can now apply the integration filter to the new variable Total Reinforcement Ratio

PVPic31.png


This shows how the total reinforcement requirement compares to that in the individual coordinate directions.

Integration over a Slice

In the previous section we discussed the Integration filter and its application to the entire VTK object. To demonstrate integration over a slice we will in this section determine the total reinforcement requirement and its center of gravity for the central cross section of the beam. The end result is shown in the picture below. The interaction of various objects can be inspected in the Pipeline Browser. The slice filter is applied to the beam VTK object and two Calculator filters are applied to the slice filter to derive the new variables “Reinforcement_ratio_x * z” and “Reinforcement_ratio_x * y” from the base data. These variables need to be integrated to determine the center of gravity of the reinforcement. Finally, Integration filters are applied to each Calculator to integrate results over the Slice. Please refer to the previous section for a general introduction of the Integration filter and its settings.

PVPicSlice1.png


Apply the following Settings in the Properties tab for the VTK object:

Properties Tab Settings Comment
Representation: Wireframe So the Slice is visible
Coloring: ReinforcementRatio_x Or any other color
Styling > Line Width: 2 Or any other setting that gives a pleasing result

PVPicSlice2.png


Next highlight the VTK object and apply a Slice filter with the following settings on the Properties tab:

Properties Tab Settings Comment
Plane Parameters > Show Plane: deselect Remove the bounding boxes
Plane Parameters > Origin: 4000 / 100 / 200 Position of central section
Plane Parameters > Normal: 1 /0 /0 Normal of Slice points in x -direction
Coloring: ReinforcementRatio_x Optional
Styling > Line Width: 2 Or any other setting that gives a pleasing result

PVPicSlice3.png


Settings Calculator 1

Calculator 1 computes the new variable ReinforcementRatio_x * y which needs to be integrated to obtain the y-coordinate of the reinforcement’s center of gravity.

PVPicSlice4.png


After pressing Apply, a new variable named “ReinforcementRatio_x * y” is available for display or further processing.


Settings Calculator 2

Calculator 2 computes the new variable ReinforcementRatio_x * z which needs to be integrated to obtain the z-coordinate of the reinforcement’s center of gravity.

PVPicSlice5.png


After pressing Apply, a new variable named “ReinforcementRatio_x * z” is available for display or further processing.

Finally, two Integration filters are applied, one on Calculator1 to integrate variable ReinforcementRatio_x * y and on Calculator2 to integrate ReinforcementRatio_x * z. Each are displayed in their own window with SpreadSheetView selected. The way to deselect all other results is explained earlier.

PVPicSlice6.png


Finally the Center of Gravity can be calculated from the above results as:

CoG_y = 55744.2 / 556.277 = 100.2 mm (exact value: 100 mm)

CoG_z = 187144 / 556.277 = 336.4 mm (exact value: 5/6 * 400 mm)

Integration over a Line

To demonstrate visualisation and integration of results over a line we use the 2D example of a heavy wall as introduced in this FC forum thread. The FreeCAD file for this example can be downloaded in this FC forum thread. The challenge is to visualise reinforcement ratio across various vertical cross sections and to determine the required area of steel from integration of those results.

Techniques introduced in previous sections of this tutorial will not be repeated here. It is also important to note again that as more objects are added to the Pipeline Browser and more display windows are open, it becomes increasingly important to ensure that the right object is selected in the Pipeline Browser and the right Window has focus when making changes to the Properties Tab. Otherwise much time can be spent on finding the right property or changes to properties may not seem to take effect.

Starting with the VTK object imported from FEMWB we note that the PV controls operate slightly differently on a 2 dimensional object. The left mouse button drags the geometry and the middle mouse button rotates it. To position the geometry in the plane of analysis (i.e. x-y), press the icon that puts the view along the negative z axis:


PVPicLine1.png


For the picture below the Coloring property on the Properties tab for the VTK object was set to ReinforcementRatio_x.

The only additional object required to visualise a variable along a straight line is a Plot Over Line filter. This can be activated from the icon bar or the menu option Filters > Alphabetical.

We next want to display the horizontal reinforcement requirements in the vertical cross section under the column. To achieve this in the way shown below, the following settings need to be changed in the Properties tab of the Plot Over Line filter (make sure the LineChartView window and the Plot Over Line object both have the focus)

Properties Tab Settings Comment
Line Parameters > Point 1: 4000 / 0 / 0 Point at bottom of wall under the column
Line Parameters > Point 2: 4000 / 4000 / 0 Point at top of wall under the column
x Axis Parameters > x Array Name: ReinforcementRatio_x Displays ReinforcementRatio_x on the horizontal axis
Series Parameters: tick “arc length” only This is the length parameter along the line
Title > Chart Title: Mid Section
Annotation > Show Legend: deselect Meaningless for the current choice of vertical axis
Left Axis > Left Axis Title: Height Across Beam
Left Axis Range > Use Custom Range: deselect Deselect to maximise the data range along the axis
Bottom Axis > Bottom Axis Title: Reinforcement Ratio in x-Direction
Bottom Axis Range > Use Custom Range: deselect Deselect to maximise the data range along the axis

PVPicLine2.png


Note that the distance along the line (arc length) is usually on the horizontal axis and the variable that we want to display (here ReinforcementRatio_x) on the vertical axis. However, as the wall section in this example is vertical and we want to see the reinforcement requirement over the height of the wall, it is more natural to inverse the axes. This, however, comes at the expense of a lot more changes to the settings in the Properties tab for the Plot Over Line filter.


In the next two picture only the location of the line was changed. Note however that this relocation will automatically change the Left Axis Range > Use Custom Range setting to “select”. This may mean that the graph does not properly fit in the LineChartView window. It is therefore necessary to deselect this option every time the position of the line is changed. Other settings are as per the above table.

Properties Tab Settings Comment
Line Parameters > Point 1: 6700 / 0 / 0 Point at bottom of wall under left side of cut-out
Line Parameters > Point 2: 6700 / 4000 / 0 Point at top of wall above left side of cut-out
Title > Chart Title: Section left of Cut-out
Left Axis Range > Use Custom Range: deselect Deselect to maximise the data range along the axis
Bottom Axis Range > Use Custom Range: deselect Deselect to maximise the data range along the axis

PVPicLine3.png


Properties Tab Settings Comment
Line Parameters > Point 1: 10950 / 0 / 0 Point at bottom of wall at right-hand support
Line Parameters > Point 2: 10950 / 4000 / 0 Point at top of wall at right-hand support
Title > Chart Title: Section at Support
Left Axis Range > Use Custom Range: deselect Deselect to maximise the data range along the axis
Bottom Axis Range > Use Custom Range: deselect Deselect to maximise the data range along the axis

PVPicLine4.png


The total horizontal reinforcement requirement in the last cross section can now simply be obtained by applying an Integration filter to the Plot Over Line object, i.e. highlight the Plot Over Line object in the Pipeline Browser and add an Integration filter from the menu option Filters > Alphabetical.

PVPicLine5.png


In the usual way deselect all but the ReinforcementRatio_x result in the SpreadSheetView and read off the result as 23.11 mm2 / mm. To obtain the total cross sectional area of steel, we still need to multiply with the thickness of the wall, which in this example is (an impressive) 600 mm. So the total cross sectional area of steel running through the cross section near the right hand support is 23.11 * 600 = 13866 mm2 = 139 cm2

To achieve a more practical distribution of reinforcement we could integrate the above graph in parts. For example, if we want to know the required cross sectional area of steel in the top 400mm of the wall then we should adjust the properties of the Plot Over Line object as follows

Properties Tab Settings Comment
Line Parameters > Point 1: 10950 / 3600 / 0 Point near top of wall at right-hand support
Line Parameters > Point 2: 10950 / 4000 / 0 Point at top of wall at right-hand support
Left Axis Range > Use Custom Range: deselect Deselect to maximise the data range along the axis
Bottom Axis Range > Use Custom Range: deselect Deselect to maximise the data range along the axis

This yields the following result

PVPicLine6.png


The result for the top 400 mm of the wall is thus 8.436 mm2 / mm. So the top 10% of the wall requires 8.44 / 23.11 * 100% = 37% of the reinforcement steel.

This procedure could be repeated to divide the wall in zones of constant reinforcement.

Representation of Vector Results with the Glyph 3D Filter

So far we have only dealt with Scalar values, like reinforcement ratio and displacement magnitude. Visualization of vector results, like Principal Stress vectors, is done with Glyphs.

Let’s return to the VTK data object for the beam with central support and visualize maximum and minimum principal stress vectors.

Highlight the VTK data object in the Pipeline Browser and select the Glyph Filter from the Filter Icon bar or from the menu option Filter > Alphabetical. Then apply the following settings in the Properties tab of the Glyph Filter object (see table and picture):

Properties Tab Settings Comment
Glyph Source > Glyph Type: Line Unfortunately there is no option for a double sided arrow
Orientation > Orientation: Major Principal Stress The Glyph takes the principal stress direction
Scale > Scale Array: Major Principal Stress The length of the line will represent the magnitude of the principal stress
Scale > Vector Scale Mode: Scale by Magnitude
Scale > Scale Factor: 100 Or any other setting that gives a pleasing result
Masking > Glyph Mode: All Points To make sure the stress in every node is displayed
Coloring > Solid Color A single color gives greatest clarity of “stress flow”
Coloring > Edit > Green Or any other setting that gives a pleasing result
Styling > Line Width > 2 Or any other setting that gives a pleasing result


PVPic32.png; PVPic33.png


If all goes well you should see the following result for the example file.

PVPic34.png


Next add another Glyph Filter with the following settings for the Minor Principal Stress (don’t forget to first highlight the VTK data object in the Pipeline Browser):

Properties Tab Settings Comment
Glyph Source > Glyph Type: Line Unfortunately there is no option for a double sided arrow
Orientation > Orientation: Minor Principal Stress The Glyph takes the principal stress direction
Scale > Scale Array: Minor Principal Stress The length of the line will represent the magnitude of the principal stress
Scale > Vector Scale Mode: Scale by Magnitude
Scale > Scale Factor: 100 Or any other setting that gives a pleasing result
Masking > Glyph Mode: All Points To make sure the stress in every node is displayed
Coloring > Solid Color A single color gives greatest clarity of “stress flow”
Coloring > Edit > Red Or any other setting that gives a pleasing result
Styling > Line Width > 2 Or any other setting that gives a pleasing result

PVPic35.png

The final result shows the major and minor principal stress vectors superimposed on the beam with ReinforcementRatio_x.

Export of Graphical Results

To export a RenderView window highlight the window and use menu option File > Save Screenshot