Creating inputs

In order to run an analysis in Fatlab, the following inputs are required:

  1. Model file
  2. FE stress files (unit load cases)
  3. Loads file

Although not strictly necessary, it is good practice to create a work folder for each analysis and store all files here.

A macro (fatlab.mac) is supplied with Fatlab examples, which assists in the generation of the inputs from ANSYS; however it must be modified by the user to fit the analysis at hand.

1. Model file

The model file contains a complete description of the FE model, i.e. a list of nodes, elements and element types. This file is used for visualizing the model and results in Fatlab.


Issue the APDL script below. If appropriate, a subset of the model can be selected beforehand such that e.g. support/loading structures are excluded. Supported elements: SOLID186, SOLID187, SOLID185, PLANE42, PLANE82, PLANE182, PLANE183, SHELL63, SHELL181, SHELL281.

1.2 SolidWorks Simulation

In SolidWorks Simulation, the model file is exported through the GUI:

  • Go to “Simulation” in the main menu and select “Export…”.
  • Select “Simulation files (*.geo)”. Remember to check “Export FEM only”.
  • Save the file.

1.3 Custom CSV format

A special comma-separated file format have been created in order to make it easier to import a model from a currently unsupported FE program. Using this format, the export of any FE program can be translated using the below syntax and then imported into Fatlab.

Only lines starting with T, N or E are read for element type, nodes and elements, respectively. So there can be several header lines, also in between. Syntax should be self-explanatory from below and attached examples. Trailing commas are insignificant and there are no requirements to the width of the file.

Supported element names are the same as for ANSYS.

Element types: T, element type no., element name

Nodes: N, node no., x, y, z

Elements: E, element no., material no., element type no., node i, node j, ...

 2. FE stress files (unit load cases)

FE stress files are lists of stress components for each node in the model. A separate unit LC stress file must be generated for each load on the model (at least one). In case of a non-linear model, two or more FE stress files may be used. These files are used by Fatlab when calculating the stress-time histories through superposition.


In ANSYS the FE stress files are generated by listing the nodal stress results for a unit load case by issuing PRNSOL,S. See script below to generate unit stress files from ANSYS. Note that it is not allowed to change the format of the export, since it is read in a fixed-column-width manner.


1 0.99868-0.45298E-04 0.80668E-01-0.33606E-09 0.50760E-07-0.74208E-05
2 0.99215 0.46994E-06 0.76008E-01 0.37790E-09 0.35704E-07-0.15339E-04
3 0.98175 0.23177E-05 0.78480E-01 0.12170E-08 0.42694E-07-0.19283E-04
4 0.96852 0.11462E-05 0.85047E-01 0.20723E-08 0.53371E-07-0.20807E-04

2.2 SolidWorks Simulation

The binary .ste files is generated during the solution process in Simulation and holds strain and stress results. Per default, they are deleted during the final stage of a solution, however, they can be kept by checking  Keep temporary database files in Simulation > Options > Default options > Results > Results folder:


Note that the order of the two last columns of stress export (TYZ and TXZ) are not consistent in ANSYS and SolidWorks Simulation. This is handled internally in Fatlab though (to comply with ANSYS format) and therefore no corrections are required from the user.

2.3 Custom CSV

Exactly 1 header line, then nodal stress results as below (1 node per line). Note the order of the shear stress components.

Stress export: node no., SX, SY, SZ, SXY, SYZ, SXZ

 3. Loads file

The loads file is an Excel spreadsheet containing a sheet for each load case. Each sheet then lists the time history for the loads, e.g. a sinusoidal curve or whatever trajectory preferred. The order of the loads must equal the order of the unit stress files. The loads file may also contain additional/irrelevant content, as long as it is separated from the load history by at least one empty column.

The top 3 lines must have the format shown below, i.e. number of repetitions of current load case, headers describing the time/load names and the associated units. The length of the time/load history can be chosen arbitrarily, as long as it describes at least one cycle.

Example loads file

Example loads file

Note that Fatlab does all calculations in [MPa]. The user must therefore ensure consistent units, such that loads multiplied with the FE stresses equals [MPa].

4. ANSYS Workbench

The input files for Fatlab can be generated easily in ANSYS Workbench by including a set of commands under Solution as shown in the figure below.

The Fatlab export commands should include the following APDL. Some minor adjustments will be necessary, i.e. setting the number of load steps, NLS, and naming them in the filename array.

!Fatlab prep macro
rstname = 'file'

NLS = 2

*DIM, filename, CHAR, NLS ! no. unit load cases
filename(1) = 'Fx'
filename(2) = 'Fy'


! open rst

! export model
/PAGE, 1E9,, 1E9,, ! one billion lines per page (disable headers)


