SteveDoyle2/pyNastran

Generalize Nastran GUI result classes, so you can use them outside of the GUI

Opened this issue · 2 comments

This will enable nodal averaging. Note that the CompositeStrainStressResults2 doesn't support nodal averaging and probably doesn't need it.

The big goals are to:

  • simplify the interface to the class to make it easy to use outside of the GUI
  • speed up places that you can
  • allow for subsets of elements
  • allow for subsets of nodes (ideally by only selecting a subset of elements)

They're found in:

  • from pyNastran.converters.nastran.gui.result_objects.plate_stress_results import PlateStrainStressResults2
  • from pyNastran.converters.nastran.gui.result_objects.solid_stress_results import SolidStrainStressResults2
  • from pyNastran.converters.nastran.gui.result_objects.composite_stress_results import CompositeStrainStressResults2

An example of this is the PlateStrainStressResults2
model is the BDF object
subcase_id is probably not required, but is used for informational purposes in the annotation (gui corner text)
node_id / element_id are all the elements in the model
iresult_to_title_annotation_map should probably be brought inside the class and replaced with an is_stress/strain flag
plate_cases is a list of plates, so [cquad4_plate_stress, ctria3_plate_stress, cquad8_plate_stress, ...] or similar for strains
eid_to_nid_map is used to build to split the nodal and centroidal results. For nodal, we can precalculate some stuff needed for nodal averaging.

res = PlateStrainStressResults2(
    subcase_id, model,
    node_id, element_id,
    plate_cases, iresult_to_title_annotation_map, title,
    data_format='%g', is_variable_data_format=False,
    nlabels=None, labelsize=None, ncolors=None, colormap='',
    set_max_min=False,
    is_fiber_distance=plate_case.is_fiber_distance,
    eid_to_nid_map=eid_to_nid_map,
    uname='PlateStressStrainResults2')

Currently all user interactive data comes from set_sidebar_args, which is probably the least user friendly part of the class. This sets whether you want centroid/corner stress, as well as how you want to process layers (Top/Bottom) into a single stress. Finally, the nodal_combine variable would be Mean/Average for nodal averaging vs Max or Absolute Max.

Part of this generalization should be to allow for updating node_id/element_id to make it possible to look at a subset of nodes/elements. This should probably be done as part of the subsequent step.

@fmamitrotta I'm not sure how to assign you

Also, thank you for offering!

Got it! No worries, and thanks for the detailed description. I'll post update here as I progress.