BVPpotential2D01

% -----------------------------------------------------
% Solving a BVP by using <fc-vfemp1>
% -----------------------------------------------------
% 2D condenser BVP[01] on GMSH mesh from disk5holes.geo.
% -----------------------------------------------------
% Boundary Value Problem: find u such that
%       - Laplacian(u) = 0   in mesh
% with boundary conditions :
%   * Dirichlet on [20,21]
%       u = +1 on [21], -1 on [20]
%   * Homogeneous Neumann on [1,10]
%       du/dn = 0 on [1,10]
%   * Robin on [22,23]
%       du/dn + 0.5*u = +1 on [22]
%       du/dn + 0.5*u = -1 on [23]
% -----------------------------------------------------
close all
clear all
geofile='disk5holes';
fullgeofile=fc_vfemp1.get_geo(2,2,geofile);
if isempty(fullgeofile), error('geofile %s not found',geofile);end
% Building the mesh using GMSH
meshfile=fc_oogmsh.gmsh.buildmesh2d(fullgeofile,30);
% Loading the mesh using <fc_simesh.siMesh> object
Th=fc_simesh.siMesh(meshfile);
Th.info('verbose',true)
% Setting -Laplacian operator
Lop=fc_vfemp1.Loperator(2,2,{1,0;0,1},[],[],[]);
% Setting the PDE : -Laplacian(u) = 0
pde=fc_vfemp1.PDE(Lop);
% Setting the BVP
bvp=fc_vfemp1.BVP(Th,pde);
bvp.setDirichlet( 21, 1);
bvp.setDirichlet( 20, -1);
bvp.setRobin(22,+1,0.5);
bvp.setRobin(23,-1,0.5);
% Default boundary condition is Homegeneous Neumann:
%   bvp.setRobin(1,0,[]);
%   bvp.setRobin(10,0,[]);

% Solving the BVP
U=bvp.solve();

% Graphics
figure(1)  % Main mesh
Th.plotmesh('inlegend',true)
legend()
axis equal;axis off

figure(2) % Boundaries of the mesh
Th.plotmesh('color','LightGray')
hold on
Th.plotmesh('d',1,'inlegend',true)
legend()
axis equal;axis off

figure(3) % Solution on the mesh
Th.plot(U)
axis off,axis image
colorbar()
shading interp

figure(4) % Isolines of the solution on the mesh
Th.plotmesh('d',1,'color','k')
hold on
Th.plotiso(U,'niso',25,'isocolorbar',true,'format','%.3f');
axis off,axis image

fc_tools.graphics.monitors.autoGrid('covers',0.9)
[fc-oogmsh] Input file : /home/cuvelier/Travail/Recherch/Matlab/fc-vfemp1/geodir/2d/disk5holes.geo
[fc-oogmsh] Mesh file <fc-oogmsh>/meshes/disk5holes-30.msh [version 4.1] already exists.
  -> Use "force" flag to rebuild if needed.
Variable  [fc_simesh.siMesh object] :
  dim=2, d=2
  nq=3289, nme=6258
  2-simplices : number 1, labels : 1 
  1-simplices : number 6, labels : 1 10 20 21 22 23 
  0-simplices : none
BVPpotential2D01-1.pngBVPpotential2D01-2.pngBVPpotential2D01-3.pngBVPpotential2D01-4.png