Specifying diffusion coefficient, PDE toolbox
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Alan Weiss
il 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 Commenti
Alan Weiss
il 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
Vedere anche
Categorie
Scopri di più su Geometry and Mesh in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!