Skip to content

Coarse-grid DX, DY compute all other domain grid distances#1054

Merged
davegill merged 4 commits intowrf-model:developfrom
davegill:single_dx
Jan 28, 2020
Merged

Coarse-grid DX, DY compute all other domain grid distances#1054
davegill merged 4 commits intowrf-model:developfrom
davegill:single_dx

Conversation

@davegill
Copy link
Copy Markdown
Contributor

@davegill davegill commented Jan 14, 2020

TYPE: new feature

KEYWORDS: dx, grid distance, MOAD

SOURCE: internal

DESCRIPTION OF CHANGES:
Similar to the WPS namelist, only the most-coarse domain needs to have the grid distance
specified. For a user, this means that only column 1 in the namelist.input file needs to be specified
for the dx and dy namelist variables. If a user does provide information for additional
domains, the provided dx an dy are ignored in favor of the values computed from the
parent_grid_ratio entries.

Since the ARW code now handles the computation of the child domain grid distances, there is
no need to explicitly include those additional columns of information in any of the ARW namelists.

It is not an error to HAVE those values additional columns of information for dx or dy (so as
to support backwards capability with older namelists). However, the dx and dy values for the
grid distances for columns 2 through max_dom are redundant and internally overwritten.

LIST OF MODIFIED FILES:
modified: share/module_check_a_mundo.F
modified: em_b_wave/namelist.input
modified: em_b_wave/namelist.input.backwards
modified: em_esmf_exp/namelist.input.jan00.ESMFSST
modified: em_esmf_exp/namelist.input.jan00.NETCDFSST
modified: em_fire/namelist.input_hill_simple
modified: em_fire/namelist.input_two_fires
modified: em_heldsuarez/namelist.input
modified: em_les/namelist.input
modified: em_les/namelist.input.SGP
modified: em_les/namelist.input_shalconv
modified: em_quarter_ss/namelist.input
modified: em_quarter_ss/namelist.input_2to1
modified: em_quarter_ss/namelist.input_3to1
modified: em_quarter_ss/namelist.input_4to1
modified: em_quarter_ss/namelist.input_5to1
modified: em_real/namelist.input
modified: em_real/namelist.input.4km
modified: em_real/namelist.input.chem
modified: em_real/namelist.input.diags
modified: em_real/namelist.input.global
modified: em_real/namelist.input.jan00
modified: em_real/namelist.input.jun01
modified: em_real/namelist.input.ndown_1
modified: em_real/namelist.input.ndown_2
modified: em_real/namelist.input.ndown_3
modified: em_real/namelist.input.pbl-les
modified: em_real/namelist.input.volc

TESTS CONDUCTED:

  1. Comparing the results from the original code with the results from the new code, bit-wise
    identical results are not expected, as the internally computed value of the grid distance will
    be different that what is assigned based on the namelist entry. The output from the netcdf
    files shows the difference in the grid distance:
> ncdump -h ORIG_CODE/wrfout_d03_2000-01-24_12:00:00 | grep -iw dx
		:DX = 3333.33f ;
> ncdump -h NEW_CODE/wrfout_d03_2000-01-24_12:00:00 | grep -iw dx
		:DX = 3333.333f ;

Differences on d01 after 3 minutes (1 CG time step, 3 d02 time steps, 9 d03 timesteps):
Screen Shot 2020-01-14 at 2 03 47 PM

