Skip to content

WRFDA memory usage reduction for thin_conv=true#1604

Merged
jamiebresch merged 1 commit intowrf-model:developfrom
jamiebresch:thinning_grid_allocation
Dec 18, 2021
Merged

WRFDA memory usage reduction for thin_conv=true#1604
jamiebresch merged 1 commit intowrf-model:developfrom
jamiebresch:thinning_grid_allocation

Conversation

@jamiebresch
Copy link
Contributor

@jamiebresch jamiebresch commented Dec 17, 2021

TYPE: enhancement

KEYWORDS: WRFDA, memory, thin_conv

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:
Problem:
thin_conv is true by default. When ob_format=1 (bufr for conventional ob types), thinning_grid_conv(num_ob_indexes) and its sub data arrays are allocated for all ob types as defined in da_control.f90 (obs_names(num_ob_indexes)) even though not all ob types are used.

Solution:
Do not call make3grids (which allocates several data arrays based on the setting of thin_mesh_conv) for ob types that are not used in the assimilation and not coded for thinning.

Note that gpsref horizontal thinning is not implemented for ob_format=1 (but is implemented for ob_format=2), so its thinning grid does not need to be allocated in da_setup_obs_structures_bufr.inc. That is the reason the specific check for gpsref appears in da_setup_obs_structures_bufr.inc but not da_setup_obs_structures_ascii.inc.

Caveat: The same fix logic is done for thin_conv_ascii (default is .false. and only matters when ob_format=2). But I have never tested thin_conv_ascii=.true.

LIST OF MODIFIED FILES:
M var/da/da_setup_structures/da_setup_obs_structures.inc
M var/da/da_setup_structures/da_setup_obs_structures_ascii.inc
M var/da/da_setup_structures/da_setup_obs_structures_bufr.inc
M var/da/da_setup_structures/da_setup_structures.f90

TESTS CONDUCTED:

  1. fixed code has been used extensively by Craig Schwartz.
  2. WRFDA regression test?
  3. Are the Jenkins tests all passing?

RELEASE NOTE: WRFDA has been fixed to reduce the memory usage for ob_format=1 (i.e. bufr for conventional obs) and thin_conv=true.

@liujake
Copy link
Contributor

liujake commented Dec 17, 2021

This looks good. I see thin_conv (and thin_conv_ascii) is a scaler logic variable. Is it possible to change it as an array so that we can turn on/off thinning for individual obs even they are read in?

@jamiebresch
Copy link
Contributor Author

This looks good. I see thin_conv (and thin_conv_ascii) is a scaler logic variable. Is it possible to change it as an array so that we can turn on/off thinning for individual obs even they are read in?

I can look into the possibility of potential future improvement.

@davegill davegill self-requested a review December 17, 2021 23:54
@jamiebresch jamiebresch merged commit d77cf82 into wrf-model:develop Dec 18, 2021
@jamiebresch jamiebresch deleted the thinning_grid_allocation branch December 18, 2021 00:29
jamiebresch added a commit that referenced this pull request Dec 23, 2021
TYPE: enhancement

