![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/269050/image.png)
Writing PDE boundary conditions
2 views (last 30 days)
Show older comments
![image.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/264952/image.png)
How can I insert these boundary conditions into the pdepe solver. ?
0 Comments
Answers (1)
Josh Meyer
on 30 Jan 2020
pdepe expects the boundary conditions to be written in a standardized form:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/269050/image.png)
Notice that only p can depend on the variable being integrated u, and the boundary conditions are written in terms of the flux term f rather than the partial derivative du/dx (the flux term generally includes this partial derivative). The flux term f is defined when you write the main pdefun function for the equations.
Once you write the left and right boundary conditions in this form, the coefficients p, q are coded into a function. The function uses the signature
function [pL,qL,pR,qR] = bcfun(xL,uL,xR,uR,t)
Notice that there is affordance for p,q on the left (pL and qL) as well as the right (pR and qR) boundaries. Similarly, there are separate input variables for x and u on the left and right. The location of the left and right boundaries is inferred from the specified meshes for x and t being solved on.
The process is described here:
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!