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

Adds first version of the MCT driver #578

Merged
merged 62 commits into from
Aug 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
711a613
Removes frazil's contribution to evaporation
gustavo-marques Jun 23, 2017
405fecb
Merge pull request #1 from gustavo-marques/ice_shelf
alperaltuntas Jun 23, 2017
346097d
Moved blank ocn_comp_mct.F90
alperaltuntas Jun 29, 2017
426357c
Time and calendar initialization in ocn_comp_mct.F90
alperaltuntas Jun 30, 2017
54f7976
Most initialization working
alperaltuntas Jul 3, 2017
86936ba
Adds option to read initial temp and salt from separate files
gustavo-marques Jul 5, 2017
e8f2999
Merge pull request #2 from gustavo-marques/temp_salt_z_init_file
alperaltuntas Jul 6, 2017
fa86163
Merge pull request #3 from NCAR/dev/gfdl
alperaltuntas Jul 6, 2017
fbd405b
Added coupler indices module
alperaltuntas Jul 7, 2017
2b794da
Merge pull request #4 from alperaltuntas/dev/ncar
alperaltuntas Jul 7, 2017
37e7356
Added ocn_import_export.F90
alperaltuntas Jul 13, 2017
57e6086
Added methods to return domain/grid shape
alperaltuntas Jul 13, 2017
5df3bc3
Added method to point ponters to members of ocean_state_type
alperaltuntas Jul 13, 2017
aba7dc2
Completed ocn_init_mct
alperaltuntas Jul 13, 2017
ed3ed30
Added ocn_import_export module
alperaltuntas Jul 13, 2017
2540ed8
Filled empty subroutines in ocn_comp_mct.F90
alperaltuntas Jul 19, 2017
970f848
added debugging
alperaltuntas Jul 19, 2017
8b38141
Wrapped global data
alperaltuntas Jul 19, 2017
3a923a2
Got initialization working
alperaltuntas Jul 20, 2017
231d19e
Merge pull request #5 from alperaltuntas/dev/ncar
alperaltuntas Jul 20, 2017
beac3ed
Adds "only" for all use statements
adcroft Jul 20, 2017
5700d67
Merge pull request #6 from adcroft/add-use-only-for-imports
alperaltuntas Jul 20, 2017
a1db77f
Cleans up white space
adcroft Jul 21, 2017
7f2207c
Merge pull request #7 from adcroft/fix-mct-whitespace
alperaltuntas Jul 21, 2017
714e8d6
Adds placeholders for stepping foward MOM
adcroft Jul 21, 2017
3ceef26
Merge pull request #10 from adcroft/sketch-out-mct-run
alperaltuntas Jul 21, 2017
5cd8d7a
Filling ice_ocean_bnd, still needs work
gustavo-marques Jul 24, 2017
1f39c84
Replaces use of "surface" with "ocean_public_type"
adcroft Jul 25, 2017
c83e238
Correct indexing when using ocean_public_type
adcroft Jul 25, 2017
a306c90
Merge pull request #11 from adcroft/use-ocn-public-for-surface
alperaltuntas Jul 25, 2017
b69ab33
Filling ice_ocean_bnd - Draft
gustavo-marques Jul 25, 2017
d517719
Merge branch 'dev/ncar' into fill_ice_ocean_bnd
gustavo-marques Jul 25, 2017
7ce40e5
Fix undefined reference to fill_ice_ocean_bnd
gustavo-marques Jul 25, 2017
6b6289a
Remove trailing whitespace
gustavo-marques Jul 25, 2017
e6c5ddd
Merge pull request #12 from gustavo-marques/fill_ice_ocean_bnd
alperaltuntas Jul 25, 2017
37a53bc
reorganize file structure
alperaltuntas Jul 25, 2017
cd58e2a
Merge pull request #13 from alperaltuntas/dev/ncar
alperaltuntas Jul 25, 2017
f7c26a5
Clean the module and start doxygenizing it
gustavo-marques Jul 25, 2017
4d346ca
Merge branch 'dev/ncar' into docs
gustavo-marques Jul 25, 2017
b403edd
Merge pull request #14 from gustavo-marques/docs
alperaltuntas Jul 25, 2017
d77936e
Fix intent(inout) in ice_ocean_boundary
gustavo-marques Jul 26, 2017
31787c2
Adds reference to set_time that was lost during a conflict handling
gustavo-marques Jul 26, 2017
f42c970
Merge pull request #15 from gustavo-marques/small_fixes
alperaltuntas Jul 26, 2017
fccb7ae
Avoids a SEGV when OBC are not in use with bi-harmonic friction
adcroft Jul 25, 2017
be46fee
(*)Fixes gprime(1) when no layer coordinates are set
adcroft Jul 28, 2017
17d4586
Merge pull request #16 from adcroft/ncar-cherry-picked-fixes
gustavo-marques Jul 28, 2017
c04f081
Fix ssh slope calculation
gustavo-marques Jul 28, 2017
76565cb
Merge pull request #17 from gustavo-marques/fix_ssh_slopes
alperaltuntas Jul 28, 2017
be1e6cf
Merge branch 'dev/master' into dev/ncar
gustavo-marques Jul 31, 2017
7480492
Merge pull request #19 from gustavo-marques/new_merge
alperaltuntas Aug 1, 2017
fb89b08
Adds code that got lost during merge
gustavo-marques Aug 1, 2017
1bca79b
Merge pull request #20 from gustavo-marques/fix_merge
alperaltuntas Aug 1, 2017
06a30ab
Fixed clock and timing
alperaltuntas Aug 10, 2017
58f78b9
Fill IOB, some fluxes still need to be checked
gustavo-marques Aug 10, 2017
2582e0a
Adds run paramaters to control SW decomposition
gustavo-marques Aug 10, 2017
369d5d6
Merge pull request #21 from alperaltuntas/dev/ncar
gustavo-marques Aug 10, 2017
f6b22ff
Merge branch 'dev/ncar' into check_fluxes
gustavo-marques Aug 10, 2017
8745b4b
Fills additional IOB fluxes
gustavo-marques Aug 11, 2017
f5a8483
Adds option to write restart files
gustavo-marques Aug 11, 2017
ba5b5ba
Merge pull request #22 from gustavo-marques/check_fluxes
alperaltuntas Aug 11, 2017
a85b728
Merge MCT modules
gustavo-marques Aug 15, 2017
f4f882f
Merge pull request #23 from gustavo-marques/combine_mct_modules
alperaltuntas Aug 15, 2017
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
15 changes: 14 additions & 1 deletion config_src/coupled_driver/ocean_model_MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ module ocean_model_mod
public ocean_model_restart
public ice_ocn_bnd_type_chksum
public ocean_public_type_chksum
public ocean_model_data_get
public ocean_model_data_get
public get_state_pointers

