Skip to content

bugfix: element_solid_strain and i_solid_vars #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions lasso/dyna/d3plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4397,7 +4397,7 @@ def _read_states_solids(self, state_data: np.ndarray, var_index: int, array_dict
i_solid_var += n_history_vars

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

# plastic strain tensor
# if present, beginning of element_solid_history_variables (if ISTRN = 11)
if self.header.has_solid_shell_plastic_strain_tensor:
try:
array_dict[ArrayType.element_solid_plastic_strain_tensor] = solid_state_data[
:, :, :, i_solid_var : i_solid_var + 6
]
array_dict[ArrayType.element_solid_plastic_strain_tensor] = array_dict[
ArrayType.element_solid_history_variables
][:, :, :, :n_strain_vars]

array_dict[ArrayType.element_solid_history_variables] = array_dict[
ArrayType.element_solid_history_variables
][:, :, :, n_strain_vars:]

if not all(array_dict[ArrayType.element_solid_history_variables].shape):
del array_dict[ArrayType.element_solid_history_variables]
except Exception:
trb_msg = traceback.format_exc()
msg = "A failure in %s was caught:\n%s"
LOGGER.warning(
msg, "_read_states_solids, element_solid_plastic_strain_tensor", trb_msg
)
finally:
i_solid_var += 6

# thermal strain tensor
# if present, beginning of element_solid_history_variables
if self.header.has_solid_shell_thermal_strain_tensor:
try:
array_dict[ArrayType.element_solid_thermal_strain_tensor] = solid_state_data[
:, :, i_solid_var : i_solid_var + 6
]
array_dict[ArrayType.element_solid_thermal_strain_tensor] = array_dict[
ArrayType.element_solid_history_variables
][:, :, :, :n_strain_vars]

array_dict[ArrayType.element_solid_history_variables] = array_dict[
ArrayType.element_solid_history_variables
][:, :, :, n_strain_vars:]

if not all(array_dict[ArrayType.element_solid_history_variables].shape):
del array_dict[ArrayType.element_solid_history_variables]
except Exception:
trb_msg = traceback.format_exc()
msg = "A failure in %s was caught:\n%s"
LOGGER.warning(
msg, "_read_states_solids, element_solid_thermal_strain_tensor", trb_msg
)
finally:
i_solid_var += 6

# catch formatting in solid_state_datra
except Exception:
Expand Down
Loading