%22%22%22Propagate%20an%20external%20pipe%20crack%20under%20repeated%20axial%20loads.%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..%2F..%2Fdocs%2Fstylesheets%2Fcustom.css%22)%0A%0A%0A%40app.cell%0Adef%20inputs()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20import%20matplotlib.pyplot%20as%20plt%0A%20%20%20%20import%20numpy%20as%20np%0A%20%20%20%20from%20notebooks._examples.synthetic%20import%20(%0A%20%20%20%20%20%20%20%20display_indices%2C%0A%20%20%20%20%20%20%20%20plot_views%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%2C%20ParisCurve%0A%20%20%20%20from%20py_fatigue.damage%20import%20get_crack_growth%0A%20%20%20%20from%20py_fatigue.geometry%20import%20HollowCylinder%0A%0A%20%20%20%20mo.md(%22%22%22%0A%20%20%20%20%20%20%20%20%23%20Paris%20growth%20of%20an%20external%20pipe%20crack%0A%0A%20%20%20%20%20%20%20%20Define%20the%20pipe%20dimensions%20and%20the%20initial%20flaw.%0A%20%20%20%20%20%20%20%20Convert%20a%20synthetic%20axial%20force%20history%20to%20nominal%20stress%20using%0A%20%20%20%20%20%20%20%20the%20gross%20annulus%20area.%20Feed%20one%20row%20per%20known%20tensile%20cycle%20to%0A%20%20%20%20%20%20%20%20the%20legacy%20Paris%20solver%20and%20inspect%20the%20recorded%20crack%20surfaces.%0A%0A%20%20%20%20%20%20%20%20The%20dimensions%2C%20load%20history%20and%20Paris%20coefficients%20are%0A%20%20%20%20%20%20%20%20illustrative.%20The%20legacy%20pipe%20model%20keeps%20its%20crack%20width-to-depth%0A%20%20%20%20%20%20%20%20ratio%20fixed%20as%20depth%20increases.%0A%20%20%20%20%20%20%20%20%22%22%22)%0A%20%20%20%20geometry%20%3D%20HollowCylinder(%0A%20%20%20%20%20%20%20%20initial_depth%3D1.0%2C%0A%20%20%20%20%20%20%20%20outer_diameter%3D100.0%2C%0A%20%20%20%20%20%20%20%20thickness%3D10.0%2C%0A%20%20%20%20%20%20%20%20height%3D100.0%2C%0A%20%20%20%20%20%20%20%20crack_position%3D%22external%22%2C%0A%20%20%20%20)%0A%20%20%20%20curve%20%3D%20ParisCurve(%0A%20%20%20%20%20%20%20%20slope%3D3.0%2C%20intercept%3D1e-10%2C%20threshold%3D20.0%2C%20critical%3D2000.0%0A%20%20%20%20)%0A%20%20%20%20outer_radius%20%3D%20geometry.outer_diameter%20%2F%202%0A%20%20%20%20area%20%3D%20np.pi%20*%20(outer_radius**2%20-%20(outer_radius%20-%20geometry.thickness)%20**%202)%0A%20%20%20%20force_max%20%3D%20synthetic_peaks()%20%20%23%20kN%0A%20%20%20%20force_min%20%3D%2010.0%20%20%23%20kN%0A%20%20%20%20minimum%20%3D%20force_min%20*%201e3%20%2F%20area%0A%20%20%20%20maximum%20%3D%20force_max%20*%201e3%20%2F%20area%0A%20%20%20%20cycles%20%3D%20CycleCount(%0A%20%20%20%20%20%20%20%20stress_range%3Dmaximum%20-%20minimum%2C%0A%20%20%20%20%20%20%20%20mean_stress%3D(maximum%20%2B%20minimum)%20%2F%202%2C%0A%20%20%20%20%20%20%20%20count_cycle%3Dnp.ones_like(maximum)%2C%0A%20%20%20%20%20%20%20%20unit%3D%22MPa%22%2C%0A%20%20%20%20)%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%20%20curve%2C%0A%20%20%20%20%20%20%20%20cycles%2C%0A%20%20%20%20%20%20%20%20display_indices%2C%0A%20%20%20%20%20%20%20%20geometry%2C%0A%20%20%20%20%20%20%20%20get_crack_growth%2C%0A%20%20%20%20%20%20%20%20maximum%2C%0A%20%20%20%20%20%20%20%20minimum%2C%0A%20%20%20%20%20%20%20%20mo%2C%0A%20%20%20%20%20%20%20%20plot_views%2C%0A%20%20%20%20%20%20%20%20plt%2C%0A%20%20%20%20)%0A%0A%0A%40app.cell%0Adef%20analysis(%0A%20%20%20%20curve%2C%0A%20%20%20%20cycles%2C%0A%20%20%20%20display_indices%2C%0A%20%20%20%20geometry%2C%0A%20%20%20%20get_crack_growth%2C%0A%20%20%20%20maximum%2C%0A%20%20%20%20minimum%2C%0A%20%20%20%20mo%2C%0A%20%20%20%20plot_views%2C%0A%20%20%20%20plt%2C%0A)%3A%0A%20%20%20%20result%20%3D%20get_crack_growth(cycles%2C%20curve%2C%20geometry)%0A%20%20%20%20final_depth%20%3D%20float(result.crack_depth%5B-1%5D)%0A%20%20%20%20_fig%2C%20axes%20%3D%20plt.subplots(3%2C%202%2C%20figsize%3D(11%2C%2011)%2C%20layout%3D%22constrained%22)%0A%20%20%20%20curve.plot(ax%3Daxes%5B0%2C%200%5D)%0A%20%20%20%20indices%20%3D%20display_indices(maximum.size)%0A%20%20%20%20axes%5B0%2C%201%5D.plot(indices%20%2B%201%2C%20maximum%5Bindices%5D%2C%20label%3D%22Peak%22)%0A%20%20%20%20axes%5B0%2C%201%5D.axhline(minimum%2C%20linestyle%3D%22--%22%2C%20label%3D%22Minimum%22)%0A%20%20%20%20axes%5B0%2C%201%5D.set(xlabel%3D%22Cycle%22%2C%20ylabel%3D%22Axial%20stress%20(MPa)%22)%0A%20%20%20%20axes%5B0%2C%201%5D.legend()%0A%0A%20%20%20%20saved%20%3D%20display_indices(result.crack_depth.size)%0A%20%20%20%20axes%5B1%2C%200%5D.plot(saved%2C%20result.crack_depth%5Bsaved%5D)%0A%20%20%20%20axes%5B1%2C%201%5D.plot(saved%2C%20result.sif%5Bsaved%5D)%0A%20%20%20%20axes%5B1%2C%200%5D.set(xlabel%3D%22Cycle%20start%22%2C%20ylabel%3D%22Crack%20depth%20(mm)%22)%0A%20%20%20%20axes%5B1%2C%201%5D.set(xlabel%3D%22Cycle%20start%22%2C%20ylabel%3D%22%CE%94K%20(MPa%20%E2%88%9Amm)%22)%0A%20%20%20%20geometry.plot(ax%3Daxes%5B2%2C%200%5D)%0A%20%20%20%20geometry.plot(ax%3Daxes%5B2%2C%201%5D%2C%20depth%3Dfinal_depth)%0A%20%20%20%20for%20profile%2C%20title%20in%20zip(%0A%20%20%20%20%20%20%20%20axes%5B2%5D%2C%20(%22Initial%20crack%22%2C%20%22Last%20recorded%20crack%22)%0A%20%20%20%20)%3A%0A%20%20%20%20%20%20%20%20profile.set(%0A%20%20%20%20%20%20%20%20%20%20%20%20title%3Dtitle%2C%20xlabel%3D%22Section%20x%20(mm)%22%2C%20ylabel%3D%22Section%20y%20(mm)%22%0A%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20outcome%20%3D%20(%0A%20%20%20%20%20%20%20%20%22the%20solver%20reported%20failure%22%0A%20%20%20%20%20%20%20%20if%20result.failure%0A%20%20%20%20%20%20%20%20else%20%22the%20spectrum%20ended%22%0A%20%20%20%20)%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%20mo.md(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22%23%23%20Growth%20and%20stop%5Cn%5CnOf%20**%7Bmaximum.size%3A%2C%7D%20prescribed%20cycles**%2C%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22the%20solver%20processed%20**%7Bresult.final_cycles%3A%2C.0f%7D**%20before%20%7Boutcome%7D.%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22The%20last%20recorded%20start-of-step%20depth%20was%20**%7Bfinal_depth%3A.3f%7D%20mm**.%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Compare%20the%20Paris%20curve%2C%20%CE%94K%20history%2C%20and%20the%20two%20cross%20sections.%22%0A%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20plot_views(_fig)%2C%0A%20%20%20%20%20%20%20%20%5D%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
a31c4de94a3ff6c4d6de30ba0ed7344f