interface ocean_model_data_get
module procedure ocean_model_data1D_get
module procedure ocean_model_data2D_get
Expand Down Expand Up @@ -1086,4 +1088,15 @@ subroutine ocean_public_type_chksum(id, timestep, ocn)
100 FORMAT(" CHECKSUM::",A20," = ",Z20)
end subroutine ocean_public_type_chksum

!> Returns pointers to objects within ocean_state_type
subroutine get_state_pointers(OS, grid, surf)
type(ocean_state_type), pointer :: OS !< Ocean state type
type(ocean_grid_type), optional, pointer :: grid !< Ocean grid
type(surface), optional, pointer :: surf !< Ocean surface state

if (present(grid)) grid => OS%grid
if (present(surf)) surf=> OS%state

end subroutine get_state_pointers

end module ocean_model_mod
945 changes: 945 additions & 0 deletions config_src/mct_driver/ocn_comp_mct.F90

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion src/core/MOM_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module MOM_grid

use MOM_hor_index, only : hor_index_type, hor_index_init
use MOM_domains, only : MOM_domain_type, get_domain_extent, compute_block_extent
use MOM_domains, only : get_global_shape
use MOM_error_handler, only : MOM_error, MOM_mesg, FATAL
use MOM_file_parser, only : get_param, log_param, log_version, param_file_type

