BVPelectrostatic2D01
close all
clear all
geofile='square4holes6dom.geo';
fullgeofile=fc_vfemp1.get_geo(2,2,geofile);
if isempty(fullgeofile), error('geofile %s not found',geofile);end
meshfile=fc_oogmsh.gmsh.buildmesh2d(fullgeofile,30);
Th=fc_simesh.siMesh(meshfile);
Th.info('verbose',true)
sigma1=1;sigma2=10;
Lop1=fc_vfemp1.Loperator(2,2,{sigma1,0;0,sigma1},[],[],[]);
Lop2=fc_vfemp1.Loperator(2,2,{sigma2,0;0,sigma2},[],[],[]);
pde1=fc_vfemp1.PDE(Lop1);
pde2=fc_vfemp1.PDE(Lop2);
bvp=fc_vfemp1.BVP(Th,pde2);
bvp.setPDE(2,10,pde1);
bvp.setDirichlet( 1, 12);
bvp.setDirichlet( 3, 0);
bvp.setDirichlet( 5, 12);
bvp.setDirichlet( 7, 0);
fprintf('*** Solving the potential phi\n')
phi=bvp.solve();
fprintf('*** Computing the electric field E\n')
Lop=fc_vfemp1.Loperator(2,2,[],[],{-1,0},[]);
Ex=Lop.apply(Th,phi);
Lop=fc_vfemp1.Loperator(2,2,[],[],{0,-1},[]);
Ey=Lop.apply(Th,phi);
E=[Ex,Ey];
ENorm=sqrt(Ex.^2+Ey.^2);
fc_tools.graphics.monitors.onGrid(3,3,'figures',1:7,'covers',0.9);
interpreter=@(x) fc_tools.graphics.interpreter(x);
if fc_tools.comp.isOctave(),opt_interp={'interpreter','tex'};else,opt_interp={'interpreter','latex'};end
tstart=tic();
figure(1)
Th.plotmesh('inlegend',true)
legend('show')
axis equal;axis off
figure(2)
Th.plotmesh('color',[0.8,0.8,0.8])
Th.plotmesh('d',1,'LineWidth',1.5,'inlegend',true)
legend('show')
axis image
figure(3)
Th.plotmesh('d',1,'color',[0,0,0])
hold on
Th.plot(phi,'EdgeColor','None')
axis image;axis off;
colorbar()
Th.plotiso(phi,'niso',20,'color','w','LineWidth',1)
Th.plotmesh('d',1,'color','w','LineWidth',1.5)
shading interp
title(interpreter('potentiel $\varphi$'),opt_interp{:})
figure(4)
Th.plotmesh('color',[0.85,0.85,0.85])
hold on
Th.plotmesh('d',1,'color',[0,0,0])
[~,~,cax]=Th.plotiso(phi,'niso',25,'isocolorbar',true,'format','%.3f');
axis image;axis off;
title(interpreter('potentiel $\varphi$'),opt_interp{:})
idxlab=Th.find(2,10);
figure(5)
Th.plotmesh('d',1,'color','k')
hold on
[~,~,cax]=Th.plotiso(phi,'niso',25,'isocolorbar',true,'format','%.3f');
Th.plotquiver(E,'d',2,'labels',[10],'colordata',phi)
axis image;axis off;
title(interpreter('potentiel $\varphi$ and electric field $E$'),opt_interp{:})
figure(6)
Th.plot(ENorm,'EdgeColor','None')
hold on
axis image;axis off;
colorbar()
Th.plotiso(ENorm,'niso',20,'color','w','LineWidth',1)
Th.plotmesh('d',1,'color','k','LineWidth',1.5)
shading interp
title(interpreter('Norm of the electric field $E$'),opt_interp{:})
figure(7)
Th.plotmesh('d',1,'color',[0,0,0])
hold on
[~,~,cax]=Th.plotiso(ENorm,'niso',25,'isocolorbar',true,'format','%.3f');
axis image;axis off;
title(interpreter('Norm of the electric field $E$'),opt_interp{:})
[fc-oogmsh] Input file : /home/cuvelier/Travail/Recherch/Matlab/fc-vfemp1/geodir/2d/square4holes6dom.geo
[fc-oogmsh] Mesh file <fc-oogmsh>/meshes/square4holes6dom-30.msh [version 4.1] already exists.
-> Use "force" flag to rebuild if needed.
Variable [fc_simesh.siMesh object] :
dim=2, d=2
nq=4632, nme=8950
2-simplices : number 6, labels : 2 4 6 8 10 20
1-simplices : number 10, labels : 1 2 3 4 5 6 7 8 10 20
0-simplices : none
*** Solving the potential phi
*** Computing the electric field E





