Effacer les filtres
Effacer les filtres

Calculating div(grad(u)) and a line integral from pde solution

3 vues (au cours des 30 derniers jours)
Hanne
Hanne le 12 Oct 2014
Commenté : Hanne le 23 Oct 2014
Dear experts,
I imported a solution of -div(grad(u))=f(u) from the pde app. I would like to do 2 things:
1. re-calculate d^2u/dx^2+d^2u/dy^2 for checking the solution
2. calculate an integral of form int g(u,du/dx,du/dy) dy along a line where x=0.
For both of these tasks, the (brute force) solutions I came up with utilizes pdegrad, tri2grid and pdeprtni a lot.
For 1. I calculate the derivatives with pdegrad, map solution to nodes with pdeprtni and pdegrad again.
For 2. I calculate derivatives with pdegrad, map to square mesh with tri2grid and integrate with trapz.
Unfortunately, all this estimation introduces error. Can anyone suggest a more straightforward & accurate way of doing this?
Thanks!
Can anyone suggest a more strayou suggest
  2 commentaires
Siddharth Sundar
Siddharth Sundar le 14 Oct 2014
Modifié(e) : Siddharth Sundar le 14 Oct 2014
-Is there a reason you are comparing the two numerical solutions?
-What is the magnitude of error introduced at every step of the calculation?
-Did you try refining the mesh further before exporting the solution to MATLAB? That might help.
-You could try integral2 instead of trapz and see if that helps.
Hanne
Hanne le 23 Oct 2014
-Is there a reason you are comparing the two numerical solutions?
This is the first time I'm using pde toolbox so just wanted to see whether I defined the equation correctly.
-What is the magnitude of error introduced at every step of the calculation?
I have no idea, for now, the error seems quite small.
-Did you try refining the mesh further before exporting the solution to MATLAB? That might help
Yes, the solution didn't change much. This is the reason I think the magnitude of error isn't too large.
-You could try integral2 instead of trapz and see if that helps.
I did play around with this. I cound't figure out how to properly import the numerical data vectors u,du/dx,du/dy into integral2, but I'll take another look. Thanks for the tip!

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differentiation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by