FUNCTION REFERENCE
applyBoundaryCondition
Apply Dirichlet, generalized Neumann, or mixed boundary conditions to edges of a 2-D PDE model.
Apply Dirichlet, generalized Neumann, or mixed boundary conditions to edges of a 2-D PDE model.
Syntax
bc = applyBoundaryCondition(model, 'dirichlet', 'Edge', edgeIDs, 'u', val); bc = applyBoundaryCondition(model, 'dirichlet', 'Edge', edgeIDs, 'u', val, 'EquationIndex', eqIDs); bc = applyBoundaryCondition(model, 'dirichlet', 'Edge', edgeIDs, 'h', h, 'r', r); bc = applyBoundaryCondition(model, 'neumann', 'Edge', edgeIDs, 'g', g, 'q', q); bc = applyBoundaryCondition(model, 'mixed', 'Edge', edgeIDs, ...)Assigns boundary conditions on the specified geometry Edge IDs. Dirichlet conditions enforce u = val or h*u = r (optionally restricted to chosen components via 'EquationIndex' or 'Equation'). Generalized Neumann conditions enforce n.(c*grad(u)) + q*u = g, where g and q default to 0. Mixed conditions combine Dirichlet constraints ('u' with 'EquationIndex', or 'h'/'r') with Neumann ('g'/'q') on the remaining components. Edges without an explicit boundary condition default to zero-flux Neumann (g = 0, q = 0). Values may be numeric or function handles @(location,state) where location includes x, y, nx, ny, subdomain. The last assignment to an edge wins: it replaces every earlier condition on that edge, and with 'EquationIndex' the components not listed revert to the default zero Neumann condition.
Example
R1=[3;4;0;1;1;0;0;0;1;1]; dl=decsg(R1); m=createpde(); geometryFromEdges(m,dl); bc=applyBoundaryCondition(m,'dirichlet','Edge',1:4,'u',0); bc.uExample
R1=[3;4;0;1;1;0;0;0;1;1]; dl=decsg(R1); m=createpde(2); geometryFromEdges(m,dl); bc=applyBoundaryCondition(m,'mixed','Edge',1:4,'u',0,'EquationIndex',1,'g',[0;1]); numel(bc.EquationIndex)Differences from MATLAB: 2-D 'Edge' regions only; 'Vertex' regions, coupled off-diagonal mixed 'h' constraints, and 3-D 'Face' boundary conditions are not supported yet.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.