Add Solver
Add a new numerical solver to the project.
Steps
- •Ask the user for the solver type/method (e.g., explicit FDM, MOL, FEM, etc.)
- •Read
solvers/base.pyto review theSolverBaseinterface - •Create an appropriate subdirectory (e.g.,
solvers/fem/) - •Implement the new solver inheriting from
SolverBase:- •Set the
nameclass attribute - •Implement
solve(T0, r, dt, t_end, alpha) -> T_history - •Handle r=0 singularity via L'Hopital's rule
- •Apply Neumann BC (r=0) and Dirichlet BC (r=1)
- •Set the
- •Add tests in
tests/test_solvers.py:- •Basic operation test (temperature decreases via diffusion)
- •Boundary condition test
- •Nonlinear (alpha>0) test
- •Register the solver in
app/run_benchmark.pyrun()function - •Verify all tests pass with
python -m pytest tests/ -v - •Update HISTORY.md