Skip to content

Commit 6d87686

Browse files
authored
Merge pull request #27 from ACCESS-NRI/dougiesquire/issue388-accessom-gtracer
Use ACCESS-NRI fork of generic tracers with access couplers
2 parents ca54c1b + 8614b58 commit 6d87686

19 files changed

+1187
-169
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "generic_tracers"]
2+
path = src/access/generic_tracers
3+
url = https://github.com/ACCESS-NRI/GFDL-generic-tracers.git

exp/MOM_compile.csh

+12-6
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ if ( $help ) then
5757
echo " EBM : ocean-seaice-land-atmosphere coupled model with energy balance atmosphere"
5858
echo " ACCESS-CM : ocean component of ACCESS-CM model."
5959
echo " ACCESS-OM : ocean component of ACCESS-OM model."
60-
echo " ACCESS-ESM : ocean component of ACCESS-ESM model with CSIRO BGC (Wombat)."
61-
echo " ACCESS-OM-BGC: ocean component of ACCESS-OM model with CSIRO BGC (Wombat)."
60+
echo " ACCESS-ESM : ocean component of ACCESS-ESM model with support for generic tracer WOMBATlite."
61+
echo " ACCESS-OM-BGC: ocean component of ACCESS-OM model with CSIRO BGC (Wombat). Wombat has now been"
62+
echo " implemented as a generic tracer and is available in the ACCESS-OM model type."
63+
echo " ACCESS-OM-BGC is retained only for legacy."
6264
echo
6365
echo "--platform followed by the platform name that has a corresponding environ file in the ../bin dir, default is gfortran"
6466
echo
@@ -104,13 +106,13 @@ endif
104106
if ( $type == EBM ) then
105107
set cppDefs = ( "-Duse_netCDF -Duse_netCDF3 -Duse_libMPI -DLAND_BND_TRACERS -DOVERLOAD_C8 -DOVERLOAD_C4 -DOVERLOAD_R4" )
106108
else if( $type == ACCESS-OM ) then
107-
set cppDefs = ( "-Duse_netCDF -Duse_libMPI -DACCESS_OM" )
109+
set cppDefs = ( "-Duse_netCDF -Duse_libMPI -DACCESS_OM -DUSE_OCEAN_BGC" )
108110
else if( $type == ACCESS-OM-BGC ) then
109111
set cppDefs = ( "-Duse_netCDF -Duse_libMPI -DACCESS_OM -DCSIRO_BGC" )
110112
else if( $type == ACCESS-CM ) then
111113
set cppDefs = ( "-Duse_netCDF -Duse_libMPI -DACCESS_CM" )
112114
else if( $type == ACCESS-ESM ) then
113-
set cppDefs = ( "-Duse_netCDF -Duse_libMPI -DACCESS_CM -DCSIRO_BGC" )
115+
set cppDefs = ( "-Duse_netCDF -Duse_libMPI -DACCESS_CM -DUSE_OCEAN_BGC" )
114116
endif
115117

116118
if ( $unit_testing ) then
@@ -221,12 +223,12 @@ if( $type == MOM_solo ) then
221223
set srcList = ( mom5/drivers )
222224
set libs = "$executable:h:h/lib_ocean/lib_ocean.a $executable:h:h/lib_FMS/lib_FMS.a"
223225
else if( $type == ACCESS-CM || $type == ACCESS-ESM) then
224-
set srcList = ( accesscm_coupler )
226+
set srcList = ( access/accesscm_coupler )
225227
set includes = "-I$executable:h:h/lib_FMS -I$executable:h:h/$type/lib_ocean"
226228
set libs = "$executable:h:h/$type/lib_ocean/lib_ocean.a"
227229
setenv OASIS true
228230
else if( $type == ACCESS-OM || $type == ACCESS-OM-BGC) then
229-
set srcList = ( accessom_coupler )
231+
set srcList = ( access/accessom_coupler )
230232
set includes = "-I$executable:h:h/lib_FMS -I$executable:h:h/$type/lib_ocean"
231233
set libs = "$executable:h:h/$type/lib_ocean/lib_ocean.a $executable:h:h/lib_FMS/lib_FMS.a"
232234
else if( $type == MOM_SIS ) then
@@ -254,6 +256,10 @@ else
254256
exit 1
255257
endif
256258

