How can I simulate 2 materials in pde toolbox script?
古いコメントを表示
In order to simulate 2 materials in a heat diffusion equation I define 2 different geometries, but then how I define the different coefficients for each material? One has heat source and the other hasn't. I am doing it as shown bellow, but the results are not what I would expect, so I am wondering if I am doing it right. There is another way to do that? Do I need to define 2 diff. equations instead?
Thank you very much in advance,
Here is my script:
numberOfPDE = 1;
model = createpde(numberOfPDE);
r1 = [3,4,0,0,0.5*10^-6,0.5*10^-6,-160*10^-9,-1.16*10^-6,-1.16*10^-6,-160*10^-9];
r2 = [3,4,0,0,0.5*10^-6,0.5*10^-6,0,-160*10^-9,-160*10^-9,0];
gdm = [r1; r2]';
g = decsg(gdm,'R1+R2',['R1'; 'R2']');
geometryFromEdges(model,g);
specifyCoefficients(model,'m',0,'d',5,'c',16,'a',0,'f',0,'face',1);
specifyCoefficients(model,'m',0,'d',5,'c',50,'a',0,'f',2*10^18,'face',2);
applyBoundaryCondition(model,'edge',1,'r',298);
applyBoundaryCondition(model,'edge',2,'q',2000,'g',596000);
applyBoundaryCondition(model,'edge',3,'g',0);
applyBoundaryCondition(model,'edge',4,'g',0);
applyBoundaryCondition(model,'edge',6,'g',0);
applyBoundaryCondition(model,'edge',7,'g',0);
hmax = 2*10^-8; % element size
msh=generateMesh(model,'Hmax',hmax);
tinitial = 0;
tfinal = 2*10^-8;
interval = 100;
tlist = linspace(tinitial,tfinal,interval);
u0 = 298; % initial temperature in the geometry
setInitialConditions(model,u0);
results = solvepde(model,tlist);
u = result.NodalSolution;
%Plot the solution at time t = tfinal.
figure;
pdeplot(model,'xydata',results.NodalSolution,'contour','on')
2 件のコメント
michio
2016 年 9 月 8 日
It seems to me that you are doing alright in specifying different coefficients for different sub-domains. I assume two different materials are represented by the two sub-domains.
specifyCoefficients(model,'m',0,'d',5,'c',16,'a',0,'f',0,'face',1);
specifyCoefficients(model,'m',0,'d',5,'c',50,'a',0,'f',2*10^18,'face',2);
It may help us help you if you describe more about your issues, your problem settings, what part of the result is not what you expect.
Laura Monreal
2016 年 9 月 14 日
Hi Michio,
I changed my name because I had problems with the other sesion. Thank you for you answer. So, in fact my f coefficient for the subdomain 2 is a cosinus that I do not see in the simulation, but i see it when I simulatet the "material" 2 byitself. I think I am not getting the result I spect because of the mesh, there is a way to introduce different meshing for different subdomains? I saw that you can not implement refinemesh usind a PDEmodel, so how should I do it?
Thank you in advance
採用された回答
その他の回答 (2 件)
Alan Weiss
2016 年 9 月 8 日
You might like the plot better if you plot the end time rather than the initial time:
pdeplot(model,'xydata',results.NodalSolution(:,end))
I am not sure that you have scaled things correctly, because I see very little difference between this plot and the plot at the second time step:
figure;pdeplot(model,'xydata',results.NodalSolution(:,2))
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Moncef
2019 年 7 月 1 日
0 投票
Hello,
please how to introduce the c coeffecient which is has matrix form:
c = [x-y, 0; 1, x.^2]
using "specifyCoefficients" matlab command?
With best regards
カテゴリ
ヘルプ センター および File Exchange で General PDEs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!