Skip to content

Commit 0b98bd0

Browse files
committed
Allow generic tracers with accesscm_coupler
1 parent ecca5ed commit 0b98bd0

File tree

4 files changed

+110
-84
lines changed

4 files changed

+110
-84
lines changed

exp/MOM_compile.csh

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ 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)."
60+
echo " ACCESS-ESM : ocean component of ACCESS-ESM model with support for generic tracer WOMBATlite."
6161
echo " ACCESS-OM-BGC: ocean component of ACCESS-OM model with CSIRO BGC (Wombat). Wombat has now been"
6262
echo " implemented as a generic tracer and is available in the ACCESS-OM model type."
6363
echo " ACCESS-OM-BGC is retained only for legacy."
@@ -112,7 +112,7 @@ else if( $type == ACCESS-OM-BGC ) then
112112
else if( $type == ACCESS-CM ) then
113113
set cppDefs = ( "-Duse_netCDF -Duse_libMPI -DACCESS_CM" )
114114
else if( $type == ACCESS-ESM ) then
115-
set cppDefs = ( "-Duse_netCDF -Duse_libMPI -DACCESS_CM -DCSIRO_BGC" )
115+
set cppDefs = ( "-Duse_netCDF -Duse_libMPI -DACCESS_CM -DUSE_OCEAN_BGC" )
116116
endif
117117

118118
if ( $unit_testing ) then
@@ -256,7 +256,7 @@ else
256256
exit 1
257257
endif
258258

259-
if( $type == ACCESS-OM ) then
259+
if( $type == ACCESS-OM || $type == ACCESS-ESM) then
260260
set srcList = ( $srcList access/shared )
261261
endif
262262

exp/ocean_compile.csh

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ 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 ) then
11+
else if ( $type == ACCESS-OM || $type == ACCESS-ESM ) then
1212
set srcList = ( $srcList mom5/ocean_bgc access/generic_tracers/generic_tracers access/generic_tracers/mocsy/src )
1313
endif
1414
mkdir -p $executable:h:h/$type/$lib_name

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 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)