# In the PDE toolbox, can I set my Dirichlet boundary condition to a single point rather than the edge?

5 views (last 30 days)
Ao Chen on 13 Aug 2022
In the PDEtoolbox, can I set my Dirichlet boundary condition to a single point rather than the edge?
We use the following code (a really small circle) to approximate the Dirichlet boundary condition for a single point (u=220 when x=0 and y=0). I would like to know if there is a method to directly define boundary conditions on a Point instead of an Edge.
Circle = [1,0,0,0.001]';
applyBoundaryCondition(GWModel,'dirichlet','Edge',[5,6,7,8],'u',220);
%Create FE analysis object
GWModel = createpde();
%Create 2-D geometry
%R = [3,4,200,200,-200,-200,100,-100,-100,100]';
R = [2,4,200,200,-200,-200,100,-100,-100,100]';
Circle = [1,0,0,0.001]';
Circle = [Circle;zeros(length(R) - length(Circle),1)];
gd = [R,Circle];
ns = char('RectangularDomain','Well'); ns = ns';
sf = 'RectangularDomain-Well';
[g,bt] = decsg(gd,sf,ns);
geometryFromEdges(GWModel,g);
figure(1);pdegplot(GWModel,'EdgeLabels','on');xlim([-250,250]), ylim([-150,150]);axis equal specifyCoefficients(GWModel, 'm',0,'d',0,'c',1,'a',0,'f',0);
%Assume Boundary conditions
applyBoundaryCondition(GWModel,'dirichlet','Edge',[5,6,7,8],'u',220);
applyBoundaryCondition(GWModel,'dirichlet','Edge',[1,2,3,4], 'u',200);
%applyBoundaryCondition(GWModel,'neumann', 'Edge',[1,4], 'q',0,'g',0);
%Create a mesh, max size
hmax = 1.25;
generateMesh(GWModel,'Hmax',hmax);
GWModel.Mesh
ans =
FEMesh with properties: Nodes: [2×233668 double] Elements: [6×116352 double] MaxElementSize: 1.2500 MinElementSize: 0.6250 MeshGradation: 1.5000 GeometricOrder: 'quadratic'
figure(2);pdemesh(GWModel);xlim([-250,250]), ylim([-150,150]);axis equal; %Solve PDE
results = solvepde(GWModel);
u = results.NodalSolution;
%Compute the flux of the solution and plot the results.
%Plot solution
figure(3)
pdeplot(GWModel,'XYData',u,'Contour','on','FlowData',[fluxx,fluxy])
axis equal
title('Numerical Solution');xlabel('x');ylabel('y')
xlim([-200,200]), ylim([-100,100]) 