Specifying diffusion coefficient, PDE toolbox

조회 수: 3 (최근 30일)
Bananach
Bananach 2016년 4월 13일
댓글: Alan Weiss 2016년 4월 13일
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.

답변 (1개)

Alan Weiss
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
Bananach
Bananach 2016년 4월 13일
What do you mean with the latest workflow? I can't use solvepde with my version. And if I check my documentation for examples and the pages marked as legacy, I get a variety of different approaches (the initmesh thing is from "Poisson's Equation on a Unit Disk").
Alan Weiss
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 CenterFile Exchange에서 Geometry and Mesh에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by