Re: NDSolve (loop)
- To: mathgroup at smc.vnet.net
- Subject: [mg117020] Re: NDSolve (loop)
- From: Mark Fisher <particlefilter at gmail.com>
- Date: Tue, 8 Mar 2011 05:32:50 -0500 (EST)
- References: <il2df8$684$1@smc.vnet.net>
On Mar 7, 5:53 am, greg28 <grega.smrk... at gmail.com> wrote: > Hi, > let me be more specific about my problem. My code in mathematica is: > > _______________________________________ > T=1000 (truncation of time, assuming that V(s,x)-> V(x) > as T-> infinity) > > alpha= 0.1 > pde= some complicated expression (involving 1st and 2nd > order derivatives) > > soln = NDSolve[{pde, V[0, x] == 0, > V[s, xu] == 0, (D[V[s, x], x] /. x -> xd) == 0}, > V[s, x], {s, 0, T}, {x, xd, xu}, > Method -> {"MethodOfLines", > "SpatialDiscretization" -> {"TensorProductGrid", > "MinPoints" -> 1000}} ] > _______________________________________ > > This is then a particular solution for alpha=0.1. > However, my problem is to find a value of alpha, > at which, for instance, V[x=0.3]=alpha/2. So I > need to write a loop which will stop when this > condition is satisfied. The problem is that one > evaluation takes a lot of time, so I wonder whether > it is somehow possible to speed up NDSolve, e.g. > by somehow telling mathematica what the solution for > alpha=0.1 was when solving for alpha=0.2 or something > like this. The shape of V should not differ too much > between alpha=0.1 and alpha=0.2... Maybe this will help. Let W[x] == V[Tmax,x] denote the solution given your current value of alpha. For the next value of alpha use V[0,s] == W[x] as your starting condition instead of V[0,s] = 0. That may put you closer to the solution, making it easier for Matheamtica to proceed and also allowing you to reduce Tmax. --Mark