From 11dc2c38ba698787533b377bd073c5e09b6858fe Mon Sep 17 00:00:00 2001 From: Christian Ethe <christian.ethe@ipsl.fr> Date: Mon, 24 Jan 2022 08:51:36 +0000 Subject: [PATCH] Resolve "diurnal cycle in TOP" --- cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_cfg | 18 ++++++------- cfgs/SHARED/namelist_top_ref | 19 +++++++++----- src/OCE/SBC/sbcblk.F90 | 13 ++++++++++ src/OCE/SBC/sbccpl.F90 | 2 -- src/OCE/SBC/sbcflx.F90 | 12 +++++++++ src/OCE/trc_oce.F90 | 5 +++- src/OFF/dtadyn.F90 | 2 ++ src/TOP/PISCES/P4Z/p4zopt.F90 | 2 +- src/TOP/trc.F90 | 3 +-- src/TOP/trcnam.F90 | 31 +++++++++++++++++++++++ src/TOP/trcstp.F90 | 14 +++------- 11 files changed, 89 insertions(+), 32 deletions(-) diff --git a/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_cfg b/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_cfg index 24a0667fd..7f302e9a0 100644 --- a/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_cfg +++ b/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_cfg @@ -403,15 +403,15 @@ ln_tsdiff = .true. ! account for differential T/S mixing (T) or not (F) cn_dir = './' ! root directory for the iwm data location - !___________!_________________________!___________________!___________!_____________!________!___________!__________________!__________!_______________! - ! ! file name ! frequency (hours) ! variable ! time interp.! clim ! 'yearly'/ ! weights filename ! rotation ! land/sea mask ! - ! ! ! (if <0 months) ! name ! (logical) ! (T/F) ! 'monthly' ! ! pairing ! filename ! - sn_mpb = 'zdfiwm_forcing' , -12. , 'power_bot' , .false. , .true. , 'yearly' , '' , '' , '' - sn_mpc = 'zdfiwm_forcing' , -12. , 'power_cri' , .false. , .true. , 'yearly' , '' , '' , '' - sn_mpn = 'zdfiwm_forcing' , -12. , 'power_nsq' , .false. , .true. , 'yearly' , '' , '' , '' - sn_mps = 'zdfiwm_forcing' , -12. , 'power_sho' , .false. , .true. , 'yearly' , '' , '' , '' - sn_dsb = 'zdfiwm_forcing' , -12. , 'scale_bot' , .false. , .true. , 'yearly' , '' , '' , '' - sn_dsc = 'zdfiwm_forcing' , -12. , 'scale_cri' , .false. , .true. , 'yearly' , '' , '' , '' + !___________!_________________________!___________________!_____________!_____________!________!___________!__________________!__________!_______________! + ! ! file name ! frequency (hours) ! variable ! time interp.! clim ! 'yearly'/ ! weights filename ! rotation ! land/sea mask ! + ! ! ! (if <0 months) ! name ! (logical) ! (T/F) ! 'monthly' ! ! pairing ! filename ! + sn_mpb = 'zdfiwm_forcing_orca2' , -12. , 'power_bot' , .false. , .true. , 'yearly' , '' , '' , '' + sn_mpc = 'zdfiwm_forcing_orca2' , -12. , 'power_cri' , .false. , .true. , 'yearly' , '' , '' , '' + sn_mpn = 'zdfiwm_forcing_orca2' , -12. , 'power_nsq' , .false. , .true. , 'yearly' , '' , '' , '' + sn_mps = 'zdfiwm_forcing_orca2' , -12. , 'power_sho' , .false. , .true. , 'yearly' , '' , '' , '' + sn_dsb = 'zdfiwm_forcing_orca2' , -12. , 'scale_bot' , .false. , .true. , 'yearly' , '' , '' , '' + sn_dsc = 'zdfiwm_forcing_orca2' , -12. , 'scale_cri' , .false. , .true. , 'yearly' , '' , '' , '' / !!====================================================================== !! *** Diagnostics namelists *** !! diff --git a/cfgs/SHARED/namelist_top_ref b/cfgs/SHARED/namelist_top_ref index edc231127..08aa0139b 100644 --- a/cfgs/SHARED/namelist_top_ref +++ b/cfgs/SHARED/namelist_top_ref @@ -100,15 +100,20 @@ nitermax = 2 ! number of iterations for sedimentation / !----------------------------------------------------------------------- +&namtrc_dcy ! Diurnal cycle +!----------------------------------------------------------------------- + ln_trcdc2dm = .false. ! Diurnal cycle for TOP +/ +!----------------------------------------------------------------------- &namtrc_opt ! light availability in the water column !----------------------------------------------------------------------- -! ! file name ! frequency (hours) ! variable ! time interp. ! clim ! 'yearly'/ ! weights ! rotation ! land/sea mask ! -! ! ! (if <0 months) ! name ! (logical) ! (T/F) ! 'monthly' ! filename ! pairing ! filename ! - sn_par = 'par.orca' , 24 , 'fr_par' , .true. , .true. , 'yearly' , '' , '' , '' - cn_dir = './' ! root directory for the location of the dynamical files - ln_varpar = .true. ! Read PAR from file - parlux = 0.43 ! Fraction of shortwave as PAR - light_loc = 'center' ! Light location in the water cell ('center', 'integral') +! ! file name ! frequency (hours) ! variable ! time interp. ! clim ! 'yearly'/ ! weights ! rotation ! land/sea mask ! +! ! ! (if <0 months) ! name ! (logical) ! (T/F) ! 'monthly' ! filename ! pairing ! filename ! + sn_par = 'par.orca' , 24 , 'fr_par' , .true. , .true. , 'yearly' , '' , '' , '' + cn_dir = './' ! root directory for the location of the dynamical files + ln_varpar = .true. ! Read PAR from file + parlux = 0.43 ! Fraction of shortwave as PAR + light_loc = 'center' ! Light location in the water cell ('center', 'integral') / !----------------------------------------------------------------------- &namtrc_dmp ! passive tracer newtonian damping (ln_trcdmp=T) diff --git a/src/OCE/SBC/sbcblk.F90 b/src/OCE/SBC/sbcblk.F90 index a88f532dc..a68659642 100644 --- a/src/OCE/SBC/sbcblk.F90 +++ b/src/OCE/SBC/sbcblk.F90 @@ -36,6 +36,7 @@ MODULE sbcblk USE phycst ! physical constants USE fldread ! read input fields USE sbc_oce ! Surface boundary condition: ocean fields + USE trc_oce ! share SMS/Ocean variables USE cyclone ! Cyclone 10m wind form trac of cyclone centres USE sbcdcy ! surface boundary condition: diurnal cycle USE sbcwave , ONLY : cdn_wave ! wave module @@ -592,6 +593,18 @@ CONTAINS wndj_ice(:,:) = sf(jp_wndj)%fnow(:,:,1) ENDIF #endif + +#if defined key_top + IF( ln_trcdc2dm ) THEN ! diurnal cycle in TOP + IF( MOD( kt - 1, nn_fsbc ) == 0 ) THEN + IF( ln_dm2dc ) THEN + qsr_mean(:,:) = ( 1. - albo ) * sf(jp_qsr)%fnow(:,:,1) * tmask(:,:,1) + ELSE + ncpl_qsr_freq = sf(jp_qsr)%freqh * 3600 ! qsr_mean will be computed in TOP + ENDIF + ENDIF + ENDIF +#endif ! END SUBROUTINE sbc_blk diff --git a/src/OCE/SBC/sbccpl.F90 b/src/OCE/SBC/sbccpl.F90 index 05070b410..eddf626a5 100644 --- a/src/OCE/SBC/sbccpl.F90 +++ b/src/OCE/SBC/sbccpl.F90 @@ -1195,8 +1195,6 @@ CONTAINS IF( ln_dm2dc .AND. ncpl_qsr_freq /= 86400 ) & & CALL ctl_stop( 'sbc_cpl_rcv: diurnal cycle reconstruction (ln_dm2dc) needs daily couping for solar radiation' ) - IF( ncpl_qsr_freq /= 0) ncpl_qsr_freq = 86400 / ncpl_qsr_freq ! used by top - IF ( ln_wave .AND. nn_components == 0 ) THEN ncpl_qsr_freq = 1; WRITE(numout,*) 'ncpl_qsr_freq is set to 1 when coupling NEMO with wave (without SAS) ' diff --git a/src/OCE/SBC/sbcflx.F90 b/src/OCE/SBC/sbcflx.F90 index efd86a49e..e8e7809d9 100644 --- a/src/OCE/SBC/sbcflx.F90 +++ b/src/OCE/SBC/sbcflx.F90 @@ -14,6 +14,7 @@ MODULE sbcflx USE oce ! ocean dynamics and tracers USE dom_oce ! ocean space and time domain USE sbc_oce ! surface boundary condition: ocean fields + USE trc_oce ! share SMS/Ocean variables USE sbcdcy ! surface boundary condition: diurnal cycle on qsr USE phycst ! physical constants ! @@ -134,6 +135,17 @@ CONTAINS qsr(ji,jj) = sf(jp_qsr)%fnow(ji,jj,1) * tmask(ji,jj,1) END_2D ENDIF +#if defined key_top + IF( ln_trcdc2dm ) THEN ! diurnal cycle in TOP + IF( ln_dm2dc ) THEN + DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) + qsr_mean(ji,jj) = sf(jp_qsr)%fnow(ji,jj,1) * tmask(ji,jj,1) + END_2D + ELSE + ncpl_qsr_freq = sf(jp_qsr)%freqh * 3600 ! qsr_mean will be computed in TOP + ENDIF + ENDIF +#endif DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) ! set the ocean fluxes from read fields utau(ji,jj) = sf(jp_utau)%fnow(ji,jj,1) * umask(ji,jj,1) vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj,1) * vmask(ji,jj,1) diff --git a/src/OCE/trc_oce.F90 b/src/OCE/trc_oce.F90 index d2489107d..f7b8309ee 100644 --- a/src/OCE/trc_oce.F90 +++ b/src/OCE/trc_oce.F90 @@ -26,9 +26,11 @@ MODULE trc_oce LOGICAL , PUBLIC :: l_co2cpl = .false. !: atmospheric pco2 recieved from oasis LOGICAL , PUBLIC :: l_offline = .false. !: offline passive tracers flag REAL(wp), PUBLIC :: r_si2 !: largest depth of extinction (blue & 0.01 mg.m-3) (RGB) + LOGICAL , PUBLIC :: ln_trcdc2dm !: Diurnal cycle for TOP ! REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:,:,:) :: etot3 !: light absortion coefficient REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:,:) :: oce_co2 !: ocean carbon flux + REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: qsr_mean !: daily mean qsr #if defined key_top !!---------------------------------------------------------------------- @@ -52,7 +54,8 @@ CONTAINS !!---------------------------------------------------------------------- !! *** trc_oce_alloc *** !!---------------------------------------------------------------------- - ALLOCATE( etot3(jpi,jpj,jpk), oce_co2(jpi,jpj), STAT=trc_oce_alloc ) + ALLOCATE( etot3(jpi,jpj,jpk), oce_co2(jpi,jpj), qsr_mean(jpi,jpj), STAT=trc_oce_alloc ) + IF( trc_oce_alloc /= 0 ) CALL ctl_warn('trc_oce_alloc: failed to allocate etot3 array') ! END FUNCTION trc_oce_alloc diff --git a/src/OFF/dtadyn.F90 b/src/OFF/dtadyn.F90 index a1b1045d0..7d66832b0 100644 --- a/src/OFF/dtadyn.F90 +++ b/src/OFF/dtadyn.F90 @@ -359,6 +359,8 @@ CONTAINS #endif ENDIF ! + ncpl_qsr_freq = sf_dyn(jf_qsr)%freqh * 3600 ! Get qsr frequency ( needed if diurnal cycle in TOP + ! CALL dta_dyn_rnf_init( Kmm ) ! CALL dta_dyn( nit000, Kbb, Kmm, Kaa ) diff --git a/src/TOP/PISCES/P4Z/p4zopt.F90 b/src/TOP/PISCES/P4Z/p4zopt.F90 index 51e95a5dc..8daf2edf7 100644 --- a/src/TOP/PISCES/P4Z/p4zopt.F90 +++ b/src/TOP/PISCES/P4Z/p4zopt.F90 @@ -107,7 +107,7 @@ CONTAINS ! for an explicit diurnal cycle ! (2) no diurnal cycle of SW is active and in that case, QSR is used. ! -------------------------------------------- - IF( l_trcdm2dc ) THEN ! diurnal cycle + IF( ln_trcdc2dm ) THEN ! diurnal cycle IF ( ln_p4z_dcyc ) THEN ! Diurnal cycle in PISCES ! ! diff --git a/src/TOP/trc.F90 b/src/TOP/trc.F90 index 0b713e5ea..d5b85e041 100644 --- a/src/TOP/trc.F90 +++ b/src/TOP/trc.F90 @@ -45,7 +45,6 @@ MODULE trc REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: gtrv !: hor. gradient at v-points at bottom ocean level REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: gtrui !: hor. gradient at u-points at top ocean level REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: gtrvi !: hor. gradient at v-points at top ocean level - REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: qsr_mean !: daily mean qsr !! passive tracers (input and output) !! ------------------------------------------ @@ -167,7 +166,7 @@ CONTAINS & neln(jpi,jpj) , heup(jpi,jpj) , heup_01(jpi,jpj) , & & etot(jpi,jpj,jpk) , etot_ndcy(jpi,jpj,jpk) , & & sbc_trc_b(jpi,jpj,jptra), sbc_trc(jpi,jpj,jptra) , & - & cvol(jpi,jpj,jpk) , trai(jptra) , qsr_mean(jpi,jpj) , & + & cvol(jpi,jpj,jpk) , trai(jptra) , & & ctrcnm(jptra) , ctrcln(jptra) , ctrcun(jptra) , & & ln_trc_ini(jptra) , & & ln_trc_sbc(jptra) , ln_trc_cbc(jptra) , ln_trc_obc(jptra) , & diff --git a/src/TOP/trcnam.F90 b/src/TOP/trcnam.F90 index fdde13d76..cacbe6171 100644 --- a/src/TOP/trcnam.F90 +++ b/src/TOP/trcnam.F90 @@ -80,6 +80,9 @@ CONTAINS WRITE(numout,*) WRITE(numout,*) ' ==>>> Passive Tracer time step = rn_Dt = ', rn_Dt ENDIF + ! + CALL trc_nam_dcy ! Diurnal Cycle + ! IF( l_trdtrc ) CALL trc_nam_trd ! Passive tracer trends ! @@ -225,6 +228,34 @@ CONTAINS ! END SUBROUTINE trc_nam_trc + SUBROUTINE trc_nam_dcy + !!--------------------------------------------------------------------- + !! *** ROUTINE trc_nam_dcy *** + !! + !! ** Purpose : read options for the passive tracer diagnostics + !! + !!--------------------------------------------------------------------- + INTEGER :: ios, ierr ! Local integer + !! + NAMELIST/namtrc_dcy/ ln_trcdc2dm + !!--------------------------------------------------------------------- + ! + IF(lwp) WRITE(numout,*) + IF(lwp) WRITE(numout,*) 'trc_nam_dcy : read the passive tracer diurnal cycle options' + IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' + ! + READ ( numnat_ref, namtrc_dcy, IOSTAT = ios, ERR = 905) +905 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dcy in reference namelist' ) + READ ( numnat_cfg, namtrc_dcy, IOSTAT = ios, ERR = 906 ) +906 IF( ios > 0 ) CALL ctl_nam ( ios , 'namtrc_dcy in configuration namelist' ) + IF(lwm) WRITE( numont, namtrc_dcy ) + + IF(lwp) THEN + WRITE(numout,*) ' Namelist : namtrc_dcy ' + WRITE(numout,*) ' Diurnal cycle for TOP ln_trcdc2dm = ', ln_trcdc2dm + ENDIF + + END SUBROUTINE trc_nam_dcy SUBROUTINE trc_nam_trd !!--------------------------------------------------------------------- diff --git a/src/TOP/trcstp.F90 b/src/TOP/trcstp.F90 index 380924186..124269c63 100644 --- a/src/TOP/trcstp.F90 +++ b/src/TOP/trcstp.F90 @@ -142,12 +142,10 @@ CONTAINS SUBROUTINE trc_stp_ctl !!---------------------------------------------------------------------- !! *** ROUTINE trc_stp_ctl *** - !! ** Purpose : Control + ocean volume !!---------------------------------------------------------------------- ! ! Define logical parameter ton control dirunal cycle in TOP - l_trcdm2dc = ln_dm2dc .OR. ( ln_cpl .AND. ncpl_qsr_freq /= 1 .AND. ncpl_qsr_freq /= 0 ) - l_trcdm2dc = l_trcdm2dc .AND. .NOT. l_offline + l_trcdm2dc = ( ln_trcdc2dm .AND. .NOT. ln_dm2dc ) ! IF( l_trcdm2dc .AND. lwp ) CALL ctl_warn( 'Coupling with passive tracers and used of diurnal cycle.', & & 'Computation of a daily mean shortwave for some biogeochemical models ' ) @@ -178,13 +176,9 @@ CONTAINS IF( ln_timing ) CALL timing_start('trc_mean_qsr') ! IF( kt == nittrc000 ) THEN - IF( ln_cpl ) THEN - rdt_sampl = rday / ncpl_qsr_freq - nb_rec_per_day = ncpl_qsr_freq - ELSE - rdt_sampl = MAX( 3600., rn_Dt ) - nb_rec_per_day = INT( rday / rdt_sampl ) - ENDIF + ! + rdt_sampl = REAL( ncpl_qsr_freq ) + nb_rec_per_day = INT( rday / ncpl_qsr_freq ) ! IF(lwp) THEN WRITE(numout,*) -- GitLab