pyNastran icon indicating copy to clipboard operation
pyNastran copied to clipboard

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

Open SteveDoyle2 opened this issue 11 months ago • 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.

SteveDoyle2 avatar Mar 17 '24 21:03 SteveDoyle2