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

8 次查看(过去 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
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
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 个评论
Hayden Bland
Hayden Bland 2020-8-6
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