I have been trying out mathematica 10 features, but sadly unable to use NDSolve for even simple PDE's. I am still wrestling with the problem of boundary conditions. The solution I get in the interpolating function doesn't have proper values specified in the boundary conditions. For example if I specify
DirichletCondition[V[S, t] == 10.0, (S >= 110 && t == 1.0)]
And if i check the boundary condition V[110,1.0] it doesn't give 10.0 as the result. The values don't make sense.
Here's my original problem
soln = NDSolveValue[
{D[V[S, t], t] + r*S*D[V[S, t], S] + 0.5 sigma^2 S^2 D[V[S,t], {S,2}] - r V[S,t] == 0,
DirichletCondition[V[S, t] == 20.0, (S >= 110 && t == 2.0)],
DirichletCondition[V[S, t] == 10.0, (S >= 110 && t == 1.0)],
DirichletCondition[V[S, t] == -Max[80 - S, 0], (S <= 80 && t == 2.0)],
DirichletCondition[V[S, t] == 0.0, (S > 80 && S < 110 && t == 2.0)]},
V, {S, t} ? mesh];
autocall[130, 1.0]
(* 15.3241 *)
which doesn't make any sense!
The condition stated preciely that at t = 1.0 make the value 10.0 for S greater than or equal to 110.0.
I am using the following mesh
? = ImplicitRegion[True, {{S, 0, 200}, {t, 0, 2.0}}];
mesh = ToElementMesh[?, MaxCellMeasure -> 0.005 , "MeshOrder" -> 2];
Strangest part is mathematica doesn't give any errors and now I think problem is with the interpolating function which is not satisfying the boundary conditions. After I remove the inner condition, DirichletCondition[V[S, t] == 10.0, (S >= 110 && t == 1.0)], I don't observe any change in price. Probably it's not even hitting this boundary. Probably I need to generate a mesh with exact boundries of t == 1.0. For t==2.0 it already works coz it's the extreme end. Maybe mathematica is not able to figure out that at t == 1.0, the value jumps to 10.0. As of now I can only forsee two solutions
- Figure out how to create a mesh with explicit boundaries
- Give up on NDSolve coz it's not meant for above cases! -- I don't think this is possible ;)
What I am doing wrong, any suggestions? Any clues on how to solve this simple PDE? Have given up partially on this tool after trying various other options...maybe NDSolveValue is not built for such problems.
Attachments: