Skip to content

Commit

Permalink
fix nmax value
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Aug 30, 2023
1 parent f7f7a1e commit 9a3ddbd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
9 changes: 4 additions & 5 deletions mediator/med_enthalpy_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ module med_enthalpy_mod

implicit none
public :: med_compute_enthalpy
logical, public :: mediator_compute_enthalpy = .true.

real(r8) :: global_htot_corr(1)
real(r8) :: global_htot_corr(1) = 0._r8
character(*), parameter :: u_FILE_u = &
__FILE__
contains
Expand Down Expand Up @@ -41,11 +42,11 @@ subroutine med_compute_enthalpy(is_local, rc)

call t_startf(subname)
rc = ESMF_SUCCESS
nmax = size(tocn)

call FB_GetFldPtr(is_local%wrap%FBImp(compocn,compocn), 'So_t', tocn, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

nmax = size(tocn)

if(FB_fldchk(is_local%wrap%FBExp(compocn), 'Faxa_rain', rc)) then
call FB_GetFldPtr(is_local%wrap%FBExp(compocn), 'Faxa_rain' , rain, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down Expand Up @@ -128,7 +129,6 @@ subroutine med_compute_enthalpy(is_local, rc)
else
allocate(hrofi(nmax))
endif

do n = 1,nmax
! Need max to ensure that will not have an enthalpy contribution if the water is below 0C
hrain(n) = max((tocn(n) - tkfrz), 0._r8) * rain(n) * cpfw
Expand Down Expand Up @@ -157,7 +157,6 @@ subroutine med_compute_enthalpy(is_local, rc)
do n = 1,size(hcorr)
local_htot_corr(1) = local_htot_corr(1) + hcorr(n)
end do

call ESMF_VMAllreduce(is_local%wrap%vm, senddata=local_htot_corr, recvdata=global_htot_corr, count=1, &
reduceflag=ESMF_REDUCE_SUM, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down
1 change: 0 additions & 1 deletion mediator/med_phases_prep_atm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ subroutine med_phases_prep_atm(gcomp, rc)

! call med_compute_enthalpy(is_local, rc)
! if (ChkErr(rc,__LINE__,u_FILE_u)) return

do n = 1,size(dataptr1)
dataptr1(n) = dataptr1(n) + med_enthalpy_get_global_htot_corr()
end do
Expand Down

0 comments on commit 9a3ddbd

Please sign in to comment.