Skip to main content
2 of 3
added 7 characters in body
xzczd
  • 71.6k
  • 10
  • 183
  • 524

How can I construct the derivative matrix for an irregular domain?

I wish to construct the derivative matrix corresponding to an irregular set of points. For example, I have the following grid consisting 16 nodes in the 2D plane:

ClearAll["Global`*"]; grid = {{-2.30259, 2.40259}, {-2.30259, 2.70259}, {-2.30259, 3.00259}, {-2.30259, 3.30259}, {-0.310155, 0.410155}, {-0.310155, 0.710155}, {-0.310155, 1.01015}, {-0.310155, 1.31015}, {0.312375, -0.212375}, {0.312375, 0.0876253}, {0.312375, 0.387625}, {0.312375, 0.687625}, {0.693147, -0.593147}, {0.693147, -0.293147}, {0.693147, 0.00685282}, {0.693147, 0.306853}}; ListPlot[grid, PlotRange -> All, Frame -> True, Axes -> False, ImageSize -> 300] 

I know about the powerful built-in function NDSolve`FiniteDifferenceDerivative in Mathematica. So, in order to construct my derivative matrix I do the following which is probably not correct:

xgrid2 = Sort@Map[First, grid] ygrid2 = Sort@Map[Last, grid] NDSolve`FiniteDifferenceDerivative[{1, 1}, {xgrid2, ygrid2}]["DifferentiationMatrix"] 

But here since the domain is irregular and there are duplicated values in xgridg2 direction, then nothing will be attained. If I use DeleteDuplicates to remove the duplicates values, then the size of the final differentiation matrix is not $16\times 16$!

I will be grateful if someone let me know for a possible way in Mathematica to construct the differentiation matrix quickly for irregular domains.

M.J.2
  • 571
  • 2
  • 9