# Boundary Condition for 3-D Poisson's Equation using PDE Toolbox

조회 수: 2 (최근 30일)
Hayden Bland 2020년 8월 6일
댓글: Hayden Bland 2020년 8월 6일
I am attempting to model the electric field of a cylinder with 3 spheres inside. To do this I am attempting to solve Poisson's Equation in 3-D with the PDE Toolbox, and am running into errors with the boundary conditions. I am getting the associated error. Any guidance is much appreciated.
"Error using pde.internal.pde3DBCImpl/setValueBCOnFace (line 100)
The "u" parameter has length 1 so the "EquationIndex" vector must also have length 1 instead of length 3.
This error occurred in the definition of a pde.BoundaryCondition entity on edge 14."
model = createpde(3) % creates 3 equations
importGeometry(model,'ModelSystem.STL') % imports solidworks part
figure(1)
pdegplot(model,'FaceLabels','on')
applyBoundaryCondition(model,'dirichlet','Face',14,'u',0) % bottom face with E field of 0
applyBoundaryCondition(model,'dirichlet','Face',13,'u',100) % top face with E field of 100
applyBoundaryCondition(model,'dirichlet','Face',1:12,'u',0) % rest of faces also with E field of 0
generateMesh(model)
pdeplot3D(model)
f = [100;100;100] % source of voltage from top plate
CA = specifyCoefficients(model,'m',0,...
'd',0,...
'c',1,...
'a',0,...
'f', f) % specifies coefficients as described in MATLAB documentation
results = solvepde(model); % this is when the error occurs
pdeplot3D(model,'ColorMapData',results.NodalSolution) % rendering of model

댓글을 달려면 로그인하십시오.

### 채택된 답변

Ravi Kumar 2020년 8월 6일
You need BC for all three equations. You might want to try u as [0;0;0] or other appropriate vector of 3 rows, where each row corresponds to the three PDEs.
Regards,
Ravi
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
Hayden Bland 2020년 8월 6일
Ah, that makes perfect sense. I foolishly attempted it with 3 columns instead earlier. Thank you for your help!

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Electromagnetics에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by