%22%22%22Propagate%20surface%20cracks%20in%20plates%2C%20pipes%2C%20bars%20and%20bolt%20threads.%22%22%22%0A%0Aimport%20marimo%0A%0A__generated_with%20%3D%20%220.26.0%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22%2C%20css_file%3D%22..%2Fdocs%2Fstylesheets%2Fcustom.css%22)%0A%0A%0A%40app.cell%0Adef%20introduction()%3A%0A%20%20%20%20from%20math%20import%20ceil%0A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20import%20matplotlib.pyplot%20as%20plt%0A%20%20%20%20from%20_examples.charts%20import%20plot_views%0A%0A%20%20%20%20mo.md(%22%22%22%0A%20%20%20%20%20%20%20%20%23%20Surface-crack%20growth%0A%0A%20%20%20%20%20%20%20%20Start%20with%20a%20finite-width%20plate%20and%20a%20semi-elliptical%20surface%0A%20%20%20%20%20%20%20%20crack%20(SC01).%20Under%20ordered%20tensile%20loads%2C%20the%20deepest%20point%20and%0A%20%20%20%20%20%20%20%20the%20free-surface%20point%20grow%20at%20different%20rates.%20The%20solver%20records%0A%20%20%20%20%20%20%20%20the%20**depth**%20and%20**surface%20half-length**%20in%20that%20order.%0A%0A%20%20%20%20%20%20%20%20Overlay%20the%20initial%20crack%20front%20and%20the%20last%20accepted%20front%20on%20the%0A%20%20%20%20%20%20%20%20plate%20cross%20section.%20Depth%20is%20measured%20downward%20from%20the%20free%0A%20%20%20%20%20%20%20%20surface.%20The%20material%20and%20loads%20are%20synthetic.%0A%0A%20%20%20%20%20%20%20%20In%20the%20round-bar%20case%20(SC07)%2C%20only%20the%20deepest%20point%20advances.%0A%20%20%20%20%20%20%20%20The%20crack%20front%20stays%20circular%20and%20meets%20the%20bar%20surface%20at%20right%20angles.%0A%0A%20%20%20%20%20%20%20%20The%20additional%20cases%20show%20an%20external%20pipe%20crack%20(SC05)%2C%20a%0A%20%20%20%20%20%20%20%20rolled%20bolt%20thread%20(SC08)%2C%20and%20symmetric%20cracks%20at%20a%20plate%20hole%0A%20%20%20%20%20%20%20%20(SC11).%20In%20each%20case%2C%20use%20the%20stress%20specified%20by%20its%20geometry.%0A%20%20%20%20%20%20%20%20%22%22%22)%0A%20%20%20%20return%20ceil%2C%20mo%2C%20plot_views%2C%20plt%0A%0A%0A%40app.cell%0Adef%20propagate(ceil)%3A%0A%20%20%20%20from%20py_fatigue.crack_growth%20import%20(%0A%20%20%20%20%20%20%20%20LoadBlock%2C%0A%20%20%20%20%20%20%20%20NasgroCurve%2C%0A%20%20%20%20%20%20%20%20SemiEllipticalSurfaceCrack%2C%0A%20%20%20%20%20%20%20%20simulate_crack_growth%2C%0A%20%20%20%20)%0A%0A%20%20%20%20geometry%20%3D%20SemiEllipticalSurfaceCrack(%0A%20%20%20%20%20%20%20%20half_width%3D50.0%2C%20thickness%3D15.0%2C%20depth%3D4.0%2C%20half_length%3D8.0%0A%20%20%20%20)%0A%20%20%20%20curve%20%3D%20NasgroCurve(1e-10%2C%202.0%2C%200.5%2C%201.0%2C%2025.0%2C%200.0%2C%20500.0%2C%202.0%2C%200.3)%0A%20%20%20%20loads%20%3D%20%5B%0A%20%20%20%20%20%20%20%20LoadBlock(10.0%2C%2070.0%2C%2050_000)%2C%0A%20%20%20%20%20%20%20%20LoadBlock(20.0%2C%2090.0%2C%2025_005)%2C%0A%20%20%20%20%20%20%20%20LoadBlock(10.0%2C%2060.0%2C%2025_000)%2C%0A%20%20%20%20%5D%0A%20%20%20%20step%20%3D%2010.0%0A%20%20%20%20trial_budget%20%3D%202%20*%20sum(ceil(block.cycles%20%2F%20step)%20for%20block%20in%20loads)%0A%20%20%20%20result%20%3D%20simulate_crack_growth(%0A%20%20%20%20%20%20%20%20geometry%2C%0A%20%20%20%20%20%20%20%20curve%2C%0A%20%20%20%20%20%20%20%20loads%2C%0A%20%20%20%20%20%20%20%20max_cycle_step%3Dstep%2C%0A%20%20%20%20%20%20%20%20length_tolerance%3D1e-6%2C%0A%20%20%20%20%20%20%20%20cycle_tolerance%3D1e-4%2C%0A%20%20%20%20%20%20%20%20max_trials%3Dtrial_budget%2C%0A%20%20%20%20)%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%20%20LoadBlock%2C%0A%20%20%20%20%20%20%20%20curve%2C%0A%20%20%20%20%20%20%20%20geometry%2C%0A%20%20%20%20%20%20%20%20loads%2C%0A%20%20%20%20%20%20%20%20result%2C%0A%20%20%20%20%20%20%20%20simulate_crack_growth%2C%0A%20%20%20%20%20%20%20%20step%2C%0A%20%20%20%20)%0A%0A%0A%40app.cell%0Adef%20ordered_profile(geometry%2C%20loads%2C%20mo%2C%20plot_views%2C%20plt%2C%20result)%3A%0A%20%20%20%20fig%2C%20(profile%2C%20history)%20%3D%20plt.subplots(%0A%20%20%20%20%20%20%20%202%2C%201%2C%20figsize%3D(7%2C%206)%2C%20layout%3D%22constrained%22%0A%20%20%20%20)%0A%20%20%20%20geometry.plot(ax%3Dprofile%2C%20result%3Dresult)%0A%20%20%20%20result.plot(ax%3Dhistory)%0A%20%20%20%20net_stress%20%3D%20geometry.net_section_stress(loads%5B0%5D.maximum)%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**%7Bresult.final_cycles%3A%2C.0f%7D%20accepted%20cycles**.%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22Stop%3A%20%7Bresult.termination.replace('_'%2C%20'%20')%7D.%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22Initial%20net-section%20stress%20at%20the%20first%20peak%20is%20%7Bnet_stress%3A.1f%7D%20MPa.%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%20height%3D%22840px%22)%2C%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20)%0A%0A%0A%40app.cell%0Adef%20round_bar_case(%0A%20%20%20%20ceil%2C%0A%20%20%20%20curve%2C%0A%20%20%20%20loads%2C%0A%20%20%20%20mo%2C%0A%20%20%20%20plot_views%2C%0A%20%20%20%20plt%2C%0A%20%20%20%20simulate_crack_growth%2C%0A)%3A%0A%20%20%20%20from%20py_fatigue.crack_growth%20import%20RoundBarSurfaceCrack%0A%0A%20%20%20%20bar%20%3D%20RoundBarSurfaceCrack(diameter%3D100.0%2C%20depth%3D4.0)%0A%20%20%20%20bar_step%20%3D%2010.0%0A%20%20%20%20bar_result%20%3D%20simulate_crack_growth(%0A%20%20%20%20%20%20%20%20bar%2C%0A%20%20%20%20%20%20%20%20curve%2C%0A%20%20%20%20%20%20%20%20loads%2C%0A%20%20%20%20%20%20%20%20max_cycle_step%3Dbar_step%2C%0A%20%20%20%20%20%20%20%20length_tolerance%3D1e-6%2C%0A%20%20%20%20%20%20%20%20cycle_tolerance%3D1e-4%2C%0A%20%20%20%20%20%20%20%20max_trials%3D2%20*%20sum(ceil(block.cycles%20%2F%20bar_step)%20for%20block%20in%20loads)%2C%0A%20%20%20%20)%0A%20%20%20%20final_depth%20%3D%20bar_result.history%5B-1%5D.sizes%5B0%5D%0A%20%20%20%20bar_fig%2C%20(bar_profile%2C%20bar_history)%20%3D%20plt.subplots(%0A%20%20%20%20%20%20%20%202%2C%201%2C%20figsize%3D(7%2C%208)%2C%20layout%3D%22constrained%22%0A%20%20%20%20)%0A%20%20%20%20bar.plot(ax%3Dbar_profile%2C%20result%3Dbar_result)%0A%20%20%20%20bar_result.plot(ax%3Dbar_history)%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%20SC07%20under%20the%20same%20ordered%20loads%5Cn%5Cn%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22The%20100%20mm%20diameter%20bar%20starts%20with%20a%204%20mm%20deep%20crack.%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22Under%20the%20three%20axial%20tensile%20blocks%20above%2C%20the%20depth%20reaches%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22**%7Bfinal_depth%3A.6f%7D%20mm**%20at%20**%7Bbar_result.final_cycles%3A%2C.0f%7D%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22cycles**.%20Termination%20is%20%60%7Bbar_result.termination%7D%60.%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(bar_fig%2C%20height%3D%22840px%22)%2C%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20)%0A%0A%0A%40app.cell%0Adef%20additional_geometries()%3A%0A%20%20%20%20from%20py_fatigue.crack_growth%20import%20(%0A%20%20%20%20%20%20%20%20CircumferentialCylinderSurfaceCrack%2C%0A%20%20%20%20%20%20%20%20HoleBoreSurfaceCrack%2C%0A%20%20%20%20%20%20%20%20RolledBoltThreadSurfaceCrack%2C%0A%20%20%20%20)%0A%0A%20%20%20%20surface_cases%20%3D%20%7B%0A%20%20%20%20%20%20%20%20%22SC05%20%C2%B7%20Pipe%22%3A%20CircumferentialCylinderSurfaceCrack(%0A%20%20%20%20%20%20%20%20%20%20%20%20inner_radius%3D20.0%2C%20thickness%3D10.0%2C%20depth%3D4.0%2C%20half_length%3D5.0%0A%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%22SC08%20%C2%B7%20Rolled%20thread%22%3A%20RolledBoltThreadSurfaceCrack(%0A%20%20%20%20%20%20%20%20%20%20%20%20major_diameter%3D12.0%2C%20minor_diameter%3D10.0%2C%20depth%3D1.5%0A%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%22SC11%20%C2%B7%20Hole%20bore%22%3A%20HoleBoreSurfaceCrack(%0A%20%20%20%20%20%20%20%20%20%20%20%20width%3D80.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20thickness%3D12.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20hole_diameter%3D12.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20depth%3D2.2%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20half_length%3D2.5%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20crack_count%3D2%2C%0A%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%7D%0A%20%20%20%20return%20(surface_cases%2C)%0A%0A%0A%40app.cell%0Adef%20additional_growth(%0A%20%20%20%20ceil%2C%0A%20%20%20%20curve%2C%0A%20%20%20%20loads%2C%0A%20%20%20%20mo%2C%0A%20%20%20%20plot_views%2C%0A%20%20%20%20plt%2C%0A%20%20%20%20simulate_crack_growth%2C%0A%20%20%20%20step%2C%0A%20%20%20%20surface_cases%2C%0A)%3A%0A%20%20%20%20_cases%20%3D%20%7B%7D%0A%20%20%20%20for%20_name%2C%20_geometry%20in%20surface_cases.items()%3A%0A%20%20%20%20%20%20%20%20_result%20%3D%20simulate_crack_growth(%0A%20%20%20%20%20%20%20%20%20%20%20%20_geometry%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20curve%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20loads%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20max_cycle_step%3Dstep%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20length_tolerance%3D1e-6%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20cycle_tolerance%3D1e-4%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20max_trials%3D2%20*%20sum(ceil(block.cycles%20%2F%20step)%20for%20block%20in%20loads)%2C%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20_fig%2C%20(_profile%2C%20_history)%20%3D%20plt.subplots(%0A%20%20%20%20%20%20%20%20%20%20%20%202%2C%201%2C%20figsize%3D(7%2C%208)%2C%20layout%3D%22constrained%22%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20_geometry.plot(ax%3D_profile%2C%20result%3D_result)%0A%20%20%20%20%20%20%20%20_result.plot(ax%3D_history)%0A%20%20%20%20%20%20%20%20_cases%5B_name%5D%20%3D%20mo.vstack(%0A%20%20%20%20%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%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%20%20%20%20%20f%22Accepted%20**%7B_result.final_cycles%3A%2C.0f%7D%20cycles**%20%C2%B7%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22%7B_result.termination.replace('_'%2C%20'%20')%7D.%22%0A%20%20%20%20%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%20%20%20%20%20plot_views(_fig%2C%20height%3D%22840px%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%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(%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%23%20Pipe%2C%20thread%20and%20plate-hole%20cases%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-%20**SC05**%20uses%20axial%20stress%20on%20the%20uncracked%20pipe%20section.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20It%20advances%20the%20radial%20depth%20and%20outer-surface%20arc%20half-length.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-%20**SC08**%20uses%20nominal%20axial%20stress%20on%20the%20thread-root%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20section.%20The%20arc%20half-length%20equals%20the%20crack%20depth.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-%20**SC11**%20uses%20remote%20gross-section%20plate%20stress.%20It%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20advances%20radial%20depth%20and%20half-length%20along%20the%20bore.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20The%20two%20cracks%20grow%20symmetrically.%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20The%20same%20numbers%20are%20used%20for%20the%20three%20stress%20histories%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20to%20illustrate%20the%20geometry%20effects.%20Each%20solver%20stops%20at%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20toughness%2C%20at%20its%20geometry%20limit%2C%20or%20when%20the%20loads%20end.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22%22%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.ui.tabs(_cases)%2C%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20)%0A%0A%0A%40app.cell%0Adef%20long_case(%0A%20%20%20%20LoadBlock%2C%0A%20%20%20%20curve%2C%0A%20%20%20%20geometry%2C%0A%20%20%20%20plt%2C%0A%20%20%20%20simulate_crack_growth%2C%0A%20%20%20%20surface_cases%2C%0A)%3A%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%20long_case_view%2C%0A%20%20%20%20%20%20%20%20synthetic_peaks%2C%0A%20%20%20%20)%0A%0A%20%20%20%20peaks%20%3D%20synthetic_peaks()%0A%20%20%20%20schedule%20%3D%20%5BLoadBlock(MINIMUM_STRESS%2C%20float(peak)%2C%201.0)%20for%20peak%20in%20peaks%5D%0A%20%20%20%20long_fig%2C%20_axes%20%3D%20plt.subplots(2%2C%202%2C%20figsize%3D(10%2C%208)%2C%20layout%3D%22constrained%22)%0A%20%20%20%20_summary%20%3D%20%5B%5D%0A%20%20%20%20for%20(_name%2C%20_geometry)%2C%20_ax%20in%20zip(%0A%20%20%20%20%20%20%20%20%7B%22SC01%20%C2%B7%20Plate%22%3A%20geometry%2C%20**surface_cases%7D.items()%2C%20_axes.flat%0A%20%20%20%20)%3A%0A%20%20%20%20%20%20%20%20_result%20%3D%20simulate_crack_growth(%0A%20%20%20%20%20%20%20%20%20%20%20%20_geometry%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20curve%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20schedule%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20max_cycle_step%3D1.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20length_tolerance%3D1e-6%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20cycle_tolerance%3D1e-4%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20max_trials%3D2%20*%20len(schedule)%2C%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20_geometry.plot(ax%3D_ax%2C%20result%3D_result)%0A%20%20%20%20%20%20%20%20_summary.append(%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22-%20**%7B_name%7D**%20%C2%B7%20%7B_result.final_cycles%3A%2C.2f%7D%20cycles%2C%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7B_result.termination.replace('_'%2C%20'%20')%7D.%22%0A%20%20%20%20%20%20%20%20)%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%20up%20to%20**%7Bpeaks.size%3A%2C%7D%20tensile%20cycles**%20to%20each%20geometry%20in%20%22%0A%20%20%20%20%20%20%20%20%22their%20generated%20order%2C%20and%20compare%20the%20last%20accepted%20profiles.%5Cn%5Cn%22%0A%20%20%20%20%20%20%20%20%2B%20%22%5Cn%22.join(_summary)%2C%0A%20%20%20%20%20%20%20%20height%3D%221640px%22%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
bfbf9a8aa955ea8e50caf37fb741b4af