FeResPost Web Site                     FeResPost Online User Manual

IV.2.11.3 Getting superelement Results from XDB files

We illustrate how the Results can be retrieved from XDB files when model contains superelements in file “RUBY/EX27/readXdb.rb”. As the model cannot be read from XDB file, database is initialized by reading a BDF file. Results are read into master database and its superelement databases using readXdb method:

   printf("\n\n   0) Reading all the results in the DataBase : \n\n")
   db.readXdb(xdbFileName)

As master database contains no nodes or elements, no Results are associated to master database, and the following lines produce no output, except the title line:

   printf("\n\n   A) Getting results from the main database : \n\n")
   db.each_resultKey do |lcName,scName,tpName|
      tmpRes=db.getResultCopy(lcName,scName,tpName)
      printf("A) %-20s%-25s%-60s%-10d\n",lcName,scName,tpName,tmpRes.Size)
   end

On the other hand, the following lines produce the same output as the corresponding ruby lines in the “OP2” example in section IV.2.11.2:

   printf("\n\n   B) Getting all the results from all databases : \n\n")
   seIds.each do |seId|
       currentDb=nil
       if seId>0 then
           currentDb=db.getSuperElementFromId(seId)
       else
           currentDb=db
       end
       printf("currentDb.SEID = %d\n",currentDb.SEID)
       currentDb.each_resultKey do |lcName,scName,tpName|
           res=currentDb.getResultCopy(lcName,scName,tpName)
           $stdout.printf("B) %s - %s - %s : %d\n",lcName,scName,tpName,res.Size)
           if (res.Name=="Displacements, Translational"||res.Name=="Stress Tensor") then
               if (bDebug) then
                   str=format("%s on SEID %d",res.Name,seId)
                   Util::printRes($stdout,str,res)
               end
           end
       end
   end

XDB files can be attached to a NastranDb object:

   printf("\n\n   1) Attaching XDB file to the database : \n\n")
   db.attachXdb(xdbFileName)

Then, information can be retrieved from XDB file, as is done when no superelement is present in the model. This information can be dependent on the superelement too, so that corresponding superelement database must be used to obtain the information. For example:

   sdb3=db.getSuperElementFromId(3)
   puts sdb3.getAttachmentNodeInfo(xdbFileName,1)
   puts sdb3.getAttachmentNodeInfo(xdbFileName,2)
   puts sdb3.getAttachmentNodeInfo(xdbFileName,3)
   puts sdb3.getAttachmentElementExtId(xdbFileName,7,1)
   puts sdb3.getAttachmentElementExtId(xdbFileName,7,5)
   puts sdb3.getAttachmentElementExtId(xdbFileName,7,8)

Remark that the XDB file is attached to master database, but accessed from one of the superelement database.

One obtains information from XDB attachment calling different methods from “db” object:

   printf("\n\n   C) Attachment information : \n\n")
   db.getAttachmentLcInfos(xdbFileName).each do |info|
       $stdout.printf("%s%30s%8d%8d%14f%14f\n",
           info[0],info[1],info[3],info[4],info[5],info[6])
   end
   $stdout.printf("nbr load cases = %d\n",db.getAttachmentNbrLoadCases(xdbFileName))
   lcNames=db.getAttachmentLcNames(xdbFileName)
   scNames=db.getAttachmentScNames(xdbFileName)
   resNames=db.getAttachmentResNames(xdbFileName)
   puts lcNames,scNames,resNames

Previous lines produce the following output:

      C) Attachment information :

   Load Case 1                       Statics       1     101     -1.000000     -1.000000
   nbr load cases = 1
   Load Case 1
   Statics
   Applied Loads, Forces
   Applied Loads, Moments
   Displacements, Rotational
   Displacements, Translational
   Reaction Forces, Forces
   Reaction Forces, Moments
   SPC Forces, Forces
   SPC Forces, Moments
   Stress Tensor

Note that tree “lcNames”, “scNames” and “resNames” Arrays are filled by these instrutions. These arrays are used later in the rest of the script.

Again, no Results can be obtained from the master database, so that the following lines produce no output except the title line:

   printf("\n\n   D) Getting Attachment results from the main database : \n\n")
   lcNames.each do |lcName|
       scNames.each do |scName|
           resNames.each do |resName|
               h=db.getAttachmentResults(xdbFileName,lcName,scName,resName)
               if (h) then
                   h.each do |key,res|
                       str1,str2,str3=key
                       $stdout.printf("D) SEID %d - %s - %s - %s : %d\n",db.SEID,str1,str2,str3,res.Size)
                   end
               end
           end
       end
   end

On the other hand, the following lines output Results obtained using “getAttachmentResults” for the superelement databases:

   printf("\n\n   E) Getting Attachment results from all databases : \n\n")
   seIds.each do |seId|
       currentDb=nil
       if seId>0 then
           currentDb=db.getSuperElementFromId(seId)
       else
           currentDb=db
       end
       printf("currentDb.SEID = %d\n",currentDb.SEID)
       lcNames.each do |lcName|
           scNames.each do |scName|
               resNames.each do |resName|
                   h=currentDb.getAttachmentResults(xdbFileName,lcName,scName,resName)
                   if (h) then
                       h.each do |key,res|
                           str1,str2,str3=key
                           $stdout.printf("E) SEID %d - %s - %s - %s : %d\n",currentDb.SEID,str1,str2,str3,res.Size)
                       end
                   end
               end
           end
       end
   end

In the same script, the characteristics are also output of Results obtained by calling the method “readXdb2H” on master and superelement databases.