BVPfunny2D01

% -----------------------------------------------------
% Solving a vector BVP by using <fc-vfemp1>
% -----------------------------------------------------
% 2D funny vector BVP[01] on GMSH mesh from condenser.geo.
% -----------------------------------------------------
% Boundary Value Problem: find (u,v) such that
%       - Laplacian(u) + v = 0   in mesh         (pde1)
%       - Laplacian(v) + u = 0   in mesh         (pde2)
% with boundary conditions :
%   * Dirichlet on [1,98,99]
%       u = 0 on [1], -12 on [98] and +12 on [99]
%       v = 0 on [1], +12 on [98] and -12 on [99]
% -----------------------------------------------------
% The associated vector BVP is: find W=(u,v) such that
%           /  Lop1  ,  Lop2  \ / u \   / 0 \
% Hop * W = |                 |*|   | = |   |    (pdes)
%           \  Lop2  ,  Lop1  / \ v /   \ 0 /
% where Lop1= -Laplacian = fc_vfemp1.Loperator(2,2,{1,[];[],1},[],[],[]))
%       Lop2= Identity   = fc_vfemp1.Loperator(2,2,[],[],[],1))
% with boundary conditions :
%   * Dirichlet on [1,98,99]
%       W = (0,0) on [1], (-12,+12) on [98] and (+12,-12) on [99]
% -----------------------------------------------------
close all
clear all
geofile='condenser';
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,10);
% Loading the mesh using <fc_simesh.siMesh> object
Th=fc_simesh.siMesh(meshfile);
Th.info('verbose',true)

% Setting the Hoperator
Hop=fc_vfemp1.Hoperator(2,2,2);
Lop1=fc_vfemp1.Loperator(2,2,{1,[];[],1},[],[],[]);
Hop.set([1,2],[1,2],Lop1);
Lop2=fc_vfemp1.Loperator(2,2,[],[],[],1);
Hop.set([1,2],[2,1],Lop2);
% Setting the PDEs (pdes)
pde=fc_vfemp1.PDE(Hop);
% Setting the vector BVP
bvp=fc_vfemp1.BVP(Th,pde);
bvp.setDirichlet( 1, 0.,1:2);
bvp.setDirichlet( 98, {-12,+12},1:2);
bvp.setDirichlet( 99, {+12,-12},1:2);

% Solving the vector BVP
W=bvp.solve('split',true);
U=W{1};V=W{2};

% 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)
Th.plot(U)
axis image;axis off;shading interp
colorbar
title('u P1-FEM solution')

figure(4);
Th.plot(V)
axis image;axis off;shading interp
colorbar
title('v P1-FEM solution')

fc_tools.graphics.monitors.autoGrid('covers',0.9)
[fc-oogmsh] Input file : /home/cuvelier/Travail/Recherch/Matlab/fc-vfemp1/geodir/2d/condenser.geo
[fc-oogmsh] Mesh file <fc-oogmsh>/meshes/condenser-10.msh [version 4.1] already exists.
  -> Use "force" flag to rebuild if needed.
Variable  [fc_simesh.siMesh object] :
  dim=2, d=2
  nq=8151, nme=15708
  2-simplices : number 1, labels : 1 
  1-simplices : number 3, labels : 1 98 99 
  0-simplices : number 8, labels : 1 2 3 4 5 6 7 8 
BVPfunny2D01-1.pngBVPfunny2D01-2.pngBVPfunny2D01-3.pngBVPfunny2D01-4.png