! export FE stress files (.fes)
/FORMAT,7,E,12,4, ,    !fix new output format in ANSYS v18 & 19


7 thoughts on “Creating inputs

  1. Andreas D.

    Dear Mikkel,

    is Fatlab capable of dealing with 3 dimensional input signals (for example 3 time series like Fx(t), Fy(t), Fz(t))? I think it should work somehow within the Load(Variable) concept using Load(Var1,Var2).


    1. admin Post author

      Hi Andreas

      Certainly. Fatlab can handle as many load signals as you like. You just make more columns in the loads file. Several of the examples include multiple loads. Also, you can use different scaling/interpolation techniques for the different loads. E.g. one load can scale the FE stresses linearly, whereas another may be interpolating.

      BR Mikkel

  2. Andreas D.

    Dear Mikkel,

    thank you for your response! Well, I looked through the examples and found out that it is possible to do a linear combination (superposition) of the stress states. Like having Fx and all the stress files, Fy and all the stress files and Fz and all the stress files. Fatlab is then searching for a combined stress state of the actual loading situation Fx(t), Fy(t) and Fz(t) given in the load-time history. Thats already a great feature! Also it is possible to have a 2D interpolation for example Fx with a dependency of Fy. So, what I’m looking for is an interpolation feature for Fx(Fy,Fz): one load and two variables.

    My problem is, due to all the nonlinearities in my model, the stress state depends on the spatial loading situation. For example, if a have 3 external displacements, my stress state a) sx(sy,sz=0) is different than stress state b) sx(sy,sz=2).

    I tried to extend the 2D interpolation feature to 3D with two dependent variables but my attempt was not successful so far. If I have success I’ll let you know.

    BG Andreas

    1. admin Post author

      Ok, now I get it… You’re right, Fatlab cannot do this as it is, but I think you should be able to manipulate the 2D interpolation feature in calc_stress_nonlinear(). It may require modifying the UI also in some places, which I suppose can be more difficult. Please let me know if you suceed.

      BR Mikkel

  3. Andreas D.

    Dear Mikkel,

    got it! I don’t know if it makes sense to post all the changes in a comment. What I did was to add an extra option “3D Interpolation” in the setup model window. If activated, Fatlab changes the next two entries to Var1/Var2 (similar to the 2D interpolation idea). In “calc_stress_nonlinear.m” I added an extra array “ULC_stress_3D” with the shape (max_ULC_per_load,max_ULC_per_load,max_ULC_per_load). In the beginning I made a mistake with the order of F,V,W in interp3: Matlab requests the order V,F,W. Here and there I made some extra changes regarding error treatment, but basically that’s it. I went through the whole code with the matlab search function for all files with “2D interpolation” and added extra options for the 3D one. If you are interested in specific code changes, I think it’s better if you contact me per mail. I’ve also added some other features (more elastomer / rubber specific ones) so sending my modified files is probably not the best idea as there are too many changes in it. I will sort the interpolation code changes out if there is any interest.

    BR Andreas

  4. Anahita Imanian

    Hello Pederson,

    Thanks for sharing your awesome code!
    I have a couple of questions.

    1) How do you calculate the state of stresses on the nodal points regarding the loading history? If I am not mistaken, you perform the stress analysis once in the static condition, and then did not figure out how do you calculate the cyclic stress states in each node.

    2) Regarding the anisotropy correction in fatigue calculations, I was wondering if you can describe how do you calculate the SN curve in different directions. Is it based on some experimental data or high fidelity approaches?

    Again thanks for the good work.

    1. admin Post author

      Hi Anahita

      Thanks for posting. As for your questions:
      1) Stresses in all nodes are calculated in an FE program for a unit load and then imported into Fatlab. Then (for each node), these stresses at unit load S@F=1 are scaled with the timeseries of the associated loads F(t) such that S(t) = S@F=1 * F(t). In case of multiple loads they are superimposed, e.g. S(t) = S1@F1=1 * F1(t) + S2@F2=1 * F2(t) + … All six stress components are treated like this and then later, an effective fatigue stress is calculated, e.g. principal stresses over time and then cycle-counting is applied. It is explained under the theory reference.
      2) Regarding the handling of anisotropy, it will be explained in a paper to be published early next year. But the overall idea is to scale (up/down) the fatigue strength (entire SN curve) for each node, depending on angle of the surface normal of said node. The scaling is defined by the user under SN curve > Setup anisotropy. It is not completly general, but fits the need of additive manufactured metals, i.e. build up in layers and sensitive to the angle between the load and the building direction. I will add the documentation here also, once the paper is out.

      BR Mikkel


Leave a Reply to admin Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.