glugeorge / coupled_ice_hydrology

MIT License
6 stars 0 forks source link

Removing the interpolation error at interface of grids #5

Open jkingslake opened 1 year ago

jkingslake commented 1 year ago

A couple of ideas that came up today in our meeting for removing the interpolation error you are seeing.

glugeorge commented 1 year ago

I think some of the interpolation errors from the term plots stem from additional interpolation errors in the initial solution, so immediately applying those two suggestions in the term plots code is not fruitful.

I believe that within the solver, the main point of error is when determining psi, as I interpolate h onto the hydrology grid before taking the gradient. However, even if i take the gradient first and then interpolate, there is still an error. And then looking further, I cannot seem to identify 2 exact regions to split up, unlike the u grid. I believe this is due to the way the h grid is defined.

Looking at sigma (the velocity grid), there is exactly two different spacings, and are seperated by that one kink:

image

With this case, we can definitely split the gradients up and glue them together. Here is the gradient of the initial velocity guess:

image

Interpolating this value onto the hydro grid should then be fine.

However, in the script, the only gradient + interpolation combination is on sigma_elem, which is less nice. Zooming in on the transition zone where the kink in sigma is located, we see there's actually 2 changes in sigma_elem:

image

This means that if we split at the same spot as sigma and take the gradients, I think there's still an error. However, with the initial guess h, it's not showing up. That made me a bit confused and decide to try to apply this split anyways in the definition of psi. However, now the system of equations won't converge to a solution. My concern is that since it is split, it gives more flexibility for h to vary or something along those lines. When I run with this split, there is still the same interpolation error. Trying to think about why this is the case. I think it might be because with the height and velocity grid changes, theres a condition to enforce continuity at the grid split. When I interpolate onto the uniform hydrology grid, this condition disappears for the hydrology perhaps?

jkingslake commented 1 year ago

What is sigma_elem? The staggered grid? Seems like it would be good to get to the bottom of why there are two different kinks in that grid.

On Sat, Nov 19, 2022, 4:00 PM George Lu @.***> wrote:

I think some of the interpolation errors from the term plots stem from additional interpolation errors in the initial solution, so immediately applying those two suggestions in the term plots code is not fruitful.

I believe that within the solver, the main point of error is when determining psi, as I interpolate h onto the hydrology grid before taking the gradient. However, even if i take the gradient first and then interpolate, there is still an error. And then looking further, I cannot seem to identify 2 exact regions to split up, unlike the u grid. I believe this is due to the way the h grid is defined.

Looking at sigma (the velocity grid), there is exactly two different spacings, and are seperated by that one kink: [image: image] https://user-images.githubusercontent.com/25989736/202869330-ec07d922-e816-4653-a522-cff1ff8b88cc.png

With this case, we can definitely split the gradients up and glue them together. Here is the gradient of the initial velocity guess: [image: image] https://user-images.githubusercontent.com/25989736/202869692-23e23e11-bca2-41fd-8bf5-f8efa391cc4b.png Interpolating this value onto the hydro grid should then be fine.

However, in the script, the only gradient + interpolation combination is on sigma_elem, which is less nice. Zooming in on the transition zone where the kink in sigma is located, we see there's actually 2 changes in sigma_elem: [image: image] https://user-images.githubusercontent.com/25989736/202869885-907058d0-fdc5-4c35-a3d4-afb374e49434.png

This means that if we split at the same spot as sigma and take the gradients, I think there's still an error. However, with the initial guess h, it's not showing up. That made me a bit confused and decide to try to apply this split anyways in the definition of psi. However, now the system of equations won't converge to a solution. My concern is that since it is split, it gives more flexibility for h to vary or something along those lines.

— Reply to this email directly, view it on GitHub https://github.com/glugeorge/coupled_ice_hydrology/issues/5#issuecomment-1320968235, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALTXJ3K2NNR7IZMXAJSBYPTWJE5YTANCNFSM6AAAAAASAISPHE . You are receiving this because you were assigned.Message ID: @.***>