Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User/wfc/remap scheme #1503

Merged
merged 19 commits into from
Oct 14, 2021
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ae54d2f
Revert "Implement changes suggested by @Hallberg-NOAA"
wfcooke Apr 22, 2019
1e68a2f
Revert "*Corrected the clock as seen by diabatic processes"
wfcooke Apr 22, 2019
deab21f
Revert "*Use rho_ref in finite volume PGF density calcs"
wfcooke Apr 22, 2019
148d88e
Update of MOM6 code to allow SPEAR to reproduce previous answers.
wfcooke Apr 22, 2019
e51601b
Updating SPEAR with MOM6 code as of 5/22
wfcooke May 23, 2019
380803c
Optional use of differing restoring piston velocities for temp and salt
MJHarrison-GFDL Jul 1, 2019
085f424
Merge pull request #2 from MJHarrison-GFDL/user/mjh/flux_restore_temp…
wfcooke Jul 1, 2019
2e174c1
Merge remote-tracking branch 'remoteGFDL/dev/gfdl' into dev/SPEAR
wfcooke Sep 4, 2019
dac0c6c
Correction to ePBL code to mitigate blowup.
wfcooke Sep 5, 2019
8532612
Merge pull request #4 from NOAA-GFDL/dev/gfdl
wfcooke Sep 6, 2019
68eb365
add MJHarrison-GFDL salt_flux_add_fix to SPEAR codeset
wfcooke Nov 6, 2019
e1905cb
Merge pull request #7 from wfcooke/user/wfc/SPEAR_20200207
wfcooke Feb 7, 2020
6557288
Merge remote-tracking branch 'upstream/dev/gfdl' into dev/gfdl
wfcooke Apr 16, 2021
cc87a17
Merge remote-tracking branch 'upstream/dev/gfdl' into dev/gfdl
wfcooke Jun 10, 2021
14f26f3
Merge remote-tracking branch 'upstream/dev/gfdl' into dev/gfdl
wfcooke Sep 29, 2021
4822b43
Added ability to change remapping scheme.
wfcooke Sep 29, 2021
8384758
Removed timers, Changes name for REMAPPING_SCHEME parameter
wfcooke Oct 1, 2021
8200cb3
Adds documentation for ODA_remapping_scheme
wfcooke Oct 13, 2021
0cbdc06
Merge branch 'dev/gfdl' into user/wfc/remap_scheme
marshallward Oct 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 23 additions & 27 deletions src/ocean_data_assim/MOM_oda_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module MOM_oda_driver_mod
use MOM_io, only : SINGLE_FILE
use MOM_interp_infra, only : init_extern_field, get_external_field_info
use MOM_interp_infra, only : time_interp_extern
use MOM_remapping, only : remappingSchemesDoc
use MOM_time_manager, only : time_type, real_to_time, get_date
use MOM_time_manager, only : operator(+), operator(>=), operator(/=)
use MOM_time_manager, only : operator(==), operator(<)
Expand Down Expand Up @@ -65,11 +66,8 @@ module MOM_oda_driver_mod

!>@{ CPU time clock ID
integer :: id_clock_oda_init
integer :: id_clock_oda_filter
integer :: id_clock_bias_adjustment
integer :: id_clock_apply_increments
integer :: id_clock_oda_prior
integer :: id_clock_oda_posterior
!>@}

#include <MOM_memory.h>
Expand Down Expand Up @@ -142,6 +140,7 @@ module MOM_oda_driver_mod
!>@{ DA parameters
integer, parameter :: NO_ASSIM = 0, OI_ASSIM=1, EAKF_ASSIM=2
!>@}
character(len=40) :: mdl = "MOM_oda_driver" !< This module's name.

contains

Expand Down Expand Up @@ -178,15 +177,13 @@ subroutine init_oda(Time, G, GV, diag_CS, CS)
character(len=30) :: coord_mode
character(len=200) :: inputdir, basin_file
logical :: reentrant_x, reentrant_y, tripolar_N, symmetric
character(len=80) :: remap_scheme
character(len=80) :: bias_correction_file, inc_file

if (associated(CS)) call MOM_error(FATAL, 'Calling oda_init with associated control structure')
allocate(CS)

id_clock_oda_init=cpu_clock_id('(ODA initialization)')
id_clock_oda_prior=cpu_clock_id('(ODA setting prior)')
id_clock_oda_filter=cpu_clock_id('(ODA filter computation)')
id_clock_oda_posterior=cpu_clock_id('(ODA getting posterior)')
call cpu_clock_begin(id_clock_oda_init)

