Updating of boundary condition during bvp4c solution procedure

5 vues (au cours des 30 derniers jours)
Eric Roden
Eric Roden le 10 Mai 2023
Commenté : Eric Roden le 11 Mai 2023
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

Réponse acceptée

Torsten
Torsten le 10 Mai 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.
  1 commentaire
Eric Roden
Eric Roden le 11 Mai 2023
Thank you, Torsten, this worked perfectly. Much appreciated.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by