Differences on d03 after 3 minutes (1 CG time step, 3 d02 time steps, 9 d03 timesteps):
Screen Shot 2020-01-14 at 2 08 39 PM

  1. Using the new source code mods, and comparing only against the new modifications, bit-wise
    identical answers with the following namelist options:
 max_dom                             = 3,
 e_we                                = 74,    31,    31,
 e_sn                                = 61,    31,    31,
 dx                                  = 30000, 10000,  3333.33,
 dy                                  = 30000, 10000,  3333.33,
 grid_id                             = 1,     2,     3,
 parent_id                           = 0,     1,     2,
 parent_grid_ratio                   = 1,     3,     3,
 max_dom                             = 3,
 e_we                                = 74,    31,    31,
 e_sn                                = 61,    31,    31,
 dx                                  = 30000, 11000,  3333.33,
 dy                                  = 30000, 11000,  3333.33,
 grid_id                             = 1,     2,     3,
 parent_id                           = 0,     1,     2,
 parent_grid_ratio                   = 1,     3,     3,
 max_dom                             = 3,
 e_we                                = 74,    31,    31,
 e_sn                                = 61,    31,    31,
 dx                                  = 30000,
 dy                                  = 30000,
 grid_id                             = 1,     2,     3,
 parent_id                           = 0,     1,     2,
 parent_grid_ratio                   = 1,     3,     3,
  1. Helpful messages are printed at the top of the ARW real and WRF standard
    outputs that describe the computed grid distances that are used within the
    programs. For all three of the namelists above, the printout is:
  Domain # 1: dx = 30000.000 m
  Domain # 2: dx = 10000.000 m
  Domain # 3: dx =  3333.333 m
  1. A test program was written around the new recursive subroutine.
MODULE inside

CONTAINS

RECURSIVE SUBROUTINE get_moad_factor ( id, parent_id, parent_grid_ratio, max_dom, factor )
   IMPLICIT NONE
   INTEGER                     :: max_dom
   INTEGER, DIMENSION(max_dom) :: parent_id, parent_grid_ratio
   INTEGER                     :: factor, id

   IF ( id .EQ. 1 ) THEN
      RETURN
   ELSE
      factor = factor * parent_grid_ratio(id)
      CALL get_moad_factor ( parent_id(id), parent_id, parent_grid_ratio, max_dom, factor )
   END IF
END  SUBROUTINE get_moad_factor

END MODULE inside

!==============

program tester
use inside
implicit none

integer , parameter :: huge_max_dom = 6

real,dimension(huge_max_dom) :: dx, dy
integer,dimension(huge_max_dom) :: grid_id, parent_id, parent_grid_ratio

integer :: factor, id, loop, max_dom

dx(1)             = 30000.
grid_id           = (/1, 2, 3, 4, 5, 6/)
parent_id         = (/0, 1, 2, 1, 4, 5/)
parent_grid_ratio = (/1, 3, 3, 2, 3, 4/)

do max_dom = 1, huge_max_dom
   do loop = 1, max_dom
      id = loop
      factor = 1
      call get_moad_factor ( id, parent_id, parent_grid_ratio, max_dom, factor )
      dx(id) = dx(1) / REAL(factor)
      print *,'max_dom = ',max_dom,', dom = ',loop,', dx = ',dx(id)
   end do
   print *,' '
end do

end program tester

The output is as expected:

> a.out
 max_dom =            1 , dom =            1 , dx =    30000.0000

 max_dom =            2 , dom =            1 , dx =    30000.0000
 max_dom =            2 , dom =            2 , dx =    10000.0000

 max_dom =            3 , dom =            1 , dx =    30000.0000
 max_dom =            3 , dom =            2 , dx =    10000.0000
 max_dom =            3 , dom =            3 , dx =    3333.33325

 max_dom =            4 , dom =            1 , dx =    30000.0000
 max_dom =            4 , dom =            2 , dx =    10000.0000
 max_dom =            4 , dom =            3 , dx =    3333.33325
 max_dom =            4 , dom =            4 , dx =    15000.0000

 max_dom =            5 , dom =            1 , dx =    30000.0000
 max_dom =            5 , dom =            2 , dx =    10000.0000
 max_dom =            5 , dom =            3 , dx =    3333.33325
 max_dom =            5 , dom =            4 , dx =    15000.0000
 max_dom =            5 , dom =            5 , dx =    5000.00000

 max_dom =            6 , dom =            1 , dx =    30000.0000
 max_dom =            6 , dom =            2 , dx =    10000.0000
 max_dom =            6 , dom =            3 , dx =    3333.33325
 max_dom =            6 , dom =            4 , dx =    15000.0000
 max_dom =            6 , dom =            5 , dx =    5000.00000
 max_dom =            6 , dom =            6 , dx =    1250.00000

