MPC Data from BDF Readin

80 views
Skip to first unread message

Dan Mueller

unread,
Sep 16, 2013, 2:09:52 PM9/16/13
to pynastra...@googlegroups.com
Developers, I am trying to import a BDF using

model=BDF()
model
.readBDF('my_model.bdf',xref=True)

in order to view some attributes of MPCs that I have in my model. When I view model.mpcs, I get a blank dictionary (i.e. nothing). I did get other information from my input deck (i.e. LBC, materials, CQUAD/CBEAM elements, etc.), so I know the input was successful. Additionally,

model.reject_cards

returned a blank list. Is there another way to look at my MPC attributes using something embedded in pyNastran? This would be a nice capability to have.

Thanks,
Dan

Nikolay Asmolovskiy

unread,
Sep 17, 2013, 3:57:41 PM9/17/13
to pynastra...@googlegroups.com
Hi Dan,

silly question: did you put MPC in cardsToRead set?

The following code works for me:

mesh = BDF(debug=True,log=None)
mesh
.cardsToRead = set(['MPC', 'GRID'])

mesh
.readBDF( 'mpc.bdf', includeDir=None, xref=False)
for mpc_id, mpc_list in mesh.mpcs.items():
   
for mpc_obj in mpc_list:
       
print (mpc_obj.__dict__)



Regards,
Nikolay

Dan Mueller

unread,
Sep 18, 2013, 11:41:32 AM9/18/13
to pynastra...@googlegroups.com
I still get mesh.mpcs as a blank dictionary. If it helps a sample RBE3 card is:

RBE3*    8621                            444             123456
*       .088208302855491 123             3              .077371001243591
*        123             4               234            .036704599857330
*        123             5               240            .003437699982896
*        123             6               246            .072630301117897
*        123             9               124            .060673501342535
*        123             10              235            .025742700323462
*        123             11              241            .001591900014318
*        123             12              247            .028526199981570
*        123             15              130            .022312900051474
*        123             16              236            .007842199876904
*        123             17              242            .056956101208925
*        123             125            .020848499611020 123
*        126             131            .006792999804019 123
*        132            .064821496605873 123             344
*       .027657000347971 123             345             349
*       .001845799968577 123             346             354
*       .008852900005877 123             350
*        ALPHA          1.0000000036-15
*


and a sample RBE2 card is:

RBE2*    8623            445             36              1
*       4.99999987369-5


Unfortunately I can't share the whole input deck. Any ideas why I can't get this information here?

Thanks,
Dan

Nikolay Asmolovskiy

unread,
Sep 18, 2013, 11:55:11 AM9/18/13
to pynastra...@googlegroups.com
Hi,

Do you have any MPC cards in your input? mesh.mpcs is the dictionary with all objects generated after parsing MPC and MPCADD cards. 
If your Multi-point constraints are defined by rigid body elements, then you have to address mesh.elements.

Regards,
Nikolay

Dan Mueller

unread,
Sep 20, 2013, 1:37:41 PM9/20/13
to pynastra...@googlegroups.com
I mistakenly didn't post this thread here. Here it is! Thanks Nikolay....I'm beginning to understand how this works now. One final question: is there a way go get ALL of the cards read in from your deck?

Thanks,
Dan

hi Dan,

you have to specify explicitly all cards you want to parse. For example,
mesh.cardsToRead = set(['MPC', 'GRID', 'QUAD4', 'PSHELL', 'PCOMP',
'RBE2', 'RBE3'])
reads all MPCs, GRIDs, 4-node shell elements, shell and composite
properties, and rigid body elements.
These items are parsed and added to the mesh.mpcs, mesh.nodes,
mesh.elements and mesh.properties dictionaries.

In order to check which cards are ignored during the parsing, I
suggest to use  debug mode ("BDF(debug=True, log=None)").
Good luck!

PS: you can post this in the groups as well ;)



2013/9/20 Dan Mueller:
> Ah I see. When you explain it that way I understand why I'm not getting
> anything there. This uncovered another issue though....my mesh.elements is
> blank. mesh.nodes isn't and some other data structures aren't, but it looks
> like other entities aren't included in BDF read in. What is the best way to
> check if anything was skipped over during parsing of the BDF file?
>
> Thanks,
> Dan

Nikolay Asmolovskiy

unread,
Sep 20, 2013, 1:50:37 PM9/20/13
to pynastra...@googlegroups.com

Effectively if you omit definition of mesh.cardsToRead pyNastran tries to read all cards from your deck.

I usually prefer to control the input, therefore I define mesh.cardsToRead every time. But this is my personal approach.

In your case, simply delete this line, and it should work as you want it to.

Dan Mueller

unread,
Sep 23, 2013, 12:18:52 AM9/23/13
to pynastra...@googlegroups.com
Nikolay, I still don't seem to be getting my RBE2/RBE3 cards. I've omitted the mesh.cardsToRead line, but only get CQUAD4, CBEAM, and CBUSH outputs (these plus RBE2/RBE3 elements are all of the card types that I am interested in from my input deck). This should print out my RBE2/RBE3 cards I think:

from pyNastran.bdf.bdf import BDF

mesh = BDF(debug=True, log=None)
# instantiates the class with the default set of cards
# debug - prints messages
# log   - if you pass in a python logging object that will be used
# instead of the dummy logger that is created internally

# mesh.cardsToRead = set(['RBE2','RBE3','CQUAD4'])
# not required, but lets you limit the cards
# if there's a problem with one

bdfFileIn="one_fastener_simple_r36_ds_101_nc.bdf"
mesh.readBDF(bdfFileIn,includeDir=None,xref=False) # reads the bdf
#includeDir lets you append path information onto the include files
#xref=True links up nodes, elements, properties, materials to make it easier to reference data

# Print out some data from this input deck.
items=len(mesh.elements)
for i in range(1,items):
if mesh.elements[i].type!=u'CQUAD4' and mesh.elements[i].type!=u'CBEAM':
print mesh.elements[i]
print mesh.elements[i].type
Am I missing something still, or does this seem right?

Thanks,
Dan

Steven Doyle

unread,
Sep 23, 2013, 12:46:38 AM9/23/13
to pynastra...@googlegroups.com
RBE2, RBE3, RBAR, RBAR1, and RJOINT cards are stored in mesh.rigidElements.  You should be able to see that from

>>> print mesh.card_stats()


--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Dan Mueller

unread,
Sep 23, 2013, 1:01:18 AM9/23/13
to pynastra...@googlegroups.com
That's an excellent line of code. That helps me navigate this a little bit. Thanks Steve/Nikolay.

Dan
Reply all
Reply to author
Forward
0 new messages