Skip to content

Commit

Permalink
Updating damage file with surface flaws 2
Browse files Browse the repository at this point in the history
  • Loading branch information
pschaugule committed Jul 31, 2023
1 parent 865bb62 commit f7d5a48
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 deletions srlife/damage.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,7 @@ def tube_surface_log_reliability(self, tube, material, receiver, time):
)
# Getting surface elements, surface normals and surface areas from surface_elements function
surface_elements, surface_normals, surface_areas = tube.surface_elements()
surface_stresses = self._calculate_surface_stresses(
stresses, surface_elements, surface_normals
)

temperatures = np.mean(tube.quadrature_results["temperature"], axis=-1)

# Figure out the number of repetitions of the load cycle
Expand All @@ -309,8 +307,9 @@ def tube_surface_log_reliability(self, tube, material, receiver, time):
)

# Surface element log reliability
# Write a condition here to check here for attribute calculate_surface_element_log_reliability
# present in damage_model
# Write a condition here to check here for
# presence of function calculate_surface_element_log_reliability
# in each fracture criteria
inc_prob = self.calculate_surface_element_log_reliability(
tube.times,
stresses,
Expand Down Expand Up @@ -355,9 +354,7 @@ def tube_total_log_reliability(self, tube, material, receiver, time):
)
# Getting surface elements, surface normals and surface areas from surface_elements function
surface_elements, surface_normals, surface_areas = tube.surface_elements()
surface_stresses = self._calculate_surface_stresses(
stresses, surface_elements, surface_normals
)

# Indices where surface elements is True
surface_indices = np.where(surface_elements)[0]
temperatures = np.mean(tube.quadrature_results["temperature"], axis=-1)
Expand Down Expand Up @@ -830,7 +827,7 @@ def calculate_surface_flattened_eq_stress(
B = material.Bs(temperatures)

# Surface normals and surface elements
count_surface_elements = np.count_nonzero(surface_elements == True)
count_surface_elements = np.count_nonzero(surface_elements is True)

# Temperature average values
mavg = np.mean(mvals, axis=0)[:count_surface_elements]
Expand Down Expand Up @@ -979,7 +976,7 @@ def calculate_surface_element_log_reliability(
# Surface normals and surface elements
surface_normals = normals
surface_elements = surface
count_surface_elements = np.count_nonzero(surface_elements == True)
count_surface_elements = np.count_nonzero(surface_elements is True)

# Temperature average values
mavg = np.mean(mvals, axis=0)[:count_surface_elements]
Expand Down Expand Up @@ -1119,7 +1116,7 @@ def calculate_surface_element_log_reliability(
surface_normals = normals
surface_elements = surface
# surface_areas = areas
count_surface_elements = np.count_nonzero(surface_elements == True)
count_surface_elements = np.count_nonzero(surface_elements is True)

# Temperature average values
mavg = np.mean(mvals, axis=0)[:count_surface_elements]
Expand Down Expand Up @@ -1284,7 +1281,7 @@ def calculate_surface_avg_normal_stress(
# Surface normals and surface elements
normals = surface_normals
surface = surface_elements
count_surface_elements = np.count_nonzero(surface_elements == True)
count_surface_elements = np.count_nonzero(surface_elements is True)

# Temperature average values
mavg = np.mean(mvals, axis=0)[:count_surface_elements]
Expand Down Expand Up @@ -1414,7 +1411,7 @@ def calculate_surface_element_log_reliability(
# Surface normals and surface elements
surface_normals = normals
surface_elements = surface
count_surface_elements = np.count_nonzero(surface_elements == True)
count_surface_elements = np.count_nonzero(surface_elements is True)

# Temperature average values
mavg = np.mean(mvals, axis=0)[:count_surface_elements]
Expand Down Expand Up @@ -1639,8 +1636,8 @@ def calculate_surface_eq_stress(
Calculate the equivalent stresses from the normal and shear stresses in surface elements
"""
# Surface normals and surface elements
surface_normals = normals
surface_elements = surface
# surface_normals = normals
# surface_elements = surface

# Normal stress
sigma_n = self.calculate_surface_normal_stress(mandel_stress, surface, normals)
Expand Down Expand Up @@ -1772,9 +1769,9 @@ def calculate_surface_eq_stress(
"""

# Surface normals and surface elements
surface_normals = normals
# surface_normals = normals
surface_elements = surface
count_surface_elements = np.count_nonzero(surface_elements == True)
count_surface_elements = np.count_nonzero(surface_elements is True)

# Material parameters
nu = np.mean(material.nu(temperatures), axis=0)[:count_surface_elements]
Expand Down Expand Up @@ -1923,9 +1920,9 @@ def calculate_surface_eq_stress(
"""

# Surface normals and surface elements
surface_normals = normals
# surface_normals = normals
surface_elements = surface
count_surface_elements = np.count_nonzero(surface_elements == True)
count_surface_elements = np.count_nonzero(surface_elements is True)

# Material parameters
cbar = np.mean(material.c_bar(temperatures), axis=0)[:count_surface_elements]
Expand Down Expand Up @@ -2012,12 +2009,12 @@ def calculate_surface_eq_stress(
"""

# Surface normals and surface elements
surface_normals = normals
# surface_normals = normals
surface_elements = surface
count_surface_elements = np.count_nonzero(surface_elements == True)
count_surface_elements = np.count_nonzero(surface_elements is True)

# Material parameters
nu = np.mean(material.nu(temperatures), axis=0)[:count_surface_elements]
# nu = np.mean(material.nu(temperatures), axis=0)[:count_surface_elements]
cbar = np.mean(material.c_bar(temperatures), axis=0)[:count_surface_elements]

# Normal stress
Expand Down Expand Up @@ -2196,10 +2193,10 @@ def calculate_surface_eq_stress(
# Surface normals and surface elements
surface_normals = normals
surface_elements = surface
count_surface_elements = np.count_nonzero(surface_elements == True)
count_surface_elements = np.count_nonzero(surface_elements is True)

# Material parameters
nu = np.mean(material.nu(temperatures), axis=0)[:count_surface_elements]
# nu = np.mean(material.nu(temperatures), axis=0)[:count_surface_elements]
cbar = np.mean(material.c_bar(temperatures), axis=0)[:count_surface_elements]

# Normal stress
Expand Down

0 comments on commit f7d5a48

Please sign in to comment.