Changeset 12122
- Timestamp:
- 2019-12-09T12:29:10+01:00 (4 years ago)
- Location:
- NEMO/branches/2019/dev_r11879_ENHANCE-05_SimonM-Harmonic_Analysis/src/OCE/DIA
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2019/dev_r11879_ENHANCE-05_SimonM-Harmonic_Analysis/src/OCE/DIA/diadetide.F90
r12022 r12122 11 11 USE dom_oce , ONLY : rdt, nsec_day 12 12 USE phycst , ONLY : rpi 13 USE tide_mod , ONLY : tide_harmo, jpmax_harmo, Wave13 USE tide_mod 14 14 USE xios 15 15 … … 39 39 !!---------------------------------------------------------------------- 40 40 41 LOGICAL :: llxatt_enabled 42 INTEGER, ALLOCATABLE, DIMENSION(:) :: itide ! Tidal-constituent index 43 REAL(wp), ALLOCATABLE, DIMENSION(:) :: ztide_omega, ztide_u, ztide_v, ztide_f ! Tidal-constituent parameters 44 REAL(wp) :: zdt 45 INTEGER :: jn 41 REAL(wp) :: zdt 42 INTEGER :: jn 43 CHARACTER (LEN=4), DIMENSION(jpmax_harmo) :: ctide_selected = ' n/a ' 44 TYPE(tide_harmonic), DIMENSION(:), POINTER :: stideconst 46 45 47 46 ! Enquire detiding activation state (test for presence of detiding-related 48 47 ! weights field and output file group) 49 IF ( xios_is_valid_field( "diadetide_weight" ).AND.xios_is_valid_filegroup( "diadetide_files" ) ) THEN50 l lxatt_enabled= .TRUE.48 IF ( xios_is_valid_field( "diadetide_weight" ).AND.xios_is_valid_filegroup( "diadetide_files" ).AND.ln_tide ) THEN 49 lk_diadetide = .TRUE. 51 50 ELSE 52 l lxatt_enabled= .FALSE.51 lk_diadetide = .FALSE. 53 52 END IF 54 lk_diadetide = llxatt_enabled55 53 56 54 IF (lwp) THEN … … 63 61 IF (lk_diadetide) THEN 64 62 ! Retrieve information about M2 tidal constituent 65 ALLOCATE( ztide_omega(1), ztide_v(1), ztide_u(1), ztide_f(1), itide(1) ) 66 DO jn = 1, jpmax_harmo 67 IF (TRIM( Wave(jn)%cname_tide ) == 'M2') itide(1) = jn 68 END DO 69 CALL tide_harmo( ztide_omega, ztide_v, ztide_u, ztide_f, itide, 1 ) 63 ctide_selected(1) = 'M2' 64 CALL tide_init_harmonics(ctide_selected, stideconst) 65 70 66 ! For M2, twice the tidal period spans slightly more than one full 71 67 ! day. Compute the maximum number of equal intervals that span exactly 72 68 ! twice the tidal period *and* whose mid-points fall within a 24-hour 73 69 ! period from midnight to midnight. 74 zdt = Wave(itide(1))%nt * 2.0_wp * rpi / ztide_omega(1)70 zdt = 2.0_wp * 2.0_wp * rpi / stideconst(1)%omega 75 71 ndiadetide = FLOOR( zdt / ( zdt - 86400.0_wp ) ) 76 DEALLOCATE( ztide_omega, ztide_v, ztide_u, ztide_f, itide )77 72 ! Compute mid-points of the intervals to be included in the detided 78 73 ! average -
NEMO/branches/2019/dev_r11879_ENHANCE-05_SimonM-Harmonic_Analysis/src/OCE/DIA/diamlr.F90
r12097 r12122 14 14 USE timing , ONLY : timing_start, timing_stop 15 15 USE xios 16 USE tide_mod , ONLY : tide_harmo, jpmax_harmo, Wave16 USE tide_mod 17 17 18 18 IMPLICIT NONE … … 78 78 INTEGER :: jl, jm, jn 79 79 INTEGER :: itide ! Number of available tidal components 80 INTEGER, ALLOCATABLE, DIMENSION(:) :: itide_const ! Index list of selected tidal constituents81 REAL(wp), ALLOCATABLE, DIMENSION(:) :: ztide_omega, ztide_u, & ! Tidal frequency, phase, nodal correction82 & ztide_v, ztide_f83 80 REAL(wp) :: ztide_phase ! Tidal-constituent phase at adatrj=0 81 CHARACTER (LEN=4), DIMENSION(jpmax_harmo) :: ctide_selected = ' n/a ' 82 TYPE(tide_harmonic), DIMENSION(:), POINTER :: stideconst 84 83 85 84 IF(lwp) THEN … … 138 137 ifld = 0 139 138 ! 140 ! Retrieve information (frequency, phase, nodal correction) about all 141 ! available tidal constituents for placeholder substitution below 142 itide = jpmax_harmo 143 ALLOCATE(itide_const(itide), ztide_omega(itide), ztide_u(itide), ztide_v(itide), ztide_f(itide)) 144 DO jn = 1, itide 145 itide_const(jn) = jn ! Select all available tidal constituents 146 END DO 147 CALL tide_harmo( ztide_omega, ztide_v, ztide_u, ztide_f, itide_const, itide ) 139 IF ( ln_tide ) THEN 140 ! Retrieve information (frequency, phase, nodal correction) about all 141 ! available tidal constituents for placeholder substitution below 142 ctide_selected(1:34) = (/ 'Mf', 'Mm', 'Ssa', 'Mtm', 'Msf', & 143 & 'Msqm', 'Sa', 'K1', 'O1', 'P1', & 144 & 'Q1', 'J1', 'S1', 'M2', 'S2', 'N2', & 145 & 'K2', 'nu2', 'mu2', '2N2', 'L2', & 146 & 'T2', 'eps2', 'lam2', 'R2', 'M3', & 147 & 'MKS2', 'MN4', 'MS4', 'M4', 'N4', & 148 & 'S4', 'M6', 'M8' /) 149 CALL tide_init_harmonics(ctide_selected, stideconst) 150 itide = size(stideconst) 151 ELSE 152 itide = 0 153 ENDIF 148 154 149 155 DO jm = 1, jpscanmax … … 165 171 ! parameters (amplitudes, angular veloccities, nodal phase 166 172 ! correction) with values that have been obtained from the 167 ! tidal-forcing implementation 173 ! tidal-forcing implementation (if enabled) 168 174 DO jn = 1, itide 169 175 ! Compute phase of tidal constituent (incl. current nodal 170 176 ! correction) at the start of the model run (i.e. for 171 177 ! adatrj=0) 172 ztide_phase = MOD( ztide_u(jn) + ztide_v(jn) - adatrj * 86400.0_wp * ztide_omega(jn), 2.0_wp * rpi ) 173 clrepl = "__TDE_"//TRIM( Wave(jn)%cname_tide )//"_omega__" 178 ztide_phase = MOD( stideconst(jn)%u + stideconst(jn)%v0 - adatrj * 86400.0_wp * stideconst(jn)%omega, & 179 & 2.0_wp * rpi ) 180 clrepl = "__TDE_"//TRIM( stideconst(jn)%cname_tide )//"_omega__" 174 181 DO WHILE ( INDEX( clxatt_expr, TRIM( clrepl ) ) > 0 ) 175 WRITE (clfloat, '(e25.18)') ztide_omega(jn)182 WRITE (clfloat, '(e25.18)') stideconst(jn)%omega 176 183 jl = INDEX( clxatt_expr, TRIM( clrepl ) ) 177 184 clxatt_expr = clxatt_expr(1:jl - 1)//clfloat// & 178 185 & clxatt_expr(jl + LEN( TRIM( clrepl ) ):LEN( TRIM( clxatt_expr ) )) 179 186 END DO 180 clrepl = "__TDE_"//TRIM( Wave(jn)%cname_tide )//"_phase__"187 clrepl = "__TDE_"//TRIM( stideconst(jn)%cname_tide )//"_phase__" 181 188 DO WHILE ( INDEX( clxatt_expr, TRIM( clrepl ) ) > 0 ) 182 189 WRITE (clfloat, '(e25.18)') ztide_phase … … 185 192 & clxatt_expr(jl + LEN( TRIM( clrepl ) ):LEN( TRIM( clxatt_expr ) )) 186 193 END DO 187 clrepl = "__TDE_"//TRIM( Wave(jn)%cname_tide )//"_amplitude__"194 clrepl = "__TDE_"//TRIM( stideconst(jn)%cname_tide )//"_amplitude__" 188 195 DO WHILE (INDEX( clxatt_expr, TRIM( clrepl ) ) > 0 ) 189 WRITE (clfloat, '(e25.18)') ztide_f(jn)196 WRITE (clfloat, '(e25.18)') stideconst(jn)%f 190 197 jl = INDEX( clxatt_expr, TRIM( clrepl ) ) 191 198 clxatt_expr = clxatt_expr(1:jl - 1)//clfloat// & … … 236 243 237 244 END DO 238 239 ! Release tidal data240 DEALLOCATE( itide_const, ztide_omega, ztide_u, ztide_v, ztide_f )241 245 242 246 ! Output number of active regressors and fields selected for analysis
Note: See TracChangeset
for help on using the changeset viewer.