@@ -94,6 +94,9 @@ module mom_oasis3_interface_mod
94
94
ocean_public_type, &
95
95
ocean_domain_type
96
96
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
97
100
98
101
! Timing
99
102
@@ -355,7 +358,7 @@ subroutine coupler_init(Dom, Time, Time_step_coupled, Run_len, dt_cpld)
355
358
mom_name_write(6 )= ' frazil'
356
359
mom_name_write(7 )= ' dssldx'
357
360
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
359
362
mom_name_write(10 )= ' co2fx_o'
360
363
361
364
@@ -486,7 +489,7 @@ subroutine coupler_init(Dom, Time, Time_step_coupled, Run_len, dt_cpld)
486
489
end subroutine coupler_init
487
490
488
491
! =======================================================================
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 )
490
493
!- -----------------------------------------!
491
494
492
495
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)
496
499
implicit none
497
500
498
501
type (ocean_public_type) :: Ocean_sfc
502
+ type (ice_ocean_boundary_type) :: Ice_ocean_boundary
499
503
type (time_type),optional :: Time
500
504
501
505
integer , intent (in ) :: step
@@ -561,9 +565,17 @@ subroutine into_coupler(step, Ocean_sfc, Time, before_ocean_update)
561
565
case (' dssldy' )
562
566
vtmp(iisd:iied,jjsd:jjed) = Ocean_sfc% gradient(iisd:iied,jjsd:jjed,2 )
563
567
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)
564
572
vtmp(iisd:iied,jjsd:jjed) = Ocean_sfc% co2(iisd:iied,jjsd:jjed)
565
573
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/ ))
567
579
case DEFAULT
568
580
call mpp_error(FATAL,&
569
581
' ==>Error from into_coupler: Unknown quantity.' )
@@ -611,16 +623,16 @@ subroutine into_coupler(step, Ocean_sfc, Time, before_ocean_update)
611
623
end subroutine into_coupler
612
624
613
625
!- ----------------------------------------------------------------------------------
614
- subroutine from_coupler (step ,Ocean_sfc ,Ice_ocean_boundary , Time )
626
+ subroutine from_coupler (step ,Ocean_sfc ,Ice_ocean_boundary , Atm_fields , Time )
615
627
616
628
! This is all highly user dependent.
617
629
618
- use constants_mod, only : hlv ! 2.500e6 J/kg
619
630
use auscom_ice_mod, only : chk_i2o_fields, chk_fields_period, chk_fields_start_time
620
631
implicit none
621
632
622
633
type (ocean_public_type) :: Ocean_sfc
623
634
type (ice_ocean_boundary_type) :: Ice_ocean_boundary
635
+ type (coupler_2d_bc_type) :: Atm_fields
624
636
type (time_type),optional :: Time
625
637
626
638
real , dimension (isg:ieg,jsg:jeg) :: gtmp
@@ -631,7 +643,7 @@ subroutine from_coupler(step,Ocean_sfc,Ice_ocean_boundary, Time)
631
643
frac_nir_dir= 0.5 * 0.57 , frac_nir_dif= 0.5 * 0.57 ! shortwave partitioning
632
644
633
645
character * 80 :: fname = ' fields_i2o_in_ocn.nc'
634
- integer :: ncid,currstep,ll,ilout
646
+ integer :: ncid,currstep,ll,ilout,n
635
647
data currstep/ 0 /
636
648
save currstep
637
649
@@ -723,7 +735,11 @@ subroutine from_coupler(step,Ocean_sfc,Ice_ocean_boundary, Time)
723
735
case (' wfiform' )
724
736
Ice_ocean_boundary% wfiform(iisc:iiec,jjsc:jjec) = vwork(iisc:iiec,jjsc:jjec)
725
737
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/ ))
727
743
case (' wnd_io' )
728
744
Ice_ocean_boundary% wnd(iisc:iiec,jjsc:jjec) = vwork(iisc:iiec,jjsc:jjec)
729
745
! 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)
752
768
753
769
if (jf .ne. 1 ) call mpp_clock_end(id_oasis_recv1)
754
770
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
+
755
783
call mpp_clock_end(id_oasis_recv)
756
784
757
785
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)
761
789
end subroutine from_coupler
762
790
763
791
!- ----------------------------------------------------------------------------------
764
- subroutine write_coupler_restart (step ,Ocean_sfc ,write_restart )
792
+ subroutine write_coupler_restart (step ,Ocean_sfc ,Ice_ocean_boundary , write_restart )
765
793
766
794
use auscom_ice_mod, only : auscom_ice_heatflux_new
767
795
768
796
logical , intent (in ) :: write_restart
769
797
integer , intent (in ) :: step
770
798
type (ocean_public_type) :: Ocean_sfc
799
+ type (ice_ocean_boundary_type) :: Ice_ocean_boundary
771
800
772
801
integer :: ncid,ll,ilout
773
802
real , dimension (iisd:iied,jjsd:jjed) :: vtmp
@@ -794,7 +823,13 @@ subroutine write_coupler_restart(step,Ocean_sfc,write_restart)
794
823
case (' dssldy' ); vtmp = Ocean_sfc% gradient(iisd:iied,jjsd:jjed,2 ); fld_ice= ' ssly_i'
795
824
case (' frazil' ); vtmp = Ocean_sfc% frazil(iisd:iied,jjsd:jjed); fld_ice= ' pfmice_i'
796
825
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'
798
833
end select
799
834
800
835
if (parallel_coupling) then
0 commit comments