Specifying diffusion coefficient, PDE toolbox
조회 수: 3 (최근 30일)
이전 댓글 표시
I currently solve elliptic PDE with Matlab as follows
pdem = createpde(1);
c=1;
a=0;
f=1;
geometryFromEdges(pdem,@squareg);
[p,e,t]=initmesh(@squareg,'hmax',0.2);
assempde(pdem,p,e,t,c,a,f);
I would like to allow for a variable diffusioncoefficient 'c'. I noticed that if I pass a function instead of a constant as 'c', I am given two arguments, call them A and B, of size 2x177, 4x312. By trying out, I found that the output should have length 312, but I don't know what the output should represent for assempde to work properly. The entries of B are indices, not spatial coordinates. I guess these indices refer to spatial coordinates that are contained in A, but I still don't know what output exactly assempde wants.
I would just want to specify a function 'c' that takes an array of size Nx2 and returns either Nx1 or Nx2x2 arrays. Is this possible?
I am using MATLAB 2015a.
댓글 수: 0
답변 (1개)
Alan Weiss
2016년 4월 13일
Since you have R2015a, you will probably be happiest using the latest workflow. For a 2-D problem, the easiest way to write diffusion coefficients is probably the string form, though you can also use the functional form, too. For an example using both types of coefficients, see this example.
Also, instead of using initmesh, you should probably try using generateMesh, and forgoing the use of the [p,e,t] matrices.
Alan Weiss MATLAB mathematical toolbox documentation
댓글 수: 2
Alan Weiss
2016년 4월 13일
Sorry, I misspoke when I said "latest." Nevertheless, follow the links I gave (which are to R2015a documentation), and see if they make sense to you. Or use the built-in doc command to explore the relevant documentation for your MATLAB version.
Alan Weiss
MATLAB mathematical toolbox documentation
참고 항목
카테고리
Help Center 및 File Exchange에서 Geometry and Mesh에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!