SOL200: reading the DSCMCOL table

74 views
Skip to first unread message

Tom DW

unread,
Jul 18, 2018, 12:30:11 PM7/18/18
to pyNastran Discuss
Hi all,

I'm trying to use SOL200 for a topology optimization. The DSCM2 sensitivity matrix  is read out via OPTEXIT=-4. However, to know which derivative corresponds to which design variable, I need the DSCMCOL table. The following readout shows that pyNastran knows the table exists, but isn't able to read it:
DEBUG:   op2.py:547                   combine=True
DEBUG:   op2.py:548                   -------- reading op2 with read_mode=1 (array sizing) --------
...
DEBUG:   op2_scalar.py:1537             table_name='ONMD'
WARNING: minor_tables.py:1434         unexpected tout for ONMD: matrix_num=101 form=0 mrows=0 ncols=200 tout=0 nvalues=0 g=0
DEBUG:   op2_scalar.py:1537             table_name='DSCMCOL'
DEBUG:   op2_scalar.py:1537             table_name='DSCM2'
DEBUG:   op2_scalar.py:1537             table_name='DBCOPT'
DEBUG:   op2.py:560                   -------- reading op2 with read_mode=2 (array filling) --------
...
DEBUG:   op2_scalar.py:1537             table_name='ONMD'
DEBUG:   op2_scalar.py:1537             table_name='DSCMCOL'
DEBUG:   op2_scalar.py:1537             table_name='DSCM2'
DEBUG:   op2_scalar.py:1537             table_name='DBCOPT'
 
and via .get_op2_stats()

displacements[1]
  isubcase = 1
  type=RealDisplacementArray nnodes=341, table_name=BOUGV1
  data: [t1, t2, t3, r1, r2, r3] shape=[1, 341, 6] dtype=float32
  node_gridtype.shape = (341, 2)
  sort1
  lsdvmns = [1]

spc_forces[1]
  isubcase = 1
  type=RealSPCForcesArray nnodes=341, table_name=OQG1
  data: [t1, t2, t3, r1, r2, r3] shape=[1, 341, 6] dtype=float32
  node_gridtype.shape = (341, 2)
  sort1
  lsdvmns = [1]

cquad8_stress[1]
  type=RealPlateStressArray nelements=100 nnodes_per_element=5 nlayers=2 ntotal=1000
  data: [1, ntotal, 8] where 8=[fiber_distance, oxx, oyy, txy, angle, omax, omin, von_mises]
  element_node.shape = (1000, 2)
  data.shape=(1, 1000, 8)
  element type: CQUAD8
  s_code: 1
  sort1
  lsdvmns = [1]

cquad8_strain_energy[1]
  type=RealStrainEnergyArray nelements=101
  element: [1, nelements]; eid=100000000 -> total
  data: [1, nelements, 3] where 3=[strain_energy, percent, strain_energy_density]
  data.shape = (1, 101, 3)
  sort1
  lsdvmns = [0]

Matrix['DSCM2'];    shape=(81, 4);    type=scipy.sparse.coo.coo_matrix;      dtype=float64;   desc=rectangular
Matrix['ICASE'];   data=None;         type=<NoneType>                        dtype=<NoneType>;  desc=N/A
Matrix['ONMD'];    data=None;         type=<NoneType>                        dtype=<NoneType>;  desc=N/A



My question is: how to make pyNastran read out the DSCMCOL table? I have tried adding it to the additional_matrices attribute, but to no avail.

Kind regards,
Tom

PS: I know a similar question has been asked(https://groups.google.com/forum/#!topic/pynastran-discuss/tYdaKC0gVf8), but it received no answer .

Steven Doyle

unread,
Jul 19, 2018, 4:02:33 AM7/19/18
to pynastra...@googlegroups.com
Tom,

The DSCMCOL table is not supported.  I'm out of town at the moment, but you can parse it yourself and use the set_generalized_tables_to_read function.  That or send me a small bdf, f06, and op2 and I can take a look when I get back.

Steve

--
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/d/optout.

Tom De Weer

unread,
Jul 19, 2018, 4:44:21 AM7/19/18
to pynastra...@googlegroups.com
Hi Steve,

I am willing to parse the op2 file myself, however I'm not quite sure how it works. I understand I have to provide a read_table function myself, but I have no idea how to write this function. Is there an example I can use as inspiration?

Kind regards,
Tom

Op do 19 jul. 2018 om 10:02 schreef Steven Doyle <mesh...@gmail.com>:

Steven Doyle

unread,
Jul 19, 2018, 8:10:13 PM7/19/18
to pynastra...@googlegroups.com
Tom, 

I'd take a look at the matrix reading in op2/tables/minor_tables.py.  The single function approach requires that you read untul the final table marker (a -1 flag).

Depending on the size of the table, you can use the struct module or numpy frombuffer.  I usually start with struct though just because it's easier. The self.show_data function is also pretty useful to figure out what you have.  It's all just pattern matching (e.g., a node id for displacement isn't negative and counts up).

Simone Coniglio

unread,
Jan 31, 2021, 5:30:59 AM1/31/21
to pyNastran Discuss
Tom or Steve,
I am having the same need of Tom, 
Did you succeed in generating a function for that? Can you share that?
Is that included in the last version of pyNastran? 
Regards
Simone

Tom De Weer

unread,
Jan 31, 2021, 6:10:34 AM1/31/21
to pynastra...@googlegroups.com
Dear Simone,

I must admit that I never got it to work. My original goal was to use the sensitivities for my own optimization routine. If you have the same goal right now, then I suggest you take another approach(since reading tables is hard):

1. Output the assembled  and elemental stiffness matrices.
2. Compute the derivative wrt your objective function via the adjoint method.

It's what I did for my thesis and it worked quite well. However, it's certainly not straightforward. I can
give some more guidance if needed, so please let me know if that's the case.

Kind regards,
Tom


Simone Coniglio

unread,
Jan 31, 2021, 12:26:20 PM1/31/21
to pyNastran Discuss
Dear Tom,

I understand your suggestions, still I would prefer to directly read DSCMCOL from op2.

Doing as you say has the limitations of not exploiting directly nastran solver if you do displacement evaluation outside, together with adjoint, or has the problem of asking twice for nastran licence and K decomposition if after building the adjoint right hand side vector you re-pass it to Nastran as a load. 

There's always the option to parse the f06 but I would loose the double precision and I would also prefer to avoid that. 

I am definitely gonna try to parse the DSCMCOL table following Steve's suggestions still thank you for your propositions. 

Kind regards

Simone

Steven Doyle

unread,
Jan 31, 2021, 11:28:52 PM1/31/21
to pyNastran Discuss
Simone,

I did end up parsing the DSCMCOL.  It's actually fairly straightforward as it's just a DRESP1/2 table.  I did not go and compare it to the DSCM2 or stiffness matrices though.  There's also quite a few optimization types (e.g., static displacement vs. psd displacement), so there might be a few things missing, but that should be obvious.

There's an example in models/bugs/msc_dscmcol/goland_final_test.bdf/op2, which will fill up the op2.op2_results.design_response.DSCMCOL object.

Steve

Simone Coniglio

unread,
Feb 1, 2021, 5:08:34 PM2/1/21
to pynastra...@googlegroups.com
Thank you Steven, 
I was missing two lines in my nastran file. 
Now it works
Regards 
Simone 
Reply all
Reply to author
Forward
0 new messages