Skip to content

Commit 2c1bfa3

Browse files
authored
Merge pull request #64 from honzatomek/bugfix/element_solid_strain
bugfix: element_solid_strain and i_solid_vars
2 parents 6335505 + 5b673a6 commit 2c1bfa3

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

lasso/dyna/d3plot.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4397,7 +4397,7 @@ def _read_states_solids(self, state_data: np.ndarray, var_index: int, array_dict
43974397
i_solid_var += n_history_vars
43984398

43994399
# strain
4400-
# they are the last 6 entries of the history vars
4400+
# they are the last 6 entries of the history vars (if ISTRN = 1)
44014401
if n_strain_vars:
44024402
try:
44034403
array_dict[ArrayType.element_solid_strain] = array_dict[
@@ -4416,34 +4416,46 @@ def _read_states_solids(self, state_data: np.ndarray, var_index: int, array_dict
44164416
LOGGER.warning(msg, "_read_states_solids, strain", trb_msg)
44174417

44184418
# plastic strain tensor
4419+
# if present, beginning of element_solid_history_variables (if ISTRN = 11)
44194420
if self.header.has_solid_shell_plastic_strain_tensor:
44204421
try:
4421-
array_dict[ArrayType.element_solid_plastic_strain_tensor] = solid_state_data[
4422-
:, :, :, i_solid_var : i_solid_var + 6
4423-
]
4422+
array_dict[ArrayType.element_solid_plastic_strain_tensor] = array_dict[
4423+
ArrayType.element_solid_history_variables
4424+
][:, :, :, :n_strain_vars]
4425+
4426+
array_dict[ArrayType.element_solid_history_variables] = array_dict[
4427+
ArrayType.element_solid_history_variables
4428+
][:, :, :, n_strain_vars:]
4429+
4430+
if not all(array_dict[ArrayType.element_solid_history_variables].shape):
4431+
del array_dict[ArrayType.element_solid_history_variables]
44244432
except Exception:
44254433
trb_msg = traceback.format_exc()
44264434
msg = "A failure in %s was caught:\n%s"
44274435
LOGGER.warning(
44284436
msg, "_read_states_solids, element_solid_plastic_strain_tensor", trb_msg
44294437
)
4430-
finally:
4431-
i_solid_var += 6
44324438

44334439
# thermal strain tensor
4440+
# if present, beginning of element_solid_history_variables
44344441
if self.header.has_solid_shell_thermal_strain_tensor:
44354442
try:
4436-
array_dict[ArrayType.element_solid_thermal_strain_tensor] = solid_state_data[
4437-
:, :, i_solid_var : i_solid_var + 6
4438-
]
4443+
array_dict[ArrayType.element_solid_thermal_strain_tensor] = array_dict[
4444+
ArrayType.element_solid_history_variables
4445+
][:, :, :, :n_strain_vars]
4446+
4447+
array_dict[ArrayType.element_solid_history_variables] = array_dict[
4448+
ArrayType.element_solid_history_variables
4449+
][:, :, :, n_strain_vars:]
4450+
4451+
if not all(array_dict[ArrayType.element_solid_history_variables].shape):
4452+
del array_dict[ArrayType.element_solid_history_variables]
44394453
except Exception:
44404454
trb_msg = traceback.format_exc()
44414455
msg = "A failure in %s was caught:\n%s"
44424456
LOGGER.warning(
44434457
msg, "_read_states_solids, element_solid_thermal_strain_tensor", trb_msg
44444458
)
4445-
finally:
4446-
i_solid_var += 6
44474459

44484460
# catch formatting in solid_state_datra
44494461
except Exception:

0 commit comments

Comments
 (0)