Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 14 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
version: 2.1

# Anchors to prevent forgetting to update a version
baselibs_version: &baselibs_version v7.5.0
bcs_version: &bcs_version v10.22.3

orbs:
circleci-tools: geos-esm/circleci-tools@0.11.0
ci: geos-esm/circleci-tools@1

workflows:
build-test:
jobs:
- build-GEOSgcm:
# Build GEOSgcm
- ci/build:
name: build-GEOSgcm-on-<< matrix.compiler >>
context:
- docker-hub-creds
matrix:
parameters:
compiler: [gfortran, ifort]
context:
- docker-hub-creds

jobs:
build-GEOSgcm:
parameters:
compiler:
type: string
executor: circleci-tools/<< parameters.compiler >>
working_directory: /root/project
steps:
- circleci-tools/checkout_fixture
- circleci-tools/mepoclone
- circleci-tools/mepodevelop
- circleci-tools/checkout_if_exists
- circleci-tools/cmake:
compiler: << parameters.compiler >>
- circleci-tools/buildinstall
- circleci-tools/compress_artifacts
- store_artifacts:
path: /logfiles

baselibs_version: *baselibs_version
repo: GEOSgcm
checkout_fixture: true
mepodevelop: true
persist_workspace: false # Needs to be true to run fv3/gcm experiment, costs extra
2 changes: 1 addition & 1 deletion MOM6_GEOSPlug/mom6_app/72x36/MOM_override
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ENERGETICS_SFC_PBL = True
USE_MLD_ITERATION = False
MASS_WEIGHT_IN_PRESSURE_GRADIENT = True

VERBOSITY = 9
!VERBOSITY = 9
DEBUG = True
FATAL_UNUSED_PARAMS = True

Expand Down
74 changes: 74 additions & 0 deletions MOM6_GEOSPlug/mom6_app/mk_MAPL_Tripolar/MAPL_Tripolar.cdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
netcdf MAPL_Tripolar {
dimensions:
string = 255 ;
n_center_x = 1440 ;
n_center_y = 1080 ;
n_corner_x = 1441 ;
n_corner_y = 1081 ;
n_levels = 75 ;

variables:
float lon_centers(n_center_y,n_center_x) ;
lon_centers:long_name = "longitude of cell center" ;
lon_centers:units = "degrees_E" ;
float lat_centers(n_center_y,n_center_x) ;
lat_centers:long_name = "latitude cell center" ;
lat_centers:units = "degrees_N" ;
float lon_corners(n_corner_y,n_corner_x) ;
lon_corners:long_name = "longitude of cell corner" ;
lon_corners:units = "degrees_E" ;
float lat_corners(n_corner_y,n_corner_x) ;
lat_corners:long_name = "latitude of cell corner" ;
lat_corners:units = "degrees_N" ;
float lev(n_levels) ;
lev:long_name = "depth of layer center" ;
lev:units = "meters" ;
float mask(n_center_y,n_center_x) ;
mask:long_name = "land/sea mask (0=land) on cell center" ;
mask:units = "none" ;
double htn(n_center_y,n_center_x) ;
htn:long_name = "length of northern edge of T-Cell" ;
htn:units = "meters" ;
double hte(n_center_y,n_center_x) ;
hte:long_name = "length of eastern edge of T-Cell" ;
hte:units = "meters" ;
double hus(n_center_y,n_center_x) ;
hus:long_name = "length of southern edge of U-Cell" ;
hus:units = "meters" ;
double huw(n_center_y,n_center_x) ;
huw:long_name = "length of western edge of U-Cell" ;
huw:units = "meters" ;
double areat(n_center_y,n_center_x) ;
areat:long_name = "area of T-Cell" ;
areat:units = "m2" ;
double areau(n_center_y,n_center_x) ;
areau:long_name = "area of U-Cell" ;
areau:units = "m2" ;
float anglet(n_center_y,n_center_x) ;
anglet:long_name = "rotation angle centered on T-Cell" ;
anglet:units = "degrees_east" ;
float angleu(n_center_y,n_center_x) ;
angleu:long_name = "rotation angle centered on U-Cell" ;
angleu:units = "degrees_east" ;
float basin(n_center_y,n_center_x) ;
basin:long_name = "basin_masks" ;
float atl_mask(n_center_y,n_center_x) ;
atl_mask:long_name = "Atlantic_mask" ;
char mom_file(string) ;
mom_file:standard_name = "path_to_ocean_hgrid_file" ;
char vgrid_file(string) ;
vgrid_file:standard_name = "path_to_vgrid_file" ;
char topo_file(string) ;
topo_file:standard_name = "path_to_ocean_topog_file" ;
char basin_file(string) ;
vgrid_file:standard_name = "path_to_basin_codes_file" ;

// global attributes:
:author = "Yury Vikhliaev" ;

data:
mom_file = "/discover/nobackup/projects/gmao/ssd/aogcm/ocean_bcs/MOM6/1440x1080_newtopo/INPUT/ocean_hgrid.nc" ;
vgrid_file = "/discover/nobackup/projects/gmao/ssd/aogcm/ocean_bcs/MOM6/1440x1080_newtopo/INPUT/vgrid.nc" ;
topo_file = "/discover/nobackup/projects/gmao/ssd/aogcm/ocean_bcs/MOM6/1440x1080_newtopo/INPUT/ocean_topog.nc" ;
basin_file = "/discover/nobackup/projects/gmao/ssd/aogcm/ocean_bcs/MOM6/1440x1080_newtopo/INPUT/basin_codes.nc" ;
}
37 changes: 37 additions & 0 deletions MOM6_GEOSPlug/mom6_app/mk_MAPL_Tripolar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
`mk_MAPL_Tripolar.py` utily creates `MAPL_Tripolar.nc` file from MOM6 mosaic grid. It takes as an argument `MAPL_Tripolar.cdl` file. `MAPL_Tripolar.cdl` file should edited before running `mk_MAPL_Triporal.py`. Metadata section in `MAPL_Tripolar.cdl` defines grid dimentions, variable names, precision and attributes. Example of metadata section:

