Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primal to dual triangle interpolation #135

Merged
merged 4 commits into from
Jan 29, 2025
Merged

Primal to dual triangle interpolation #135

merged 4 commits into from
Jan 29, 2025

Conversation

GeorgeR227
Copy link
Contributor

This PR introduces p2_d2_interpolation which is meant to faithfully map primal Form-2 data onto dual Form-2 data. The process looks at the dual to a primal point which is composed of dual triangles from primal triangles upon which this primal point is incident. The values from these primal triangles are transferred to their dual triangle components by area weighting these dual triangle components. Components from individual primal triangles are then all summed to generate the value for the dual Form-2.

Using the inverse hodge 0 after interpolating can spread out data from primal triangles onto primal points. Similarly, using inverse hodge 2 can first map data from dual points onto primal triangles. Moving through the entire pipeline, this serves as a simple dual point to primal point interpolation.

Introduced tests on Icosphere and changed function interpolation test to use relative error. Also fixed of point interpolation to d0_p0 instead of d1_p1.
@GeorgeR227
Copy link
Contributor Author

Investigating the error caused by this interpolation I've drawn some conclusions.

  • For constant functions over primal triangles, the results seems to be exact, even on the boundaries.
  • For linear functions, error shows up only on the boundaries in which the gradients of the function span but the results are exact on the interior. This means that for simulations that have set boundary conditions, this interpolation will work well. The positivity/negativity of the error is also dependent on if the function is increasing/decreasing in that direction. It may be possible to apply a correction factor to remedy this but I haven't yet investigated this.

The analytic function on primal points. Function is 2x + 3y.
image

The absolute error between the analytic and the interpolated analytic function from dual points.
image

  • For non-linear functions, quadratic in this example, error on the boundary follows the same rule as before in that it follows the gradients. However, in this case, there is some appreciable error on the interior. Of course, if the function is dominated by either a linear or a constant term then this error will tend towards zero.

The analytic function on primal points. Function is 1/10*x^2 + 5 where x is centered in the center of the mesh.
image

The relative error between the analytic and the interpolated analytic function from dual points.
image

@GeorgeR227
Copy link
Contributor Author

I've taken the liberty of plotting the evolution of relative interior error over time for the quadratic function mentioned above. Hopefully this serves as a guide to determine how fine a mesh is needed when only tolerating a certain amount of error. Mesh is a 32x16 sized triangulated grid with grid spacing going from 4 till 0.0625 by halving.

image

@GeorgeR227 GeorgeR227 requested a review from lukem12345 January 29, 2025 17:10
@lukem12345 lukem12345 merged commit 07620ed into main Jan 29, 2025
8 of 9 checks passed
@lukem12345 lukem12345 deleted the gr/p2-d2-interp branch January 29, 2025 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants