Bone remodeling
Problem setting
Import modules :
Coefficients :
Initial condition :
Time stepping options :
Part 1 : Solving the problem
Implement and solve the problem using your own functions for the backward Euler's method and Newton's method.
/tmp/ipykernel_160/2476182983.py:1: MatplotlibDeprecationWarning: The seaborn styles shipped by Matplotlib are deprecated since 3.6, as they no longer correspond to the styles shipped by seaborn. However, they will remain available as 'seaborn-v0_8-<style>'. Alternatively, directly use the seaborn API instead.
plt.style.use('seaborn-poster')
Part 2 : Convergence Assessment
Compute successive numerical solutions as you increase the number of time steps Ntsteps
You can use 1D piecewise linear interpolation directly from SciPy:
Compute and plot (in double logarithmic scale) the rmse(m) by increasing m until you consider that your solution is accurate enough.
Part 3
Solve the same problem using SciPy's function solve_ivp from the integrate submodule
Use the integration method method = 'LSODA' . Check what the method does and how to use it.
The methods does not require a time stepping vector. Instead the user sets the absolute tolerance through the keyword argument atol, and the time step size is adapted automatically to guarantee the user-specified accuracy requirements. Compare the number of time steps that are needed by LSODA and your Backward Euler Method to achieve comparable accuracy.