Supporting documentation regarding PDE boundary files
1 view (last 30 days)
Show older comments
I am trying to solve a PDE on a square domain, and came across the boundary files squareb1,squareb2, etc. These are potentially useful to me, however I am not clear what boundary conditions each file gives. I want a file with Neumann conditions around each edge.
Thanks!
0 Comments
Accepted Answer
Bill Greene
on 16 Aug 2013
Hi,
Your question is certainly a reasonable one. The boundary matrix format in those files is unquestionably difficult to decode.
I suggest an alternate approach instead of trying to decipher those example files. This example boundary file below will define a zero Neumann boundary condition on all edges of a model-- a square or something much more complicated.
function [ q, g, h, r ] = boundaryFileZeroNeumann( p, e, u, time )
% Define a zero Neumann condition on all edges
N = 1 % number of pde in the system
ne = size(e,2); % number of boundary edges
q = zeros(N^2, ne); % Neumann coefficient q is zero on all edges
g = zeros(N, ne); % Neumann coefficient g is zero on all edges
h = zeros(N^2, 2*ne); % Dirichlet h coefficient is zero at both ends of all edges
r = zeros(N,2*ne); % Dirichlet r coefficient is zero at both ends of all edges
end
The line N = 1 says that you have a single PDE (i.e. a scalar PDE) in your system. If you have more than one, you need to change this line. You can pass this function to assempde or the other high-level PDE Toolbox functions by defining
b = @boundaryFileZeroNeumann;
This function is a very simple boundary file example. You can easily generalize this to an arbitrary combination of Dirichlet and Neumann conditions. Take a look at this documentation page if you are interested in doing that.
Bill
More Answers (0)
See Also
Categories
Find more on Boundary Conditions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!