FeResPost Web Site                     FeResPost Online User Manual

IV.2.8.4 Producing a “clean” model from topometric optimization

We provide here an example where modeling information is read from the XDB file. The modeling information corresponds to the last output of a topometric optimization. The purpose of the script is to produce a “clean” FEM corresponding to the topometric optimization. The example is given in “RUBY/EX22/recoverTopometricModel.rb”.

The reading of PSHELL cards is done as follows:

pshellCards={}
db.each_xdbRaw(xdbFileName,["PSHELL",49],"iifififfffi") do |tab|
    card=[]
    card << "PSHELL"
    (0...10).each do |i|
        if (tab[i].class==Float&&tab[i].nan?) then
            card << ""
        else
            card << tab[i]
        end
    end
    if (tab[10]==0) then
        card << ""
    else
        card << tab[10]
    end
    pshellCards[tab[0]]=card
end

Remark that:

In the rest of the script, one generates renumbered PSHELL cards. Each PSHELL PID will be the same as the element ID of the CQUAD4 that refers to the property. The CQUAD4 elements are modified accordingly. The new Nastran cards are output in “newModel.bdf” file, and a GMSH file corresponding to the modified thicknesses is output:

outputCards=[]
propRemap={}
elemIds=cquad4Cards.keys.sort
elemIds.each do |elemId|
    elemCard=cquad4Cards[elemId].clone
    propId=elemCard[2]
    if propId>1000000 then
        elemCard[2]=elemId
        propRemap[propId]=elemId
    end
    outputCards << elemCard[0..7]
end

propIds=pshellCards.keys.sort
res=Result.new
res.TensorOrder=0
res.Format=1
propIds.each do |propId|
    propCard=pshellCards[propId].clone
    if propRemap.has_key?(propId) then
        propCard[1]=propRemap[propId]
        res.insert([propCard[1]],["NONE",propCard[3]])
    end
    outputCards << propCard[0..8]
end
NastranDb::writeNastranCards("newModel.bdf","w","right","short",outputCards)
#~ Util::printRes($stdout,"brol",res)
db.writeGmsh("thicknesses.gmsh",0,[[res,"thickness","ElemCenters"]])

Note that the example could be improved. For example, you could also consider the CTRIA3 elements in the model generation.