Expand All @@ -13,7 +14,7 @@ module MOM_grid
#include <MOM_memory.h>

public MOM_grid_init, MOM_grid_end, set_derived_metrics, set_first_direction
public isPointInCell, hor_index_type
public isPointInCell, hor_index_type, get_global_grid_size

!> Ocean grid type. See mom_grid for details.
type, public :: ocean_grid_type
Expand Down Expand Up @@ -443,6 +444,16 @@ subroutine set_first_direction(G, y_first)
G%first_direction = y_first
end subroutine set_first_direction

!> Return global shape of horizontal grid
subroutine get_global_grid_size(G, niglobal, njglobal)
type(ocean_grid_type), intent(inout) :: G !< The horizontal grid type
integer, intent(out) :: niglobal !< i-index global size of grid
integer, intent(out) :: njglobal !< j-index global size of grid

call get_global_shape(G%domain, niglobal, njglobal)

end subroutine get_global_grid_size

!> Allocate memory used by the ocean_grid_type and related structures.
subroutine allocate_metrics(G)
type(ocean_grid_type), intent(inout) :: G !< The horizontal grid type
Expand Down
13 changes: 12 additions & 1 deletion src/framework/MOM_domains.F90
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module MOM_domains
public :: To_East, To_West, To_North, To_South, To_All, Omit_Corners
public :: create_group_pass, do_group_pass, group_pass_type
public :: start_group_pass, complete_group_pass
public :: compute_block_extent
public :: compute_block_extent, get_global_shape

