I am trying to solve the following boundary value problem:
D*(dS^2/dz^2) - v*(dS/dz) - S/(S+k_s) = 0
Where D, v and k are constants (see code below). The boundary conditions are:
S(z = 0) = 23.8 and dS/dz(z = infinity) = 0
I am attempting to use scipy.integrate.solve_bvp to solve the problem over a z range of (0,100), but I am having a really hard time setting the boundary values. All of the examples I have seen online don't really describe what is going on in the functions used to calculate their boundary values as an input for solve_bvp. I also have the added complication of having a boundary value at infinity. This is what I have so far:
# constants
D = 200.6
v = 0.02
k = 0.20
# split second order ODE into 2 first order ODEs
def sulfate_profile(z,U):
dUdz = [U[1], (v*U[1] + U[0]/(U[0]+k))/D]
return dUdz
# I initiated these boundary conditions but I don't really know what they mean...
def bc(za, zb):
return np.array([za[0], zb[1]])
z_list = np.linspace(0,100,1000)
z_a = np.zeros((2, z_list.size))
# solve SO4 concentration ODE over depth range (z_list)
sulfate_reduction = solve_bvp(sulfate_profile,bc,z_list,z_a)
This gives me an output, but I'm sure that it's wrong. I would really appreciate any suggestions - thanks in advance!
