Re: Zonal/meridional area averaged variable plot in popmodel and MOC calculation

From: ranzhg <ranzhang9_at_nyahnyahspammersnyahnyah>
Date: Wed Jan 05 2011 - 23:07:21 MST

Dear Dennis Shea

Thank you for your kind replay, I attached the Atlantic MOC recalculated and the one directly output from the model (see the attached file), from the picture, we can see there are many differences between two pics, I don't know where I should improve the code. Any suggestion is appreciate.

the main part of code list below:

 ; ==============================================================
; compute MOC
; http://test.www.ncl.ucar.edu/Document/Functions/Built-in/moc_globe_atl.shtml
; ==============================================================
  TimeDateMOC = systemfunc("date")
  lat_aux_region2_start = nyaux
  ntr = n_transport_reg
  ilat_aux_grid = toint(lat_aux_grid)
  MOCGA = moc_globe_atl(lat_aux_grid,WORK1,WORK2,WORK3,tlat,REGION_MASK_LAT_AUX)
  printVarSummary(MOCGA)
               ; Atlantic
  do n=1,nyaux-1
       section = tlat .ge. lat_aux_grid(n-1) .and. tlat .lt. lat_aux_grid(n) .and. \
                 REGION_MASK_LAT_AUX(1,:,:).eq.1
       if (any(section) .and. n.lt.lat_aux_region2_start) then
           lat_aux_region2_start = n
       end if
  end do
  MOCnew(0,0,0,0:km-1,:) = (/ dim_cumsum(MOCGA(0,0,:,:),2) /)
  MOCnew(0,0,1,0:km-1,:) = (/ dim_cumsum(MOCGA(1,0,:,:),2) /)
  MOCnew(0,0,2,0:km-1,:) = (/ dim_cumsum(MOCGA(2,0,:,:),2) /)
  MOCnew(0,1,0,0:km-1,:) = (/ dim_cumsum(MOCGA(0,1,:,:),2) /)
  MOCnew(0,1,1,0:km-1,:) = (/ dim_cumsum(MOCGA(1,1,:,:),2) /)
  MOCnew(0,1,2,0:km-1,:) = (/ dim_cumsum(MOCGA(2,1,:,:),2) /)
  delete(WORK1)
  delete(WORK2)
  delete(WORK3)
 ; delete(MOCGA)
  wallClockElapseTime(TimeDateMOC, "MOC: Computed MOC",0)
; ==============================================================
; compute MOC addition at Atlantic southern boundary
; ==============================================================
  TimeDateMOC_moc_s = systemfunc("date")
  moc_s = new((/3,km/),float)
  moc_s = 0.0
  v_e = in->VVEL ; Eulerian-mean grid-y velocity
  v_i = in->VISOP ; Eddy-induced (bolus) grid-y velocity
  v_sm = in->VSUBM ; Eddy-induced (bolus) grid-y velocity
  dxu = in->DXU
  htn = in->HTN
  dz = in->dz
  WORK1 = new((/km,ny,nx/),double)
  WORK2 = new((/km,ny,nx/),double)
  WORK3 = new((/km,ny,nx/),double)
  dxuk = conform(WORK1,dxu,(/1,2/))
  htnk = conform(WORK1,htn,(/1,2/))
  WORK1 = 0.5 * v_e(0,:,:,:) * dxuk
  WORK2(:,:,1:nx-1) = WORK1(:,:,0:nx-2)
  WORK2(:,:,0) = 0.0
  WORK1 = WORK1+WORK2
  WORK2 = v_i(0,:,:,:) * htnk
  WORK3 = v_sm(0,:,:,:) * htnk
  wallClockElapseTime(TimeDateMOC_moc_s, "MOC: WORK1-3 for South: moc_s",0)
  rmlak0 = conform(WORK1, REGION_MASK_LAT_AUX(0,:,:), (/1,2/))
  rmlak1 = conform(WORK1, REGION_MASK_LAT_AUX(1,:,:), (/1,2/))
  j = lat_aux_region2_start
  TMP1 = where(rmlak1(:,j+1,:) .eq. 1,WORK1(:,j,:),0.0)
  TMP2 = where(rmlak1(:,j+1,:) .eq. 1,WORK2(:,j,:),0.0)
  TMP3 = where(rmlak1(:,j+1,:) .eq. 1,WORK3(:,j,:),0.0)
  moc_s(0,:) = tofloat(dim_sum(TMP1))
  moc_s(1,:) = tofloat(dim_sum(TMP2))
  moc_s(2,:) = tofloat(dim_sum(TMP3))
  delete(WORK1)
  delete(WORK2)
  delete(WORK3)
  delete(TMP1)
  delete(TMP2)
  delete(TMP3)
  wallClockElapseTime(TimeDateMOC_moc_s, "MOC: made moc_s",0)
  moc_s(:,km-1) = - dz(km-1) * moc_s(:,km-1)
  k = km-2
  do while(k.ge.0)
     moc_s(:,k) = moc_s(:,k+1) - dz(k) * moc_s(:,k)
     k=k-1
  end do
  wallClockElapseTime(TimeDateMOC_moc_s, "MOC: finalized moc_s",0)
; ==============================================================
; Add southern boundary for Atlantic only
; set dims == ntransport_req=2,moc_comp=3,km=60,nyaux=395
; ==============================================================
  moc_sn = conform(MOCnew(0,1,:,0:km-1,:),moc_s,(/0,1/))
  MOCnew(0,1,:,0:km-1,:) = MOCnew(0,1,:,0:km-1,:)+moc_sn
  TimeDate = systemfunc("date")
  print("finalized MOC, "+TimeDate)

Regards.
Ran

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

moc.jpg
Received on Wed Jan 5 23:07:46 2011

This archive was generated by hypermail 2.1.8 : Thu Jan 13 2011 - 09:24:21 MST