-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
negative weights in cube_to_target #62
Comments
Discussion in the email:===weights debug prints:
@PeterHjortLauritzen ’s explanation and our tests for the calculation of weights:
===Reply 2 from PeterL ===Results after deactivating the exact integration The results look reasonble! The weights_out (ind=3) changed from -2.2046321616736293E-009 to 1.8986300128590624E-009, by changing the weights of S8 (please see figures below) from -1.0584823573189794E-008 to -6.4815613463673699E-009. The new results seem to be reasonable, which seems to be proportional to the line intergal from the figure below: So, this line “else if (abs(yseg(1) -yseg(2))<fuzzy_width) then” in subroutine <side_integral> is unimportant as slope is not a return value. ===Reply 3 from PeterL |
Excellent work! So did I understand correctly that the removal of the exact integration branches fix the problem? If that's the case, do you think we should still add the limiter for increased robustness in future cases? Or maybe it's better to fail in those possible future cases for force further more rigorous improvements. |
Thanks Mark! yes, so far, the removal of the exact integration branches fix the problem. I think it's fine not to add a limiter anymore. |
@jsbamboo Thank you for adding all this info to the Github repo. Would you be willing to open a PR for removing the exact integration in this code base? |
no problem! please check this PR #63 |
Description of the problem
In the experience of using the cube_to_target (mapping terr_height/
PHIS
from the base cube to target) for regionally refined meshes (RRM), we've encountered issues with large negative values for terr_target.=> related to negative
weights_all / weights_out / wt
incube_to_target.F90
.=> resulting from some dominant negative
weights
inremap.F90
(corresponding to the overlap area “omega_kl” between the target grid and the base cube grid in Lauritzen et al. 2015).This generally happens when the dx of the target grid is comparable/smaller than the dx of the base cube:
Temporary solutions / limiters
Initially, my stopgap solution to fix the negative PHIS was just to to write an NCL script to manually “correct” these large negative values by averaging the PHIS values of the surrounding grid points.
@mt5555 pointed out that we can add a simple non-negative limiter. Two options documented in the email:
I’ve tested the two methods by modifying
remap.F90
and they both worked well.Underlying reasons and solution
Finally, @PeterHjortLauritzen helped us to identify the underlying reasons for the negative weights and suggested the solution. The discussion in email is documented here:
ldbg
flag incube_to_target.F90
weights_out
/omega_kl and writes out there debug files:side_integral.dat, inner_nonconvex.dat, inner_integral.dat
line segment parallel to latitude - compute weights exactly
) caused the problem. It thinks the line segment is parallel to the latitude (judging by dy<fuzzy_width), but it's not (just because the segment is too short). see more details in the discussion pasted below.Summary of solutions
The text was updated successfully, but these errors were encountered: