From 6e288dff46136478c0fbabead4d9451702b0d53c Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Sun, 7 Aug 2016 02:54:38 +0000 Subject: [PATCH] Add computation of sine and cosine of wind rotation angle at U and V points This commit adds code in geogrid to compute the sine and cosine of the wind rotation angle at the U- and V-staggered points in the grid. The new fields are written to geogrid output as SINALPHA_U, COSALPHA_U, SINALPHA_V, and COSALPHA_V. These fields are currently only used by the code to initialize WRF from MPAS output. M geogrid/src/process_tile_module.F M geogrid/src/output_module.F git-svn-id: https://svn-wrf-wps.cgd.ucar.edu/trunk@942 86b71a92-4018-0410-97f8-d555beccfc3a --- geogrid/src/output_module.F | 66 ++++++++++++++++++++++++++++++++++++++- geogrid/src/process_tile_module.F | 31 ++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) diff --git a/geogrid/src/output_module.F b/geogrid/src/output_module.F index eec734e..5eb0584 100644 --- a/geogrid/src/output_module.F +++ b/geogrid/src/output_module.F @@ -493,7 +493,7 @@ module output_module #endif #ifdef _GEOGRID - if (grid_type == 'C') NUM_AUTOMATIC_FIELDS = 24 + if (grid_type == 'C') NUM_AUTOMATIC_FIELDS = 28 if (grid_type == 'E') NUM_AUTOMATIC_FIELDS = 7 NUM_FIELDS = nfields+NUM_AUTOMATIC_FIELDS @@ -604,6 +604,22 @@ module output_module fields(24)%units = 'degrees longitude' fields(24)%descr = 'Longitude at grid cell corners' + fields(25)%fieldname = 'SINALPHA_U' + fields(25)%units = 'none' + fields(25)%descr = 'Sine of rotation angle on U grid' + + fields(26)%fieldname = 'COSALPHA_U' + fields(26)%units = 'none' + fields(26)%descr = 'Cosine of rotation angle on U grid' + + fields(27)%fieldname = 'SINALPHA_V' + fields(27)%units = 'none' + fields(27)%descr = 'Sine of rotation angle on V grid' + + fields(28)%fieldname = 'COSALPHA_V' + fields(28)%units = 'none' + fields(28)%descr = 'Cosine of rotation angle on V grid' + else if (grid_type == 'E') then fields(1)%fieldname = 'XLAT_M' fields(1)%units = 'degrees latitude' @@ -835,6 +851,54 @@ module output_module fields(24)%dimnames(2) = 'south_north_stag' fields(24)%stagger = 'CORNER' fields(24)%istagger = CORNER + + ! SINALPHA on U + if (extra_col) then + fields(25)%dom_end(1) = fields(25)%dom_end(1) + 1 + fields(25)%mem_end(1) = fields(25)%mem_end(1) + 1 + fields(25)%patch_end(1) = fields(25)%patch_end(1) + 1 + else if (my_proc_id == IO_NODE .and. .not. do_tiled_output) then + fields(25)%dom_end(1) = fields(25)%dom_end(1) + 1 + end if + fields(25)%dimnames(1) = 'west_east_stag' + fields(25)%stagger = 'U' + fields(25)%istagger = U + + ! COSALPHA on U + if (extra_col) then + fields(26)%dom_end(1) = fields(26)%dom_end(1) + 1 + fields(26)%mem_end(1) = fields(26)%mem_end(1) + 1 + fields(26)%patch_end(1) = fields(26)%patch_end(1) + 1 + else if (my_proc_id == IO_NODE .and. .not. do_tiled_output) then + fields(26)%dom_end(1) = fields(26)%dom_end(1) + 1 + end if + fields(26)%dimnames(1) = 'west_east_stag' + fields(26)%stagger = 'U' + fields(26)%istagger = U + + ! SINALPHA on V + if (extra_row) then + fields(27)%dom_end(2) = fields(27)%dom_end(2) + 1 + fields(27)%mem_end(2) = fields(27)%mem_end(2) + 1 + fields(27)%patch_end(2) = fields(27)%patch_end(2) + 1 + else if (my_proc_id == IO_NODE .and. .not. do_tiled_output) then + fields(27)%dom_end(2) = fields(27)%dom_end(2) + 1 + end if + fields(27)%dimnames(2) = 'south_north_stag' + fields(27)%stagger = 'V' + fields(27)%istagger = V + + ! COSALPHA on V + if (extra_row) then + fields(28)%dom_end(2) = fields(28)%dom_end(2) + 1 + fields(28)%mem_end(2) = fields(28)%mem_end(2) + 1 + fields(28)%patch_end(2) = fields(28)%patch_end(2) + 1 + else if (my_proc_id == IO_NODE .and. .not. do_tiled_output) then + fields(28)%dom_end(2) = fields(28)%dom_end(2) + 1 + end if + fields(28)%dimnames(2) = 'south_north_stag' + fields(28)%stagger = 'V' + fields(28)%istagger = V else if (grid_type == 'E') then ! Lat V diff --git a/geogrid/src/process_tile_module.F b/geogrid/src/process_tile_module.F index b02e222..e6de177 100644 --- a/geogrid/src/process_tile_module.F +++ b/geogrid/src/process_tile_module.F @@ -408,6 +408,7 @@ module process_tile_module if (grid_type == 'C') then call mprintf(.true.,STDOUT,' Processing ROTANG') + ! Mass-staggered points allocate(sina_array(start_mem_i:end_mem_i, start_mem_j:end_mem_j)) allocate(cosa_array(start_mem_i:end_mem_i, start_mem_j:end_mem_j)) @@ -421,6 +422,36 @@ module process_tile_module if (associated(sina_array)) deallocate(sina_array) if (associated(cosa_array)) deallocate(cosa_array) + + ! U-staggered points + allocate(sina_array(start_mem_i:end_mem_stag_i, start_mem_j:end_mem_j)) + allocate(cosa_array(start_mem_i:end_mem_stag_i, start_mem_j:end_mem_j)) + + call get_rotang(xlat_array_u, xlon_array_u, cosa_array, sina_array, & + start_mem_i, start_mem_j, end_mem_stag_i, end_mem_j) + + call write_field(start_mem_i, end_mem_stag_i, start_mem_j, end_mem_j, 1, 1, 'SINALPHA_U', & + datestr, real_array = sina_array) + call write_field(start_mem_i, end_mem_stag_i, start_mem_j, end_mem_j, 1, 1, 'COSALPHA_U', & + datestr, real_array = cosa_array) + + if (associated(sina_array)) deallocate(sina_array) + if (associated(cosa_array)) deallocate(cosa_array) + + ! V-staggered points + allocate(sina_array(start_mem_i:end_mem_i, start_mem_j:end_mem_stag_j)) + allocate(cosa_array(start_mem_i:end_mem_i, start_mem_j:end_mem_stag_j)) + + call get_rotang(xlat_array_v, xlon_array_v, cosa_array, sina_array, & + start_mem_i, start_mem_j, end_mem_i, end_mem_stag_j) + + call write_field(start_mem_i, end_mem_i, start_mem_j, end_mem_stag_j, 1, 1, 'SINALPHA_V', & + datestr, real_array = sina_array) + call write_field(start_mem_i, end_mem_i, start_mem_j, end_mem_stag_j, 1, 1, 'COSALPHA_V', & + datestr, real_array = cosa_array) + + if (associated(sina_array)) deallocate(sina_array) + if (associated(cosa_array)) deallocate(cosa_array) end if ! Every field up until now should probably just be processed regardless of what the user -- 2.11.4.GIT