KEYWORDS: WRFDA, thin_conv

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:
1. add a new namelist variable thin_conv_opt(num_ob_indexes) to complement thin_conv/thin_conv_ascii switch.
When thin_conv/thin_conv_ascii is .true., thin_conv_opt can be set differently for each ob type.
thin_conv_opt is further modified inside WRFDA to account for unused ob types (a different implementation to achieve the same memory reduction purpose as previous commit #1604).
2. Some redundant code in several subroutines is moved to a higher-level subroutine.
Now the calculation of some lat/lon info (rlat_min,rlat_max,rlon_min,rlon_max,dlat_grid,dlon_grid) to be used for making thinning grids is done only once in da_setup_obs_structures.inc, rather than in each da_setup_obs_structures_ascii.inc, da_setup_obs_structures_bufr.inc, da_setup_obs_structures_rain.inc, and da_setup_radiance_structures.inc.

LIST OF MODIFIED FILES:
M       Registry/registry.var
M       var/da/da_control/da_control.f90
M       var/da/da_obs_io/da_obs_io.f90
M       var/da/da_obs_io/da_read_obs_ascii.inc
M       var/da/da_obs_io/da_read_obs_bufr.inc
M       var/da/da_obs_io/da_scan_obs_ascii.inc
M       var/da/da_radiance/da_setup_radiance_structures.inc
M       var/da/da_setup_structures/da_setup_obs_structures.inc
M       var/da/da_setup_structures/da_setup_obs_structures_ascii.inc
M       var/da/da_setup_structures/da_setup_obs_structures_bufr.inc
M       var/da/da_setup_structures/da_setup_obs_structures_rain.inc
M       var/da/da_setup_structures/da_setup_structures.f90

TESTS CONDUCTED:
1. tested a few thin_conv and thin_conv_ascii cases and results are the same as V4.3.2.

RELEASE NOTE: N/A for now. Will add description for thin_conv_opt in a future PR.
vlakshmanan-scala pushed a commit to scala-computing/WRF that referenced this pull request Apr 4, 2024
TYPE: enhancement

KEYWORDS: WRFDA, memory, thin_conv

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:
Problem:
thin_conv is true by default. When ob_format=1 (bufr for conventional ob types), thinning_grid_conv(num_ob_indexes) and its sub data arrays are allocated for all ob types as defined in da_control.f90 (obs_names(num_ob_indexes)) even though not all ob types are used.

Solution:
Do not call make3grids (which allocates several data arrays based on the setting of thin_mesh_conv) for ob types that are not used in the assimilation and not coded for thinning.

Note that gpsref horizontal thinning is not implemented for ob_format=1 (but is implemented for ob_format=2), so its thinning grid does not need to be allocated in da_setup_obs_structures_bufr.inc. That is the reason the specific check for gpsref appears in da_setup_obs_structures_bufr.inc but not da_setup_obs_structures_ascii.inc.

Caveat: The same fix logic is done for thin_conv_ascii (default is .false. and only matters when ob_format=2). But I have never tested thin_conv_ascii=.true.

LIST OF MODIFIED FILES:
M       var/da/da_setup_structures/da_setup_obs_structures.inc
M       var/da/da_setup_structures/da_setup_obs_structures_ascii.inc
M       var/da/da_setup_structures/da_setup_obs_structures_bufr.inc
M       var/da/da_setup_structures/da_setup_structures.f90

TESTS CONDUCTED:
1. fixed code has been used extensively by Craig Schwartz.

RELEASE NOTE: WRFDA has been fixed to reduce the memory usage for ob_format=1 (i.e. bufr for conventional obs) and thin_conv=true.
vlakshmanan-scala pushed a commit to scala-computing/WRF that referenced this pull request Apr 4, 2024
TYPE: enhancement

KEYWORDS: WRFDA, thin_conv

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:
1. add a new namelist variable thin_conv_opt(num_ob_indexes) to complement thin_conv/thin_conv_ascii switch.
When thin_conv/thin_conv_ascii is .true., thin_conv_opt can be set differently for each ob type.
thin_conv_opt is further modified inside WRFDA to account for unused ob types (a different implementation to achieve the same memory reduction purpose as previous commit wrf-model#1604).
2. Some redundant code in several subroutines is moved to a higher-level subroutine.
Now the calculation of some lat/lon info (rlat_min,rlat_max,rlon_min,rlon_max,dlat_grid,dlon_grid) to be used for making thinning grids is done only once in da_setup_obs_structures.inc, rather than in each da_setup_obs_structures_ascii.inc, da_setup_obs_structures_bufr.inc, da_setup_obs_structures_rain.inc, and da_setup_radiance_structures.inc.

LIST OF MODIFIED FILES:
M       Registry/registry.var
M       var/da/da_control/da_control.f90
M       var/da/da_obs_io/da_obs_io.f90
M       var/da/da_obs_io/da_read_obs_ascii.inc
M       var/da/da_obs_io/da_read_obs_bufr.inc
M       var/da/da_obs_io/da_scan_obs_ascii.inc
M       var/da/da_radiance/da_setup_radiance_structures.inc
M       var/da/da_setup_structures/da_setup_obs_structures.inc
M       var/da/da_setup_structures/da_setup_obs_structures_ascii.inc
M       var/da/da_setup_structures/da_setup_obs_structures_bufr.inc
M       var/da/da_setup_structures/da_setup_obs_structures_rain.inc
M       var/da/da_setup_structures/da_setup_structures.f90

TESTS CONDUCTED:
1. tested a few thin_conv and thin_conv_ascii cases and results are the same as V4.3.2.

RELEASE NOTE: N/A for now. Will add description for thin_conv_opt in a future PR.
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.

3 participants