Tutorial

This section provides a hands-on tutorial on the basic usage of ALFE.

Introduction

2D Cantilever

Here is a very basic example. We can start from creating a simple 2D cantilever with 6 mm x 4 mm. It is meshed with 24 four-node plane-stress elements. The material is assumed with Young's modulus of 1 MPa and Poisson's ratio of 0.3.

1. Define a cantilever

Define nodes and elements. The number of nodes in the two directions can be represented by xnumand ynum.

List<Node> nodes = new List<Node>(xnum * ynum);
List<Element> elems = new List<Element>((xnum - 1) * (ynum - 1));

Then, all nodes can be found through two for loops.

for (int i = 0; i < xnum; i++)
{
    for (int j = 0; j < ynum; j++)
    {
        nodes.Add(new Node(i, j));
    }
}

Constructing a quadrilateral element (a pixel element) requires a nodal set and a specified material. The material can be created by the code below.

Next, elements can be defined easily through inputting the counterclockwise vertex indices.

2. Define loads and boundary conditions

Now, let's set loads and boundary conditions. So, we need to define two lists for loads and supports. The number of loads is 1 because we just apply a load on the center of the one side. Another side of the cantilever should be fixed, so the number of supports should be ynum.

The easiest way to define supports is adding a if structure when defining nodes.

Also, we can compute the index of the loaded node according to ynum. A 2D vector is used to present a force.

3. Do FEA

Before doing FEA, we need to create a model and a FE system through assembling above lists.

After that, we can initialize the system and solve it.

Finally, let's print all displacements

4. Complete Code

Output:

Last updated

Was this helpful?