@@ -275,11 +275,16 @@ def add_field(
275275 mesh_location = meshed_region .elements
276276 else :
277277 raise ValueError ("Only elemental, nodal or faces location are supported for plotting." )
278- component_count = field .component_count
279- if component_count > 1 :
280- overall_data = np .full ((len (mesh_location ), component_count ), np .nan )
281- else :
282- overall_data = np .full (len (mesh_location ), np .nan )
278+ if field .component_count > 1 :
279+ # Take the norm
280+ field = dpf .core .operators .math .norm (field = field , server = field ._server ).eval ()
281+ # Patch for badly defined ls-dyna fields
282+ field = dpf .core .operators .logic .elementary_data_selector (
283+ field = field ,
284+ elementary_data_index = 0 ,
285+ server = field ._server ,
286+ ).eval ()
287+ overall_data = np .full (len (mesh_location ), np .nan )
283288 if location != locations .overall :
284289 ind , mask = mesh_location .map_scoping (field .scoping )
285290 overall_data [ind ] = field .data [mask ]
@@ -938,9 +943,17 @@ def plot_contour(
938943
939944 # Merge field data into a single array
940945 if component_count > 1 :
941- overall_data = np .full ((len (mesh_location ), component_count ), np .nan )
942- else :
943- overall_data = np .full (len (mesh_location ), np .nan )
946+ fields_container = dpf .core .operators .math .norm_fc (
947+ fields_container = fields_container , server = fields_container ._server
948+ ).eval ()
949+ # Patch for badly defined ls-dyna fields
950+ fields_container = dpf .core .operators .logic .elementary_data_selector_fc (
951+ fields_container = fields_container ,
952+ elementary_data_index = 0 ,
953+ server = fields_container ._server ,
954+ ).eval ()
955+
956+ overall_data = np .full (len (mesh_location ), np .nan )
944957
945958 for field in fields_container :
946959 ind , mask = mesh_location .map_scoping (field .scoping )
0 commit comments