Question: pdsolve and finite difference method discrepancy

I was using pdsolve to solve for a 1-D longitudinal wave equation.  My particular problem added an external stimulus that is not mechanical in original, so the acoustic wave velocity has to be modeled as a variable c(H) and I also have to add a du/dx term in the model.  You can see my question posted on April 17, 2026.  I was told that pdsolve does not handle such a problem.  The suggestion in the posting is to use a finite difference method.  

I am verifying that approach by solving a simplier problem where c is constant but with an initial uniformly stretched material.  The solution does not seem to be physical.  The material should relax throughout the whole length of the material, but the solution shows relaxation at the end and stay uniformly stretched at the center.  I ran the problem with pdsolve and get a different result that I think is more realistic.

Is there something I can tweak in the finite difference approach to overcome that issue?

pde_finite_difference_method_linear_ic.mw

pdsolve_exercise_damping_ini_linear_a.mw

Please Wait...