![]() |
![]() |
![]() |
Demo: A planar truss
This code models an assembly of elastic bars subject to elongation and compression. The libray OFELI contains the class Bar2DL2 that handles elastic planar with 2 degrees of freedom for each node that are x and y displacements at nodes.
IPF data("truss",argv[1]);
int output_flag = data.getOutput();
int save_flag = data.getSave();
Mesh ms(data.getMeshFile());
Prescription p(ms,data.getDataFile());
|
SkSMatrix<double> A(ms);
Vect<double> bc(ms), bf(ms);
p.get(BOUNDARY_CONDITION,bc);
p.get(POINT_FORCE,bf);
Vect<double> b(bf);
double section = data.getDouble("section");
|
MeshElements(ms) {
Bar2DL2 eq(theElement,section);
eq.Stiffness();
eq.ElementAssembly(A);
}
|
A.Prescribe(b); A.solve(b); |
IOField pf(data.getMeshFile(),data.getPlotFile(),ms,IOField::OUT); pf.put(b); DeformMesh(ms,b,40); |
<OFELI_File>
<info>
<title />
<date />
<author />
</info>
<Project name="tower">
<mesh_file value="tower.dat"/>
<verbose value="1"/>
<output value="1"/>
<save value="1"/>
<plot value="1"/>
<init value="1"/>
<parameter label="section" value="0.005"/>
<plot_file value="tower1.d"/>
</Project>
<Mesh dim="2" nb_dof="2">
<Nodes>
0.00000000e+00 0.00000000e+00 11 6.00000000e+00 0.00000000e+00 11
3.00000000e+00 1.50000000e+00 0 0.00000000e+00 3.00000000e+00 0
6.00000000e+00 3.00000000e+00 0 3.00000000e+00 4.50000000e+00 0
0.00000000e+00 6.00000000e+00 0 6.00000000e+00 6.00000000e+00 0
3.00000000e+00 7.50000000e+00 0 0.00000000e+00 9.00000000e+00 0
6.00000000e+00 9.00000000e+00 0 3.00000000e+00 1.05000000e+01 0
0.00000000e+00 1.20000000e+01 0 6.00000000e+00 1.20000000e+01 0
3.00000000e+00 1.50000000e+01 0
</Nodes>
<Elements shape="line" nodes="2">
1 2 1 1 3 1 2 3 1
3 4 1 3 5 1 1 4 1
2 5 1 4 5 1 4 6 1
5 6 1 6 7 1 6 8 1
4 7 1 5 8 1 7 8 1
7 9 1 8 9 1 9 10 1
9 11 1 7 10 1 8 11 1
10 11 1 10 12 1 11 12 1
12 13 1 12 14 1 10 13 1
11 14 1 13 14 1 13 15 1
14 15 1
</Elements>
<Material>
1 Iron
</Material>
</Mesh>
<Prescription>
<PointForce y="15.0" dof="1">5.0</PointForce>
</Prescription>
</OFELI_File>
|
The mesh here above describes a tower. Note that the node with coordinate y=15 is submitted to a concentrated load equal to 15.0.
![]() |
![]() |
![]() |