# truss roof

The model can be downloaded. [truss-roof.zip](https://github.com/TLCFEM/suanPan-manual/blob/dev/docs/Example/Structural/Statics/truss-roof.zip)

## Model

### Node

A 2D truss model is developed. To define nodes, use the [`node`](/suanpan-manual/command-collection/define/node.md) command. As this is a 2D model, each node is defined by two coordinates, thus the command looks like this: `node <tag> <x> <y>`.

```
# file: node
node  1 15  0
node  2 15  7
node  3 20  7.5
node  4 25  0
node  5 30  0
node  6 35  0
node  7 35  4
node  8 30  6
node  9 25  7
node  10  10  0
node  11  5 0
node  12  5 4
node  13  10  6
node  14  0 0
node  15  20  0
node  16  40  0
```

Here we define 16 nodes. The truss roof has a span of 40 and an apex height of 7.5.

### Element

To model truss elements, we use the [`T2D2`](/suanpan-manual/element/truss/t2d2.md) element. (Yes! The same designation as in ABAQUS!)

```
# file: element
element T2D2 1 1 2 1 0.2 ! element 1 connecting nodes 1 and 2 using material 1 with cross-sectional area 0.2
element T2D2 2 3 2 1 0.2
element T2D2 3 4 3 1 0.2
element T2D2 4 5 4 1 0.2
element T2D2 5 6 5 1 0.2
# ...
```

Here the first five elements are shown. The cross sectional area can be directly specified with [`T2D2`](/suanpan-manual/element/truss/t2d2.md). Alternatively, the truss section can be built up manually using basic shapes, see the [`T2D2S`](/suanpan-manual/element/truss/t2d2s.md) element for details.

You may have noticed that the material model used is not defined. Do not worry, for model definitions, the order is not important, see [Structure](/suanpan-manual/basic/structure.md) for explanation.

### Load and BC

Definitions of nodes and elements are stored in files `node` and `element`. We load it first using [`file`](/suanpan-manual/command-collection/define/file.md) command.

```
# file: truss-roof.supan
file node
file element
```

For material, we simply define an elastic [`Elastic1D`](/suanpan-manual/material/material1d/elastic/elastic1d.md) material with a Young's modulus of $$3E4$$.

```
# file: truss-roof.supan
material Elastic1D 1 30E3
```

The left-most node `14` is fixed, while the right-most node `16` is roller supported. This means for node `14`, both x and y displacements are fixed, while for node `16`, only y displacement is fixed. One can use either [`fix`](/suanpan-manual/command-collection/define/bc.md) (penalty method) or [`fix2`](/suanpan-manual/command-collection/define/bc.md) (multiplier method) to apply homogeneous boundary conditions. Both shall lead to the same result.

```
# file: truss-roof.supan
fix2 1 1 14 ! fix x-displacement (dof 1) of node 14
fix2 2 2 14 16 ! fix y-displacement (dof 2) of nodes 14 and 16
```

For load, we apply a vertical [`displacement`](/suanpan-manual/command-collection/define/load.md) load on top of the apex.

```
# file: truss-roof.supan
displacement 1 0 -1 2 3 ! a displacement load with tag 1 on node 3 dof 2 (vertical) with a magnitude of -1
```

The second parameter `0` is a placeholder for [`amplitude`](/suanpan-manual/command-collection/define/amplitude.md), a `0` means a default [`Ramp`](/suanpan-manual/amplitude/universal/linear.md) is used.

### Analysis

A simple static step is required to analyse the model.

```
# file: truss-roof.supan
step static 1
set ini_step_size 1
set fixed_step_size true

analyze ! perform analysis
```

### Probe Result

It is possible to probe the simple results of the analysis, for example, one can check the displacement and resistance of node `3` by using the [`peek`](/suanpan-manual/command-collection/process/peek.md) command. To record various results, one may want to use [`recorder`](/suanpan-manual/command-collection/define/recorder.md) command.

```
peek node 3
```

The following printout shall be expected.

```
Node 3:
Coordinate:
   20.0000    7.5000
Displacement:
   0.2238  -1.0000
Resistance:
  -1.7053e-13  -7.4093e+01
```

### Bye

Do not forget to quit.

```
exit
```

## Results

The deformation is shown.

![deformation of truss roof](/files/-MQ5s0vKUlhBt5ajxaQN)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tlcfem.gitbook.io/suanpan-manual/example/structural/statics/truss-roof.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
