%22%22%22Use%20Paris%20and%20Walker%20curves%20and%20compare%20legacy%20propagation%20geometries.%22%22%22%0A%0Aimport%20marimo%0A%0A__generated_with%20%3D%20%220.26.0%22%0Aapp%20%3D%20marimo.App(css_file%3D%22..%2Fdocs%2Fstylesheets%2Fcustom.css%22)%0A%0A%0A%40app.cell%0Adef%20introduction()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%0A%20%20%20%20mo.md(%22%22%22%0A%20%20%20%20%20%20%20%20%23%20Paris%20and%20Walker%20curves%20and%20legacy%20growth%0A%0A%20%20%20%20%20%20%20%20Compare%20Paris%20and%20Walker%20rates%20using%20the%20same%20synthetic%20material%0A%20%20%20%20%20%20%20%20coefficients.%20The%20Walker%20example%20specifies%20a%20stress%20ratio%20and%0A%20%20%20%20%20%20%20%20changes%20the%20rate%20as%20a%20function%20of%20stress%20intensity%20range.%0A%0A%20%20%20%20%20%20%20%20Then%20use%20the%20Paris%20curve%20with%20two%20geometries%20under%20the%20same%20two%0A%20%20%20%20%20%20%20%20stress%20ranges.%20The%20depth%20and%20stress%20intensity%20in%20the%20lower%20panels%0A%20%20%20%20%20%20%20%20are%20the%20values%20recorded%20at%20the%20start%20of%20each%20step.%0A%20%20%20%20%20%20%20%20%22%22%22)%0A%20%20%20%20return%20(mo%2C)%0A%0A%0A%40app.cell%0Adef%20calculate(mo)%3A%0A%20%20%20%20import%20matplotlib.pyplot%20as%20plt%0A%20%20%20%20import%20numpy%20as%20np%0A%20%20%20%20from%20py_fatigue%20import%20CycleCount%2C%20ParisCurve%2C%20WalkerCurve%0A%20%20%20%20from%20py_fatigue.damage%20import%20get_crack_growth%0A%20%20%20%20from%20py_fatigue.geometry%20import%20HollowCylinder%2C%20InfiniteSurface%0A%20%20%20%20from%20_examples.charts%20import%20plot_views%0A%0A%20%20%20%20material%20%3D%20dict(slope%3D3.0%2C%20intercept%3D1e-10%2C%20threshold%3D20.0%2C%20critical%3D2000.0)%0A%20%20%20%20paris%20%3D%20ParisCurve(**material)%0A%20%20%20%20walker%20%3D%20WalkerCurve(**material%2C%20load_ratio%3D0.1%2C%20walker_exponent%3D0.5)%0A%20%20%20%20cycles%20%3D%20CycleCount(%0A%20%20%20%20%20%20%20%20stress_range%3Dnp.array(%5B50.0%2C%2070.0%5D)%2C%0A%20%20%20%20%20%20%20%20mean_stress%3Dnp.zeros(2)%2C%0A%20%20%20%20%20%20%20%20count_cycle%3Dnp.array(%5B3.0%2C%202.0%5D)%2C%0A%20%20%20%20)%0A%20%20%20%20geometries%20%3D%20%7B%0A%20%20%20%20%20%20%20%20%22Infinite%20surface%22%3A%20InfiniteSurface(initial_depth%3D1.0)%2C%0A%20%20%20%20%20%20%20%20%22External%20cylinder%20crack%22%3A%20HollowCylinder(%0A%20%20%20%20%20%20%20%20%20%20%20%20initial_depth%3D1.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20outer_diameter%3D100.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20thickness%3D10.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20height%3D100.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20crack_position%3D%22external%22%2C%0A%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%7D%0A%0A%20%20%20%20fig%2C%20(law%2C%20depth%2C%20intensity)%20%3D%20plt.subplots(%0A%20%20%20%20%20%20%20%203%2C%201%2C%20figsize%3D(7%2C%209)%2C%20layout%3D%22constrained%22%0A%20%20%20%20)%0A%20%20%20%20paris.plot(ax%3Dlaw)%0A%20%20%20%20law.lines%5B-1%5D.set_label(%22Paris%22)%0A%20%20%20%20walker.plot(ax%3Dlaw)%0A%20%20%20%20law.lines%5B-1%5D.set_label(f%22Walker%20%C2%B7%20R%20%3D%20%7Bwalker.load_ratio%3Ag%7D%22)%0A%20%20%20%20law.set(ylabel%3D%22Growth%20rate%20(mm%2Fcycle)%22)%0A%20%20%20%20law.legend()%0A%0A%20%20%20%20summary%20%3D%20%5B%5D%0A%20%20%20%20for%20label%2C%20crack%20in%20geometries.items()%3A%0A%20%20%20%20%20%20%20%20result%20%3D%20get_crack_growth(cycles%2C%20paris%2C%20crack)%0A%20%20%20%20%20%20%20%20result.plot(ax%3Ddepth)%0A%20%20%20%20%20%20%20%20depth.lines%5B-1%5D.set_label(label)%0A%20%20%20%20%20%20%20%20saved_steps%20%3D%20len(result.crack_depth)%0A%20%20%20%20%20%20%20%20step_start%20%3D%20np.r_%5B%0A%20%20%20%20%20%20%20%20%20%20%20%200.0%2C%20np.cumsum(result.count_cycle%5B%3A%20saved_steps%20-%201%5D)%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20intensity.plot(step_start%2C%20result.sif%2C%20%22o-%22%2C%20label%3Dlabel)%0A%20%20%20%20%20%20%20%20summary.append(%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Geometry%22%3A%20label%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Cycles%20processed%22%3A%20result.final_cycles%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Last%20recorded%20depth%20(mm)%22%3A%20float(result.crack_depth%5B-1%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Last%20geometry%20factor%22%3A%20float(result.geometry_factor%5B-1%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20depth.set_ylabel(%22Crack%20depth%20(mm)%22)%0A%20%20%20%20depth.legend()%0A%20%20%20%20intensity.set(xlabel%3D%22Cycles%20at%20start%20of%20step%22%2C%20ylabel%3D%22%CE%94K%20(MPa%20%E2%88%9Amm)%22)%0A%20%20%20%20intensity.legend()%0A%0A%20%20%20%20mo.vstack(%0A%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20plot_views(fig%2C%20height%3D%221240px%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.ui.table(summary)%2C%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20)%0A%20%20%20%20return%20geometries%2C%20paris%0A%0A%0A%40app.cell%0Adef%20long_case(geometries%2C%20paris)%3A%0A%20%20%20%20import%20matplotlib.pyplot%20as%20_plt%0A%20%20%20%20import%20numpy%20as%20_np%0A%20%20%20%20from%20_examples.synthetic%20import%20(%0A%20%20%20%20%20%20%20%20MINIMUM_STRESS%2C%0A%20%20%20%20%20%20%20%20display_indices%2C%0A%20%20%20%20%20%20%20%20long_case_view%2C%0A%20%20%20%20%20%20%20%20synthetic_peaks%2C%0A%20%20%20%20)%0A%20%20%20%20from%20py_fatigue%20import%20CycleCount%20as%20_CycleCount%0A%20%20%20%20from%20py_fatigue.damage%20import%20get_crack_growth%20as%20_get_crack_growth%0A%0A%20%20%20%20peaks%20%3D%20synthetic_peaks()%0A%20%20%20%20spectrum%20%3D%20_CycleCount(%0A%20%20%20%20%20%20%20%20stress_range%3Dpeaks%20-%20MINIMUM_STRESS%2C%0A%20%20%20%20%20%20%20%20mean_stress%3D(peaks%20%2B%20MINIMUM_STRESS)%20%2F%202%2C%0A%20%20%20%20%20%20%20%20count_cycle%3D_np.ones_like(peaks)%2C%0A%20%20%20%20)%0A%20%20%20%20long_fig%2C%20ax%20%3D%20_plt.subplots()%0A%20%20%20%20outcomes%20%3D%20%5B%5D%0A%20%20%20%20for%20long_label%2C%20geometry%20in%20geometries.items()%3A%0A%20%20%20%20%20%20%20%20growth%20%3D%20_get_crack_growth(spectrum%2C%20paris%2C%20geometry)%0A%20%20%20%20%20%20%20%20indices%20%3D%20display_indices(growth.crack_depth.size)%0A%20%20%20%20%20%20%20%20ax.plot(indices%2C%20growth.crack_depth%5Bindices%5D%2C%20label%3Dlong_label)%0A%20%20%20%20%20%20%20%20outcome%20%3D%20%22failure%22%20if%20growth.failure%20else%20%22spectrum%20completed%22%0A%20%20%20%20%20%20%20%20outcomes.append(%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22-%20**%7Blong_label%7D**%20%C2%B7%20%7Boutcome%7D%20after%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bgrowth.final_cycles%3A%2C.0f%7D%20cycles.%22%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20ax.set(%0A%20%20%20%20%20%20%20%20xlabel%3D%22Cycles%20at%20start%20of%20step%22%2C%0A%20%20%20%20%20%20%20%20ylabel%3D%22Crack%20depth%20(mm)%22%2C%0A%20%20%20%20%20%20%20%20yscale%3D%22log%22%2C%0A%20%20%20%20)%0A%20%20%20%20ax.legend()%0A%20%20%20%20long_case_view(%0A%20%20%20%20%20%20%20%20long_fig%2C%0A%20%20%20%20%20%20%20%20f%22Apply%20the%20Paris%20curve%20to%20**%7Bpeaks.size%3A%2C%7D%20generated%20cycles**%20in%20%22%0A%20%20%20%20%20%20%20%20%22order.%20Each%20input%20row%20represents%20one%20cycle.%20Compare%20how%20the%20two%20%22%0A%20%20%20%20%20%20%20%20%22geometries%20grow%20and%20where%20the%20legacy%20analysis%20stops.%5Cn%5Cn%22%0A%20%20%20%20%20%20%20%20%2B%20%22%5Cn%22.join(outcomes)%2C%0A%20%20%20%20)%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
5470383ee06c6d58c96a9aeca7c5cdce