Exporting all solution variables from PDE Toolbox

조회 수: 5 (최근 30일)
Jakub Checinski
Jakub Checinski 2018년 4월 2일
댓글: Jakub Checinski 2018년 4월 2일
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?

채택된 답변

Alan Weiss
Alan Weiss 2018년 4월 2일
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
Jakub Checinski
Jakub Checinski 2018년 4월 2일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by