! Use ens1 parameters , this could be changed at a later time
Expand All @@ -195,44 +192,49 @@ subroutine init_oda(Time, G, GV, diag_CS, CS)
call get_MOM_input(PF,dirs,ensemble_num=0)
call unit_scaling_init(PF, CS%US)

call get_param(PF, "MOM", "ASSIM_METHOD", assim_method, &
call get_param(PF, mdl, "ASSIM_METHOD", assim_method, &
"String which determines the data assimilation method "//&
"Valid methods are: \'EAKF\',\'OI\', and \'NO_ASSIM\'", default='NO_ASSIM')
call get_param(PF, "MOM", "ASSIM_FREQUENCY", CS%assim_frequency, &
call get_param(PF, mdl, "ASSIM_FREQUENCY", CS%assim_frequency, &
"data assimilation frequency in hours")
call get_param(PF, "MOM", "USE_REGRIDDING", CS%use_ALE_algorithm , &
call get_param(PF, mdl, "USE_REGRIDDING", CS%use_ALE_algorithm , &
"If True, use the ALE algorithm (regridding/remapping).\n"//&
"If False, use the layered isopycnal algorithm.", default=.false. )
call get_param(PF, "MOM", "REENTRANT_X", CS%reentrant_x, &
call get_param(PF, mdl, "REENTRANT_X", CS%reentrant_x, &
"If true, the domain is zonally reentrant.", default=.true.)
call get_param(PF, "MOM", "REENTRANT_Y", CS%reentrant_y, &
call get_param(PF, mdl, "REENTRANT_Y", CS%reentrant_y, &
"If true, the domain is meridionally reentrant.", &
default=.false.)
call get_param(PF,"MOM", "TRIPOLAR_N", CS%tripolar_N, &
call get_param(PF, mdl, "TRIPOLAR_N", CS%tripolar_N, &
"Use tripolar connectivity at the northern edge of the "//&
"domain. With TRIPOLAR_N, NIGLOBAL must be even.", &
default=.false.)
call get_param(PF,"MOM", "APPLY_TRACER_TENDENCY_ADJUSTMENT", CS%do_bias_adjustment, &
call get_param(PF, mdl, "APPLY_TRACER_TENDENCY_ADJUSTMENT", CS%do_bias_adjustment, &
"If true, add a spatio-temporally varying climatological adjustment "//&
"to temperature and salinity.", &
default=.false.)
if (CS%do_bias_adjustment) then
call get_param(PF,"MOM", "TRACER_ADJUSTMENT_FACTOR", CS%bias_adjustment_multiplier, &
call get_param(PF, mdl, "TRACER_ADJUSTMENT_FACTOR", CS%bias_adjustment_multiplier, &
"A multiplicative scaling factor for the climatological tracer tendency adjustment ", &
default=1.0)
endif
call get_param(PF,"MOM", "USE_BASIN_MASK", CS%use_basin_mask, &
call get_param(PF, mdl, "USE_BASIN_MASK", CS%use_basin_mask, &
"If true, add a basin mask to delineate weakly connected "//&
"ocean basins for the purpose of data assimilation.", &
default=.false.)

call get_param(PF,"MOM", "NIGLOBAL", CS%ni, &
call get_param(PF, mdl, "NIGLOBAL", CS%ni, &
"The total number of thickness grid points in the "//&
"x-direction in the physical domain.")
call get_param(PF,"MOM", "NJGLOBAL", CS%nj, &
call get_param(PF, mdl, "NJGLOBAL", CS%nj, &
"The total number of thickness grid points in the "//&
"y-direction in the physical domain.")
call get_param(PF, 'MOM', "INPUTDIR", inputdir)
call get_param(PF, mdl, "INPUTDIR", inputdir)
call get_param(PF, mdl, "ODA_REMAPPING_SCHEME", remap_scheme, &
"This sets the reconstruction scheme used "//&
"for vertical remapping for all variables. "//&
"It can be one of the following schemes: "//&
trim(remappingSchemesDoc), default="PPM_H4")
inputdir = slasher(inputdir)

select case(lowercase(trim(assim_method)))
Expand Down Expand Up @@ -281,7 +283,7 @@ subroutine init_oda(Time, G, GV, diag_CS, CS)
call MOM_initialize_coord(CS%GV, CS%US, PF, .false., &
dirs%output_directory, tv_dummy, dG%max_depth)
call ALE_init(PF, CS%GV, CS%US, dG%max_depth, CS%ALE_CS)
call MOM_grid_init(CS%Grid, PF)
call MOM_grid_init(CS%Grid, PF, global_indexing=.false.)
call ALE_updateVerticalGridType(CS%ALE_CS, CS%GV)
call copy_dyngrid_to_MOM_grid(dG, CS%Grid, CS%US)
CS%mpp_domain => CS%Grid%Domain%mpp_domain
Expand All @@ -300,7 +302,7 @@ subroutine init_oda(Time, G, GV, diag_CS, CS)
"Coordinate mode for vertical regridding.", &
default="ZSTAR", fail_if_missing=.false.)
call initialize_regridding(CS%regridCS, CS%GV, CS%US, dG%max_depth,PF,'oda_driver',coord_mode,'','')
call initialize_remapping(CS%remapCS,'PLM')
call initialize_remapping(CS%remapCS,remap_scheme)
call set_regrid_params(CS%regridCS, min_thickness=0.)
isd = G%isd; ied = G%ied; jsd = G%jsd; jed = G%jed

Expand Down Expand Up @@ -351,7 +353,7 @@ subroutine init_oda(Time, G, GV, diag_CS, CS)
call set_PElist(CS%ensemble_pelist(CS%ensemble_id,:))

if (CS%do_bias_adjustment) then
call get_param(PF, "MOM", "TEMP_SALT_ADJUSTMENT_FILE", bias_correction_file, &
call get_param(PF, mdl, "TEMP_SALT_ADJUSTMENT_FILE", bias_correction_file, &
"The name of the file containing temperature and salinity "//&
"tendency adjustments", default='temp_salt_adjustment.nc')

Expand Down Expand Up @@ -405,7 +407,6 @@ subroutine set_prior_tracer(Time, G, GV, h, tv, CS)
!! switch to global pelist
call set_PElist(CS%filter_pelist)
!call MOM_mesg('Setting prior')
call cpu_clock_begin(id_clock_oda_prior)

! computational domain for the analysis grid
isc=CS%Grid%isc;iec=CS%Grid%iec;jsc=CS%Grid%jsc;jec=CS%Grid%jec
Expand All @@ -432,7 +433,6 @@ subroutine set_prior_tracer(Time, G, GV, h, tv, CS)
call pass_var(CS%Ocean_prior%S(:,:,:,m),CS%Grid%domain)
enddo

call cpu_clock_end(id_clock_oda_prior)
!! switch back to ensemble member pelist
call set_PElist(CS%ensemble_pelist(CS%ensemble_id,:))

Expand Down Expand Up @@ -461,7 +461,6 @@ subroutine get_posterior_tracer(Time, CS, h, tv, increment)
!! switch to global pelist
call set_PElist(CS%filter_pelist)
call MOM_mesg('Getting posterior')
call cpu_clock_begin(id_clock_oda_posterior)
if (present(h)) h => CS%h ! get analysis thickness
!! Calculate and redistribute increments to CS%tv right after assimilation
!! Retain CS%tv to calculate increments for IAU updates CS%tv_inc otherwise
Expand Down Expand Up @@ -490,7 +489,6 @@ subroutine get_posterior_tracer(Time, CS, h, tv, increment)
if (present(tv)) tv => CS%tv
if (present(h)) h => CS%h

call cpu_clock_end(id_clock_oda_posterior)

!! switch back to ensemble member pelist
call set_PElist(CS%ensemble_pelist(CS%ensemble_id,:))
Expand Down Expand Up @@ -518,12 +516,10 @@ subroutine oda(Time, CS)

!! switch to global pelist
call set_PElist(CS%filter_pelist)
call cpu_clock_begin(id_clock_oda_filter)
call get_profiles(Time, CS%Profiles, CS%CProfiles)
#ifdef ENABLE_ECDA
call ensemble_filter(CS%Ocean_prior, CS%Ocean_posterior, CS%CProfiles, CS%kdroot, CS%mpp_domain, CS%oda_grid)
#endif
call cpu_clock_end(id_clock_oda_filter)
!! switch back to ensemble member pelist
call set_PElist(CS%ensemble_pelist(CS%ensemble_id,:))
call get_posterior_tracer(Time, CS, increment=.true.)
Expand Down