Creating sets of shells' elements and nodes

46 views
Skip to first unread message

Refaat Yakoub

unread,
Apr 16, 2015, 5:14:47 PM4/16/15
to pynastra...@googlegroups.com
My objective is to export results on shells elements and notes.  I thought of the following steps but not sure if it is the most efficient:

  1. Loop for all mesh elements
  2. Check if element.type is a shell type
  3. if it is, add its ID and its nodes IDs to a container
  4. Assign each container to a set number
Is this the way to do it or is there a more efficient way?


steve

unread,
Apr 16, 2015, 5:36:13 PM4/16/15
to pynastra...@googlegroups.com
I guess my first question is what do you mean by notes and "results"?  Do you mean results such as stress or thickness?  If you're after stress, what type of elements and properties (e.g. PSHELL vs. PCOMP)?  Also, do you only want a subset of the elements?

Steve

Refaat Yakoub

unread,
Apr 16, 2015, 5:38:08 PM4/16/15
to pynastra...@googlegroups.com
I want to output stress results at a subset of the elements (only at shells).  I also want to output displacement at the nodes of the shells only.

--
You received this message because you are subscribed to a topic in the Google Groups "pyNastran Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pynastran-discuss/0XThuqCS6h8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pynastran-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

steve

unread,
Apr 16, 2015, 6:30:16 PM4/16/15
to pynastra...@googlegroups.com
I'd start with this (this is for v0.7 version).

model = OP2()
model.read_op2(op2_filename)
isubcase = 1
itime = 0
quad_stress = model.cquad4_stress[isubcase]

#[fiber_dist, oxx, oyy, txy, angle, majorP, minorP, ovm] -> 5 for max_principal
max_principal_stress = quad_stress[itime, :, 5]

nnodes = quad_stress.nnodes  # this will be 1 or 5 (centroid or 4+centroid) for cquads


So, here's where you can get some differences.  If you have bilinear elements, presumably you'll drop the centroidal stresses and just use the nodal stresses.  In that case, you can just get the node ids from:

nodes = quad_stress.element_node[:, 1]
i = where(nodes != 0)[0]

nodes_only = nodes[i]
max_principal_nodes_only = max_principal_stress[i]

Since you'll have nodes with the same IDs on different elements, you'll now need to average the stresses.

If you have centroidal stresses, you'll need to map the element ids to the nodes ids, pull the stresses, and average the stresses.   You'll need to read the BDF and loop over the elements to extract the node IDs in that case.

Once you have the node IDs, you can use:
disp = model.displacements[isubcase]

# tx, ty, tz, rx, ry, rz - be careful of the CD coordinate system
t_xyz = disp.data[itime, :, 3]
disp_nodes = disp.node_gridtype[:, 0]

Then use the unique set of nodes that you want displacements for:
unodes = unique(nodes_only)

and loop over them to get the index:
j = searchsorted(disp_nodes, unodes)

and get the displacements:
disp_out = t_xyz[j, :]

Then just do that for the different element types (e.g. ctria3_stress, ctria6_stress, etc.) and write them out.

Refaat Yakoub

unread,
Apr 16, 2015, 6:34:40 PM4/16/15
to pynastra...@googlegroups.com
I'm sorry I must have confused you. I wanted to do this on the bdf model to create the sets in the case control for stress and displacement output. 
--

steve

unread,
Apr 16, 2015, 6:56:35 PM4/16/15
to pynastra...@googlegroups.com
Oh.  It wasn't clear.

model = BDF()
model.read_bdf(bdf_filename)

eids = []
nodes = []
for eid, element in model.elements:
    if element.type in ['CQUAD4', 'CTRIA3', 'CQUAD8', 'CTRIA6']:
        nodes += element.nodeIDs()
        eids.append(eid)

unodes = unique(nodes)

then just write the set cards.

Refaat Yakoub

unread,
Apr 16, 2015, 7:39:19 PM4/16/15
to pynastra...@googlegroups.com
Thank you so much, do you have a recommendation on writing the ordered id's like 1-900 instead of 1,2,3,...900


On Thursday, April 16, 2015, steve <mesh...@gmail.com> wrote:

Steven Doyle

unread,
Apr 16, 2015, 7:44:05 PM4/16/15
to pynastra...@googlegroups.com
I'm not familiar with Case control SET cards beyond that just doing 1,2,3,4...900.  I'd just look in the QRG.

--
You received this message because you are subscribed to the Google Groups "pyNastran Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynastran-disc...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages