Skip to content

Commit 8a30f50

Browse files
committed
fixes from testing for ATM auxhist output
1 parent f62eff7 commit 8a30f50

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

mediator/med_io_mod.F90

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -870,30 +870,28 @@ subroutine med_io_write_FB(io_file, FB, whead, wdata, nx, ny, nt, &
870870

871871
ng = maxval(maxIndexPTile)
872872
if (tiles) then
873-
if (luse_float) then
874-
lnx = ntile*ny*nx
875-
lny = 1
876-
lntile = 1
877-
else
878-
lnx = nx
879-
lny = ny
880-
lntile = ng/(lnx*lny)
881-
write(tmpstr,*) subname, 'ng,lnx,lny,lntile = ',ng,lnx,lny,lntile
873+
lnx = ng
874+
lny = 1
875+
lntile = 1
876+
if (nx > 0) lnx = nx
877+
if (ny > 0) lny = ny
878+
if (ntile > 0) lntile = ntile
879+
write(tmpstr,*) subname, 'ng,lnx,lny,lntile = ',ng,lnx,lny,lntile
880+
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
881+
if (lnx*lny*lntile /= ng) then
882+
write(tmpstr,*) subname,' ERROR: grid size not consistent ',ng,lnx,lny,lntile
882883
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
883-
if (lntile /= ntile) then
884-
call ESMF_LogWrite(trim(subname)//' ERROR: grid2d size and ntile are not consistent ', ESMF_LOGMSG_INFO)
885-
call ESMF_Finalize(endflag=ESMF_END_ABORT)
886-
endif
884+
call ESMF_Finalize(endflag=ESMF_END_ABORT)
887885
end if
888886
else
889-
lnx = ng
890-
lny = 1
891-
if (nx > 0) lnx = nx
892-
if (ny > 0) lny = ny
893-
if (lnx*lny /= ng) then
894-
write(tmpstr,*) subname,' WARNING: grid2d size not consistent ',ng,lnx,lny
895-
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
896-
endif
887+
lnx = ng
888+
lny = 1
889+
if (nx > 0) lnx = nx
890+
if (ny > 0) lny = ny
891+
if (lnx*lny /= ng) then
892+
write(tmpstr,*) subname,' WARNING: grid2d size not consistent ',ng,lnx,lny
893+
call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO)
894+
endif
897895
end if
898896
deallocate(minIndexPTile, maxIndexPTile)
899897

mediator/med_phases_history_mod.F90

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,7 @@ subroutine med_phases_history_write_comp_aux(gcomp, compid, auxcomp, rc)
10621062
logical :: enable_auxfile
10631063
character(CL) :: time_units ! units of time variable
10641064
integer :: nx,ny ! global grid size
1065+
integer :: ntile ! number of tiles for tiled domain eg CSG
10651066
logical :: write_now ! if true, write time sample to file
10661067
real(r8) :: time_val ! time coordinate output
10671068
real(r8) :: time_bnds(2) ! time bounds output
@@ -1268,6 +1269,7 @@ subroutine med_phases_history_write_comp_aux(gcomp, compid, auxcomp, rc)
12681269
! Set shorthand variables
12691270
nx = is_local%wrap%nx(compid)
12701271
ny = is_local%wrap%ny(compid)
1272+
ntile = is_local%wrap%ntile(compid)
12711273

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

13091311
! end definition phase
@@ -1318,14 +1320,14 @@ subroutine med_phases_history_write_comp_aux(gcomp, compid, auxcomp, rc)
13181320
if (auxcomp%files(nf)%doavg) then
13191321
call med_io_write(auxcomp%files(nf)%io_file, auxcomp%files(nf)%FBaccum, whead(2), wdata(2), nx, ny, &
13201322
nt=auxcomp%files(nf)%nt, pre=trim(compname(compid))//'Imp', flds=auxcomp%files(nf)%flds, &
1321-
use_float=.true.,rc=rc)
1323+
use_float=.true., ntile=ntile, rc=rc)
13221324
if (ChkErr(rc,__LINE__,u_FILE_u)) return
13231325
call med_methods_FB_reset(auxcomp%files(nf)%FBaccum, value=czero, rc=rc)
13241326
if (ChkErr(rc,__LINE__,u_FILE_u)) return
13251327
else
13261328
call med_io_write(auxcomp%files(nf)%io_file, is_local%wrap%FBimp(compid,compid), whead(2), wdata(2), nx, ny, &
13271329
nt=auxcomp%files(nf)%nt, pre=trim(compname(compid))//'Imp', flds=auxcomp%files(nf)%flds, &
1328-
use_float=.true.,rc=rc)
1330+
use_float=.true., ntile=ntile, rc=rc)
13291331
if (ChkErr(rc,__LINE__,u_FILE_u)) return
13301332
end if
13311333

0 commit comments

Comments
 (0)