Skip to content

Commit

Permalink
Avoid re-initialization of time series for parent after child domain …
Browse files Browse the repository at this point in the history
…starts (#1953)

This PR corrects an issue in which time series for a parent domain were re-initialized when a child domain started later than the initial time for a simulation.

TYPE: bug fix

KEYWORDS: time series, tslist, nest

SOURCE: Mathieu Landreau (LHEEA, Centrale Nantes, France), Michael Duda (NSF NCAR)

DESCRIPTION OF CHANGES:
Problem:
When running a simulation with a nest starting later than its parent and with the time series option activated, the parent domain time series is reinitialized when the nest starts.

Solution:
This issue is corrected by:

1) Initializing time series-specific members of the domain type, in particular, initializing `have_calculated_tslocs` to `.FALSE.`
    
2) Returning early from the wrf_tsin routine if `grid%have_calculated_tslocs` is `.TRUE.` (but avoiding changes to the value of `have_calculated_tslocs` otherwise).

ISSUE:
Fixes #1927

LIST OF MODIFIED FILES:
M frame/module_domain_type.F
M share/wrf_tsin.F

TESTS CONDUCTED:
- The problem was observed on a personal test case and the modifications fixed it.
- It passes Jenkins tests.

RELEASE NOTE: Fix an issue in which time series for a parent domain were re-initialized when a child domain started later than the initial time for a simulation.
  • Loading branch information
mgduda committed Dec 21, 2023
1 parent 43a88c0 commit 4288d10
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
16 changes: 8 additions & 8 deletions frame/module_domain_type.F
Expand Up @@ -224,14 +224,14 @@ MODULE module_domain_type
Type(WRFU_TimeInterval) :: last_dtInterval

! Time series location information
INTEGER :: ntsloc, ntsloc_domain
INTEGER :: next_ts_time
INTEGER, POINTER, DIMENSION(:) :: itsloc, jtsloc, id_tsloc
REAL, POINTER, DIMENSION(:) :: lattsloc, lontsloc
CHARACTER (LEN=5), POINTER, DIMENSION(:) :: nametsloc
CHARACTER (LEN=25), POINTER, DIMENSION(:) :: desctsloc
CHARACTER (LEN=256), POINTER, DIMENSION(:) :: ts_filename
LOGICAL :: have_calculated_tslocs
INTEGER :: ntsloc = 0, ntsloc_domain = 0
INTEGER :: next_ts_time = 0
INTEGER, POINTER, DIMENSION(:) :: itsloc => NULL(), jtsloc => NULL(), id_tsloc => NULL()
REAL, POINTER, DIMENSION(:) :: lattsloc => NULL(), lontsloc => NULL()
CHARACTER (LEN=5), POINTER, DIMENSION(:) :: nametsloc => NULL()
CHARACTER (LEN=25), POINTER, DIMENSION(:) :: desctsloc => NULL()
CHARACTER (LEN=256), POINTER, DIMENSION(:) :: ts_filename => NULL()
LOGICAL :: have_calculated_tslocs = .FALSE.
LOGICAL :: have_displayed_alloc_stats ! used in module_alloc_space to display alloc stats; only do it once.

! Track location information
Expand Down
7 changes: 6 additions & 1 deletion share/wrf_tsin.F
Expand Up @@ -24,12 +24,17 @@ SUBROUTINE wrf_tsin ( grid , ierr )

ierr = 0

!
! If time series locations have already been computed by calc_ts_locations,
! assume that we have already read the 'tslist' file for this domain and return
!
IF ( grid%have_calculated_tslocs ) RETURN

#if ((EM_CORE == 1) && (DA_CORE != 1))
IF ( grid%dfi_opt == DFI_NODFI .OR. (grid%dfi_opt /= DFI_NODFI .AND. grid%dfi_stage == DFI_SETUP) ) THEN
#endif
CALL model_to_grid_config_rec ( grid%id , model_config_rec , config_flags )
grid%ntsloc = 0
grid%have_calculated_tslocs = .FALSE.

IF ( grid%max_ts_locs <= 0 ) RETURN

Expand Down

0 comments on commit 4288d10

Please sign in to comment.