```
dimensions:
string = 255 ;
n_center_x = 1440 ;
n_center_y = 1080 ;
n_corner_x = 1441 ;
n_corner_y = 1081 ;
n_levels = 75 ;

variables:
float lon_centers(n_center_y,n_center_x) ;
lon_centers:long_name = "longitude of cell center" ;
lon_centers:units = "degrees_E" ;
float lat_centers(n_center_y,n_center_x) ;
lat_centers:long_name = "latitude cell center" ;
lat_centers:units = "degrees_N" ;
.................................................................
double areat(n_center_y,n_center_x) ;
areat:long_name = "area of T-Cell" ;
areat:units = "m2" ;
double areau(n_center_y,n_center_x) ;
areau:long_name = "area of U-Cell" ;
areau:units = "m2" ;
```

Data section contains path to input files. Example of data section

```
data:
mom_file = "/discover/nobackup/projects/gmao/ssd/aogcm/ocean_bcs/MOM6/1440x1080_newtopo/INPUT/ocean_hgrid.nc" ;
vgrid_file = "/discover/nobackup/projects/gmao/ssd/aogcm/ocean_bcs/MOM6/1440x1080_newtopo/INPUT/vgrid.nc" ;
topo_file = "/discover/nobackup/projects/gmao/ssd/aogcm/ocean_bcs/MOM6/1440x1080_newtopo/INPUT/ocean_topog.nc" ;
basin_file = "/discover/nobackup/projects/gmao/ssd/aogcm/ocean_bcs/MOM6/1440x1080_newtopo/INPUT/basin_codes.nc" ;
```

77 changes: 77 additions & 0 deletions MOM6_GEOSPlug/mom6_app/mk_MAPL_Tripolar/mk_MAPL_Tripolar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env python3

'''
To use this script load appropriate python and ncl modules, edit top of MAPL_Tripolar.cdl file,
then run it as:

./mk_MAPL_Tripolar.py MAPL_Tripolar.cdl

'''

import os, sys
import numpy as np
import netCDF4 as nc

mapl_file='MAPL_Tripolar.nc'
cdl_file=sys.argv[1]
os.system(f'ncgen -o {mapl_file} {cdl_file}')

with nc.Dataset(mapl_file) as ff:
mom_file=ff['mom_file'][:].data.tobytes().decode().replace('\x00','')
vgrid_file=ff['vgrid_file'][:].data.tobytes().decode().replace('\x00','')
topo_file=ff['topo_file'][:].data.tobytes().decode().replace('\x00','')
basin_file=ff['basin_file'][:].data.tobytes().decode().replace('\x00','')

with nc.Dataset(mom_file) as ff:
# Grid dimension: (jm,im)
xx=ff['x'][:] # (2*jm+1, 2*im+1)
yy=ff['y'][:] # (2*jm+1, 2*im+1)
dx=ff['dx'][:] # (2*jm+1, 2*im)
dy=ff['dy'][:] # (2*jm, 2*im+1)
angle_dx=ff['angle_dx'][:] # (2*jm+1, 2*im+1)
area=ff['area'][:] # (2*jm, 2*im)

with nc.Dataset(vgrid_file) as ff:
dz=ff['dz'][:]

with nc.Dataset(topo_file) as ff:
mask=ff['wet'][:]

with nc.Dataset(basin_file) as ff:
basin=ff['basin'][:]
atl_mask=np.where(basin==2.0, 1.0, 0.0)

with nc.Dataset(mapl_file, mode='r+') as ff:
ff['lon_centers'][:]=xx[1::2,1::2]
ff['lat_centers'][:]=yy[1::2,1::2]
ff['lon_corners'][:]=xx[0::2,0::2]
ff['lat_corners'][:]=yy[0::2,0::2]
ff['lev'][:]=np.cumsum(dz)-0.5*dz
ff['mask'][:]=mask[:]

ff['htn'][:]=dx[2::2,0::2]+dx[2::2,1::2]
ff['hte'][:]=dy[0::2,2::2]+dy[1::2,2::2]

