diff --git a/.gitmodules b/.gitmodules index b499e43096..637f1188ed 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,9 +4,3 @@ [submodule "pkg/GSW-Fortran"] path = pkg/GSW-Fortran url = https://github.com/TEOS-10/GSW-Fortran.git -[submodule "pkg/MOM6_DA_hooks"] - path = pkg/MOM6_DA_hooks - url = https://github.com/MJHarrison-GFDL/MOM6_DA_hooks.git -[submodule "pkg/geoKdTree"] - path = pkg/geoKdTree - url = https://github.com/travissluka/geoKdTree.git diff --git a/config_src/external/GFDL_ocean_BGC/README.md b/config_src/external/GFDL_ocean_BGC/README.md index 584e5aa16d..198575c8a7 100644 --- a/config_src/external/GFDL_ocean_BGC/README.md +++ b/config_src/external/GFDL_ocean_BGC/README.md @@ -3,4 +3,4 @@ GFDL_ocean_BGC These APIs reflect those for the GFDL ocean_BGC available at https://github.com/NOAA-GFDL/ocean_BGC. -The modules in this directory do not do any computations. They simple reflect the APIs of the above package. +The modules in this directory do not do any computations. They simply reflect the APIs of the above package. diff --git a/config_src/external/ODA_hooks/README.md b/config_src/external/ODA_hooks/README.md new file mode 100644 index 0000000000..b26731a463 --- /dev/null +++ b/config_src/external/ODA_hooks/README.md @@ -0,0 +1,9 @@ +ODA_hooks +========= + +These APIs reflect those for the ocean data assimilation hooks similar to https://github.com/MJHarrison-GFDL/MOM6_DA_hooks + +The modules in this directory do not do any computations. They simply reflect the APIs of the above package. + +- kdtree.f90 - would come from https://github.com/travissluka/geoKdTree +- ocean_da_core.F90, ocean_da_types.F90, write_ocean_obs.F90 were copied from https://github.com/MJHarrison-GFDL/MOM6_DA_hooks diff --git a/config_src/external/ODA_hooks/kdtree.f90 b/config_src/external/ODA_hooks/kdtree.f90 new file mode 100644 index 0000000000..a27716dde1 --- /dev/null +++ b/config_src/external/ODA_hooks/kdtree.f90 @@ -0,0 +1,12 @@ +!> A null version of K-d tree from geoKdTree +module kdtree + implicit none + private + + public :: kd_root + + !> A K-d tree tpe + type kd_root + integer :: dummy !< To stop a compiler from doing nothing + end type kd_root +end module kdtree diff --git a/config_src/external/ODA_hooks/ocean_da_core.F90 b/config_src/external/ODA_hooks/ocean_da_core.F90 new file mode 100644 index 0000000000..90004bd9d5 --- /dev/null +++ b/config_src/external/ODA_hooks/ocean_da_core.F90 @@ -0,0 +1,90 @@ +!> A set of dummy interfaces for compiling the MOM6 DA driver code. +module ocean_da_core_mod +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! +! This module contains a set of dummy interfaces for compiling the MOM6 DA +! driver code. These interfaces are not finalized and will be replaced by supported +! interfaces at some later date. +! +! 3/22/18 +! matthew.harrison@noaa.gov +! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + use mpp_domains_mod, only : domain2d + use time_manager_mod, only : time_type, set_time, get_date + ! ODA_tools modules + use ocean_da_types_mod, only : ocean_profile_type, grid_type + + + implicit none + private + public :: ocean_da_core_init, open_profile_dataset + public :: get_profiles, copy_profiles + +contains + + !> Initialize ODA + subroutine ocean_da_core_init(Domain, T_grid, Profiles, model_time) + type(domain2d), pointer, intent(in) :: Domain !< MOM type for the local domain` + type(grid_type), pointer, intent(in) :: T_grid !< MOM grid type for the local domain + type(ocean_profile_type), pointer :: Profiles + !< This is an unstructured recursive list of profiles + !< which are either within the localized domain corresponding + !< to the Domain argument, or the global profile list + type(time_type), intent(in) :: model_time !< Model time + + Profiles=>NULL() + return + end subroutine ocean_da_core_init + + !> Open a profile dataset + subroutine open_profile_dataset(Profiles, Domain, T_grid, & + filename, time_start, time_end, obs_variable, localize) + type(ocean_profile_type), pointer :: Profiles + !< This is an unstructured recursive list of profiles + !< which are either within the localized domain corresponding + !< to the Domain argument, or the global profile list + type(domain2d), pointer, intent(in) :: Domain !< MOM type for the local domain + type(grid_type), pointer, intent(in) :: T_grid !< MOM grid type for the local domain + character(len=*), intent(in) :: filename !< filename containing profile data + type(time_type), intent(in) :: time_start, time_end !< start and end times for the analysis + integer, intent(in), optional :: obs_variable !< If present, then extract corresponding data + !< from file, otherwise, extract all available data which. + logical, intent(in), optional :: localize !< Localize the observations to the current computational domain + + return + + end subroutine open_profile_dataset + + !> Get profiles obs relevant to current analysis interval + subroutine get_profiles(model_time, Profiles, Current_profiles) + type(time_type), intent(in) :: model_time + type(ocean_profile_type), pointer :: Profiles + type(ocean_profile_type), pointer :: Current_profiles + + Profiles=>NULL() + Current_Profiles=>NULL() + + return + end subroutine get_profiles + + !> Copy profiles at current analysis step from a linked list to an array + !! feasible now since the number of localized current profiles is small + subroutine copy_profiles(Current_profiles, Profiles) + type(ocean_profile_type), pointer :: Current_profiles + type(ocean_profile_type), pointer, dimension(:) :: Profiles + + return + + end subroutine copy_profiles + + !> Copy observations + subroutine copy_obs(obs_in, obs_out) + type(ocean_profile_type), pointer :: obs_in + type(ocean_profile_type), pointer :: obs_out + + return + end subroutine copy_obs + +end module ocean_da_core_mod diff --git a/config_src/external/ODA_hooks/ocean_da_types.F90 b/config_src/external/ODA_hooks/ocean_da_types.F90 new file mode 100644 index 0000000000..165ed4f4ba --- /dev/null +++ b/config_src/external/ODA_hooks/ocean_da_types.F90 @@ -0,0 +1,126 @@ +!> This module contains a set of data structures and interfaces for compiling the MOM6 DA +!! driver code. +module ocean_da_types_mod +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! +! This module contains a set of data structures and interfaces for compiling the MOM6 DA +! driver code. This code is not yet finalized and will be replaced by supported +! software at some later date. +! +! 3/22/18 +! matthew.harrison@noaa.gov +! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +#ifndef MAX_LEVS_FILE_ +#define MAX_LEVS_FILE_ 50 +#endif + +#ifndef MAX_LINKS_ +#define MAX_LINKS_ 100 +#endif + +!============================================================ +! This module contains type declarations and default values +! for oda modules. +!============================================================ + +! Contact: Matthew.Harrison@noaa.gov and Feiyu.Lu@noaa.gov + + use time_manager_mod, only : time_type + !use obs_tools_mod, only : obs_def_type + !use mpp_domains_mod, only : domain2d + + implicit none + + private + + integer, parameter, public :: MAX_LEVELS_FILE = MAX_LEVS_FILE_ !< Controls record length for optimal storage + integer, parameter, public :: MAX_LINKS = MAX_LINKS_ !< Maximum number of records per profile for storage for profiles + integer, parameter, public :: UNKNOWN = 0 + + integer, save, public :: TEMP_ID = 1 + integer, save, public :: SALT_ID = 2 + real, parameter, public :: MISSING_VALUE = -1.e10 + + !> Type for ocean state in DA space (same decomposition and vertical grid) + type, public :: OCEAN_CONTROL_STRUCT + integer :: ensemble_size + real, pointer, dimension(:,:,:) :: SSH=>NULL() !NULL() !NULL() !NULL() !NULL() !NULL() !NULL(), id_s=>NULL() !< diagnostic IDs for temperature and salinity + integer, dimension(:), pointer :: id_u=>NULL(), id_v=>NULL() !< diagnostic IDs for zonal and meridional velocity + integer, dimension(:), pointer :: id_ssh=>NULL() !< diagnostic IDs for SSH + end type OCEAN_CONTROL_STRUCT + + !> Profile + type, public :: ocean_profile_type + integer :: variable !< variable ids are defined by the ocean_types module (e.g. TEMP_ID, SALT_ID) + integer :: inst_type !< instrument types are defined by platform class (e.g. MOORING, DROP, etc.) and instrument type (XBT, CDT, etc.) + integer :: nvar !< number of observations types associated with the current profile + real :: project !< e.g. FGGE, COARE, ACCE, ... + real :: probe !< MBT, XBT, drifting buoy + real :: ref_inst !< instrument (thermograph, hull sensor, ...) + integer :: wod_cast_num !< NODC world ocean dataset unique id + real :: fix_depth !< adjust profile depths (for XBT drop rate corrections) + real :: ocn_vehicle !< ocean vehicle type + real :: database_id !< a unique profile id + integer :: levels !< number of levels in the current profile + integer :: basin_mask !<1:Southern Ocean, 2:Atlantic Ocean, 3:Pacific Ocean, + !! 4:Arctic Ocean, 5:Indian Ocean, 6:Mediterranean Sea, 7:Black Sea, + !! 8:Hudson Bay, 9:Baltic Sea, 10:Red Sea, 11:Persian Gulf + integer :: profile_flag !< an overall flag for the profile + integer :: profile_flag_s !< an overall flag for the profile salinity + real :: lat, lon !< latitude and longitude (degrees E and N) + logical :: accepted !< logical flag to disable a profile + integer :: nlinks !< number of links used to construct the profile (when reading from disk) + type(ocean_profile_type), pointer :: next=>NULL() !< all profiles are stored as linked list. + type(ocean_profile_type), pointer :: prev=>NULL() + type(ocean_profile_type), pointer :: cnext=>NULL() ! current profiles are stored as linked list. + type(ocean_profile_type), pointer :: cprev=>NULL() + integer :: nbr_xi, nbr_yi ! nearest neighbor model gridpoint for the profile + real :: nbr_dist ! distance to nearest neighbor model gridpoint + real, dimension(:), pointer :: depth + real, dimension(:), pointer :: data_t => NULL(), data_s => NULL() + real, dimension(:), pointer :: data + !integer, dimension(:), pointer :: flag_t + !integer, dimension(:), pointer :: flag_s ! level-by-level flags for salinity + !::sdu:: For now ECDA use flag as a logical, will likely change in future releases. + logical, dimension(:), pointer :: flag + real :: temp_err, salt_err ! measurement error + !real, dimension(:), pointer :: ms_t ! ms temperature by level + !real, dimension(:), pointer :: ms_s ! ms salinity by level + real, dimension(:), pointer :: ms_inv => NULL() + real, dimension(:), pointer :: ms => NULL() +! type(obs_def_type), dimension(:), pointer :: obs_def => NULL() + type(time_type) :: time + integer :: yyyy + integer :: mmdd + !type(time_type), pointer :: Model_time ! each profile can be associated with a first-guess field with an associated time and grid + !type(grid_type), pointer :: Model_grid + real :: i_index, j_index ! model longitude and latitude indices respectively + real, dimension(:), pointer :: k_index ! model depth indices + type(time_type) :: tdiff ! positive difference between model time and observation time + end type ocean_profile_type + + !> Grid information for ODA purposes, including arrays of + !! lat, lon, depth, thickness, basin and land mask + type, public :: grid_type + real, pointer, dimension(:,:) :: x=>NULL(), y=>NULL() + !real, pointer, dimension(:,:) :: x_bound=>NULL(), y_bound=>NULL() + !real, pointer, dimension(:,:) :: dx=>NULL(), dy=>NULL() + real, pointer, dimension(:,:,:) :: z=>NULL() + real, pointer, dimension(:,:,:) :: h=>NULL() + !real, pointer, dimension(:) :: z_bound=>NULL() + !real, pointer, dimension(:) :: dz => NULL() + real, pointer, dimension(:,:) :: basin_mask => NULL() + real, pointer, dimension(:,:,:) :: mask => NULL() + !type(domain2d), pointer :: Dom ! FMS domain type + !logical :: cyclic + integer :: ni, nj, nk + end type grid_type + +end module ocean_da_types_mod diff --git a/config_src/external/ODA_hooks/write_ocean_obs.F90 b/config_src/external/ODA_hooks/write_ocean_obs.F90 new file mode 100644 index 0000000000..468698d475 --- /dev/null +++ b/config_src/external/ODA_hooks/write_ocean_obs.F90 @@ -0,0 +1,60 @@ +!> Dummy interfaces for writing ODA data +module write_ocean_obs_mod + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! +! This module contains a set of dummy interfaces for compiling the MOM6 DA +! driver code. These interfaces are not finalized and will be replaced by supported +! interfaces at some later date. +! +! 3/22/18 +! matthew.harrison@noaa.gov +! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + use ocean_da_types_mod, only : ocean_profile_type + use time_manager_mod, only : time_type, get_time, set_date, operator ( - ) + + implicit none + + private + + public :: open_profile_file, write_profile, close_profile_file, & + write_ocean_obs_init + +contains + +!> Open a profile file +integer function open_profile_file(name, nvar, grid_lon, grid_lat,thread,fset) + character(len=*), intent(in) :: name !< File name + integer, intent(in), optional :: nvar !< Number of variables + real, dimension(:), optional, intent(in) :: grid_lon !< Longitude [degreeE] + real, dimension(:), optional, intent(in) :: grid_lat !< Latitude [degreeN] + integer, intent(in), optional :: thread !< Thread + integer, intent(in), optional :: fset !< File set + + open_profile_file=-1 +end function open_profile_file + +!> Write a profile +subroutine write_profile(unit,profile) + integer, intent(in) :: unit !< File unit + type(ocean_profile_type), intent(in) :: profile !< Profile + + return +end subroutine write_profile + +!> Close a profile file +subroutine close_profile_file(unit) + integer, intent(in) :: unit !< File unit + + return +end subroutine close_profile_file + +!> Initialize write_ocean_obs module +subroutine write_ocean_obs_init() + + return +end subroutine write_ocean_obs_init + +end module write_ocean_obs_mod diff --git a/pkg/MOM6_DA_hooks b/pkg/MOM6_DA_hooks deleted file mode 160000 index 6d8834ca8c..0000000000 --- a/pkg/MOM6_DA_hooks +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6d8834ca8cf399f1a0d202239d72919907f6cd74 diff --git a/pkg/geoKdTree b/pkg/geoKdTree deleted file mode 160000 index a4670b9743..0000000000 --- a/pkg/geoKdTree +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a4670b9743c883d310d821eeac5b1f77f587b9d5 diff --git a/src/ocean_data_assim/core b/src/ocean_data_assim/core deleted file mode 120000 index e0a21d3192..0000000000 --- a/src/ocean_data_assim/core +++ /dev/null @@ -1 +0,0 @@ -../../pkg/MOM6_DA_hooks/src/core \ No newline at end of file diff --git a/src/ocean_data_assim/geoKdTree b/src/ocean_data_assim/geoKdTree deleted file mode 120000 index 61fd167bb6..0000000000 --- a/src/ocean_data_assim/geoKdTree +++ /dev/null @@ -1 +0,0 @@ -../../pkg/geoKdTree \ No newline at end of file