--- MITgcm/verification/fizhi-gridalt-hs/code/fizhi_init_vars.F 2004/08/20 13:47:36 1.2 +++ MITgcm/verification/fizhi-gridalt-hs/code/fizhi_init_vars.F 2005/05/05 21:27:39 1.3 @@ -1,6 +1,7 @@ -C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/fizhi-gridalt-hs/code/fizhi_init_vars.F,v 1.2 2004/08/20 13:47:36 molod dead $ +C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/fizhi-gridalt-hs/code/fizhi_init_vars.F,v 1.3 2005/05/05 21:27:39 molod Exp $ C $Name: $ +#include "FIZHI_OPTIONS.h" subroutine fizhi_init_vars (myThid) c----------------------------------------------------------------------- c Routine to initialise the fizhi state. @@ -20,18 +21,19 @@ c Calls: dyn2phys (x4) c----------------------------------------------------------------------- implicit none -#include "CPP_OPTIONS.h" #include "SIZE.h" #include "fizhi_SIZE.h" -#include "land_SIZE.h" +#include "fizhi_land_SIZE.h" #include "GRID.h" #include "DYNVARS.h" #include "gridalt_mapping.h" #include "fizhi_coms.h" -#include "land_coms.h" +#include "fizhi_land_coms.h" +#include "fizhi_earth_coms.h" #include "EEPARAMS.h" #include "SURFACE.h" #include "PARAMS.h" +#include "chronos.h" integer myThid @@ -41,9 +43,12 @@ _RL windphy(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy) _RL udyntemp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) _RL vdyntemp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) + _RL tempphy(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy) integer i, j, L, bi, bj, Lbotij integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2 + logical alarm + external alarm im1 = 1-OLx im2 = sNx+OLx @@ -54,8 +59,19 @@ jdim1 = 1 jdim2 = sNy - IF ( startTime.EQ.0. .AND. nIter0.EQ.0 ) THEN - print *,' In fizhi_init_vars: Cold start ' +c First Check to see if we can start a fizhi experiment at current time +c All Fizhi alarms must be on for the first time step of a segment + + if( .not.alarm('moist') .or. .not.alarm('turb') .or. + . .not.alarm('radsw') .or. .not.alarm('radlw') ) then + print *,' Cant Start Fizhi experiment at ',nymd,' ',nhms + stop + endif + +C Deal Here with Variables that are on a Fizhi Pickup or need Initialization + + IF ( startTime.EQ.baseTime .AND. nIter0.EQ.0 ) THEN + print *,' In fizhi_init_vars: Beginning of New Experiment ' do bj = myByLo(myThid), myByHi(myThid) do bi = myBxLo(myThid), myBxHi(myThid) @@ -124,35 +140,139 @@ c Create initial fields on phys. grid - interpolate from dyn. grid call dyn2phys(udyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy, - . 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,1,uphy) + . 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,1,tempphy) +c Note: Interpolation gives bottom-up arrays (level 1 is bottom), +c Physics works top-down. so -> need to flip arrays + do L = 1,Nrphys + do j = 1,sNy + do i = 1,sNx + uphy(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj) + enddo + enddo + enddo call dyn2phys(vdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy, - . 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,1,vphy) + . 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,1,tempphy) + do L = 1,Nrphys + do j = 1,sNy + do i = 1,sNx + vphy(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj) + enddo + enddo + enddo call dyn2phys(theta,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy, - . 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,thphy) + . 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,tempphy) + do L = 1,Nrphys + do j = 1,sNy + do i = 1,sNx + thphy(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj) + enddo + enddo + enddo + call dyn2phys(salt,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy, - . 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,sphy) + . 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,tempphy) + do L = 1,Nrphys + do j = 1,sNy + do i = 1,sNx + sphy(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj) + enddo + enddo + enddo -c Now initialize tke, xlmt, khmt, xxmt, yymt, ctmt, zetamt, -c Now initialize land state too - tcanopy, etc... - do L = 1,Nrphys - do i = 1,nchp - tke(i,L,bi,bj) = 0. - xlmt(i,L,bi,bj) = 0. - khmt(i,L,bi,bj) = 0. +c Zero out fizhi tendency arrays on the fizhi grid + do L = 1,Nrphys + do j = 1,sNy + do i = 1,sNx + duphy(i,j,L,bi,bj) = 0. + dvphy(i,j,L,bi,bj) = 0. + dthphy(i,j,L,bi,bj) = 0. + dsphy(i,j,L,bi,bj) = 0. enddo - enddo -c Now initialize land state too - tcanopy, etc... ZERO FOR NOW, + enddo + enddo + +c Zero out fizhi tendency arrays on the dynamics grid + do L = 1,Nr + do j = jm1,jm2 + do i = im1,im2 + guphy(i,j,L,bi,bj) = 0. + gvphy(i,j,L,bi,bj) = 0. + gthphy(i,j,L,bi,bj) = 0. + gsphy(i,j,L,bi,bj) = 0. + enddo + enddo + enddo + +c Initialize vegetation tile tke, xlmt, khmt, xxmt, yymt, ctmt, zetamt, + if( (nhms.eq.nhms0) .and. (nymd.eq.nymd0) ) then + print *,' Cold Start: Zero out Turb second moments ' + do i = 1,nchp + ctmt(i,bi,bj) = 0. + xxmt(i,bi,bj) = 0. + yymt(i,bi,bj) = 0. + zetamt(i,bi,bj) = 0. + enddo + do L = 1,Nrphys + do i = 1,nchp + tke(i,L,bi,bj) = 0. + xlmt(i,L,bi,bj) = 0. + khmt(i,L,bi,bj) = 0. + enddo + enddo + else + print *,' Need initial Values for TKE - dont have them! ' + stop + endif + +c Now initialize vegetation tile land state too - tcanopy, etc... +c call fizhi_init_vegsurftiles( nymd,nhms, 'D', myThid ) +c Now initialize land state too - tcanopy, etc... SET FOR NOW, c READ CLIM FOR REAL - do i = 1,nchp - tcanopy(i) = 0. - tdeep(i) = 0. - ecanopy(i) = 0. - swetshal(i) = 0. - swetroot(i) = 0. - swetdeep(i) = 0. - capac(i) = 0. - snodep(i) = 0. - enddo + do i = 1,nchp + tcanopy(i,bi,bj) = 283. + tdeep(i,bi,bj) = 282.5 + ecanopy(i,bi,bj) = 2.e-2 + swetshal(i,bi,bj) = 0.6 + swetroot(i,bi,bj) = 0.5 + swetdeep(i,bi,bj) = 0.5 + capac(i,bi,bj) = 0. + snodep(i,bi,bj) = 0. + enddo + +c Now initialize fizhi arrays that will be on a pickup + print *,' Initialize fizhi arrays that will be on pickup ' + imstturblw(bi,bj) = 0 + imstturbsw(bi,bj) = 0 + iras(bi,bj) = 0 + nlwcld(bi,bj) = 0 + nlwlz(bi,bj) = 0 + nswcld(bi,bj) = 0 + nswlz(bi,bj) = 0 + do L = 1,Nrphys + do j = 1,sNy + do i = 1,sNx + swlz(i,j,L,bi,bj) = 0. + lwlz(i,j,L,bi,bj) = 0. + qliqavesw(i,j,L,bi,bj) = 0. + qliqavelw(i,j,L,bi,bj) = 0. + fccavesw(i,j,L,bi,bj) = 0. + fccavelw(i,j,L,bi,bj) = 0. + cldtot_sw(i,j,L,bi,bj) = 0. + cldras_sw(i,j,L,bi,bj) = 0. + cldlsp_sw(i,j,L,bi,bj) = 0. + cldtot_lw(i,j,L,bi,bj) = 0. + cldras_lw(i,j,L,bi,bj) = 0. + cldlsp_lw(i,j,L,bi,bj) = 0. + enddo + enddo + enddo + do j = 1,sNy + do i = 1,sNx + rainlsp(i,j,bi,bj) = 0. + raincon(i,j,bi,bj) = 0. + snowfall(i,j,bi,bj) = 0. + enddo + enddo enddo enddo @@ -161,8 +281,10 @@ print *,' In fizhi_init_vars: Read from restart ' C-- Read fizhi package state variables from pickup file - call fizhi_read_pickup( nIter0, myThid ) - + + call fizhi_read_pickup( nIter0, myThid ) + CALL FIZHI_READ_VEGTILES( nIter0, 'D', myThid ) + ENDIF return