Updating of boundary condition during bvp4c solution procedure

3 views (last 30 days)
Dear colleagues:
I am solving the Poisson-Boltzmann equation, a non-linear elliptical PDE which describes the distribution of electric potential (psi) in the vicinity of a charged surface, as a boundary value problem using bvp4c. For this problem, psi is the primary dependent variable being solved for as a function of distance away from the charged surface. One of the boundary conditions is surface charge density (sigp), which is itself dependent on the electric potential at the surface, i.e. sigp is dependent (in a non-linear way) on the value of psi at x = 0. Thus I need to update the surface charge density (sigp) boundary condition dynamically during the solution, based on the current value for psi at x = 0. A few basic questions are:
1. Would I do the calculation to update sigp within the bvpfcn or the bcfcn routine
2. How do I go about getting a hold of the value for psi at x = 0
3. How do I go about passing the updated boundary condition value back to the solution routine?
I'm guessing this is going to involve use of the "Unknown Parameters" facility in bvp4c, but exactly how to implement this is not clear.
Thanks in advance for any help anyone can provide.
Kind regards, Eric
Eric Roden, University of Wisconsin-Madison, Department of Geoscience

Accepted Answer

Torsten
Torsten on 10 May 2023
In bvp4c, your boundary conditions at xl = xstart and xr = xend can take the form fl(xl,psil) = 0 and fr(xr,psir) = 0 where fl and fr can be nonlinear functions of the value of psi at x = xl (named ul in the example codes) or x = xr (named ur in the example codes).
Thus it should be no problem to specify the surface charge density (sigp) if you know how it depends on the (given) value of psi. Here I assume you want to make sigp depend on the value of psi on the same side of your integration interval [xl xr]. Thus cases like fl(xl,psir) = 0 or fr(xr,psil) = 0 should be excluded, I guess.

More Answers (0)

Categories

Find more on Signal Processing in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!