How to increase the size of "s" using pdegeom?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have written a pdegeom file which produce a sinusoidal edge. The standard amount of grid points (size(s)) is set to 50. This is not enough to reproduce approx. 50 periods of the sinus correctly.
The pdegeom file (you can check it with pdegplot('Geom') to see that the sinus is not correctly plotted):
function [ x,y ] = Geom(bs,s)
nbs = 10;
if nargin==0
x=nbs;
return
end
dl=[ 0 1 2 3 4 5 6 7 8 9;
1 2 3 4 5 6 7 8 9 10;
0 0 0 0 0 0 0 0 1 1;
1 1 1 1 2 2 2 1 2 2];
if nargin==1
x=dl(:,bs);
return
end
x=zeros(size(s));
y=zeros(size(s));
[m,n]=size(bs);
if m==1 && n==1,
bs=bs*ones(size(s)); % expand bs
elseif m~=size(s,1) || n~=size(s,2),
error(message('pde:cardg:SizeBs'));
end
nn=size(bs,1)*size(bs,2);
if nn==0
x=[];
y=[];
return
end
for ibs=1:nn
switch bs(ibs)
case 1 % Boundary-Tip down right
xx=50 - (50-10)*s(ibs);
yy=-50 +0*s(ibs);
case 2 % Tip side right
xx=10 - (10-5)*(s(ibs)-1);
yy=-50*(1-(s(ibs)-1));
case 3 % Tip apex half
xx=5*cos(pi/2*(s(ibs)-2));
yy=5*sin(pi/2*(s(ibs)-2));
case 4 % Tip to resist
xx=0*(s(ibs)-3);
yy=5 + ((20-12)-5)*(s(ibs)-3);
case 5 % resist to sample
xx=0*(s(ibs)-4);
yy=(20-12) + (12)*(s(ibs)-4);
case 6 % Sample
xx=50*(s(ibs)-5);
yy=20 + 0*(s(ibs)-5);
case 7 % Boundary right - Resist
xx=50 + 0*(s(ibs)-6);
yy=20 - (12)*(s(ibs)-6);
case 8 % Boundary right
xx=50 + 0*(s(ibs)-7);
yy=(20-12) - ((20-12)-(-50))*(s(ibs)-7);
case 9 % Layer right - Tip side
xx=30*(s(ibs)-8);
yy=(20-12)+3*sin(2*pi/1*xx);
case 10
xx=30-(30-50)*(s(ibs)-9);
yy=20-12+0*(s(ibs)-9);
end
x(ibs)=xx;
y(ibs)=yy;
end
end
0 commentaires
Réponse acceptée
Bill Greene
le 30 Oct 2014
If your concern is about producing a nice looking plot from pdegplot, you will need to edit that function by changing the line:
n=50;
at around line 46 to make n something larger.
If your concern is about getting a sufficiently fine mesh near the sinusoid edge, you don't need to do anything but specify a sufficiently small value of hmax in the call to initmesh. initmesh will call your Geom function as often as needed to produce a mesh with an accurate boundary.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Geometry and Mesh dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!