Matlab: how to write a non-uniform diffusion coefficient in a 2D region using pdetool box
Afficher commentaires plus anciens
I'm solving an advection-diffusion equation using pdetool box . How to make the diffusion coefficient c to be 1 when y>0.03 and 0.2 otherwise. Thanks
c = 1;
a = 1;
f = 0
d = 1; xmin=0;xmax=0.575;ymin=0;ymax=0.05315;ymax2=0.066;
gdm = [3;4;xmin;xmax;xmax;xmin;ymax;ymax2;ymin;ymin];
g = decsg(gdm, 'S1', ('S1')');
hmax = .1; % element size
[p, e, t] = initmesh(g, 'Hmax', hmax);
[p,e,t] = refinemesh(g,p,e,t);
[p,e,t] = refinemesh(g,p,e,t);
[p,e,t] = refinemesh(g,p,e,t);
[p,e,t] = refinemesh(g,p,e,t);
[p,e,t] = refinemesh(g,p,e,t);
numberOfPDE = 1;
pb = pde(numberOfPDE);
% Create a geometry entity
pg = pdeGeometryFromEdges(g);
bc1 = pdeBoundaryConditions(pg.Edges(1),'u',100);
bc2 = pdeBoundaryConditions(pg.Edges(2),'u',66);
bc3 = pdeBoundaryConditions(pg.Edges(3),'u',11);
bc4 = pdeBoundaryConditions(pg.Edges(4),'g',0);
pb.BoundaryConditions = [bc1,bc2,bc3,bc4];
u = pdenonlin(pb,p,e,t,c,a,f, 'jacobian', 'lumped');
figure;
hold on
pdeplot(p, e, t, 'xydata', u, 'contour', 'off', 'colormap', 'jet(99)');
title 'chemical Diffusion, Steady State Solution'
xlabel 'X-coordinate, cm'
ylabel 'Y-coordinate, cm'
Réponses (0)
Catégories
En savoir plus sur Visualization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!