RELEASE NOTE: The ARW real and WRF code now ignore the provided grid distance for any domain other than the most-coarse grid. This update to the namelist processing for grid distance provides user-level behavior in the real/WRF namelist.input file similar to the WPS geogrid program's usage of the namelist.wps file.

TYPE: new feature

KEYWORDS: dx, grid distance, MOAD

SOURCE: internal

DESCRIPTION OF CHANGES:
Similar to the WPS namelist, only the most-coarse domain needs to have
the grid distance specified.

LIST OF MODIFIED FILES:
modified:   share/module_check_a_mundo.F

TESTS CONDUCTED:
1. Bit-wise identical answers with the following namelist options:
```
 max_dom                             = 3,
 e_we                                = 74,    31,    31,
 e_sn                                = 61,    31,    31,
 dx                                  = 30000, 10000,  3333.33,
 dy                                  = 30000, 10000,  3333.33,
 grid_id                             = 1,     2,     3,
 parent_id                           = 0,     1,     2,
 parent_grid_ratio                   = 1,     3,     3,
```
```
 max_dom                             = 3,
 e_we                                = 74,    31,    31,
 e_sn                                = 61,    31,    31,
 dx                                  = 30000, 11000,  3333.33,
 dy                                  = 30000, 11000,  3333.33,
 grid_id                             = 1,     2,     3,
 parent_id                           = 0,     1,     2,
 parent_grid_ratio                   = 1,     3,     3,
```
```
 max_dom                             = 3,
 e_we                                = 74,    31,    31,
 e_sn                                = 61,    31,    31,
 dx                                  = 30000,
 dy                                  = 30000,
 grid_id                             = 1,     2,     3,
 parent_id                           = 0,     1,     2,
 parent_grid_ratio                   = 1,     3,     3,
```
2. Helpful messages are printed at the top of the ARW real and WRF standard
outputs that describe the computed grid distances that are used within the
programs. For all three of the namelists above, the printout is:
```
  Domain # 1: dx = 30000.000 m
  Domain # 2: dx = 10000.000 m
  Domain # 3: dx =  3333.333 m
```
3. A test program was written around the new recursive subroutine.
```
MODULE inside

CONTAINS

RECURSIVE SUBROUTINE get_moad_factor ( id, parent_id, parent_grid_ratio, max_dom, factor )
   IMPLICIT NONE
   INTEGER                     :: max_dom
   INTEGER, DIMENSION(max_dom) :: parent_id, parent_grid_ratio
   INTEGER                     :: factor, id

   IF ( id .EQ. 1 ) THEN
      RETURN
   ELSE
      factor = factor * parent_grid_ratio(id)
      CALL get_moad_factor ( parent_id(id), parent_id, parent_grid_ratio, max_dom, factor )
   END IF
END  SUBROUTINE get_moad_factor

END MODULE inside

!==============

program tester
use inside
implicit none

integer , parameter :: huge_max_dom = 6

real,dimension(huge_max_dom) :: dx, dy
integer,dimension(huge_max_dom) :: grid_id, parent_id, parent_grid_ratio

integer :: factor, id, loop, max_dom

dx(1)             = 30000.
grid_id           = (/1, 2, 3, 4, 5, 6/)
parent_id         = (/0, 1, 2, 1, 4, 5/)
parent_grid_ratio = (/1, 3, 3, 2, 3, 4/)

do max_dom = 1, huge_max_dom
   do loop = 1, max_dom
      id = loop
      factor = 1
      call get_moad_factor ( id, parent_id, parent_grid_ratio, max_dom, factor )
      dx(id) = dx(1) / REAL(factor)
      print *,'max_dom = ',max_dom,', dom = ',loop,', dx = ',dx(id)
   end do
   print *,' '
end do

end program tester
```
The output is as expected:
```
> a.out
 max_dom =            1 , dom =            1 , dx =    30000.0000

 max_dom =            2 , dom =            1 , dx =    30000.0000
 max_dom =            2 , dom =            2 , dx =    10000.0000

 max_dom =            3 , dom =            1 , dx =    30000.0000
 max_dom =            3 , dom =            2 , dx =    10000.0000
 max_dom =            3 , dom =            3 , dx =    3333.33325

 max_dom =            4 , dom =            1 , dx =    30000.0000
 max_dom =            4 , dom =            2 , dx =    10000.0000
 max_dom =            4 , dom =            3 , dx =    3333.33325
 max_dom =            4 , dom =            4 , dx =    15000.0000

 max_dom =            5 , dom =            1 , dx =    30000.0000
 max_dom =            5 , dom =            2 , dx =    10000.0000
 max_dom =            5 , dom =            3 , dx =    3333.33325
 max_dom =            5 , dom =            4 , dx =    15000.0000
 max_dom =            5 , dom =            5 , dx =    5000.00000

 max_dom =            6 , dom =            1 , dx =    30000.0000
 max_dom =            6 , dom =            2 , dx =    10000.0000
 max_dom =            6 , dom =            3 , dx =    3333.33325
 max_dom =            6 , dom =            4 , dx =    15000.0000
 max_dom =            6 , dom =            5 , dx =    5000.00000
 max_dom =            6 , dom =            6 , dx =    1250.00000
```

