Skip to content

Commit 9e0ca30

Browse files
committed
Inline harmonic analysis
Another bug fix: initial state added back to the mean state.
1 parent 30a7606 commit 9e0ca30

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/diagnostics/MOM_harmonic_analysis.F90

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ subroutine HA_write(ha1, Time, G, CS)
324324
! Local variables
325325
real, dimension(:,:,:), allocatable :: FtSSHw !< An array containing the harmonic constants [A]
326326
integer :: year, month, day, hour, minute, second
327-
integer :: nc, k, is, ie, js, je
327+
integer :: nc, i, j, k, is, ie, js, je
328328

329329
character(len=255) :: filename !< Output file name
330330
type(MOM_infra_file) :: cdf !< The file handle for output harmonic constants
@@ -357,6 +357,11 @@ subroutine HA_write(ha1, Time, G, CS)
357357
call create_MOM_file(cdf, trim(filename), cdf_vars, &
358358
2*nc+1, cdf_fields, SINGLE_FILE, 86400.0, G=G)
359359

360+
! Add the initial field back to the mean state
361+
do j=js,je ; do i=is,ie
362+
FtSSHw(i,j,1) = FtSSHw(i,j,1) + ha1%ref(i,j)
363+
enddo ; enddo
364+
360365
! Write data
361366
call MOM_write_field(cdf, cdf_fields(1), G%domain, FtSSHw(:,:,1), 0.0)
362367
do k=1,nc

0 commit comments

Comments
 (0)