The example illustrates the manipulation of objects of the classes defined in FeResPost. The example is presented in directory “TESTSAT/RUBY/EX12”, in file “testCla.rb”.
First, a ClaDb is created and initialized by reading an ESAComp data file:
db=ClaDb.new
db.Id="testDB"
db.readEdf("test.edf")
Then, a new ClaMat “mat1” is created. Its data are initialized by calls to the appropriate methods, and the material is inserted into the ClaDb:
mat1=ClaMat.new
mat1.Id="mat1"
mat1.Type="isotropic"
mat1.fillModuli({"E"=>72e9,"nu"=>0.33})
mat1.fillCTEs({"alfa"=>2.3e-5})
db.insertMaterial(mat1)
The ClaMat object previously stored into the ClaDb is retrieved into “mat2” variable. The material stiffness matrix is requested and its components are printed:
mat2=db.getMaterialCopy("mat1")
stiffMat = mat2.getStiffness
printf("\n\n stiffMat:\n\n")
stiffMat.each do |line|
line.each do |cell|
printf("%14g",cell)
end
printf("\n")
end
(Similarly, the compliance matrix is printed for the same material.) The following instructions illustrate the creation of a ClaLam object that is stored in the ClaDb:
lam=ClaLam.new lam.Id="testLam" lam.addPly( 1,"mat1",0.00037, 0.0,30e6) lam.addPly( 2,"mat1",0.00037, 45.0,30e6) lam.addPly( 3,"mat1",0.00037,-45.0,30e6) lam.addPly( 4,"mat1",0.00037, 90.0,30e6) lam.addPly(15,"mat1",0.00037, 90.0,30e6) lam.addPly( 6,"mat1",0.00037,-45.0,30e6) lam.addPly( 7,"mat1",0.00037, 45.0,30e6) lam.addPly( 8,"mat1",0.00037, 0.0,30e6) lam.addPly(16,"mat1",0.00037, 0.0,30e6) db.insertLaminate(lam)
Then, characteristics of the laminate like the stiffness and compliance matrices are printed. the following lines illustrate the printing of the laminate ABBD (stiffness) matrix:
ABBD = lam.get_ABBD
printf("\n\n ABBD:\n\n")
ABBD.each do |line|
line.each do |cell|
printf("%14g",cell)
end
printf("\n")
end
Note that the quantities can be printed in any direction with respect to the laminate axes. For example, the following lines illustrate the printing of laminate thermal expansion coefficient in direction 45 with respect to the laminate axes:
alfaEh1 = lam.get_alfaEh1(45.0)
printf("\n\n alfaEh1 (45o):\n\n")
alfaEh1.each do |cell|
printf("%14g\n",cell)
end
Similarly, the vector is printed. Finally, the ClaDb is saved into a neutral file. (This neutral file “test.ndf” is used in the other composite examples.)