Skip to content

Commit

Permalink
Moved pkg/MOM6_DA_hook to config_src/external
Browse files Browse the repository at this point in the history
- Removed two git submodules and added bare interfaces to
  config_src/exernal/ODA_hooks/
- Added some missing documentation
  • Loading branch information
adcroft committed Jun 19, 2020
1 parent 7c6041a commit b31da6a
Show file tree
Hide file tree
Showing 11 changed files with 298 additions and 11 deletions.
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion config_src/external/GFDL_ocean_BGC/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
9 changes: 9 additions & 0 deletions config_src/external/ODA_hooks/README.md
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions config_src/external/ODA_hooks/kdtree.f90
Original file line number Diff line number Diff line change
@@ -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
90 changes: 90 additions & 0 deletions config_src/external/ODA_hooks/ocean_da_core.F90
Original file line number Diff line number Diff line change
@@ -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
! [email protected]
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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
126 changes: 126 additions & 0 deletions config_src/external/ODA_hooks/ocean_da_types.F90
Original file line number Diff line number Diff line change
@@ -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
! [email protected]
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#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: [email protected] and [email protected]

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() !<sea surface height (m) across ensembles
real, pointer, dimension(:,:,:,:) :: h=>NULL() !<layer thicknesses (m or kg) across ensembles
real, pointer, dimension(:,:,:,:) :: T=>NULL() !<layer potential temperature (degC) across ensembles
real, pointer, dimension(:,:,:,:) :: S=>NULL() !<layer salinity (psu or g kg-1) across ensembles
real, pointer, dimension(:,:,:,:) :: U=>NULL() !<layer zonal velocity (m s-1) across ensembles
real, pointer, dimension(:,:,:,:) :: V=>NULL() !<layer meridional velocity (m s-1) across ensembles
integer, dimension(:), pointer :: id_t=>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
60 changes: 60 additions & 0 deletions config_src/external/ODA_hooks/write_ocean_obs.F90
Original file line number Diff line number Diff line change
@@ -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
! [email protected]
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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
1 change: 0 additions & 1 deletion pkg/MOM6_DA_hooks
Submodule MOM6_DA_hooks deleted from 6d8834
1 change: 0 additions & 1 deletion pkg/geoKdTree
Submodule geoKdTree deleted from a4670b
1 change: 0 additions & 1 deletion src/ocean_data_assim/core

This file was deleted.

1 change: 0 additions & 1 deletion src/ocean_data_assim/geoKdTree

This file was deleted.

0 comments on commit b31da6a

Please sign in to comment.