# NDsolve solving for boundary condition

Posted 10 years ago
1611 Views
|
3 Replies
|
0 Total Likes
|
 Hello,I am struggling with a calculation of band bending in solids. For this I have to solve a second order differential equation. In principle this works, however I want to find that particular solution, which just "touches" zero by varying an initial condition (pot'[0]). BBpot = NDSolve[{(charge[z])*e/(eps*epsrel) == pot''[z], pot[0] == 0.6}, pot'[z]==somestart,{pot[z]}, {z, 0, 1*10^-6}, Method -> {"EventLocator", "Event" -> pot'[z],"EventAction" :> Throw[zend = z, "StopIntegration"],"EventLocationMethod" -> "LinarInterpolation",Method -> "ExplicitRungeKutta"}]As an explanation: charge depents on pot itself, which is the function to solve for. The behavior of the solution is quite unspectacular. The function will decrease from its inital 0.6 and in principle become stable, when it reaches a minimum. This is why I stop the integration and assign to zend by EventLocator. However the solution is only physically accurate if the minimum at zend has the value zero. Coming to this solution is possible by changing pot'[0]When I putpot[zend]==0in the equation system it will not work (probably because it doesn't know zend (yet)?) because it has no starting value for pot'. I also tried using "shooting" method to give a starting value for pot', but am obviously doing something wrong. I also thought of embedding the differential equation in a findroot, but from what I read I don't know how to combine it.Any help or suggestions are highly appreciated
3 Replies
Sort By:
Posted 10 years ago
 Hi Raphael,A couple of questions:With pot[0] positive, pot'[0] negative, and pot'' positive everywhere, we have a concave upward parabola. So pot decreases to a minimum and then heads up forever. Do you mean that the solution being sought is where that minimum occurs at pot = 0 and any z?If charge depends on pot, how is charge determined. Is solving this system one step of an iteration that should converge to a self-consistent charge? If so, what is a reasonable first approximation for charge?Best,David
Posted 10 years ago
 Depending on whether your charge[ z ] function is simple or not, could you use DSolve to find the exact solution to your problem and from that be able to solve for your initial condition? That seems to work if I try really really simple charge[ z ] and supply just enough initial conditions.
Posted 10 years ago
 No thats thats not possible. Right now it is some boltzmannstatistic sums, but in a next steps FermiDirac Integrals and integration over interpolated data has to be included.