%22%22%22Propagate%20through%20cracks%20in%20plates%20and%20shells.%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%20import%20marimo%20as%20mo%0A%0A%20%20%20%20mo.md(%22%22%22%0A%20%20%20%20%20%20%20%20%23%20Through-crack%20growth%20in%20plates%20and%20shells%0A%0A%20%20%20%20%20%20%20%20Compare%20a%20center%20crack%20(TC01)%20and%20a%20single%20edge%20crack%20(TC02)%20under%20the%0A%20%20%20%20%20%20%20%20same%20ordered%20tensile%20loads.%20The%20center%20crack%20grows%20symmetrically%2C%20so%0A%20%20%20%20%20%20%20%20the%20solver%20records%20the%20**half-length**.%20The%20edge%20crack%20grows%20from%20one%0A%20%20%20%20%20%20%20%20side%2C%20so%20the%20solver%20records%20the%20**length%20from%20that%20edge**.%0A%0A%20%20%20%20%20%20%20%20Each%20profile%20shows%20the%20initial%20crack%20as%20a%20dashed%20line%20and%20the%20last%0A%20%20%20%20%20%20%20%20accepted%20crack%20in%20red.%20The%20material%20and%20loads%20are%20synthetic.%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%20propagate()%3A%0A%20%20%20%20from%20math%20import%20ceil%0A%0A%20%20%20%20from%20py_fatigue.crack_growth%20import%20(%0A%20%20%20%20%20%20%20%20CenterThroughCrack%2C%0A%20%20%20%20%20%20%20%20EdgeThroughCrack%2C%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%20simulate_crack_growth%2C%0A%20%20%20%20)%0A%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%20geometries%20%3D%20%7B%0A%20%20%20%20%20%20%20%20%22TC01%22%3A%20CenterThroughCrack(half_width%3D50.0%2C%20half_length%3D4.0)%2C%0A%20%20%20%20%20%20%20%20%22TC02%22%3A%20EdgeThroughCrack(width%3D100.0%2C%20length%3D4.0)%2C%0A%20%20%20%20%7D%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%20%23%20Start%20with%20the%20steps%20needed%20to%20cover%20each%20block%20and%20allow%20for%20retries.%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%20results%20%3D%20%7B%0A%20%20%20%20%20%20%20%20name%3A%20simulate_crack_growth(%0A%20%20%20%20%20%20%20%20%20%20%20%20geometry%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%3Dtrial_budget%2C%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20for%20name%2C%20geometry%20in%20geometries.items()%0A%20%20%20%20%7D%0A%20%20%20%20return%20LoadBlock%2C%20curve%2C%20geometries%2C%20loads%2C%20results%2C%20simulate_crack_growth%0A%0A%0A%40app.cell%0Adef%20ordered_profiles(geometries%2C%20loads%2C%20mo%2C%20results)%3A%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%20fig%2C%20axes%20%3D%20plt.subplots(3%2C%201%2C%20figsize%3D(7%2C%208)%2C%20layout%3D%22constrained%22)%0A%20%20%20%20summaries%20%3D%20%5B%5D%0A%20%20%20%20for%20(name%2C%20geometry)%2C%20profile%20in%20zip(geometries.items()%2C%20axes%5B%3A2%5D)%3A%0A%20%20%20%20%20%20%20%20result%20%3D%20results%5Bname%5D%0A%20%20%20%20%20%20%20%20geometry.plot(ax%3Dprofile%2C%20result%3Dresult)%0A%20%20%20%20%20%20%20%20result.plot(ax%3Daxes%5B2%5D%2C%20label%3Dname)%0A%20%20%20%20%20%20%20%20net_stress%20%3D%20geometry.net_section_stress(loads%5B0%5D.maximum)%0A%20%20%20%20%20%20%20%20summaries.append(%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22-%20**%7Bname%7D**%20%C2%B7%20%7Bresult.final_cycles%3A%2C.0f%7D%20accepted%20cycles%2C%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bresult.termination.replace('_'%2C%20'%20')%7D.%20%22%0A%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)%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%5Cn%22.join(summaries))%2C%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%5D%0A%20%20%20%20)%0A%0A%0A%40app.cell%0Adef%20shell_cases(curve%2C%20loads%2C%20mo%2C%20simulate_crack_growth)%3A%0A%20%20%20%20from%20math%20import%20ceil%20as%20_ceil%0A%20%20%20%20import%20matplotlib.pyplot%20as%20_shell_plt%0A%20%20%20%20from%20py_fatigue.crack_growth%20import%20(%0A%20%20%20%20%20%20%20%20AxialCylinderThroughCrack%2C%0A%20%20%20%20%20%20%20%20CircumferentialCylinderThroughCrack%2C%0A%20%20%20%20%20%20%20%20SphereThroughCrack%2C%0A%20%20%20%20)%0A%20%20%20%20from%20_examples.charts%20import%20plot_views%20as%20_plot_views%0A%0A%20%20%20%20shells%20%3D%20(%0A%20%20%20%20%20%20%20%20SphereThroughCrack(mean_radius%3D100.0%2C%20thickness%3D1.0%2C%20half_length%3D4.0)%2C%0A%20%20%20%20%20%20%20%20AxialCylinderThroughCrack(%0A%20%20%20%20%20%20%20%20%20%20%20%20mean_radius%3D100.0%2C%20thickness%3D1.0%2C%20half_length%3D4.0%0A%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20CircumferentialCylinderThroughCrack(%0A%20%20%20%20%20%20%20%20%20%20%20%20mean_radius%3D100.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20thickness%3D1.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20half_length%3D4.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20length%3D2500.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20poisson%3D0.3%2C%0A%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20)%0A%20%20%20%20shell_step%20%3D%2010.0%0A%20%20%20%20shell_fig%2C%20shell_axes%20%3D%20_shell_plt.subplots(%0A%20%20%20%20%20%20%20%202%2C%202%2C%20figsize%3D(9%2C%207)%2C%20layout%3D%22constrained%22%0A%20%20%20%20)%0A%20%20%20%20shell_summaries%20%3D%20%5B%5D%0A%20%20%20%20for%20(_case%2C%20_shell)%2C%20_profile%20in%20zip(%0A%20%20%20%20%20%20%20%20zip((%22TC06%22%2C%20%22TC07%22%2C%20%22TC08%22)%2C%20shells)%2C%20shell_axes.flat%0A%20%20%20%20)%3A%0A%20%20%20%20%20%20%20%20_run%20%3D%20simulate_crack_growth(%0A%20%20%20%20%20%20%20%20%20%20%20%20_shell%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%3Dshell_step%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%0A%20%20%20%20%20%20%20%20%20%20%20%20*%20sum(_ceil(block.cycles%20%2F%20shell_step)%20for%20block%20in%20loads)%2C%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20_shell.plot(ax%3D_profile%2C%20result%3D_run)%0A%20%20%20%20%20%20%20%20_run.plot(ax%3Dshell_axes%5B1%2C%201%5D%2C%20label%3D_case)%0A%20%20%20%20%20%20%20%20shell_summaries.append(%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22-%20**%7B_case%7D**%20%C2%B7%20%7B_run.final_cycles%3A%2C.0f%7D%20cycles%2C%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7B_run.termination.replace('_'%2C%20'%20')%7D.%22%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(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22%23%23%20Through%20cracks%20in%20shells%5Cn%5Cn%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Here%20the%20same%20synthetic%20membrane-stress%20history%20is%20applied%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22in%20the%20opening%20direction%20for%20each%20crack.%20That%20means%20hoop%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22stress%20for%20TC07%20and%20axial%20stress%20for%20TC08.%5Cn%5Cn%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2B%20%22%5Cn%22.join(shell_summaries)%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%20_plot_views(shell_fig%2C%20height%3D%221640px%22)%2C%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20)%0A%0A%0A%40app.cell%0Adef%20long_case(LoadBlock%2C%20curve%2C%20geometries%2C%20simulate_crack_growth)%3A%0A%20%20%20%20import%20matplotlib.pyplot%20as%20_plt%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%20long_axes%20%3D%20_plt.subplots(%0A%20%20%20%20%20%20%20%202%2C%201%2C%20figsize%3D(7%2C%205)%2C%20layout%3D%22constrained%22%0A%20%20%20%20)%0A%20%20%20%20outcomes%20%3D%20%5B%5D%0A%20%20%20%20for%20(case%2C%20crack)%2C%20long_profile%20in%20zip(geometries.items()%2C%20long_axes)%3A%0A%20%20%20%20%20%20%20%20long_result%20%3D%20simulate_crack_growth(%0A%20%20%20%20%20%20%20%20%20%20%20%20crack%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%20crack.plot(ax%3Dlong_profile%2C%20result%3Dlong_result)%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**%7Bcase%7D**%20%C2%B7%20%7Blong_result.termination.replace('_'%2C%20'%20')%7D%20after%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Blong_result.final_cycles%3A%2C.2f%7D%20cycles.%22%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20del%20long_result%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%20**%7Bpeaks.size%3A%2C%7D%20tensile%20cycles**%20in%20their%20generated%20order.%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%20%20%20%20height%3D%22840px%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
beadc652d94bf08a59781b0ff4af57c3