Exporting all solution variables from PDE Toolbox

5 Ansichten (letzte 30 Tage)
Jakub Checinski
Jakub Checinski am 2 Apr. 2018
Kommentiert: Jakub Checinski am 2 Apr. 2018
I am solving a DC conductive media problem using the PDE Toolbox. The Plot menu allows me to see both the electric potential and the electric current density, but the Solve->Export Solution button always seem to export a 1D vector containing the electric potential only. How can I get a full solution (both variables) exported?

Akzeptierte Antwort

Alan Weiss
Alan Weiss am 2 Apr. 2018
I'm afraid that you have to do some post-processing. If your exported solution is u, which is the potential at the nodes, then
[ux,uy] = pdegrad(p,t,u);
gives you the gradients at the triangle centers. To get the interpolated values of the potential at the triangle centers,
ut = pdeintrp(p,t,u);
I don't remember exactly how the gradient relates to the current density, but I think that it is proportional, and the constant of proportionality is related to the conductance, but I don't remember precisely what is the relationship.
Alan Weiss
MATLAB mathematical toolbox documentation
  1 Kommentar
Jakub Checinski
Jakub Checinski am 2 Apr. 2018
Thank you. Indeed, manually recalculating gradient from the exported potential variable makes it possible to obtain the current density. I guess there is no shorter solution for the time being.
For future readers, I would like to note that I had to use the standard MATLAB gradient function to get this done. Pdegrad didn't work as it changed the mesh, but maybe in newer versions of MATLAB this can be fixed with pdeintrp.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by