One shows here how calculations can be performed with Result objects. One first initializes the DataBase and imports Results with function “readOp2”. In this example, one works with the thermo-elastic version of the model, but its initialization is vey similar to the initialization in other examples. One also add addition Groups corresponding to skins and honeycomb of the sandwich panels, like in the example of section IV.2.2.5. Those parts are not described here.
One first describes the manipulation of results that lead to the calculation of maximum equivalent Von Mises stress in the skins of upper panel. The corresponding ruby lines look like this:
targetGrp = db.getGroupCopy("pan_PZ_Al_2024")
stress = db.getResultCopy("ORBIT_ONE_MS2_Z","Statics",\
"Stress Tensor","ElemCorners",targetGrp,[])
scalar = stress.deriveTensorToOneScal("VonMises")
maxScalar = scalar.extractResultMax
maxRkl = maxScalar.extractRkl
maxStress = stress.extractResultOnRkl(maxRkl)
maxScalarData = maxScalar.getData()[0]
maxStressData = maxStress.getData()[0]
puts
puts "Maximum Von Mises stress in panel +Z skins :"
puts
printf(" %.2f Pa on element %d (layer=\"%s\").\n",
maxScalarData[5],maxScalarData[0],maxScalarData[2])
printf(" Sxx = %.2f, Syy = %.2f, Szz = %.2f,\n",maxStressData[5],\
maxStressData[6],maxStressData[7])
printf(" Sxy = %.2f, Syz = %.2f, Szx = %.2f\n",maxStressData[8],\
maxStressData[9],maxStressData[10])
Basically, the process can be divided into three parts:
Actual calculation of Von Mises stress. One recovers the Cauchy stress tensor corresponding to the selected load case and selected Group. Then one derives a scalar equivalent Von Mises stress.
Selection of the data corresponding to the maximum Von Mises stress. This is done as follows:
First, a call to “extractResultMax” is done to build a Result object containing the maximum Von Mises stress.
The ResKeyList object is then retrieved corresponding to this maximum stress. The ResKeyList object contains only one Result key.
One recovers the Cauchy stress tensor corresponding to the maximum stress.
Finally, the values contained in the selected maximum equivalent Von Mises stress and corresponding Cauchy stress values. Remark the “[0]” at the end of calls to “getData” methods. The reader must remember that this method returns an Array of Arrays. But in this particular case, the returned Array has only one Array element.
Printing of the Results. The reader will understand by himself how it works.
In the same file, a maximum out-of-plane value is also calculated shear stress in the honeycomb of the +Z panel. The calculation of this stress is done as follows:
targetGrp = db.getGroupCopy("pan_PZ_Honey_72")
stress = db.getResultCopy("ORBIT_ONE_MS2_Z","Statics",\
"Stress Tensor","ElemCorners",targetGrp,[])
sXZ = stress.deriveTensorToOneScal("Component XZ")
sYZ = stress.deriveTensorToOneScal("Component YZ")
scalar = Post.sqrt(sXZ*sXZ+sYZ*sYZ)
Similarly, one calculates the “MaxShear” stress (obtained from the eigen values of the Cauchy stress tensor):
targetGrp = db.getGroupCopy("pan_PZ_Honey_72")
stress = db.getResultCopy("ORBIT_ONE_MS2_Z","Statics",\
"Stress Tensor","ElemCorners",targetGrp,[])
scalar = stress.deriveTensorToOneScal("MaxShear")
In the same data file, this section shows how the bar stresses are recovered:
targetGrp = db.getGroupCopy("strut_A")
stress = db.getResultCopy("ORBIT_ONE_MS2_X","Statics",\
"Beam Axial Stress for Bending Loads","ElemCorners",targetGrp,[])
scalar = Post.abs(stress)
maxScalar = scalar.extractResultMax
maxRkl = maxScalar.extractRkl
maxStress = stress.extractResultOnRkl(maxRkl)
maxScalarData = maxScalar.getData()[0]
maxStressData = maxStress.getData()[0]
puts
puts "Maximum bar stress in strut A :"
puts
printf(" %.2f Pa on element %d (layer=\"%s\").\n",
maxScalarData[5],maxScalarData[0],maxScalarData[2])
printf(" Sxx = %.2f\n",maxStressData[5])
puts
puts
Note that the way maximum stress is recovered from FE Results is different because Nastran calculates only the longitudinal component of the stress tensor at four locations in the cross-section. The shear stress is not taken into account in this calculation. More complicated calculations have to be performed to take into account all the components of the stress tensor for bar and beam elements.
These examples are provided in file “RUBY/EX05/printStressMax.rb”. Another example illustrating the calculation of tensorial results eigen-values and eigen-vectors is presented in file “RUBY/EX05/eigenQR.rb”.