PDE with Min in the definition

I was trying to come up a some numerical solution to the following PDE system, but it failed for a good reason. Is there a way that we can get around it?

r = 0.1; σ = 0.2; K = 40; n = 20; T = 1; q = 0.05;
sol2 = NDSolve[{Min[-D[c[S, t], t] -
1/2 σ^2 S^2 D[c[S, t], {S, 2}] -
D[c[S, t], S] (r - q) S + r c[S, t], c[S, t] - (S - K)] == 0,

c[0, t] == 0,
c[S, T] == (S - K) Boole[S > K],
c[3 K, t] == 3 K - K E^(-r (T - t))

}, c, {t, 0, T}, {S, 0, 120}

]

• Side issue: Avoid capital single-letter variables. For instance, K is used as a dummy variable in solutions expressed in terms of sums and integrals. Probably not an issue here, but it's a good habit. May 16, 2017 at 20:42
• I feel there should be some form of a trapezoidal differentiation to avoid calculating the derivative directly. May 16, 2017 at 22:03
• Have you seen the tutorial on the Method of Lines? I doubt NDSolve can handle this directly as a PDE, but maybe it could with a system of ODEs, for which more robust discontinuity processing is available. May 16, 2017 at 22:32
• @MichaelE2 I think the Min will still not allow it. May 17, 2017 at 0:47
• I'm afraid even if there's no Min, NDSolve will have trouble in solving the problem, because part of the equation is inverse problem for parabolic equation (the i.c. is given at T, while you're solving the equation from T to 0), which is a well-known ill-posed problem. May 17, 2017 at 3:19