![]() |
![]() |
![]() |
Demo: A planar beam
This code solves an elastic beam problem in structural mechanics theory. The libray OFELI contains the class Beam3DL2 that handles elastic beams in the space with 6 degrees of freedom for each node. These degrees of freedom are supported by the vertices of each element line.
IPF data("beam - 1.0",argv[1]);
int verbose = data.getVerbose();
int output_flag = data.getOutput();
Mesh ms(data.getMeshFile());
Prescription p(ms,data.getDataFile());
|
SkSMatrix<double> A(ms); Vect<double> b(ms), bc(ms), bf(ms); p.get(BOUNDARY_CONDITION,bc,0); p.get(POINT_FORCE,bf); |
MeshElements(ms) {
Beam3DL2 eq(theElement,0.1,0.1,0.1);
eq.Stiffness();
eq.ElementAssembly(A);
eq.ElementAssembly(b);
}
b = bf;
|
A.Prescribe(b,bc); A.solve(b); |
Vect<double> u(ms,3);
Beam3DL2 eq(ms,uf,u);
cout << "Element Axial Force Bending Moment Twisting Moment Shear Force" << endl;
MeshElements(ms) {
Beam3DL2 eq(theElement,0.1,0.1,0.1,b);
cout << setw(8) << theElementLabel;
cout << " " << eq.AxialForce();
cout << " " << eq.BendingMoment();
cout << " " << eq.TwistingMoment();
cout << " " << eq.ShearForce() << endl;
}
|
DeformMesh(ms,u);
ms.put("deformed_beam.m");
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
<OFELI_File>
<info>
<title />
<date />
<author />
</info>
<Project name="beam">
<mesh_file value="beam.dat"/>
<data_file value="beam.dat" />
<verbose value="1" />
<output value="0">
<save value="1"/>
<plot value="1"/>
<init value="1"/>
<plot_file value="beam.d"/>
</Project>
<Mesh dim="3" nb_dof="6">
<Nodes>
0.00000000e+00 0.00000000e+00 0.00000000e+00 111111
1.25000000e-01 0.00000000e+00 0.00000000e+00 0
2.50000000e-01 0.00000000e+00 0.00000000e+00 0
3.75000000e-01 0.00000000e+00 0.00000000e+00 0
5.00000000e-01 0.00000000e+00 0.00000000e+00 0
6.25000000e-01 0.00000000e+00 0.00000000e+00 0
7.50000000e-01 0.00000000e+00 0.00000000e+00 0
8.75000000e-01 0.00000000e+00 0.00000000e+00 0
1.00000000e+00 0.00000000e+00 0.00000000e+00 0
</Nodes>
<Elements shape="line" nodes="2">
1 2 1 2 3 1
3 4 1 4 5 1
5 6 1 6 7 1
7 8 1 8 9 1
</Elements>
</Mesh>
<Prescription>
<PointForce x="1" dof="2">-0.01</PointForce>
<PointForce x="1" dof="3"> 0.01</PointForce>
</Prescription>
</OFELI_File>
|
Let us give some explanations about this project file:
![]() |
![]() |
![]() |