CICE-Consortium / CICE

Development repository for the CICE sea-ice model
Other
53 stars 129 forks source link

C grid noise in corners #792

Closed JFLemieux73 closed 1 year ago

JFLemieux73 commented 1 year ago

See also issue #791.

JFLemieux73 commented 1 year ago

If we want to implement another discretization we should consider what Bill proposed;

https://github.com/CICE-Consortium/CICE/issues/714

This could be our next coding camp! 😎

JFLemieux73 commented 1 year ago

Dave, I ran it with a dt=120 s...the checkerboard is still there.

JFLemieux73 commented 1 year ago

I read again Till's comment above about l_fixed_area = .false. in the transport_driver. So I decided to set l_fixed_area = .true. I am not exactly sure what this does and if I am allowed to use it but interestingly when I set it to true the checkerboard disappears for both test cases as shown below:

fixed_area_True_NE_aice_2005-01-15-00000

fixed_area_True_EB_aice_2005-01-15-00000

Any comments about this?

eclare108213 commented 1 year ago

Wow! I'm not familiar with how l_fixed_area is supposed to work, not having ever used it, but my impression is that you need to externally calculate some things to send into the transport routine in addition to changing the flag. So this might not be actually transporting anything? @whlipscomb might be able to shed some light on what's needed here.

dabail10 commented 1 year ago

Are you sure you had incremental remapping on?

JFLemieux73 commented 1 year ago

Yes. advection = 'remap'

dabail10 commented 1 year ago

Cool.

JFLemieux73 commented 1 year ago

Here are some comments taken from ice_transport_remap.F90:

! Finally, a few words about the edgearea fields: ! ! In earlier versions of this scheme, the divergence of the velocity ! field implied by the remapping was, in general, different from the ! value of del*u computed in the dynamics. For energetic consistency ! (in CICE as well as in layered ocean models such as HYPOP), ! these two values should agree. This can be ensured by setting ! l_fixed_area = T and specifying the area transported across each grid ! cell edge in the arrays edgearea_e and edgearea_n. The departure ! regions are then tweaked, following an idea by Mats Bentsen, such ! that they have the desired area. If l_fixed_area = F, these regions ! are not tweaked, and the edgearea arrays are output variables.

TillRasmussen commented 1 year ago

Would it be worthwhile to reach out to Mats Bentsen?

On Thu, Dec 22, 2022 at 7:34 PM JFLemieux73 @.***> wrote:

Here are some comments taken from ice_transport_remap.F90:

! Finally, a few words about the edgearea fields: ! ! In earlier versions of this scheme, the divergence of the velocity ! field implied by the remapping was, in general, different from the ! value of del*u computed in the dynamics. For energetic consistency ! (in CICE as well as in layered ocean models such as HYPOP), ! these two values should agree. This can be ensured by setting ! l_fixed_area = T and specifying the area transported across each grid ! cell edge in the arrays edgearea_e and edgearea_n. The departure ! regions are then tweaked, following an idea by Mats Bentsen, such ! that they have the desired area. If l_fixed_area = F, these regions ! are not tweaked, and the edgearea arrays are output variables.

— Reply to this email directly, view it on GitHub https://github.com/CICE-Consortium/CICE/issues/792#issuecomment-1363217624, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH7N7DQRGIVIHIDOGSFIKZLWOSNMDANCNFSM6AAAAAASBKJUVQ . You are receiving this because you were mentioned.Message ID: @.***>

JFLemieux73 commented 1 year ago

We could start with Bill's opinion and then maybe we could contact Mats. In the meantime I am trying to better understand the remapping...

eclare108213 commented 1 year ago

I am working up a discretization using the variational approach, as in the current B-grid EVP. I'm not sure it will work, since C-grid doesn't have enough velocity nodes to use a fully bilinear approximation -- this means that the discretization will be lower order than in a bilinear case. It might be less likely to checkerboard, but there's no guarantee that it won't, and we also might get some insight into how the boundary conditions play in.

JFLemieux73 commented 1 year ago

Happy new year! I still have to investigate but results above suggest that the checkerboard comes from the remapping not the C grid discretization...do we need the variational approach?

eclare108213 commented 1 year ago

I think it's important, but I'm willing to entertain other ideas. My understanding is that the advection scheme is not creating the checkerboard so much as allowing it, because a feature of incremental remapping is its very low diffusion -- a good thing as far as advection goes. I interpret your results above as advection schemes (or maybe energetic inconsistencies) in the other codes covering up the problems, rather than fixing the source. On the B-grid, the variational approach eventually led to a discretization that did not checkerboard while using the same advection scheme being used here, and it's not a discretization that could simply be written down based on the form of the continuous equations. In deriving the current B-grid EVP scheme, I went through several iterations that did checkerboard, even while using the variational approach for the derivation -- those schemes were much simpler (lower order). The key was to use a higher order basis function (bilinear) for the velocity AND stresses, which is what produces the 4 values per grid cell (nw, ne, sw, se) for all of the components.

The problem I'm having with the C-grid is that it does not have enough degrees of freedom (which Sergei also pointed out, I think). I can use a bilinear basis function for the stresses but I haven't found a basis that works for velocities located on the edge mid-points. The discretization I just worked out uses a bilinear stress approximation (on corners) but only linear for the velocities (i.e. assuming u varies in the x direction and is constant in y, similarly for v). I just reached the end of the derivation and it is not correct for sigma12, which needs du/dy etc. (I should have realized that earlier -- lesson learned). I could write down what the sigma12 discretization would be based on the forms of sigma1 and sigma2, but then it wouldn't be consistent with the divergence, tension and stress terms. (Unless maybe we somehow change the boundary conditions?) The variational approach ensures that all of these things are consistent with each other, as they must be to guarantee that the discretized equations dissipate energy in the same manner as the continuous equations. That's why I think it's important.

whlipscomb commented 1 year ago

@JFLemieux73, I'm having to revisit my long-ago youth. But fortunately, I wrote some comments on l_fixed_area in ice_transport_remap.F90.

According to those comments, this tweak ensures that the area fluxed across each cell edge is equal to the area implied by del*u in the dynamics. On a C-grid, u is simply the cell-edge velocity, instead of an average from neighboring corners as on the B-grid.

It would be easier to show with a picture, but I'll try in words. The idea is to tweak the size of the departure region without too much changing its basic shape. Try drawing a north cell edge with a departure region above. The departure region is a quadrilateral defined by the two edge vertices and the departure points of the two back trajectories. The velocity in this case would be mainly in the negative-y direction. For simplicity, assume that both departure points lie inside the cell above the edge (i.e., they don't lie in the adjacent cells to the left and right).

On the segment connecting the two departure points, mark the midpoint. From the midpoint, draw a segment to each edge vertex. This divides the departure region into three triangles.

Now slide the midpoint up a little bit. This slightly increases the area of the three triangles. If you slide the midpoint down, the three triangles get smaller.

The way the code works is that it figures out how much to move the midpoint. Otherwise, the midpoint stays put, and the logic is the same as for l_fixed_area = F.

It doesn't surprise me that setting l_fixed_area = T suppresses noise, but I'm not sure I'd have predicted it either. It's been too long since I thought about it.

But if it works, I'd say to go ahead and use this setting with the C grid. At some later time, we could write a simpler remapping scheme that's more natural on a C-grid. But I'm guessing that for now, you're mainly looking for a fix that works.

Please let me know if this description isn't clear.

JFLemieux73 commented 1 year ago

The C grid noise has been eliminated with l_fixed_area=T (see issues #809 and #811). The code does not crash anymore for gx simulations (see PR #833).