MATLAB Answers

How do I define the boundary condition between two conducting materials to solve a PDE?

3 views (last 30 days)
Mark Lepage
Mark Lepage on 11 May 2018
Hello,
As the question describes, I'm looking to solve an electrostatics PDE, where I have two different conducting materials.
I can set up the PDE equations no problem, however when I solve the PDE, it is assuming that at the boundary condition at the interface between the materials, the Neumann boundary condition is equal to 0 (by default, because I didn't set it).
On paper, I would solve this by knowing the current flow is equal going into and out of the surface, but can't readily define this using a Neumann boundary condition. I could define the voltage at the interface and iterate until the current flows are equal but this seems redundant as the problem is fully specified to begin with.
Here is my pseudo code:
%Create PDE model
model = createpde();
modelName = 'differentK.stl';
sensor = importGeometry(model,modelName);
figure
pdegplot(model,'FaceLabels','on');
figure
pdegplot(model,'CellLabels','on','FaceAlpha',0.5);
%Apply PDE coefficients
k1 = 0.001; %k is the conductivity in S/mm, but only relevent if using neumann boundary conditions
k2 = 0.01;
k3 = 0.1;
specifyCoefficients(model,'Cell',1,'m',0,'d',0,'c',k1,'a',0,'f',0);
specifyCoefficients(model,'Cell',2,'m',0,'d',0,'c',k2,'a',0,'f',0);
specifyCoefficients(model,'Cell',3,'m',0,'d',0,'c',k3,'a',0,'f',0);
%Apply boundary conditions
%Positive Ring
applyBoundaryCondition(model,'dirichlet','face',[5,1],'u',0);
%Negative Ring
applyBoundaryCondition(model,'dirichlet','face',13,'u',1);
disp('Boundary conditions applied...')
%Generate Mesh and Solve PDE
generateMesh(model);
disp('Mesh has been generated...')
result = solvepde(model);
disp('PDE has been solved...')
u = result.NodalSolution;
figure
pdeplot3D(model,'ColorMapData',u)
hColorbar = colorbar;
ylabel(hColorbar,'Electric potential (V)')
title("PDE Solution")

Answers (0)

Community Treasure Hunt

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

Start Hunting!