ff['huw'][0:-1,:]=dy[1:-1:2,1::2]+dy[2::2,1::2]
ff['huw'][-1,:]=dy[-1,1::2]+dy[-1,-1:1:-2]

ff['hus'][:,0:-1]=dx[1::2,1:-1:2]+dx[1::2,2::2]
ff['hus'][:,-1]=dx[1::2,-1]+dx[1::2,0]

ff['areat'][:]=area[0::2,0::2]+area[1::2,0::2]+area[1::2,1::2]+area[0::2,1::2]

ll=ul=ur=lr=np.zeros(ff['areau'].shape)
ll=area[1::2,1::2]; # lower left corner
ul[0:-1,:]=area[2::2,1::2]; ul[-1,:]=area[-1,-1::-2] # upper left corner
lr[:,0:-1]=area[1::2,2::2]; lr[:,-1]=area[1::2,0] # lower right corner
ur[0:-1,0:-1]=area[2::2,2::2]
ur[0:-1,-1]=area[2::2,0]
ur[-1,0:-1]=area[-1,-2:1:-2]
ur[-1,-1]=area[-1,0] # upper right corner
ff['areau'][:]=ll+ul+ur+lr

ff['angleu'][:]=angle_dx[2::2,2::2]
ff['anglet'][:]=angle_dx[1::2,1::2]

ff['basin'][:]=basin[:]
ff['atl_mask'][:]=atl_mask[:]
14 changes: 14 additions & 0 deletions MOM6_GEOSPlug/mom6_cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ list( APPEND MOM6_SRCS
src/ALE/coord_slight.F90
src/ALE/coord_zlike.F90
src/ALE/MOM_ALE.F90
src/ALE/MOM_hybgen_regrid.F90
src/ALE/MOM_hybgen_remap.F90
src/ALE/MOM_hybgen_unmix.F90
src/ALE/MOM_regridding.F90
src/ALE/MOM_remapping.F90
src/ALE/P1M_functions.F90
Expand All @@ -40,6 +43,7 @@ list( APPEND MOM6_SRCS
src/ALE/regrid_solvers.F90
src/core/MOM_barotropic.F90
src/core/MOM_boundary_update.F90
src/core/MOM_check_scaling.F90
src/core/MOM_checksum_packages.F90
src/core/MOM_continuity.F90
src/core/MOM_continuity_PPM.F90
Expand All @@ -57,6 +61,7 @@ list( APPEND MOM6_SRCS
src/core/MOM_PressureForce.F90
src/core/MOM_PressureForce_FV.F90
src/core/MOM_PressureForce_Montgomery.F90
src/core/MOM_stoch_eos.F90
src/core/MOM_transcribe_grid.F90
src/core/MOM_unit_tests.F90
src/core/MOM_variables.F90
Expand Down Expand Up @@ -88,6 +93,7 @@ list( APPEND MOM6_SRCS
# src/equation_of_state/TEOS10/gsw_gibbs.f90
# src/equation_of_state/TEOS10/gsw_gibbs_ice.f90
# src/equation_of_state/TEOS10/gsw_gibbs_pt0_pt0.f90
# src/equation_of_state/TEOS10/gsw_mod_error_functions.f90
# src/equation_of_state/TEOS10/gsw_mod_freezing_poly_coefficients.f90
# src/equation_of_state/TEOS10/gsw_mod_gibbs_ice_coefficients.f90
# src/equation_of_state/TEOS10/gsw_mod_kinds.f90
Expand Down Expand Up @@ -134,8 +140,11 @@ list( APPEND MOM6_SRCS
src/framework/MOM_restart.F90
src/framework/MOM_safe_alloc.F90
src/framework/MOM_string_functions.F90
src/framework/MOM_unique_scales.F90
src/framework/MOM_unit_scaling.F90
src/framework/MOM_write_cputime.F90
src/framework/posix.F90
src/framework/posix.h
src/ice_shelf/MOM_ice_shelf_diag_mediator.F90
src/ice_shelf/MOM_ice_shelf_dynamics.F90
src/ice_shelf/MOM_ice_shelf.F90
Expand Down Expand Up @@ -202,6 +211,7 @@ list( APPEND MOM6_SRCS
src/tracer/MOM_tracer_flow_control.F90
src/tracer/MOM_tracer_hor_diff.F90
src/tracer/MOM_tracer_registry.F90
src/tracer/MOM_tracer_types.F90
src/tracer/MOM_tracer_Z_init.F90
src/tracer/nw2_tracers.F90
src/tracer/oil_tracer.F90
Expand Down Expand Up @@ -484,7 +494,11 @@ list( APPEND MOM6_SRCS
config_src/external/drifters/MOM_particles.F90
config_src/external/drifters/MOM_particles_types.F90
# stochastic physics
config_src/external/stochastic_physics/get_stochy_pattern.F90
config_src/external/stochastic_physics/stochastic_physics.F90
# database comms
config_src/external/database_comms/database_client_interface.F90
config_src/external/database_comms/MOM_database_comms.F90
)


Expand Down