@@ -1285,7 +1285,8 @@ class SphSectionInfo:
1285
1285
has_material_density : bool = False
1286
1286
has_internal_energy : bool = False
1287
1287
has_n_affecting_neighbors : bool = False
1288
- has_strain_and_strainrate : bool = False
1288
+ has_strain : bool = False
1289
+ has_strainrate : bool = False
1289
1290
has_true_strains : bool = False
1290
1291
has_mass : bool = False
1291
1292
n_sph_history_vars : int = 0
@@ -2193,7 +2194,8 @@ def _read_sph_element_data_flags(self):
2193
2194
self ._sph_info .has_material_density = sph_header_data ["isphfg6" ] != 0
2194
2195
self ._sph_info .has_internal_energy = sph_header_data ["isphfg7" ] != 0
2195
2196
self ._sph_info .has_n_affecting_neighbors = sph_header_data ["isphfg8" ] != 0
2196
- self ._sph_info .has_strain_and_strainrate = sph_header_data ["isphfg9" ] != 0
2197
+ self ._sph_info .has_strain = sph_header_data ["isphfg9" ] != 0
2198
+ self ._sph_info .has_strainrate = sph_header_data ["isphfg9" ] > 6
2197
2199
self ._sph_info .has_true_strains = sph_header_data ["isphfg9" ] < 0
2198
2200
self ._sph_info .has_mass = sph_header_data ["isphfg10" ] != 0
2199
2201
self ._sph_info .n_sph_history_vars = sph_header_data ["isphfg11" ]
@@ -5082,13 +5084,17 @@ def _read_states_sph(self, state_data: np.ndarray, var_index: int, array_dict: d
5082
5084
5083
5085
# extract data
5084
5086
try :
5085
- sph_data = state_data [:, var_index : var_index + n_particles * n_variables ]
5087
+ sph_data = state_data [:, var_index : var_index + n_particles * n_variables ].reshape ((
5088
+ n_states ,
5089
+ n_particles ,
5090
+ n_variables ,
5091
+ ))
5086
5092
5087
5093
i_var = 1
5088
5094
5089
5095
# deletion
5090
5096
try :
5091
- array_dict [ArrayType .sph_deletion ] = sph_data [:, 0 ] < 0
5097
+ array_dict [ArrayType .sph_deletion ] = sph_data [:, :, 0 ] < 0
5092
5098
except Exception :
5093
5099
trb_msg = traceback .format_exc ()
5094
5100
msg = "A failure in %s was caught:\n %s"
@@ -5097,7 +5103,7 @@ def _read_states_sph(self, state_data: np.ndarray, var_index: int, array_dict: d
5097
5103
# particle radius
5098
5104
if info .has_influence_radius :
5099
5105
try :
5100
- array_dict [ArrayType .sph_radius ] = sph_data [:, i_var ]
5106
+ array_dict [ArrayType .sph_radius ] = sph_data [:, :, i_var ]
5101
5107
except Exception :
5102
5108
trb_msg = traceback .format_exc ()
5103
5109
msg = "A failure in %s was caught:\n %s"
@@ -5108,7 +5114,7 @@ def _read_states_sph(self, state_data: np.ndarray, var_index: int, array_dict: d
5108
5114
# pressure
5109
5115
if info .has_particle_pressure :
5110
5116
try :
5111
- array_dict [ArrayType .sph_pressure ] = sph_data [:, i_var ]
5117
+ array_dict [ArrayType .sph_pressure ] = sph_data [:, :, i_var ]
5112
5118
except Exception :
5113
5119
trb_msg = traceback .format_exc ()
5114
5120
msg = "A failure in %s was caught:\n %s"
@@ -5119,20 +5125,18 @@ def _read_states_sph(self, state_data: np.ndarray, var_index: int, array_dict: d
5119
5125
# stress
5120
5126
if info .has_stresses :
5121
5127
try :
5122
- array_dict [ArrayType .sph_stress ] = sph_data [
5123
- :, i_var : i_var + n_particles * 6
5124
- ].reshape ((n_states , n_particles , 6 ))
5128
+ array_dict [ArrayType .sph_stress ] = sph_data [:, :, i_var : i_var + 6 ]
5125
5129
except Exception :
5126
5130
trb_msg = traceback .format_exc ()
5127
5131
msg = "A failure in %s was caught:\n %s"
5128
5132
LOGGER .warning (msg , "_read_states_sph, pressure" , trb_msg )
5129
5133
finally :
5130
- i_var += 6 * n_particles
5134
+ i_var += 6
5131
5135
5132
5136
# eff. plastic strain
5133
5137
if info .has_plastic_strain :
5134
5138
try :
5135
- array_dict [ArrayType .sph_effective_plastic_strain ] = sph_data [:, i_var ]
5139
+ array_dict [ArrayType .sph_effective_plastic_strain ] = sph_data [:, :, i_var ]
5136
5140
except Exception :
5137
5141
trb_msg = traceback .format_exc ()
5138
5142
msg = "A failure in %s was caught:\n %s"
@@ -5143,7 +5147,7 @@ def _read_states_sph(self, state_data: np.ndarray, var_index: int, array_dict: d
5143
5147
# density
5144
5148
if info .has_material_density :
5145
5149
try :
5146
- array_dict [ArrayType .sph_density ] = sph_data [:, i_var ]
5150
+ array_dict [ArrayType .sph_density ] = sph_data [:, :, i_var ]
5147
5151
except Exception :
5148
5152
trb_msg = traceback .format_exc ()
5149
5153
msg = "A failure in %s was caught:\n %s"
@@ -5154,7 +5158,7 @@ def _read_states_sph(self, state_data: np.ndarray, var_index: int, array_dict: d
5154
5158
# internal energy
5155
5159
if info .has_internal_energy :
5156
5160
try :
5157
- array_dict [ArrayType .sph_internal_energy ] = sph_data [:, i_var ]
5161
+ array_dict [ArrayType .sph_internal_energy ] = sph_data [:, :, i_var ]
5158
5162
except Exception :
5159
5163
trb_msg = traceback .format_exc ()
5160
5164
msg = "A failure in %s was caught:\n %s"
@@ -5165,42 +5169,39 @@ def _read_states_sph(self, state_data: np.ndarray, var_index: int, array_dict: d
5165
5169
# number of neighbors
5166
5170
if info .has_n_affecting_neighbors :
5167
5171
try :
5168
- array_dict [ArrayType .sph_n_neighbors ] = sph_data [:, i_var ]
5172
+ array_dict [ArrayType .sph_n_neighbors ] = sph_data [:, :, i_var ]
5169
5173
except Exception :
5170
5174
trb_msg = traceback .format_exc ()
5171
5175
msg = "A failure in %s was caught:\n %s"
5172
5176
LOGGER .warning (msg , "_read_states_sph, n_neighbors" , trb_msg )
5173
5177
finally :
5174
5178
i_var += 1
5175
5179
5176
- # strain and strainrate
5177
- if info .has_strain_and_strainrate :
5180
+ # strain
5181
+ if info .has_strain :
5178
5182
try :
5179
- array_dict [ArrayType .sph_strain ] = sph_data [
5180
- :, i_var : i_var + n_particles * 6
5181
- ].reshape ((n_states , n_particles , 6 ))
5183
+ array_dict [ArrayType .sph_strain ] = sph_data [:, :, i_var : i_var + 6 ]
5182
5184
except Exception :
5183
5185
trb_msg = traceback .format_exc ()
5184
5186
msg = "A failure in %s was caught:\n %s"
5185
5187
LOGGER .warning (msg , "_read_states_sph, strain" , trb_msg )
5186
5188
finally :
5187
- i_var += 6 * n_particles
5189
+ i_var += 6
5188
5190
5191
+ if info .has_strainrate :
5189
5192
try :
5190
- array_dict [ArrayType .sph_strainrate ] = sph_data [
5191
- :, i_var : i_var + n_particles * 6
5192
- ].reshape ((n_states , n_particles , 6 ))
5193
+ array_dict [ArrayType .sph_strainrate ] = sph_data [:, :, i_var : i_var + 6 ]
5193
5194
except Exception :
5194
5195
trb_msg = traceback .format_exc ()
5195
5196
msg = "A failure in %s was caught:\n %s"
5196
5197
LOGGER .warning (msg , "_read_states_sph, strainrate" , trb_msg )
5197
5198
finally :
5198
- i_var += 6 * n_particles
5199
+ i_var += 6
5199
5200
5200
5201
# mass
5201
5202
if info .has_mass :
5202
5203
try :
5203
- array_dict [ArrayType .sph_mass ] = sph_data [:, i_var ]
5204
+ array_dict [ArrayType .sph_mass ] = sph_data [:, :, i_var ]
5204
5205
except Exception :
5205
5206
trb_msg = traceback .format_exc ()
5206
5207
msg = "A failure in %s was caught:\n %s"
0 commit comments