Skip to content

Commit

Permalink
Inline harmonic analysis
Browse files Browse the repository at this point in the history
Another bug fix: initial state added back to the mean state.
  • Loading branch information
c2xu committed Oct 30, 2024
1 parent 30a7606 commit 9e0ca30
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/diagnostics/MOM_harmonic_analysis.F90
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ subroutine HA_write(ha1, Time, G, CS)
! Local variables
real, dimension(:,:,:), allocatable :: FtSSHw !< An array containing the harmonic constants [A]
integer :: year, month, day, hour, minute, second
integer :: nc, k, is, ie, js, je
integer :: nc, i, j, k, is, ie, js, je

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

! Add the initial field back to the mean state
do j=js,je ; do i=is,ie
FtSSHw(i,j,1) = FtSSHw(i,j,1) + ha1%ref(i,j)
enddo ; enddo

! Write data
call MOM_write_field(cdf, cdf_fields(1), G%domain, FtSSHw(:,:,1), 0.0)
do k=1,nc
Expand Down

0 comments on commit 9e0ca30

Please sign in to comment.