RELEASE NOTE: The ARW real and WRF code now ignore the provided grid distance for any domain other than the most-coarse grid. This provides user-level behavior similar to the WPS geogrid program.
Since the ARW code now handles the computation of the
child domain grid distances, there is no need to explicitly
include those additional columns of information in any of
the ARW namelists.

It is not an error to _HAVE_ those values (so as to support
backwards capability with older namelists). However, the
dx and dy values for the grid distances for columns 2 through
max_dom are redundant and internally overwritten.

modified:   em_b_wave/namelist.input
modified:   em_b_wave/namelist.input.backwards
modified:   em_esmf_exp/namelist.input.jan00.ESMFSST
modified:   em_esmf_exp/namelist.input.jan00.NETCDFSST
modified:   em_fire/namelist.input_hill_simple
modified:   em_fire/namelist.input_two_fires
modified:   em_heldsuarez/namelist.input
modified:   em_les/namelist.input
modified:   em_les/namelist.input.SGP
modified:   em_les/namelist.input_shalconv
modified:   em_quarter_ss/namelist.input
modified:   em_quarter_ss/namelist.input_2to1
modified:   em_quarter_ss/namelist.input_3to1
modified:   em_quarter_ss/namelist.input_4to1
modified:   em_quarter_ss/namelist.input_5to1
modified:   em_real/namelist.input
modified:   em_real/namelist.input.4km
modified:   em_real/namelist.input.chem
modified:   em_real/namelist.input.diags
modified:   em_real/namelist.input.global
modified:   em_real/namelist.input.jan00
modified:   em_real/namelist.input.jun01
modified:   em_real/namelist.input.ndown_1
modified:   em_real/namelist.input.ndown_2
modified:   em_real/namelist.input.ndown_3
modified:   em_real/namelist.input.pbl-les
modified:   em_real/namelist.input.volc
@davegill davegill requested a review from a team as a code owner January 21, 2020 17:41
@davegill
Copy link
Copy Markdown
Contributor Author

@weiwangncar @smileMchen @kkeene44
Folks,
These changes will impact version 4.2. Since the Jan 2020 tutorial slides are already finalized, please update your tutorial slides where the dx / dy values are listed in several columns.

num_metgrid_soil_levels = 4,
dx = 156343.322,20000, 4000,
dy = 156343.322,20000, 4000,
dx = 156343.322,20000,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davegill
Out of curiosity, why does this one still need d02 info?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kkeene44
Kelly,
Muchas gracias
🦅 👁 👍

@davegill davegill merged commit 3d3c7e5 into wrf-model:develop Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants