FeResPost Web Site                     FeResPost Online User Manual

IV.2.7 Reading optimization results

One provides here an example for the reading of optimization results. The first steps of the example consists in the creation of a NastranDb object, and the attachment of an XDB file:

    db=NastranDb.new()  
    db.Name="tmpDB"  
    #~ db.readBdf("../../MODEL/EXEC_XDB/sol200_a.bdf")  
 
    xdbFileName="../../MODEL/EXEC_XDB/sol200_a.xdb"  
    #~ xdbFileName="../../MODEL/EXEC_XDB/sol200_b.xdb"  
    db.attachXdb(xdbFileName)

Remark, that the reading of the Nastran finite element model from a BDF file is not necessary to access optimization results.

In the Nastran examples, one provides two optimization runs:

The two runs lead to similar kinds of outputs, including the history of design variables. Only, the topometric optimization generates automatically design variables (for example, one variable per element). Then, the numbering of design variables kind by awkward.

The printing of design variables history is done with the following ruby instructions:

    x=db.getAttachmentDesVarHistory(xdbFileName,nil,nil)  
    STDOUT.printf("%14s%14s%14s' n","STEP","DVID","VALUE")  
    x.each do |tab|  
        STDOUT.printf("%14d%14d%14f' n",tab[0],tab[1],tab[2])  
    end

In this case, one prints the history of all design variables, and for all steps. (“nil” values are passed for corresponding arguments of the “getAttachmentDesVarHistory” method.) If you do the same with “sol200_b.xdb”, file, you will obtain a very long output as the number of design variables can be very large for topometric optimization.

The definition of constraints is printed as follows:

    x=db.getAttachmentConstrDefinitions(xdbFileName)  
    STDOUT.printf("%8s%8s%8s%8s%8s%14s' n","IDCID","DCID","IRID","TYPE","LUFLAG","BOUND")  
    x.each do |tab|  
        str=""  
        if tab[4]==1 then  
            str=">"  
        elsif tab[4]==2 then  
            str="<"  
        end  
        STDOUT.printf("%8d%8d%8d%8d%8s%14f' n",tab[0],tab[1],tab[2],tab[3],str,tab[5])  
    end

And the corresponding histories are obtained as follows:

    x=db.getAttachmentConstrHistory(xdbFileName)  
    STDOUT.printf("%8s%8s%14s' n","STEP","IDCID","VALUE")  
    x.each do |tab|  
        STDOUT.printf("%8d%8d%14f' n",tab[0],tab[1],tab[2])  
    end

Here, the history is printed for all optimization steps, as the corresponding parameter is not provided.

And similarly, the objective history is printed as follows:

    x=db.getAttachmentObjectiveHistory(xdbFileName)  
    STDOUT.printf("%8s%14s%8s%14s' n","STEP","OBJ.","IRID","Cst. VALUE")  
    x.each do |tab|  
        STDOUT.printf("%8d%14f%8d%14f' n",tab[0],tab[1],tab[2],tab[3])  
    end

You can remark that when a topometric optimization is calculated by Nastran as a design variable optimization. (Nastran defines automatically one design variable per element.)

The example is provided in file "RUBY/EX21/printSol200Infos.rb".