husseinaluie / FlowSieve

FlowSieve coarse-graining code base
https://flowsieve.readthedocs.io/en/latest/
Other
18 stars 9 forks source link

Helmholtz decomposition in a high-resolution current #27

Closed fecampos closed 1 year ago

fecampos commented 1 year ago

Dears, I am using high-resolution currents from a MITgcm simulation. Previous to the use coarse-graining filtering, I have used Helmholtz decomposition to get Helmholtz scalars (Psi and Phi) following the github documentation for high-resolution velocities. In Li, Z., Chao, Y., & McWilliams, J. C. (2006) (Computation of the streamfunction and velocity potential for limited and irregular domains) explains a methodology to get Psi and Phi that I believe is similar to the used in Helmholtz_projection.cpp. However, I do not understand the step to refine the projection using a seed. Could you help me giving me more details about this step?. Thank you sou much.

Best regards

bastorer commented 1 year ago

Hi Fernando,

Absolutely!

The seed is a starting guess to the Helmholtz solver. The kind of solver that we use in Helmholtz_projection.cpp is an iterative solver, so that it converges towards the correct Psi/Phi from an initial guess over a series of iterations. If the initial guess is "good" (i.e. somewhat reflective of the true Psi/Phi), then it could greatly reduce the time required to converge. In the absence of some known starting guess, we start with a zero solution.

Mathematically, we're trying to solve Ax=b for x, where A,b are known and A is very large and very sparse. If we have a guess x_0 for what x should be, then we can instead solve Ax' = b-Ax_0, where x'=x-x_0. If x_0 is a good guess, then b-Ax_0 will be "small" and the new problem should converge much faster than original.

One example of how to get a "good" initial guess is to solve for Psi/Phi on a coarser grid (where computational costs are lower and convergence is faster), and use those solutions as a seed for the finer grid.

Regards, Ben

fecampos commented 1 year ago

Thank you so much Ben.

Regards,

Fernando