259+
if( $type == ACCESS-OM || $type == ACCESS-ESM) then
260+
set srcList = ( $srcList access/shared )
261+
endif
262+
257263
# Always include FMS
258264
set libs = "$libs $executable:h:h/lib_FMS/lib_FMS.a"
259265

exp/ocean_compile.csh

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ set lib_name = "lib_ocean"
66

77
if( $type == ACCESS-OM || $type == ACCESS-CM || $type == ACCESS-OM-BGC || $type == ACCESS-ESM) then
88
set srcList = ( $srcList mom5/ocean_access )
9-
if( $type == ACCESS-OM-BGC || $type == ACCESS-ESM) then
9+
if( $type == ACCESS-OM-BGC ) then
1010
set srcList = ( $srcList mom5/ocean_csiro_bgc )
11+
else if ( $type == ACCESS-OM || $type == ACCESS-ESM ) then
12+
set srcList = ( $srcList mom5/ocean_bgc access/generic_tracers/generic_tracers access/generic_tracers/mocsy/src )
1113
endif
1214
mkdir -p $executable:h:h/$type/$lib_name
1315
cd $executable:h:h/$type/$lib_name

src/access/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# ACCESS-specific code
2+
3+
This directory includes code that is specific to ACCESS-models.
4+
5+
[ACCESS-specific generic tracers](https://github.com/ACCESS-NRI/GFDL-generic-tracers) are included as a git submodule. To retrieve the code for the submodule run:
6+
7+
```bash
8+
git submodule update --init --recursive
9+
```

src/accesscm_coupler/mom_oasis3_interface.F90 src/access/accesscm_coupler/mom_oasis3_interface.F90

+44-9
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ module mom_oasis3_interface_mod
9494
ocean_public_type, &
9595
ocean_domain_type
9696
use time_manager_mod, only: time_type
97+
use gtracer_flux_mod, only: set_coupler_type_data, extract_coupler_type_data
98+
use coupler_types_mod, only: coupler_2d_bc_type, ind_pcair, ind_u10, ind_psurf, ind_csurf, ind_flux
99+
use constants_mod, only: WTMCO2, hlv
97100

98101
! Timing
99102

@@ -355,7 +358,7 @@ subroutine coupler_init(Dom, Time, Time_step_coupled, Run_len, dt_cpld)
355358
mom_name_write(6)='frazil'
356359
mom_name_write(7)='dssldx'
357360
mom_name_write(8)='dssldy'
358-
mom_name_write(9)='co2_o'
361+
mom_name_write(9)='co2_o' ! Ocean surface pCO2 is not used by any other models
359362
mom_name_write(10)='co2fx_o'
360363

361364

@@ -486,7 +489,7 @@ subroutine coupler_init(Dom, Time, Time_step_coupled, Run_len, dt_cpld)
486489
end subroutine coupler_init
487490

488491
!=======================================================================
489-
subroutine into_coupler(step, Ocean_sfc, Time, before_ocean_update)
492+
subroutine into_coupler(step, Ocean_sfc, Ice_ocean_boundary, Time, before_ocean_update)
490493
!------------------------------------------!
491494

492495
use ocean_operators_mod, only : GRAD_BAROTROPIC_P !GRAD_SURF_sealev
@@ -496,6 +499,7 @@ subroutine into_coupler(step, Ocean_sfc, Time, before_ocean_update)
496499
implicit none
497500

498501
type (ocean_public_type) :: Ocean_sfc
502+
type (ice_ocean_boundary_type) :: Ice_ocean_boundary
499503
type (time_type),optional :: Time
500504

501505
integer, intent(in) :: step
@@ -561,9 +565,17 @@ subroutine into_coupler(step, Ocean_sfc, Time, before_ocean_update)
561565
case('dssldy')
562566
vtmp(iisd:iied,jjsd:jjed) = Ocean_sfc%gradient(iisd:iied,jjsd:jjed,2)
563567
case('co2_o')
568+
! Note, this is not actually used by the other models
569+
! If this is needed in the future with generic WOMBATlite, it can be calculated from the csurf
570+
! and alpha fields in the Ocean_sfc%fields coupler_bc_type "co2_flux" boundary condition:
571+
! pco2 [ppmv] = 1e6 * (co2_csurf / co2_alpha)
564572
vtmp(iisd:iied,jjsd:jjed) = Ocean_sfc%co2(iisd:iied,jjsd:jjed)
565573
case('co2fx_o')
566-
vtmp(iisd:iied,jjsd:jjed) = Ocean_sfc%co2flux(iisd:iied,jjsd:jjed)
574+
! vtmp(iisd:iied,jjsd:jjed) = Ocean_sfc%co2flux(iisd:iied,jjsd:jjed)
575+
! Extract the flux field in the IOB%fluxes coupler_bc_type "co2_flux" boundary condition,
576+
! converting from [mol/m^2/s] to [kg(CO2)/m^2/s] and to positive downwards
577+
call extract_coupler_type_data(Ice_ocean_boundary%fluxes, "co2_flux", ind_flux, vtmp, &
578+
scale_factor=-1.e-3*WTMCO2, idim=(/iisc,iisc,iiec,iiec/), jdim=(/jjsc,jjsc,jjec,jjec/))
567579
case DEFAULT
568580
call mpp_error(FATAL,&
569581
'==>Error from into_coupler: Unknown quantity.')
@@ -611,16 +623,16 @@ subroutine into_coupler(step, Ocean_sfc, Time, before_ocean_update)
611623
end subroutine into_coupler
612624

613625
!-----------------------------------------------------------------------------------
614-
subroutine from_coupler(step,Ocean_sfc,Ice_ocean_boundary, Time)
626+
subroutine from_coupler(step,Ocean_sfc,Ice_ocean_boundary, Atm_fields, Time)
615627

616628
! This is all highly user dependent.
617629

618-
use constants_mod, only : hlv ! 2.500e6 J/kg
619630
use auscom_ice_mod, only : chk_i2o_fields, chk_fields_period, chk_fields_start_time
620631
implicit none
621632

622633
type (ocean_public_type) :: Ocean_sfc
623634
type (ice_ocean_boundary_type) :: Ice_ocean_boundary
635+
type (coupler_2d_bc_type) :: Atm_fields
624636
type (time_type),optional :: Time
625637

626638
real, dimension(isg:ieg,jsg:jeg) :: gtmp
@@ -631,7 +643,7 @@ subroutine from_coupler(step,Ocean_sfc,Ice_ocean_boundary, Time)
631643
frac_nir_dir=0.5*0.57, frac_nir_dif=0.5*0.57 ! shortwave partitioning
632644

633645
character*80 :: fname = 'fields_i2o_in_ocn.nc'
634-
integer :: ncid,currstep,ll,ilout
646+
integer :: ncid,currstep,ll,ilout,n
635647
data currstep/0/
636648
save currstep
637649

@@ -723,7 +735,11 @@ subroutine from_coupler(step,Ocean_sfc,Ice_ocean_boundary, Time)
723735
case('wfiform')
724736
Ice_ocean_boundary%wfiform(iisc:iiec,jjsc:jjec) = vwork(iisc:iiec,jjsc:jjec)
725737
case('co2_io')
726-
Ice_ocean_boundary%co2(iisc:iiec,jjsc:jjec) = vwork(iisc:iiec,jjsc:jjec)
738+
! Ice_ocean_boundary%co2(iisc:iiec,jjsc:jjec) = vwork(iisc:iiec,jjsc:jjec)
739+
! Set the pcair field in the Atm_fields coupler_bc_type "co2_flux" boundary condition,
740+
! converting from [ppmv] to [mol/mol]
741+
call set_coupler_type_data(vwork, "co2_flux", ind_pcair, Atm_fields, &
742+
scale_factor=1.e-6, idim=(/iisc,iisc,iiec,iiec/), jdim=(/jjsc,jjsc,jjec,jjec/))
727743
case('wnd_io')
728744
Ice_ocean_boundary%wnd(iisc:iiec,jjsc:jjec) = vwork(iisc:iiec,jjsc:jjec)
729745
!20171024: 2 more i2o fields: water and heat fluxes due to land ice discharge into ocean
@@ -752,6 +768,18 @@ subroutine from_coupler(step,Ocean_sfc,Ice_ocean_boundary, Time)
752768

753769
if(jf .ne. 1) call mpp_clock_end(id_oasis_recv1)
754770
enddo !jf
771+
772+
! Set the u10 and psurf fields in the Atm_fields coupler_bc_types
773+
do n = 1, Atm_fields%num_bcs
774+
if ((Atm_fields%bc(n)%flux_type .eq. 'air_sea_gas_flux_generic') .or. &
775+
(Atm_fields%bc(n)%flux_type .eq. 'air_sea_gas_flux')) then
776+
call set_coupler_type_data(ice_ocean_boundary%wnd, Atm_fields%bc(n)%name, ind_u10, &
777+
Atm_fields, idim=(/iisc,iisc,iiec,iiec/), jdim=(/jjsc,jjsc,jjec,jjec/))
778+
call set_coupler_type_data(ice_ocean_boundary%p, Atm_fields%bc(n)%name, ind_psurf, &
779+
Atm_fields, idim=(/iisc,iisc,iiec,iiec/), jdim=(/jjsc,jjsc,jjec,jjec/))
780+
endif
781+
enddo
782+
755783
call mpp_clock_end(id_oasis_recv)
756784

757785
if (chk_i2o_fields .and. (mod(step, chk_fields_period) == 0) .and. (step >= chk_fields_start_time) .and. (mpp_pe() == mpp_root_pe())) then
@@ -761,13 +789,14 @@ subroutine from_coupler(step,Ocean_sfc,Ice_ocean_boundary, Time)
761789
end subroutine from_coupler
762790

763791
!-----------------------------------------------------------------------------------
764-
subroutine write_coupler_restart(step,Ocean_sfc,write_restart)
792+
subroutine write_coupler_restart(step,Ocean_sfc,Ice_ocean_boundary,write_restart)
765793

766794
use auscom_ice_mod, only : auscom_ice_heatflux_new
767795

768796
logical, intent(in) :: write_restart
769797
integer, intent(in) :: step
770798
type (ocean_public_type) :: Ocean_sfc
799+
type (ice_ocean_boundary_type) :: Ice_ocean_boundary
771800

772801
integer :: ncid,ll,ilout
773802
real, dimension(iisd:iied,jjsd:jjed) :: vtmp
@@ -794,7 +823,13 @@ subroutine write_coupler_restart(step,Ocean_sfc,write_restart)
794823
case('dssldy'); vtmp = Ocean_sfc%gradient(iisd:iied,jjsd:jjed,2); fld_ice='ssly_i'
795824
case('frazil'); vtmp = Ocean_sfc%frazil(iisd:iied,jjsd:jjed); fld_ice='pfmice_i'
796825
case('co2_o'); vtmp = Ocean_sfc%co2(iisd:iied,jjsd:jjed); fld_ice='co2_oi'
797-
case('co2fx_o'); vtmp = Ocean_sfc%co2flux(iisd:iied,jjsd:jjed); fld_ice='co2fx_oi'
826+
case('co2fx_o')
827+
! vtmp = Ocean_sfc%co2flux(iisd:iied,jjsd:jjed); fld_ice='co2fx_oi'
828+
! Extract the flux field in the IOB%fluxes coupler_bc_type "co2_flux" boundary condition,
829+
! converting from [mol/m^2/s] to [kg(CO2)/m^2/s] and to positive downwards
830+
call extract_coupler_type_data(Ice_ocean_boundary%fluxes, "co2_flux", ind_flux, vtmp, &
831+
scale_factor=-1.e-3*WTMCO2, idim=(/iisc,iisc,iiec,iiec/), jdim=(/jjsc,jjsc,jjec,jjec/))
832+
fld_ice='co2fx_oi'
798833
end select
799834

800835
if (parallel_coupling) then

0 commit comments

Comments
 (0)