Skip to content

Commit

Permalink
fixes in chsum and debug scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Mandel committed Sep 1, 2010
1 parent d46d3eb commit be6d402
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion other/Matlab/util1_jan/private/file_name.m
Expand Up @@ -4,7 +4,7 @@
% Jan Mandel 22-apr-05

if num1>=0 & num2>=0,
id=sprintf('%s_%05i_%05i',name,num1,num2);
id=sprintf('%s_%06i_%05i',name,num1,num2);
elseif num1>=0 & num2<0,
id=sprintf('%s_%05i',name,num1);
elseif num1<0 & num2>=0,
Expand Down
27 changes: 14 additions & 13 deletions wrfv2_fire/phys/module_fr_sfire_driver.F
Expand Up @@ -480,13 +480,14 @@ subroutine sfire_driver_phys (ifun,need_lfn_update, &
pid=0
if(itimestep.le.10.or.mod(itimestep,10).eq.0)pid=itimestep ! print 1-10 then every 10th
!pid=itimestep
if(fire_print_file.gt.0)then
if(itimestep.le.fire_print_file.or.mod(itimestep,fire_print_file).eq.0)pid=itimestep ! print 1-fire_print_file then every fire_print_file-th
endif
if(ifun.eq.3)then
call print_chsum(ims,ime,kms,kme,jms,jme,ids,ide,kds,kde,jds,jde,ips,ipe,kps,kpe,jps,jpe,1,0,0,u,'u')
call print_chsum(ims,ime,kms,kme,jms,jme,ids,ide,kds,kde,jds,jde,ips,ipe,kps,kpe,jps,jpe,0,1,0,v,'v')
call print_chsum(ims,ime,kms,kme,jms,jme,ids,ide,kds,kde,jds,jde,ips,ipe,kps,kpe,jps,jpe,0,0,1,ph,'ph')
call print_chsum(id,ims,ime,kms,kme,jms,jme,ids,ide,kds,kde,jds,jde,ips,ipe,kps,kpe,jps,jpe,1,0,0,u,'u')
call print_chsum(id,ims,ime,kms,kme,jms,jme,ids,ide,kds,kde,jds,jde,ips,ipe,kps,kpe,jps,jpe,0,0,1,v,'v')
call print_chsum(id,ims,ime,kms,kme,jms,jme,ids,ide,kds,kde,jds,jde,ips,ipe,kps,kpe,jps,jpe,0,1,0,ph,'ph')
endif
! fake atm tile bounds
Expand Down Expand Up @@ -768,10 +769,10 @@ subroutine sfire_driver_phys (ifun,need_lfn_update, &
endif
enddo
call print_chsum(ims,ime,1,1,jms,jme,ids,ide,1,1,jds,jde,ips,ipe,1,1,jps,jpe,1,0,0,uah,'uah')
call print_chsum(ims,ime,1,1,jms,jme,ids,ide,1,1,jds,jde,ips,ipe,1,1,jps,jpe,0,1,0,vah,'vah')
call print_chsum(ifms,ifme,1,1,jfms,jfme,ifds,ifde,1,1,jfds,jfde,ifps,ifpe,1,1,jfps,jfpe,0,0,0,fp%vx,'uf')
call print_chsum(ifms,ifme,1,1,jfms,jfme,ifds,ifde,1,1,jfds,jfde,ifps,ifpe,1,1,jfps,jfpe,0,0,0,fp%vy,'vf')
call print_chsum(id,ims,ime,1,1,jms,jme,ids,ide,1,1,jds,jde,ips,ipe,1,1,jps,jpe,1,0,0,uah,'uah')
call print_chsum(id,ims,ime,1,1,jms,jme,ids,ide,1,1,jds,jde,ips,ipe,1,1,jps,jpe,0,0,1,vah,'vah')
call print_chsum(id,ifms,ifme,1,1,jfms,jfme,ifds,ifde,1,1,jfds,jfde,ifps,ifpe,1,1,jfps,jfpe,0,0,0,fp%vx,'uf')
call print_chsum(id,ifms,ifme,1,1,jfms,jfme,ifds,ifde,1,1,jfds,jfde,ifps,ifpe,1,1,jfps,jfpe,0,0,0,fp%vy,'vf')
#ifdef DEBUG_OUT
if(pid.gt.0)then
call write_array_m(ips,ipe1,jps,jpe,ims,ime,jms,jme,uah,'uah',pid)
Expand All @@ -796,10 +797,10 @@ subroutine sfire_driver_phys (ifun,need_lfn_update, &
endif
if(ifun.eq.6)then
call print_chsum(ifms,ifme,1,1,jfms,jfme,ifds,ifde,1,1,jfds,jfde,ifps,ifpe,1,1,jfps,jfpe,0,0,0,fgrnhfx,'fgrnhfx')
call print_chsum(ifms,ifme,1,1,jfms,jfme,ifds,ifde,1,1,jfds,jfde,ifps,ifpe,1,1,jfps,jfpe,0,0,0,fgrnqfx,'fgrnqfx')
call print_chsum(ims,ime,1,1,jms,jme,ids,ide,1,1,jds,jde,ips,ipe,1,1,jps,jpe,0,0,0,grnhfx,'grnhfx')
call print_chsum(ims,ime,1,1,jms,jme,ids,ide,1,1,jds,jde,ips,ipe,1,1,jps,jpe,0,0,0,grnqfx,'grnqfx')
call print_chsum(id,ifms,ifme,1,1,jfms,jfme,ifds,ifde,1,1,jfds,jfde,ifps,ifpe,1,1,jfps,jfpe,0,0,0,fgrnhfx,'fgrnhfx')
call print_chsum(id,ifms,ifme,1,1,jfms,jfme,ifds,ifde,1,1,jfds,jfde,ifps,ifpe,1,1,jfps,jfpe,0,0,0,fgrnqfx,'fgrnqfx')
call print_chsum(id,ims,ime,1,1,jms,jme,ids,ide,1,1,jds,jde,ips,ipe,1,1,jps,jpe,0,0,0,grnhfx,'grnhfx')
call print_chsum(id,ims,ime,1,1,jms,jme,ids,ide,1,1,jds,jde,ips,ipe,1,1,jps,jpe,0,0,0,grnqfx,'grnqfx')
#ifdef DEBUG_OUT
if(pid.gt.0)then
call write_array_m(ips,ipe,jps,jpe,ims,ime,jms,jme,grnhfx,'grnhfx',pid)
Expand Down
28 changes: 16 additions & 12 deletions wrfv2_fire/phys/module_fr_sfire_util.F
Expand Up @@ -1312,7 +1312,7 @@ subroutine print_id
call message(msg)
end subroutine print_id

subroutine print_chsum( &
subroutine print_chsum( id, &
ims,ime,kms,kme,jms,jme, & ! memory dims
ids,ide,kds,kde,jds,jde, & ! domain dims
ips,ipe,kps,kpe,jps,jpe, & ! patch or tile dims
Expand All @@ -1323,7 +1323,7 @@ subroutine print_chsum( &
USE module_dm
#endif

integer, intent(in):: &
integer, intent(in):: id, &
ims,ime,kms,kme,jms,jme, & ! memory dims
ids,ide,kds,kde,jds,jde, & ! domain dims
ips,ipe,kps,kpe,jps,jpe, & ! patch dims
Expand All @@ -1336,21 +1336,25 @@ subroutine print_chsum( &

!*** local
integer::lsum
integer::i,j,k,n,imax,jmax,kmax,iel,thread
integer::i,j,k,n,ipe1,jpe1,kpe1,iel,thread,is,js,ks
integer, save::psum,gsum
real::rel
equivalence(rel,iel)
character(len=256)msg

if(fire_print_msg.le.0)return

imax=ifval(ipe.eq.ide.and.istag.ne.0,ipe+1,ipe)
kmax=ifval(kpe.eq.kde.and.kstag.ne.0,kpe+1,kpe)
jmax=ifval(jpe.eq.jde.and.jstag.ne.0,jpe+1,jpe)
ipe1=ifval(ipe.eq.ide.and.istag.ne.0,ipe+1,ipe)
kpe1=ifval(kpe.eq.kde.and.kstag.ne.0,kpe+1,kpe)
jpe1=ifval(jpe.eq.jde.and.jstag.ne.0,jpe+1,jpe)
is=ifval(istag.ne.0,1,0)
ks=ifval(kstag.ne.0,1,0)
js=ifval(jstag.ne.0,1,0)

lsum=0
do j=jps,jmax
do k=kps,kmax
do i=ips,imax
do j=jps,jpe1
do k=kps,kpe1
do i=ips,ipe1
rel=a(i,k,j)
lsum=ieor(lsum,iel)
enddo
Expand All @@ -1359,7 +1363,7 @@ subroutine print_chsum( &

! get process sum over all threads
thread=0
!$ thread=omp_get_thread_num
!$ thread=omp_get_thread_num()
if(thread.eq.0)psum=0
!$OMP BARRIER
!$OMP CRITICAL(CHSUM)
Expand All @@ -1374,8 +1378,8 @@ subroutine print_chsum( &
#else
gsum = lsum
#endif
write(msg,1)name,ids,ide,kds,kde,jds,jde,gsum
1 format(a10,' dims',6i5,' chsum ',z8)
write(msg,1)id,name,ids,ide+is,kds,kde+ks,jds,jde+js,gsum
1 format(i6,1x,a10,' dims',6i5,' chsum ',z8.8)
call message(msg)
endif

Expand Down

0 comments on commit be6d402

Please sign in to comment.