Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions model/src/w3src6md.F90
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,9 @@ SUBROUTINE W3SIN6 (A, CG, WN2, UABS, USTAR, USDIR, CD, DAIR, &
ECOS2 = ECOS(1:NSPEC) ! Only indices from 1 to NSPEC
ESIN2 = ESIN(1:NSPEC) ! are requested.
!
IKN = IRANGE(1,NSPEC,NTH) ! Index vector for elements of 1 ... NK
! ! such that e.g. SIG(1:NK) = SIG2(IKN).
DO IK = 1, NK
IKN(IK) = 1 + (IK-1)*NTH
END DO
DSII2 = DDEN2 / DTH / SIG2 ! Frequency bandwidths (int.) (rad)
DSII = DSII2(IKN)
SIG = SIG2(IKN)
Expand Down Expand Up @@ -673,9 +674,9 @@ SUBROUTINE W3SDS6 (A, CG, WN, S, D)
#endif
!
!/ 0) --- Initialize essential parameters ---------------------------- /
IKN = IRANGE(1,NSPEC,NTH) ! Index vector for elements of 1,
! ! 2,..., NK such that for example
! ! SIG(1:NK) = SIG2(IKN).
DO IK = 1, NK
IKN(IK) = 1 + (IK-1)*NTH
END DO
FREQ = SIG2(IKN)/TPI
ANAR = 1.0
BNT = 0.035**2
Expand Down Expand Up @@ -899,7 +900,9 @@ SUBROUTINE LFACTOR(S, CINV, U10, USTAR, USDIR, SIG, DSII, &
NK10Hz = MAX(NK,NK10Hz)
!
ALLOCATE(IK10Hz(NK10Hz))
IK10Hz = REAL( IRANGE(1,NK10Hz,1) )
DO IK = 1, NK10Hz
IK10Hz(IK) = REAL(IK)
END DO
!
ALLOCATE(SIG10Hz(NK10Hz))
ALLOCATE(CINV10Hz(NK10Hz))
Expand Down Expand Up @@ -1134,7 +1137,7 @@ SUBROUTINE TAU_WAVE_ATMOS(S, CINV, SIG, DSII, TAUNWX, TAUNWY )
INTEGER, SAVE :: IENT = 0
#endif
REAL, PARAMETER :: FRQMAX = 10. ! Upper freq. limit to extrapolate to.
INTEGER :: NK10Hz
INTEGER :: NK10Hz, I
!
REAL :: ECOS2(NSPEC), ESIN2(NSPEC)
REAL, ALLOCATABLE :: IK10Hz(:), SIG10Hz(:), CINV10Hz(:)
Expand All @@ -1152,7 +1155,9 @@ SUBROUTINE TAU_WAVE_ATMOS(S, CINV, SIG, DSII, TAUNWX, TAUNWY )
NK10Hz = MAX(NK,NK10Hz)
!
ALLOCATE(IK10Hz(NK10Hz))
IK10Hz = REAL( IRANGE(1,NK10Hz,1) )
DO I = 1, NK10Hz
IK10Hz(I) = REAL(I)
END DO
!
ALLOCATE(SIG10Hz(NK10Hz))
ALLOCATE(CINV10Hz(NK10Hz))
Expand Down Expand Up @@ -1193,6 +1198,14 @@ SUBROUTINE TAU_WAVE_ATMOS(S, CINV, SIG, DSII, TAUNWX, TAUNWY )
! --- The wave supported stress (waves to atmosphere) ------------ /
TAUNWX = TAUWINDS(SDENSX10Hz,CINV10Hz,DSII10Hz) ! x-component
TAUNWY = TAUWINDS(SDENSY10Hz,CINV10Hz,DSII10Hz) ! y-component
!
IF (ALLOCATED(IK10Hz)) DEALLOCATE(IK10Hz)
IF (ALLOCATED(SIG10Hz)) DEALLOCATE(SIG10Hz)
IF (ALLOCATED(CINV10Hz)) DEALLOCATE(CINV10Hz)
IF (ALLOCATED(DSII10Hz)) DEALLOCATE(DSII10Hz)
IF (ALLOCATED(SDENSX10Hz)) DEALLOCATE(SDENSX10Hz)
IF (ALLOCATED(SDENSY10Hz)) DEALLOCATE(SDENSY10Hz)
IF (ALLOCATED(UCINV10Hz)) DEALLOCATE(UCINV10Hz)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these deallocates don't do anything - it's implicit in fotran that they get deallocated (because they were allocated in this subroutine)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @anton-seaice , that makes sense. I’ve removed the explicit DEALLOCATE block in TAU_WAVE_ATMOS in this commit 65b55f7

@ezhilsabareesh8 ezhilsabareesh8 Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anton-seaice in the MCW test with the updated executable, removing the explicit DEALLOCATE block brought the WW3 memory growth back and the job reached ~794 GB. Restoring the block matches the tested passing behaviour.

So I think we should keep the explicit deallocations here, even if they are theoretically redundant.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated executable, removing

I can't see any deployments this PR which use the comment without the deallocate statements ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one ACCESS-NRI/ACCESS-OM3#109 (comment), which uses this commit

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hich uses this commit

Uses:

https://github.com/ACCESS-NRI/ACCESS-OM3/blob/13c4bf2fc6dfee6b19d333139f9dd6258439944f/spack.yaml#L36

git.3372234ec8898d21498f71e57e057d63b2c1095a=2026.03.000

which looks liek the head of the default branch (https://github.com/ACCESS-NRI/WW3/tree/dev/2026.03)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anton-seaice Removed the deallocate block in this commit 10fa061 and tested with the executable ACCESS-NRI/ACCESS-OM3#109 (comment), it's running fine

!/
END SUBROUTINE TAU_WAVE_ATMOS
!/ ------------------------------------------------------------------- /
Expand Down
5 changes: 3 additions & 2 deletions model/src/w3swldmd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,9 @@ SUBROUTINE W3SWL6 (A, CG, WN, S, D)
#endif
!
!/ 0) --- Initialize parameters -------------------------------------- /
IKN = IRANGE(1,NSPEC,NTH) ! Index vector for array access, e.g.
! ! in form of WN(1:NK) == WN2(IKN).
DO IK = 1, NK
IKN(IK) = 1 + (IK-1)*NTH
END DO
ABAND = SUM(RESHAPE(A,(/ NTH,NK /)),1) ! action density as function of wavenumber
DDIS = 0.
D = 0.
Expand Down
Loading