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?
WET_DRY and NESTING (refined) possible bug
WET_DRY and NESTING (refined) possible bug
- Attachments
-
- zeta_donor.PNG (1.74 KiB) Viewed 6369 times
-
- wetdry_mask_donor.PNG (1.32 KiB) Viewed 6369 times
-
- zeta_receiver.PNG (1.6 KiB) Viewed 6369 times
-
- wetdry_mask_receiver.PNG (1.23 KiB) Viewed 6369 times
- 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
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:
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.
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
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.
Re: WET_DRY and NESTING (refined) possible bug
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
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 (51.53 KiB) Viewed 6341 times
-
- 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
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.
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.
- 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
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.
-
- 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
HI Prof arango. This is very good news to me. Thanks a lot for you hard work on ROMS.
Re: WET_DRY and NESTING (refined) possible bug
This is great news. Thanks a lot for looking into this.