Skip to content

Commit

Permalink
fixes from testing for ATM auxhist output
Browse files Browse the repository at this point in the history
  • Loading branch information
DeniseWorthen committed Jul 25, 2024
1 parent f62eff7 commit 8a30f50
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
40 changes: 19 additions & 21 deletions mediator/med_io_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -870,30 +870,28 @@ subroutine med_io_write_FB(io_file, FB, whead, wdata, nx, ny, nt, &

ng = maxval(maxIndexPTile)
if (tiles) then
if (luse_float) then
lnx = ntile*ny*nx
lny = 1
lntile = 1
else
lnx = nx
lny = ny
lntile = ng/(lnx*lny)
write(tmpstr,*) subname, 'ng,lnx,lny,lntile = ',ng,lnx,lny,lntile
lnx = ng
lny = 1
lntile = 1
if (nx > 0) lnx = nx
if (ny > 0) lny = ny
if (ntile > 0) lntile = ntile
write(tmpstr,*) subname, 'ng,lnx,lny,lntile = ',ng,lnx,lny,lntile
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
if (lnx*lny*lntile /= ng) then
write(tmpstr,*) subname,' ERROR: grid size not consistent ',ng,lnx,lny,lntile
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
if (lntile /= ntile) then
call ESMF_LogWrite(trim(subname)//' ERROR: grid2d size and ntile are not consistent ', ESMF_LOGMSG_INFO)
call ESMF_Finalize(endflag=ESMF_END_ABORT)
endif
call ESMF_Finalize(endflag=ESMF_END_ABORT)
end if
else
lnx = ng
lny = 1
if (nx > 0) lnx = nx
if (ny > 0) lny = ny
if (lnx*lny /= ng) then
write(tmpstr,*) subname,' WARNING: grid2d size not consistent ',ng,lnx,lny
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
endif
lnx = ng
lny = 1
if (nx > 0) lnx = nx
if (ny > 0) lny = ny
if (lnx*lny /= ng) then
write(tmpstr,*) subname,' WARNING: grid2d size not consistent ',ng,lnx,lny
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
endif
end if
deallocate(minIndexPTile, maxIndexPTile)

Expand Down
8 changes: 5 additions & 3 deletions mediator/med_phases_history_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,7 @@ subroutine med_phases_history_write_comp_aux(gcomp, compid, auxcomp, rc)
logical :: enable_auxfile
character(CL) :: time_units ! units of time variable
integer :: nx,ny ! global grid size
integer :: ntile ! number of tiles for tiled domain eg CSG
logical :: write_now ! if true, write time sample to file
real(r8) :: time_val ! time coordinate output
real(r8) :: time_bnds(2) ! time bounds output
Expand Down Expand Up @@ -1268,6 +1269,7 @@ subroutine med_phases_history_write_comp_aux(gcomp, compid, auxcomp, rc)
! Set shorthand variables
nx = is_local%wrap%nx(compid)
ny = is_local%wrap%ny(compid)
ntile = is_local%wrap%ntile(compid)

! Increment number of time samples on file
auxcomp%files(nf)%nt = auxcomp%files(nf)%nt + 1
Expand Down Expand Up @@ -1303,7 +1305,7 @@ subroutine med_phases_history_write_comp_aux(gcomp, compid, auxcomp, rc)
call med_io_write(auxcomp%files(nf)%io_file, is_local%wrap%FBimp(compid,compid), &
whead(1), wdata(1), nx, ny, nt=auxcomp%files(nf)%nt, &
pre=trim(compname(compid))//'Imp', flds=auxcomp%files(nf)%flds, &
use_float=.true., rc=rc)
use_float=.true., ntile=ntile, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! end definition phase
Expand All @@ -1318,14 +1320,14 @@ subroutine med_phases_history_write_comp_aux(gcomp, compid, auxcomp, rc)
if (auxcomp%files(nf)%doavg) then
call med_io_write(auxcomp%files(nf)%io_file, auxcomp%files(nf)%FBaccum, whead(2), wdata(2), nx, ny, &
nt=auxcomp%files(nf)%nt, pre=trim(compname(compid))//'Imp', flds=auxcomp%files(nf)%flds, &
use_float=.true.,rc=rc)
use_float=.true., ntile=ntile, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call med_methods_FB_reset(auxcomp%files(nf)%FBaccum, value=czero, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else
call med_io_write(auxcomp%files(nf)%io_file, is_local%wrap%FBimp(compid,compid), whead(2), wdata(2), nx, ny, &
nt=auxcomp%files(nf)%nt, pre=trim(compname(compid))//'Imp', flds=auxcomp%files(nf)%flds, &
use_float=.true.,rc=rc)
use_float=.true., ntile=ntile, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if

Expand Down

0 comments on commit 8a30f50

Please sign in to comment.