Modifying element node numbers (again)

4 views
Skip to first unread message

clarkbr...@gmail.com

unread,
Feb 10, 2021, 7:03:51 PMFeb 10
to pyNastran Discuss
Steve,
I tried to understand/follow the thread dated Apr 9, 2019 titled Modifying the nodes that define an element. I tried the various ways you describe. Nothing will modify the element even tho all assignments do not generate a gripe.
I have a large model read from a .dat with the xref=True.
Wing spars are modeled as CBEAMs for upper and lower spar caps and the web is a CQUAD. I want to change the node numbers for some of them. For every CBEAM that has nodeA=3007 or 3019, I want it to be nodeA=3113.
I found the map:
nid_to_eids_map = model.get_node_id_to_elements_map()
Collected a list of elements:
elems=[]
elems.append(nid_to_eids_map[3007])
elems.append(nid_to_eids_map[3019])
So elems has some CBEAMs and some CQUADs:
[[$inboard right upper spar 0 caps for wing
  CBEAM       3001    3001    3007    3034     -1.      0.      0.,
  $inboard right upper spar 0 web for wing
  CQUAD4      3007    3007    3007    3034    3036    3009,
  $inboard left upper spar 0 caps for wing with inverted elem coord sys
  CBEAM       7001    7001    3007    5034      1.      0.      0.,
  $inboard left upper spar 0 web for wing
  CQUAD4      7007    7007    3007    5034    5036    3009],
 [$inboard right upper spar 2 caps for wing
  CBEAM       3005    3005    3019    3046     -1.      0.      0.,
  $inboard right upper spar 2 web for wing
  CQUAD4      3011    3011    3019    3046    3048    3021,
  $inboard left upper spar 2 caps for wing with inverted elem coord sys
  CBEAM       7005    7005    3019    5046      1.      0.      0.,
  $inboard left upper spar 2 web for wing
  CQUAD4      7011    7011    3019    5046    5048    3021]]
I try to change the first CBEAM:
elems[0][0].nodes_ref[0]=model.Node(3113)
but
elems[0][0]
is unchanged.
$inboard right upper spar 0 caps for wing
CBEAM       3001    3001    3007    3034     -1.      0.      0.
I tried
elems[0][0].nodes[0]=3113
but
elems[0][0]
is unchanged
$inboard right upper spar 0 caps for wing
CBEAM       3001    3001    3007    3034     -1.      0.      0.
I tried
elems[0][0].uncross_reference()
elems[0][0].nodes[0]=3113
elems[0][0].cross_reference(model)
but
elems[0][0]
is unchanged
$inboard right upper spar 0 caps for wing
CBEAM       3001    3001    3007    3034     -1.      0.      0.
I tried reading the .dat with xref=False and using
elems[0][0].nodes[0]=3113
but that didn't work either.
Please straighten me out. Actually, don't explain why some didn't work, but propose a way that should work.
Thanks,
Clark

clarkbr...@gmail.com

unread,
Feb 12, 2021, 4:07:45 PMFeb 12
to pyNastran Discuss
Steve
Perhaps my subsequent question about deleting implied this had been solved. It hasn't.
I gave up on the methods above and tried the desired changes with update_field().
This doesn't seem to work.
elems[0][0].update_field(3,3013)
elems[0][0]
Out[64]:
$inboard right upper spar 0 caps for wing
CBEAM       3001    3001    3007    3034     -1.      0.      0.

And model.Element(3001) shows its unchanged
model.Element(3001)
Out[69]:
$inboard right upper spar 0 caps for wing
CBEAM       3001    3001    3007    3034     -1.      0.      0.
But .get_field shows it is changed. it is element 3001
elems[0][0].get_field(1)
Out[72]: 3001
and field(3) has changed as desired
elems[0][0].get_field(3)
Out[71]: 3013
And so does
model.Element(3001).get_field(3)
Out[99]: 3013
Yet...
model.Element(3001)
Out[73]:
$inboard right upper spar 0 caps for wing
CBEAM       3001    3001    3007    3034     -1.      0.      0.
doesn't reflect that change.

If I press on and write the deck back out, the element is unchanged.
$inboard right upper spar 0 caps for wing
CBEAM       3001    3001    3007    3034     -1.      0.      0.

I'm pretty confused.
Clark

clarkbr...@gmail.com

unread,
Feb 12, 2021, 4:50:55 PMFeb 12
to pyNastran Discuss
Steve,
Patience please. I'm starting to understand a few things.
It seems that the list of elems I made were copies so changing them didn't change the model.
If I stick to changing model.elements, I seem to be changing the underlying data.
I'll keep working on the assumption. Hold off on answering until I get farther.
For example, I tried the strategy of deleting and recreating the element:
temp = elems[i][0]; del model.elements[temp.eid]
 model.add_cbeam(temp.get_field(1),temp.get_field(2),[rpivot_nodes[0],temp.get_field(4)],temp.x,g0=None)
This seems to work.
model.elements[3001]
Out[146]: CBEAM       3001    3001    3013    3034     -1.      0.      0.
And that element in the written out file is ok:
CBEAM       3001    3001    3013    3034     -1.      0.      0.

Clark
Reply all
Reply to author
Forward
0 new messages