![]() |
![]() |
![]() |
This code solves linearized elastostatics problems with planar deformations.
IPF data("lelas2d - 1.1 ",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> b(ms.getNbDOF()); |
Vect<double> bc(ms.getNbDOF()); p.get(BOUNDARY_CONDITION,bc,0); Vect<double> body_f(ms.getNbDOF()); p.get(BODY_FORCE,body_f); NodeVect<double> bound_f(ms,2); p.get(TRACTION,bound_f,0); |
MeshElements(ms) {
Elas2DQ4 eq(theElement);
eq.Deviator();
eq.Dilatation();
eq.BodyRHS(Vect<double>(theElement,body_f));
eq.ElementAssembly(A);
eq.ElementAssembly(b);
}
|
MeshSides(ms) {
Elas2DQ4 eq(theSide);
eq.BoundaryRHS(Vect<double>(theSide,bound_f));
eq.SideAssembly(b);
}
|
a.Prescribe(ms,b,bc); a.Factor(); a.Solve(b); |
NodeVect<double> uf(ms,b,"Displacement");
if (save_flag) {
IOField pl_file(data.getPlotFile(),OUT);
pl_file.put(uf);
}
|
ElementVect<double> st(ms, 3, "Principal Stress");
ElementVect<double> vm(ms, 1, "Von-Mises Stress");
MeshElements(ms) {
LocalVect<double,3> ste;
Elas2DQ4 eq(theElement,b);
eq.Stress(ste,vm(theElement->getLabel()));
st(theElement->getLabel(),1) = ste(1);
st(theElement->getLabel(),2) = ste(2);
st(theElement->getLabel(),3) = ste(3);
}
|
<?xml version="1.0" encoding="ISO-8859-1" ?> <OFELI_File> <info> <title></title> <date></date> <author></author> </info> <Project name="beam"> <verbose>1</verbose> <output>1</output> <save>1</save> <plot>1</plot> <init>1</init> <mesh_file>beam.m</mesh_file> <plot_file>beam.d</plot_file> <prescription_file>beam.pr</prescription_file> </Project> </OFELI_File> |
The only thing that may differ from other seen project files is that prescription data is given in a separate file: beam.pr. Let us give this one:
<?xml version="1.0" encoding="ISO-8859-1" ?> <OFELI_File> <info> <title></title> <date></date> <author></author> </info> <Prescription> <BoundaryCondition code="1">0.0</BoundaryCondition> <Traction code="1" dof="2">-1000.0</Traction> </Prescription> </OFELI_File> |
Clearly, we have prescribed by this file a (Dirichlet) boundary condition that enforces a value of 0.0 for degrees of freedom with code 1. In addition, we have prescribed a traction of value -1000 for the second degrees of freedom (y-traction) having code 1.
![]() |
![]() |
![]() |