MATLAB Answers

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

조회 수: 9(최근 30일)
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
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
f = [100;100;100] % source of voltage from top plate
CA = specifyCoefficients(model,'m',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
Ravi Kumar 6 Aug 2020
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.
  댓글 수: 1
Hayden Bland
Hayden Bland 6 Aug 2020
Ah, that makes perfect sense. I foolishly attempted it with 3 columns instead earlier. Thank you for your help!

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by