From 98c0c9211b27eea63bf429b2eaeb1e2b1dd1a40a Mon Sep 17 00:00:00 2001 From: udistr Date: Sun, 1 Nov 2026 12:44:26 +0000 Subject: [PATCH] da_update_bc: couple boundary u/v with MAPFAC_UY/MAPFAC_VX, as WRF and real.exe do TYPE: bug fix KEYWORDS: WRFDA, da_update_bc, lateral boundary, map factor, lat-lon, map_proj 6 SOURCE: Ehud Strobach DESCRIPTION OF CHANGES: Problem: da_update_bc reads MAPFAC_U and MAPFAC_V to uncouple/recouple the boundary winds (da_couple_uv: u*(c1h*mu+c2h)/msf). WRF couples u with msfuy and v with msfvx (dyn_em/couple_or_uncouple_em.F, "u coupled with y"), and so does real.exe when it writes wrfbdy_d01 (main/real_em.F: couple(..., 'u', grid%msfuy ...), couple(..., 'v', grid%msfvx ...)). On conformal projections all these factors are equal, so nothing changes there. On a lat-lon grid (map_proj = 6) MAPFAC_UY = 1 everywhere while MAPFAC_U = MAPFAC_UX = 1/cos(lat), so the updated first boundary time of U was divided by MAPFAC_U = 1.06-1.37 (on a domain spanning 20-43N), i.e. 6% (south boundary) to 27% (north boundary) too weak in every cycle, and its tendency (U_BTXS) was wrong by up to ~2x. V is unaffected in practice because MAPFAC_V = MAPFAC_VX on lat-lon grids. T and PH are coupled without a map factor in both WRF and da_update_bc. Solution: Read MAPFAC_UY and MAPFAC_VX (in da_update_bc and da_update_bc_ad). LIST OF MODIFIED FILES: M var/da/da_update_bc/da_update_bc.f90 M var/da/da_update_bc/da_update_bc_ad.f90 TESTS CONDUCTED: 1. Identity test on a lat-lon domain (640x460, 0.05 deg): da_file = real.exe's own wrfinput, so the update must leave real.exe's wrfbdy unchanged. Before: U_BXS, U_BYE, U_BTXS changed by 13%, 27%, 218% (relative rms). After: the output matches real.exe's wrfbdy to round-off (4e-8). V/T/PH/QVAPOR/MU unchanged before and after. Tested with WRFDA v4.1.2, whose da_update_bc lines are identical to develop. 2. Jenkins tests: not run by us. RELEASE NOTE: da_update_bc now couples the lateral-boundary u and v winds with MAPFAC_UY and MAPFAC_VX, as WRF and real.exe do. On lat-lon (map_proj = 6) domains the updated U boundary was previously too weak by the x map factor in the first boundary interval of every cycle. Co-Authored-By: Claude Opus 5.5 --- var/da/da_update_bc/da_update_bc.f90 | 8 ++++---- var/da/da_update_bc/da_update_bc_ad.f90 | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/var/da/da_update_bc/da_update_bc.f90 b/var/da/da_update_bc/da_update_bc.f90 index a1b2d27122..8732e0c05f 100644 --- a/var/da/da_update_bc/da_update_bc.f90 +++ b/var/da/da_update_bc/da_update_bc.f90 @@ -181,8 +181,8 @@ program da_update_bc num2d=23 varsf(1)='MUB' varsf(2)='MU' - varsf(3)='MAPFAC_U' - varsf(4)='MAPFAC_V' + varsf(3)='MAPFAC_UY' ! WRF couples u with msfuy (dyn_em/couple_or_uncouple_em.F) + varsf(4)='MAPFAC_VX' ! and v with msfvx; they differ from MAPFAC_U/V on lat-lon grids varsf(5)='MAPFAC_M' varsf(6)='TMN' varsf(7)='SST' @@ -344,14 +344,14 @@ program da_update_bc call da_get_var_2d_real_cdf( da_file, trim(varsf(n)), mub, & dims(1), dims(2), 1, debug) - case ('MAPFAC_U') ; + case ('MAPFAC_UY') ; if ( .not. update_lateral_bdy ) cycle allocate(msfu(dims(1), dims(2))) call da_get_var_2d_real_cdf( da_file, trim(varsf(n)), msfu, & dims(1), dims(2), 1, debug) - case ('MAPFAC_V') ; + case ('MAPFAC_VX') ; if ( .not. update_lateral_bdy ) cycle allocate(msfv(dims(1), dims(2))) diff --git a/var/da/da_update_bc/da_update_bc_ad.f90 b/var/da/da_update_bc/da_update_bc_ad.f90 index 2d4f0093ea..8884936d59 100644 --- a/var/da/da_update_bc/da_update_bc_ad.f90 +++ b/var/da/da_update_bc/da_update_bc_ad.f90 @@ -122,8 +122,8 @@ program da_update_bc_ad num2d=4 varsf(1)='MUB' varsf(2)='MU' - varsf(3)='MAPFAC_U' - varsf(4)='MAPFAC_V' + varsf(3)='MAPFAC_UY' ! WRF couples u with msfuy (dyn_em/couple_or_uncouple_em.F) + varsf(4)='MAPFAC_VX' ! and v with msfvx; they differ from MAPFAC_U/V on lat-lon grids if ( update_lateral_bdy ) then ! First, the boundary times @@ -204,14 +204,14 @@ program da_update_bc_ad call da_get_var_2d_real_cdf( wrfinput, trim(varsf(n)), mub, & dims(1), dims(2), 1, debug) - case ('MAPFAC_U') ; + case ('MAPFAC_UY') ; if ( .not. update_lateral_bdy ) cycle allocate(msfu(dims(1), dims(2))) call da_get_var_2d_real_cdf( wrfinput, trim(varsf(n)), msfu, & dims(1), dims(2), 1, debug) - case ('MAPFAC_V') ; + case ('MAPFAC_VX') ; if ( .not. update_lateral_bdy ) cycle allocate(msfv(dims(1), dims(2)))