interface pass_var
module procedure pass_var_3d, pass_var_2d
Expand Down Expand Up @@ -1896,4 +1896,15 @@ subroutine get_domain_extent(Domain, isc, iec, jsc, jec, isd, ied, jsd, jed, &

end subroutine get_domain_extent

!> Returns the global shape of h-point arrays
subroutine get_global_shape(domain, niglobal, njglobal)
type(MOM_domain_type), intent(in) :: domain !< MOM domain
integer, intent(out) :: niglobal !< i-index global size of h-point arrays
integer, intent(out) :: njglobal !< j-index global size of h-point arrays

niglobal = domain%niglobal
njglobal = domain%njglobal

end subroutine get_global_shape

end module MOM_domains
11 changes: 0 additions & 11 deletions src/ice_shelf/MOM_ice_shelf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1053,17 +1053,6 @@ subroutine add_shelf_flux(G, CS, state, fluxes)
endif


! Add frazil formation diagnosed by the ocean model (J m-2) in the
! form of surface layer evaporation (kg m-2 s-1). Update lprec in the
! control structure for diagnostic purposes.

if (associated(state%frazil)) then
fraz = state%frazil(i,j) / CS%time_step / CS%Lat_fusion
if (associated(fluxes%evap)) fluxes%evap(i,j) = fluxes%evap(i,j) - fraz
CS%lprec(i,j)=CS%lprec(i,j) - fraz
state%frazil(i,j) = 0.0
endif

if (associated(fluxes%sens)) fluxes%sens(i,j) = -frac_area*CS%t_flux(i,j)*CS%flux_factor
if (associated(fluxes%salt_flux)) fluxes%salt_flux(i,j) = frac_area * CS%salt_flux(i,j)*CS%flux_factor
if (associated(fluxes%p_surf)) fluxes%p_surf(i,j) = frac_area * CS%g_Earth * CS%mass_shelf(i,j)
Expand Down
37 changes: 35 additions & 2 deletions src/initialization/MOM_coord_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ subroutine MOM_initialize_coord(GV, PF, write_geom, output_dir, tv, max_depth)
! Set-up the layer densities, GV%Rlay, and reduced gravities, GV%g_prime.
call get_param(PF, mdl, "COORD_CONFIG", config, &
"This specifies how layers are to be defined: \n"//&
" \t ALE or none - used to avoid defining layers in ALE mode \n"//&
" \t file - read coordinate information from the file \n"//&
" \t\t specified by (COORD_FILE).\n"//&
" \t BFB - Custom coords for buoyancy-forced basin case \n"//&
Expand Down Expand Up @@ -93,7 +94,8 @@ subroutine MOM_initialize_coord(GV, PF, write_geom, output_dir, tv, max_depth)
call user_set_coord(GV%Rlay, GV%g_prime, GV, PF, eos)
case ("BFB")
call BFB_set_coord(GV%Rlay, GV%g_prime, GV, PF, eos)
case ("none")
case ("none", "ALE")
call set_coord_to_none(GV%Rlay, GV%g_prime, GV, PF)
case default ; call MOM_error(FATAL,"MOM_initialize_coord: "// &
"Unrecognized coordinate setup"//trim(config))
end select
Expand Down Expand Up @@ -493,7 +495,38 @@ subroutine set_coord_linear(Rlay, g_prime, GV, param_file)
call callTree_leave(trim(mdl)//'()')
end subroutine set_coord_linear

! -----------------------------------------------------------------------------
!> Sets Rlay to Rho0 and g_prime to zero except for the free surface.
!! This is for use only in ALE mode where Rlay should not be used and g_prime(1) alone
!! might be used.
subroutine set_coord_to_none(Rlay, g_prime, GV, param_file)
real, dimension(:), intent(out) :: Rlay !< The layers' target coordinate values
!! (potential density).
real, dimension(:), intent(out) :: g_prime !< A structure indicating the open file to
!! parse for model parameter values.
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters
real :: g_fs ! Reduced gravity across the free surface, in m s-2.
character(len=40) :: mdl = "set_coord_to_none" ! This subroutine's name.
integer :: k, nz
nz = GV%ke

call callTree_enter(trim(mdl)//"(), MOM_coord_initialization.F90")

call get_param(param_file, mdl, "GFS" , g_fs, &
"The reduced gravity at the free surface.", units="m s-2", &
default=GV%g_Earth)

g_prime(1) = g_fs
do k=2,nz ; g_prime(k) = 0. ; enddo
Rlay(1) = GV%Rho0
do k=2,nz ; Rlay(k) = Rlay(k-1) + g_prime(k)*(GV%Rho0/GV%g_Earth) ; enddo

call callTree_leave(trim(mdl)//'()')

end subroutine set_coord_to_none

!> This subroutine writes out a file containing any available data related
!! to the vertical grid used by the MOM ocean model.
subroutine write_vertgrid_file(GV, param_file, directory)
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure
type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters
Expand Down
33 changes: 23 additions & 10 deletions src/initialization/MOM_state_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1795,10 +1795,14 @@ subroutine MOM_temp_salt_initialize_from_Z(h, tv, G, GV, PF, just_read_params)
logical, optional, intent(in) :: just_read_params !< If present and true, this call will
!! only read parameters without changing h.

character(len=200) :: filename ! The name of an input file containing temperature
! and salinity in z-space; also used for ice shelf area.
character(len=200) :: shelf_file ! The name of an input file used for ice shelf area.
character(len=200) :: inputdir ! The directory where NetCDF input filesare.
character(len=200) :: filename !< The name of an input file containing temperature
!! and salinity in z-space; also used for ice shelf area.
character(len=200) :: tfilename !< The name of an input file containing only temperature
!! in z-space.
character(len=200) :: sfilename !< The name of an input file containing only salinity
!! in z-space.
character(len=200) :: shelf_file !< The name of an input file used for ice shelf area.
character(len=200) :: inputdir !! The directory where NetCDF input filesare.
character(len=200) :: mesg, area_varname, ice_shelf_file

type(EOS_type), pointer :: eos => NULL()
Expand Down Expand Up @@ -1892,15 +1896,24 @@ subroutine MOM_temp_salt_initialize_from_Z(h, tv, G, GV, PF, just_read_params)

call get_param(PF, mdl, "TEMP_SALT_Z_INIT_FILE",filename, &
"The name of the z-space input file used to initialize \n"//&
"the layer thicknesses, temperatures and salinities.", &
default="temp_salt_z.nc", do_not_log=just_read)
"temperatures (T) and salinities (S). If T and S are not \n" //&
"in the same file, TEMP_Z_INIT_FILE and SALT_Z_INIT_FILE \n" //&
"must be set.",default="temp_salt_z.nc",do_not_log=just_read)
call get_param(PF, mdl, "TEMP_Z_INIT_FILE",tfilename, &
"The name of the z-space input file used to initialize \n"//&
"temperatures, only.", default=trim(filename),do_not_log=just_read)
call get_param(PF, mdl, "SALT_Z_INIT_FILE",sfilename, &
"The name of the z-space input file used to initialize \n"//&
"temperatures, only.", default=trim(filename),do_not_log=just_read)
filename = trim(inputdir)//trim(filename)
tfilename = trim(inputdir)//trim(tfilename)
sfilename = trim(inputdir)//trim(sfilename)
call get_param(PF, mdl, "Z_INIT_FILE_PTEMP_VAR", potemp_var, &
"The name of the potential temperature variable in \n"//&
"TEMP_SALT_Z_INIT_FILE.", default="ptemp", do_not_log=just_read)
"TEMP_Z_INIT_FILE.", default="ptemp",do_not_log=just_read)
call get_param(PF, mdl, "Z_INIT_FILE_SALT_VAR", salin_var, &
"The name of the salinity variable in \n"//&
"TEMP_SALT_Z_INIT_FILE.", default="salt", do_not_log=just_read)
"SALT_Z_INIT_FILE.", default="salt",do_not_log=just_read)
call get_param(PF, mdl, "Z_INIT_HOMOGENIZE", homogenize, &
"If True, then horizontally homogenize the interpolated \n"//&
"initial conditions.", default=.false., do_not_log=just_read)
Expand Down Expand Up @@ -1965,10 +1978,10 @@ subroutine MOM_temp_salt_initialize_from_Z(h, tv, G, GV, PF, just_read_params)
! to the North/South Pole past the limits of the input data, they are extrapolated using the average
! value at the northernmost/southernmost latitude.

call horiz_interp_and_extrap_tracer(filename, potemp_var,1.0,1, &
call horiz_interp_and_extrap_tracer(tfilename, potemp_var,1.0,1, &
G, temp_z, mask_z, z_in, z_edges_in, missing_value_temp, reentrant_x, tripolar_n, homogenize)

call horiz_interp_and_extrap_tracer(filename, salin_var,1.0,1, &
call horiz_interp_and_extrap_tracer(sfilename, salin_var,1.0,1, &
G, salt_z, mask_z, z_in, z_edges_in, missing_value_salt, reentrant_x, tripolar_n, homogenize)

kd = size(z_in,1)
Expand Down
4 changes: 2 additions & 2 deletions src/parameterizations/lateral/MOM_hor_visc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, CS,
v0(i,J) = CS%IDXDY2v(i,J)*(CS%DY2q(I,J)*sh_xy(I,J) - CS%DY2q(I-1,J)*sh_xy(I-1,J)) - &
CS%IDX2dyCv(i,J)*(CS%DX2h(i,j+1)*sh_xx(i,j+1) - CS%DX2h(i,j)*sh_xx(i,j))
enddo ; enddo
if (apply_OBC .and. OBC%zero_biharmonic) then
if (apply_OBC) then; if (OBC%zero_biharmonic) then
do n=1,OBC%number_of_segments
I = OBC%segment(n)%HI%IsdB ; J = OBC%segment(n)%HI%JsdB
if (OBC%segment(n)%is_N_or_S .and. (J >= Jsq-1) .and. (J <= Jeq+1)) then
Expand All @@ -593,7 +593,7 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, CS,
enddo
endif
enddo
endif
endif; endif
endif

do j=Jsq,Jeq+1 ; do i=Isq,Ieq+1
Expand Down