WET_DRY and NESTING (refined) possible bug

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
Tomasz
Posts: 23
Joined: Tue Oct 07, 2008 11:27 am
Location: Marine Institute, Ireland

WET_DRY and NESTING (refined) possible bug

#1 Unread post by Tomasz »

I have been working over the past few months on the development of a refined model application that includes the intertidal zones. I have recently updated to svn 741 and I have a question as follows:

Is wetting-drying meant to be working in a nested refined 2-way grids application?

I can see that the code replaces interior coarse grid data with the refined averaged values in the interior (fine2coarse2d & fine2coarse3d), but seems like there is no account for the wetdry masking in there.
As the result, I get the zeta field in part of the donor (parent) model as in the attached zeta_donor.png (see highlighted cell) and for the wetdry masking see wetdry_mask_donor.png.


So, the highlighted cell above is wet, but zeta there is visibly higher than in the surrounding wet cells generating the pressure gradient, etc.

I used the refinement ratio of 3, and zeta and the wetdry masking in the corresponding 9 cells in the receiver (child) grid are also in the attachment.

Averaging zeta at all 9 cells above gives c. -0.55, which we then see in the highlighted parent’s cell, but 4 out of 9 of those child cells are dry with zeta fixed at such level so that h does not drop below Dcrit. Shouldn’t these cells should be excluded from the averaging?
Attachments
zeta_donor.PNG
zeta_donor.PNG (1.74 KiB) Viewed 6369 times
wetdry_mask_donor.PNG
wetdry_mask_donor.PNG (1.32 KiB) Viewed 6369 times
zeta_receiver.PNG
zeta_receiver.PNG (1.6 KiB) Viewed 6369 times
wetdry_mask_receiver.PNG
wetdry_mask_receiver.PNG (1.23 KiB) Viewed 6369 times

User avatar
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: WET_DRY and NESTING (refined) possible bug

#2 Unread post by arango »

Well, this is a hard problem. The interpolation weights need to be adjusted if you get wet and dry cells at every time step because of the masking. I need to look for a solution for this case. Bringing refinement grids all the way to the coast with wetting and drying requires special considerations. The two-way is very tricky for such a case and require some thinking.

I was aware of this possibility but I postponed any solution until other issues with the nesting are debugged and resolved. I want to get the quadratic conservative interpolation first before addressing this issue.

In permanent masking, the interpolation weights need to add to unity when multiplied by the respective masking. These weights are already adjusted in the Matlab script contact.m and written the connectivity NetCDF file. In wetting and drying, they need to be readjusted inside ROMS at every time-step. Notice that in the Matlab script, we do:

Code: Select all

for n=1:Npoints,
  LW(1) = mask(index1(n)) * (1 - p(n)) * (1 - q(n));
  LW(2) = mask(index2(n)) * p(n) * (1 - q(n));
  LW(3) = mask(index3(n)) * p(n) * q(n);
  LW(4) = mask(index4(n)) * (1 -p(n)) * q(n);

  MaskSum = mask(index1(n)) + mask(index2(n)) +                         ...
            mask(index3(n)) + mask(index4(n));

  if (MaskSum < 4),                  % at least one of the corners is land
    LWsum = sum(LW);
    if (LWsum > 0),
      LW = LW ./ LWsum;              % using only water points
    else
      LW(1:4) = 0;                   % all donor grid corners are on land
    end
  end
  
  W(:,n) = LW;
end
See internal functions linear_weights and quadratic_weights in contact.m.

One possible solution is to not rescale the interpolation weights in the presence of land/sea mask in contact.m and do the appropriate rescaling in interpolation routines in nesting.F by using the rmask_full, umask_full, and vmask_full arrays. This requires to modify the Matlab scripts and regenerate the connectivity NetCDF file. The only technical difficulty is that this code becomes adjoitable because it time dependent.

Tomasz
Posts: 23
Joined: Tue Oct 07, 2008 11:27 am
Location: Marine Institute, Ireland

Re: WET_DRY and NESTING (refined) possible bug

#3 Unread post by Tomasz »

Thanks Hernan. I would certainly very welcome this issue addressed in due time in the future. In the meantime I would have few further questions:

1) I can see that wetting drying is accounted for in the contacts region. I suppose then that the 1-way refined grid application should work fine?

2) I am also considering a composite-refined grid approach, that is the receiver composite grid is also a refined grid (green grid below). So rather than developing the refined grid application I would cut my parent's grid along the red line and connect the green higher resolution grid to it. Would this approach work in the current release of ROMS? I notice the 'Complex Estuary Refinement-Composite Sub-Class' on ROMS wiki page, which would suggest it is possible, but I also notice the warning saying that the composite grids work on the same time step, whereas in the refined grids we scale the time step accordingly
Attachments
connemara_bath_composite.PNG
connemara_bath_composite.PNG (51.53 KiB) Viewed 6341 times

simion1232006
Posts: 60
Joined: Tue Sep 29, 2009 3:50 pm
Location: School of Environment System Engineering,UWA

Re: WET_DRY and NESTING (refined) possible bug

#4 Unread post by simion1232006 »

I am facing the similar issue. I attempted to modified the nesting.F subroutine, while it is quite hard. I noticed that Lweight is directly taken from the contact file (created by matlab),and is constantly used to interpolate value from donor to receiver or from receiver to donor. Given that contact.m is already updated, this is valid when land-sea mask remain the same , while may cause problems when turning on wet_dry. I am wondering whether ROMS group can develop a internal function to create this Lweight based on wet_dry option (similar to the changes in contact.m).
My solution would be.
ifdef WET_DRY
Lweight= generate_Lweight(rmask_full, umask_full, vmask_full)
end
I know I could modify the code by myself, while this may create additional bugs I can not foresee. I feel it is much better if ROMS group can update this in the near future (It should not be very complicated). One of the benefit of nesting is to have an refined grid near the coast, and working together with wet_dry is very important.

User avatar
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: WET_DRY and NESTING (refined) possible bug

#5 Unread post by arango »

I changed the logic how is this done. Please be patient. An upgrade to the nesting algorithms will be released in the next two days. I am working on the documentation.

simion1232006
Posts: 60
Joined: Tue Sep 29, 2009 3:50 pm
Location: School of Environment System Engineering,UWA

Re: WET_DRY and NESTING (refined) possible bug

#6 Unread post by simion1232006 »

HI Prof arango. This is very good news to me. Thanks a lot for you hard work on ROMS.

Tomasz
Posts: 23
Joined: Tue Oct 07, 2008 11:27 am
Location: Marine Institute, Ireland

Re: WET_DRY and NESTING (refined) possible bug

#7 Unread post by Tomasz »

This is great news. Thanks a lot for looking into this.

Post Reply