Changeset 13778 for NEMO/branches/UKMO/NEMO_4.0.3_icesheet_and_river_coupling/src/OCE/SBC/sbccpl.F90
- Timestamp:
- 2020-11-11T14:27:17+01:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/UKMO/NEMO_4.0.3_icesheet_and_river_coupling/src/OCE/SBC/sbccpl.F90
r13587 r13778 36 36 USE eosbn2 ! 37 37 USE sbcrnf , ONLY : l_rnfcpl 38 USE cpl_rnf_1d, ONLY: nn_cpl_river, cpl_rnf_1d_init, cpl_rnf_1d_to_2d ! Variables used in 1D river outflow 38 39 USE sbcisf , ONLY : l_isfcpl 39 40 #if defined key_cice … … 120 121 INTEGER, PARAMETER :: jpr_tauwy = 56 ! y component of the ocean stress from waves 121 122 INTEGER, PARAMETER :: jpr_ts_ice = 57 ! Sea ice surface temp 122 123 INTEGER, PARAMETER :: jprcv = 57 ! total number of fields received 123 INTEGER, PARAMETER :: jpr_grnm = 58 ! Greenland ice mass 124 INTEGER, PARAMETER :: jpr_antm = 59 ! Antarctic ice mass 125 INTEGER, PARAMETER :: jpr_rnf_1d = 60 ! 1D river runoff 126 INTEGER, PARAMETER :: jpr_qtr = 61 ! Transmitted solar 127 128 INTEGER, PARAMETER :: jprcv = 61 ! total number of fields received 124 129 125 130 INTEGER, PARAMETER :: jps_fice = 1 ! ice fraction sent to the atmosphere … … 186 191 TYPE(FLD_C) :: sn_rcv_w10m, sn_rcv_taumod, sn_rcv_tau, sn_rcv_tauw, sn_rcv_dqnsdt, sn_rcv_qsr, & 187 192 & sn_rcv_qns , sn_rcv_emp , sn_rcv_rnf, sn_rcv_ts_ice 188 TYPE(FLD_C) :: sn_rcv_cal, sn_rcv_iceflx, sn_rcv_co2, sn_rcv_mslp, sn_rcv_icb, sn_rcv_isf 193 TYPE(FLD_C) :: sn_rcv_cal, sn_rcv_iceflx, sn_rcv_co2, sn_rcv_mslp, sn_rcv_icb, sn_rcv_isf, & 194 sn_rcv_grnm, sn_rcv_antm 189 195 ! Send to waves 190 196 TYPE(FLD_C) :: sn_snd_ifrac, sn_snd_crtw, sn_snd_wlev … … 271 277 & sn_rcv_iceflx, sn_rcv_co2 , sn_rcv_mslp , & 272 278 & sn_rcv_icb , sn_rcv_isf , sn_rcv_wfreq, sn_rcv_tauw , & 273 & sn_rcv_ts_ice 279 & sn_rcv_ts_ice, sn_rcv_grnm , sn_rcv_antm , & 280 & nn_coupled_iceshelf_fluxes , ln_iceshelf_init_atmos , & 281 & rn_greenland_total_fw_flux , rn_greenland_calving_fraction , & 282 & rn_antarctica_total_fw_flux , rn_antarctica_calving_fraction , & 283 & rn_iceshelf_fluxes_tolerance 284 274 285 !!--------------------------------------------------------------------- 275 286 ! … … 310 321 WRITE(numout,*)' runoffs = ', TRIM(sn_rcv_rnf%cldes ), ' (', TRIM(sn_rcv_rnf%clcat ), ')' 311 322 WRITE(numout,*)' calving = ', TRIM(sn_rcv_cal%cldes ), ' (', TRIM(sn_rcv_cal%clcat ), ')' 323 WRITE(numout,*)' Greenland ice mass = ', TRIM(sn_rcv_grnm%cldes ), ' (', TRIM(sn_rcv_grnm%clcat ), ')' 324 WRITE(numout,*)' Antarctica ice mass = ', TRIM(sn_rcv_antm%cldes ), ' (', TRIM(sn_rcv_antm%clcat ), ')' 312 325 WRITE(numout,*)' iceberg = ', TRIM(sn_rcv_icb%cldes ), ' (', TRIM(sn_rcv_icb%clcat ), ')' 313 326 WRITE(numout,*)' ice shelf = ', TRIM(sn_rcv_isf%cldes ), ' (', TRIM(sn_rcv_isf%clcat ), ')' … … 345 358 WRITE(numout,*)' - orientation = ', sn_snd_crtw%clvor 346 359 WRITE(numout,*)' - mesh = ', sn_snd_crtw%clvgrd 360 WRITE(numout,*)' nn_coupled_iceshelf_fluxes = ', nn_coupled_iceshelf_fluxes 361 WRITE(numout,*)' ln_iceshelf_init_atmos = ', ln_iceshelf_init_atmos 362 WRITE(numout,*)' rn_greenland_total_fw_flux = ', rn_greenland_total_fw_flux 363 WRITE(numout,*)' rn_antarctica_total_fw_flux = ', rn_antarctica_total_fw_flux 364 WRITE(numout,*)' rn_greenland_calving_fraction = ', rn_greenland_calving_fraction 365 WRITE(numout,*)' rn_antarctica_calving_fraction = ', rn_antarctica_calving_fraction 366 WRITE(numout,*)' rn_iceshelf_fluxes_tolerance = ', rn_iceshelf_fluxes_tolerance 347 367 ENDIF 348 368 … … 360 380 361 381 ! default definitions of srcv 362 srcv(:)%laction = .FALSE. ; srcv(:)%clgrid = 'T' ; srcv(:)%nsgn = 1. ; srcv(:)%nct = 1 382 srcv(:)%laction = .FALSE. 383 srcv(:)%clgrid = 'T' 384 srcv(:)%nsgn = 1. 385 srcv(:)%nct = 1 386 srcv(:)%dimensions = 2 363 387 364 388 ! ! ------------------------- ! … … 479 503 ! ! ------------------------- ! 480 504 srcv(jpr_rnf )%clname = 'O_Runoff' 481 IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' ) THEN 482 srcv(jpr_rnf)%laction = .TRUE. 505 srcv(jpr_rnf_1d )%clname = 'ORunff1D' 506 IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' .OR. TRIM( sn_rcv_rnf%cldes ) == 'coupled1d' ) THEN 507 IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled' ) srcv(jpr_rnf)%laction = .TRUE. 508 IF( TRIM( sn_rcv_rnf%cldes ) == 'coupled1d' ) THEN 509 srcv(jpr_rnf_1d)%laction = .TRUE. 510 srcv(jpr_rnf_1d)%dimensions = 1 ! 1D field passed through coupler 511 END IF 483 512 l_rnfcpl = .TRUE. ! -> no need to read runoffs in sbcrnf 484 513 ln_rnf = nn_components /= jp_iam_sas ! -> force to go through sbcrnf if not sas … … 487 516 ENDIF 488 517 ! 489 srcv(jpr_cal)%clname = 'OCalving' ; IF( TRIM( sn_rcv_cal%cldes) == 'coupled' ) srcv(jpr_cal)%laction = .TRUE. 518 srcv(jpr_cal )%clname = 'OCalving' 519 IF( TRIM( sn_rcv_cal%cldes ) == 'coupled' ) srcv(jpr_cal)%laction = .TRUE. 520 521 srcv(jpr_grnm )%clname = 'OGrnmass' 522 IF( TRIM( sn_rcv_grnm%cldes ) == 'coupled' ) THEN 523 srcv(jpr_grnm)%laction = .TRUE. 524 srcv(jpr_grnm)%dimensions = 0 ! Scalar field 525 ENDIF 526 527 srcv(jpr_antm )%clname = 'OAntmass' 528 IF( TRIM( sn_rcv_antm%cldes ) == 'coupled' ) THEN 529 srcv(jpr_antm)%laction = .TRUE. 530 srcv(jpr_antm)%dimensions = 0 ! Scalar field 531 ENDIF 532 490 533 srcv(jpr_isf)%clname = 'OIcshelf' ; IF( TRIM( sn_rcv_isf%cldes) == 'coupled' ) srcv(jpr_isf)%laction = .TRUE. 491 534 srcv(jpr_icb)%clname = 'OIceberg' ; IF( TRIM( sn_rcv_icb%cldes) == 'coupled' ) srcv(jpr_icb)%laction = .TRUE. … … 738 781 ENDIF 739 782 ENDIF 740 741 ! =================================================== !742 ! Allocate all parts of frcv used for received fields !743 ! =================================================== !744 DO jn = 1, jprcv745 IF ( srcv(jn)%laction ) ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) )746 END DO747 ! Allocate taum part of frcv which is used even when not received as coupling field748 IF ( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jpr_taum)%nct) )749 ! Allocate w10m part of frcv which is used even when not received as coupling field750 IF ( .NOT. srcv(jpr_w10m)%laction ) ALLOCATE( frcv(jpr_w10m)%z3(jpi,jpj,srcv(jpr_w10m)%nct) )751 ! Allocate jpr_otx1 part of frcv which is used even when not received as coupling field752 IF ( .NOT. srcv(jpr_otx1)%laction ) ALLOCATE( frcv(jpr_otx1)%z3(jpi,jpj,srcv(jpr_otx1)%nct) )753 IF ( .NOT. srcv(jpr_oty1)%laction ) ALLOCATE( frcv(jpr_oty1)%z3(jpi,jpj,srcv(jpr_oty1)%nct) )754 ! Allocate itx1 and ity1 as they are used in sbc_cpl_ice_tau even if srcv(jpr_itx1)%laction = .FALSE.755 IF( k_ice /= 0 ) THEN756 IF ( .NOT. srcv(jpr_itx1)%laction ) ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jpr_itx1)%nct) )757 IF ( .NOT. srcv(jpr_ity1)%laction ) ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jpr_ity1)%nct) )758 END IF759 783 760 784 ! ================================ ! … … 766 790 767 791 ! default definitions of nsnd 768 ssnd(:)%laction = .FALSE. ; ssnd(:)%clgrid = 'T' ; ssnd(:)%nsgn = 1. ; ssnd(:)%nct = 1 792 ssnd(:)%laction = .FALSE. 793 ssnd(:)%clgrid = 'T' 794 ssnd(:)%nsgn = 1. 795 ssnd(:)%nct = 1 796 ssnd(:)%dimensions = 2 769 797 770 798 ! ! ------------------------- ! … … 1049 1077 ENDIF 1050 1078 1079 ! Initialise 1D river outflow scheme 1080 nn_cpl_river = 1 1081 IF ( TRIM( sn_rcv_rnf%cldes ) == 'coupled1d' ) CALL cpl_rnf_1d_init ! Coupled runoff using 1D array 1082 1083 ! =================================================== ! 1084 ! Allocate all parts of frcv used for received fields ! 1085 ! =================================================== ! 1086 DO jn = 1, jprcv 1087 1088 IF ( srcv(jn)%laction ) THEN 1089 SELECT CASE( srcv(jn)%dimensions ) 1090 ! 1091 CASE( 0 ) ! Scalar field 1092 ALLOCATE( frcv(jn)%z3(1,1,1) ) 1093 1094 CASE( 1 ) ! 1D field 1095 ALLOCATE( frcv(jn)%z3(nn_cpl_river,1,1) ) 1096 1097 CASE DEFAULT ! 2D (or pseudo 3D) field. 1098 ALLOCATE( frcv(jn)%z3(jpi,jpj,srcv(jn)%nct) ) 1099 1100 END SELECT 1101 END IF 1102 1103 END DO 1104 ! Allocate taum part of frcv which is used even when not received as coupling field 1105 IF ( .NOT. srcv(jpr_taum)%laction ) ALLOCATE( frcv(jpr_taum)%z3(jpi,jpj,srcv(jpr_taum)%nct) ) 1106 ! Allocate w10m part of frcv which is used even when not received as coupling field 1107 IF ( .NOT. srcv(jpr_w10m)%laction ) ALLOCATE( frcv(jpr_w10m)%z3(jpi,jpj,srcv(jpr_w10m)%nct) ) 1108 ! Allocate jpr_otx1 part of frcv which is used even when not received as coupling field 1109 IF ( .NOT. srcv(jpr_otx1)%laction ) ALLOCATE( frcv(jpr_otx1)%z3(jpi,jpj,srcv(jpr_otx1)%nct) ) 1110 IF ( .NOT. srcv(jpr_oty1)%laction ) ALLOCATE( frcv(jpr_oty1)%z3(jpi,jpj,srcv(jpr_oty1)%nct) ) 1111 ! Allocate itx1 and ity1 as they are used in sbc_cpl_ice_tau even if srcv(jpr_itx1)%laction = .FALSE. 1112 IF( k_ice /= 0 ) THEN 1113 IF ( .NOT. srcv(jpr_itx1)%laction ) ALLOCATE( frcv(jpr_itx1)%z3(jpi,jpj,srcv(jpr_itx1)%nct) ) 1114 IF ( .NOT. srcv(jpr_ity1)%laction ) ALLOCATE( frcv(jpr_ity1)%z3(jpi,jpj,srcv(jpr_ity1)%nct) ) 1115 END IF 1116 1051 1117 ! 1052 1118 ! ================================ ! … … 1066 1132 ENDIF 1067 1133 xcplmask(:,:,0) = 1. - SUM( xcplmask(:,:,1:nn_cplmodel), dim = 3 ) 1134 ! 1135 IF( nn_coupled_iceshelf_fluxes .gt. 0 ) THEN 1136 ! Crude masks to separate the Antarctic and Greenland icesheets. Obviously something 1137 ! more complicated could be done if required. 1138 greenland_icesheet_mask = 0.0 1139 WHERE( gphit >= 0.0 ) greenland_icesheet_mask = 1.0 1140 antarctica_icesheet_mask = 0.0 1141 WHERE( gphit < 0.0 ) antarctica_icesheet_mask = 1.0 1142 1143 IF( .not. ln_rstart ) THEN 1144 greenland_icesheet_mass = 0.0 1145 greenland_icesheet_mass_rate_of_change = 0.0 1146 greenland_icesheet_timelapsed = 0.0 1147 antarctica_icesheet_mass = 0.0 1148 antarctica_icesheet_mass_rate_of_change = 0.0 1149 antarctica_icesheet_timelapsed = 0.0 1150 ENDIF 1151 1152 ENDIF 1068 1153 ! 1069 1154 END SUBROUTINE sbc_cpl_init … … 1126 1211 REAL(wp) :: zcumulneg, zcumulpos ! temporary scalars 1127 1212 REAL(wp) :: zcoef ! temporary scalar 1213 LOGICAL :: ll_wrtstp ! write diagnostics? 1128 1214 REAL(wp) :: zrhoa = 1.22 ! Air density kg/m3 1129 1215 REAL(wp) :: zcdrag = 1.5e-3 ! drag coefficient 1216 REAL(wp) :: zgreenland_icesheet_mass_in, zantarctica_icesheet_mass_in 1217 REAL(wp) :: zgreenland_icesheet_mass_b, zantarctica_icesheet_mass_b 1218 REAL(wp) :: zmask_sum, zepsilon 1130 1219 REAL(wp) :: zzx, zzy ! temporary variables 1131 1220 REAL(wp), DIMENSION(jpi,jpj) :: ztx, zty, zmsk, zemp, zqns, zqsr, zcloud_fra 1132 1221 !!---------------------------------------------------------------------- 1222 ! 1223 ll_wrtstp = (( MOD( kt, sn_cfctl%ptimincr ) == 0 ) .OR. ( kt == nitend )) .AND. (nn_print>0) 1133 1224 ! 1134 1225 IF( kt == nit000 ) THEN … … 1147 1238 isec = ( kt - nit000 ) * NINT( rdt ) ! date of exchanges 1148 1239 DO jn = 1, jprcv ! received fields sent by the atmosphere 1149 IF( srcv(jn)%laction ) CALL cpl_rcv( jn, isec, frcv(jn)%z3, xcplmask(:,:,1:nn_cplmodel), nrcvinfo(jn) ) 1240 IF( srcv(jn)%laction ) THEN 1241 1242 IF ( srcv(jn)%dimensions <= 1 ) THEN 1243 CALL cpl_rcv_1d( jn, isec, frcv(jn)%z3, SIZE(frcv(jn)%z3), nrcvinfo(jn) ) 1244 ELSE 1245 CALL cpl_rcv( jn, isec, frcv(jn)%z3, xcplmask(:,:,1:nn_cplmodel), nrcvinfo(jn) ) 1246 END IF 1247 1248 END IF 1150 1249 END DO 1151 1250 … … 1474 1573 IF( srcv(jpr_fice )%laction ) fr_i(:,:) = frcv(jpr_fice )%z3(:,:,1) 1475 1574 ! 1575 ENDIF 1576 1577 ! ! land ice masses : Greenland 1578 zepsilon = rn_iceshelf_fluxes_tolerance 1579 1580 IF( srcv(jpr_grnm)%laction .AND. nn_coupled_iceshelf_fluxes == 1 ) THEN 1581 1582 ! This is a zero dimensional, single value field. 1583 zgreenland_icesheet_mass_in = frcv(jpr_grnm)%z3(1,1,1) 1584 1585 greenland_icesheet_timelapsed = greenland_icesheet_timelapsed + rdt 1586 1587 IF( ln_iceshelf_init_atmos .AND. kt == 1 ) THEN 1588 ! On the first timestep (of an NRUN) force the ocean to ignore the icesheet masses in the ocean restart 1589 ! and take them from the atmosphere to avoid problems with using inconsistent ocean and atmosphere restarts. 1590 zgreenland_icesheet_mass_b = zgreenland_icesheet_mass_in 1591 greenland_icesheet_mass = zgreenland_icesheet_mass_in 1592 ENDIF 1593 1594 IF( ABS( zgreenland_icesheet_mass_in - greenland_icesheet_mass ) > zepsilon ) THEN 1595 zgreenland_icesheet_mass_b = greenland_icesheet_mass 1596 1597 ! Only update the mass if it has increased. 1598 IF ( (zgreenland_icesheet_mass_in - greenland_icesheet_mass) > 0.0 ) THEN 1599 greenland_icesheet_mass = zgreenland_icesheet_mass_in 1600 ENDIF 1601 1602 IF( zgreenland_icesheet_mass_b /= 0.0 ) & 1603 & greenland_icesheet_mass_rate_of_change = ( greenland_icesheet_mass - zgreenland_icesheet_mass_b ) / greenland_icesheet_timelapsed 1604 greenland_icesheet_timelapsed = 0.0_wp 1605 ENDIF 1606 IF(lwp .AND. ll_wrtstp) THEN 1607 WRITE(numout,*) 'Greenland icesheet mass (kg) read in is ', zgreenland_icesheet_mass_in 1608 WRITE(numout,*) 'Greenland icesheet mass (kg) used is ', greenland_icesheet_mass 1609 WRITE(numout,*) 'Greenland icesheet mass rate of change (kg/s) is ', greenland_icesheet_mass_rate_of_change 1610 WRITE(numout,*) 'Greenland icesheet seconds lapsed since last change is ', greenland_icesheet_timelapsed 1611 ENDIF 1612 ELSE IF ( nn_coupled_iceshelf_fluxes == 2 ) THEN 1613 greenland_icesheet_mass_rate_of_change = rn_greenland_total_fw_flux 1614 ENDIF 1615 1616 ! ! land ice masses : Antarctica 1617 IF( srcv(jpr_antm)%laction .AND. nn_coupled_iceshelf_fluxes == 1 ) THEN 1618 1619 ! This is a zero dimensional, single value field. 1620 zantarctica_icesheet_mass_in = frcv(jpr_antm)%z3(1,1,1) 1621 1622 antarctica_icesheet_timelapsed = antarctica_icesheet_timelapsed + rdt 1623 1624 IF( ln_iceshelf_init_atmos .AND. kt == 1 ) THEN 1625 ! On the first timestep (of an NRUN) force the ocean to ignore the icesheet masses in the ocean restart 1626 ! and take them from the atmosphere to avoid problems with using inconsistent ocean and atmosphere restarts. 1627 zantarctica_icesheet_mass_b = zantarctica_icesheet_mass_in 1628 antarctica_icesheet_mass = zantarctica_icesheet_mass_in 1629 ENDIF 1630 1631 IF( ABS( zantarctica_icesheet_mass_in - antarctica_icesheet_mass ) > zepsilon ) THEN 1632 zantarctica_icesheet_mass_b = antarctica_icesheet_mass 1633 1634 ! Only update the mass if it has increased. 1635 IF ( (zantarctica_icesheet_mass_in - antarctica_icesheet_mass) > 0.0 ) THEN 1636 antarctica_icesheet_mass = zantarctica_icesheet_mass_in 1637 END IF 1638 1639 IF( zantarctica_icesheet_mass_b /= 0.0 ) & 1640 & antarctica_icesheet_mass_rate_of_change = ( antarctica_icesheet_mass - zantarctica_icesheet_mass_b ) / antarctica_icesheet_timelapsed 1641 antarctica_icesheet_timelapsed = 0.0_wp 1642 ENDIF 1643 IF(lwp .AND. ll_wrtstp) THEN 1644 WRITE(numout,*) 'Antarctica icesheet mass (kg) read in is ', zantarctica_icesheet_mass_in 1645 WRITE(numout,*) 'Antarctica icesheet mass (kg) used is ', antarctica_icesheet_mass 1646 WRITE(numout,*) 'Antarctica icesheet mass rate of change (kg/s) is ', antarctica_icesheet_mass_rate_of_change 1647 WRITE(numout,*) 'Antarctica icesheet seconds lapsed since last change is ', antarctica_icesheet_timelapsed 1648 ENDIF 1649 ELSE IF ( nn_coupled_iceshelf_fluxes == 2 ) THEN 1650 antarctica_icesheet_mass_rate_of_change = rn_antarctica_total_fw_flux 1476 1651 ENDIF 1477 1652 ! … … 1746 1921 1747 1922 ! --- Continental fluxes --- ! 1748 IF( srcv(jpr_rnf)%laction ) THEN ! runoffs (included in emp later on)1923 IF( srcv(jpr_rnf)%laction ) THEN ! 2D runoffs (included in emp later on) 1749 1924 rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1) 1925 ENDIF 1926 IF( srcv(jpr_rnf_1d)%laction ) THEN ! 1D runoff 1927 CALL cpl_rnf_1d_to_2d(frcv(jpr_rnf_1d)%z3(:,:,:)) 1750 1928 ENDIF 1751 1929 IF( srcv(jpr_cal)%laction ) THEN ! calving (put in emp_tot and emp_oce) … … 1786 1964 zsnw(:,:) = picefr(:,:) 1787 1965 ! --- Continental fluxes --- ! 1788 IF( srcv(jpr_rnf)%laction ) THEN ! runoffs (included in emp later on)1966 IF( srcv(jpr_rnf)%laction ) THEN ! 2D runoffs (included in emp later on) 1789 1967 rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1) 1968 ENDIF 1969 IF( srcv(jpr_rnf_1d)%laction ) THEN ! 1D runoff 1970 CALL cpl_rnf_1d_to_2d(frcv(jpr_rnf_1d)%z3(:,:,:)) 1790 1971 ENDIF 1791 1972 IF( srcv(jpr_cal)%laction ) THEN ! calving (put in emp_tot)
Note: See TracChangeset
for help on using the changeset viewer.