# How can I solve this 1D nonlinear, variable-coefficient hyperbolic PDE?

I need to solve the following hyperbolic equation in x and phi co-ordinates

$$\frac{\partial \left ( -s/f \right )}{\partial \varphi }+\frac{\partial \left ( 1/f \right )}{\partial x}=0$$

$$\varphi >0\rightarrow f=\left ( 1+\frac{\left ( 1-s \right )\left ( 1+0.4\varphi e^{-x} \right )}{10s} \right )^{-1}$$

$$\varphi <0\rightarrow f=\left ( 1+\frac{1-s}{10s} \right )^{-1}$$

$$\varphi =-0.1x\rightarrow s=0.1,f=0.526$$ $$x=0,\varphi >0\rightarrow s=1,f=1$$

in domain $$0<x<1$$ $$-0.1x<\varphi <1$$

I am searching for the hyperbolic package that can solve this equation like clawpack, but I don't know how to define my equation there thanks

• yes David , you are right, in the problem I want to solve at initial condition f=0 and 1/f tends to infinity but lets here assume at t=0 s=0.1 and f=0.5 Oct 22 '14 at 6:26
• David I edit the equation a little bit, this is exactly the one that I need to solve as you can see its in x and phi coordinate instead of x and time, and I need to deal with different f when phi is negative Oct 22 '14 at 8:48
• David,the initial condition is at phi=-0.1x, s=0.1 and the boundary condition is at x=0 Oct 22 '14 at 10:31
• It is much clearer now! Are you interested in solutions after characteristics cross? Do you have some basis for determining a meaningful weak solution after characteristics cross? Oct 23 '14 at 7:31
• I am familiar with the analytical solution (self similar and method of characteristics) of first order hyperbolic equations and shock condition, but I never solved them numerically.do you think I can solve this equation by method of characteristics? Oct 23 '14 at 12:13

Since you have a scalar problem in one space dimension, it shouldn't be too difficult to come up with a semi-analytic solution using the method of characteristics. Here's something to get you started.

The problem can be written in a nicer form if you define $g=1/f$. Then you can solve for $s$ to find

$$s(g,x,\phi) = \frac{\alpha(x,\phi)}{\alpha(x,\phi) + g - 1}$$

where

$$\alpha(x,\phi) = \begin{cases} \frac{1+\frac{4}{10}\phi e^{-x}}{10} & \phi>0 \\ \frac{1}{10} & \phi \le 0.\end{cases}$$

Then your conservation law is simply

$$g_x - \left( s(g,x,\phi) g \right)_\phi = 0,$$

which looks like a traditional scalar hyperbolic PDE. The method of characteristics will allow you to find solutions up to the "time" when characteristics cross. You will probably need a Newton solver and an ODE solver to implement the method.

In case you want to compute an approximate solution by numerical discretization, I recommend the following:

• If you know your solutions do not contain shocks, then I would just code up a simple finite difference discretization of the equation above (for instance, using Python or MATLAB and centered differences).
• If you need to compute solutions with shocks, then more sophisticated methods are called for. You might consider using PyClaw (disclaimer: I'm a PyClaw developer).
• I am working on the semi analytic solution but do you know any package that can solve this numerically, to compare the result Oct 27 '14 at 22:54