Skip to content

Commit

Permalink
Merge pull request #98 from boschresearch/fix-warnings
Browse files Browse the repository at this point in the history
Fix warnings
  • Loading branch information
johannes-mueller authored Aug 28, 2024
2 parents ae2fcf8 + 7e3d665 commit cd5380d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
19 changes: 12 additions & 7 deletions src/pylife/mesh/gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ def _compute_gradient_hexahedral_single_node(self, xi, nodal_values, Jinv):

def _compute_gradient_hexahedral(self, df):

df["grad_x"] = 0
df["grad_y"] = 0
df["grad_z"] = 0
df["grad_x"] = 0.0
df["grad_y"] = 0.0
df["grad_z"] = 0.0

# extract node positions xij where i = node number from 1 to 8, j = coordinate axis
x11,x12,x13 = df.iloc[0,:3]
Expand Down Expand Up @@ -299,9 +299,9 @@ def _compute_gradient_simplex_single_node(self, node_index, nodal_values, Jinv):

def _compute_gradient_simplex(self, df):

df["grad_x"] = 0
df["grad_y"] = 0
df["grad_z"] = 0
df["grad_x"] = 0.0
df["grad_y"] = 0.0
df["grad_z"] = 0.0

# extract node positions xij where i = node number from 1 to 8, j = coordinate axis
x11,x12,x13 = df.iloc[0,:3]
Expand Down Expand Up @@ -377,7 +377,12 @@ def gradient_of(self, value_key):
assert value_key in self._obj

# extract only the needed columns, order and sort multi-index
df = self._obj[["x", "y", "z", value_key]].reorder_levels(["element_id", "node_id"]).sort_index(level="element_id", sort_remaining=False)
df = (
self._obj[["x", "y", "z", value_key]]
.reorder_levels(["element_id", "node_id"])
.sort_index(level="element_id", sort_remaining=False)
)


# apply the function which computes the gradient to every element separately
df_grad = df.groupby("element_id", group_keys=False).apply(self._compute_gradient)
Expand Down
1 change: 1 addition & 0 deletions src/pylife/strength/damage_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ def _compute_crack_opening_loop(self):
# if there is no hysteresis in the first run of the HCM algorithm, precompute some required values
# this is described in the correction document to the FKM nonlinear
if len(last_index_of_first_run) == 0:
last_index_of_first_run = 0

# compute helper variables for fatigue limit
a_0, delta_J_eff_th, _ = self._calculate_fatigue_limit_variables(D_akt)
Expand Down
4 changes: 2 additions & 2 deletions src/pylife/strength/fkm_load_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ def scaled_by_constant(self, gamma_L):
if len(self._obj.columns) >= 2:

# only scale the first column
result = self._obj.copy()
result.iloc[:,0] = result.iloc[:,0] * gamma_L
result = self._obj.copy().astype(np.float64)
result.iloc[:, 0] = result.iloc[:, 0] * gamma_L
return result

return self._obj * gamma_L
Expand Down

0 comments on commit cd5380d

Please sign in to comment.