Filter löschen
Filter löschen

Specifying diffusion coefficient, PDE toolbox

4 Ansichten (letzte 30 Tage)
Bananach
Bananach am 13 Apr. 2016
Kommentiert: Alan Weiss am 13 Apr. 2016
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.

Antworten (1)

Alan Weiss
Alan Weiss am 13 Apr. 2016
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 Kommentare
Bananach
Bananach am 13 Apr. 2016
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 am 13 Apr. 2016
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

Melden Sie sich an, um zu kommentieren.

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by