0

I am trying to solve the following set of coupled differential equations ( variables are p,n and psi) using the bvp solver in python :-

1. d2n/dx2-(d2psi/dx2)n-(dpsi/dx)(dn/dx)=k1 in domain 1
2. d2p/dx2+(d2psi/dx2)p+(dpsi/dx)(dp/dx)=k2 in domain 1
3. d2psi/dx2= k*(p-n) in domain 1
4. d2psi/dx2= 0 in domain 2 where domain 1 is given by x<=L and domain 2 is given by L<x<=(L+t)

subjected to the boundary conditions :

p(0)= p0, n(0)= n0, psi(0)= 0, p(L)= p0*exp(-psi/Vth), n(L)= n0*exp(psi/Vth), psi(L+t)= 5. 

I can set the equations up. But considering the fact that there are two different domains where the equations are to be solved, I am facing some trouble. Any help regarding the same would be highly appreciated.

Anweshan
  • 29
  • 6
  • Matlab supports multi-point boundary conditions, the scipy solver does not. You can always fall back to set the residuals of the conditions at the second and third boundary as function of the free initial values at the first boundary and then solve this with a non-linear solver, aka the shooting method. – Lutz Lehmann May 26 '20 at 06:54
  • So, this problem can never be implemented using the bvp solver!!Actually I was next planning to solve these equations in 3-D by running the bvp solver in 3 dimensions. – Anweshan May 26 '20 at 07:06
  • As you have written the equations, the state vector for the any ODE solver already has 6 components. What do you mean with "3D"? (And "never" is too final a word, this functionality might get implemented in the future in solve_bvp or a similar function.) – Lutz Lehmann May 26 '20 at 07:10
  • By 3D, I meant that the variables will spatially vary along x,y and z – Anweshan May 26 '20 at 07:15
  • Then you'd have a PDE, ODE solvers will not help at all, you would need something like finite elements. – Lutz Lehmann May 26 '20 at 07:21
  • Yes, I understand what you mean. But I was planning to run this bvp solver along one direction keeping the other direction constant. Considering the 2d case, I could define two meshes : xmesh and ymesh, and then could run the bvp solver along ymesh for all points in xmesh and keep on storing the results in a 2d array. That would resolve the pdes into odes and would give me a 2d solution. – Anweshan May 26 '20 at 07:29
  • You would get a result, but be careful that it is indeed a solution (or approximation thereof) to your original problem. – Lutz Lehmann May 26 '20 at 07:58

0 Answers0