📄 dynamics_vars.f90
字号:
ak(k) = a26(k) bk(k) = b26(k) enddo case (30)! CAM 30-Level setup *** ks = 12 do k=1,plev+1 ak(k) = a30(k) bk(k) = b30(k) enddo! *** Revised 32-L setup with ptop at 0.4 mb *** case (32) ks = 18 do k=1,plev+1 ak(k) = a32(k) bk(k) = b32(k) enddo! *** Revised 55-L setup with ptop at 0.01 mb *** case (55) ks = 41 do k=1,plev+1 ak(k) = a55(k) bk(k) = b55(k) enddo! *** Others *** case (64) ks = 51 do k=1,plev+1 ak(k) = a64(k) bk(k) = b64(k) enddo case (96) ks = 77 do k=1,plev+1 ak(k) = a96(k) bk(k) = b96(k) enddo end select ptop = ak(1) pint = ak(ks+1) return!EOC end subroutine set_eta!-----------------------------------------------------------------------!----------------------------------------------------------------------- !BOP! !ROUTINE: rayf_init --- Initialization for Rayleigh friction!! !INTERFACE:subroutine rayf_init! !USES: implicit none!------------------------------Commons----------------------------------! !DESCRIPTION:! ! {\bf Purpose:} Initialization of the Rayleigh friction! ! !REVISION HISTORY: ! 00.01.10 Grant Creation using code from SJ Lin! 01.03.26 Sawyer Added ProTeX documentation! 01.06.06 Sawyer Modified for dynamics_vars!!EOP!-----------------------------------------------------------------------!BOC!! !LOCAL VARIABLES: integer k, tdt real(r8) c1 real(r8) pc real(r8) press(plev) tdt = int(dtime) ! dtime is a variable internal to this module write(6,*) 'Time step (seconds) for Rayleigh friction =',tdt write(6,*) 'Level, pressure, rfac:'! e-folding time if (ak(1) .le. 50.) then c1 = 1. / (5.*24*3600.) else c1 = 1. / (14.*24.*3600.) endif pc = max(10., ak(1)) do k = 1, ks press(k) = 0.5*(ak(k) + ak(k+1)) rfac(k) = tdt*c1*(1.+tanh(1.5*log10(pc/press(k)))) write(6,*) k, press(k), rfac(k) enddo return!EOCend subroutine rayf_init!-----------------------------------------------------------------------!----------------------------------------------------------------------- !BOP! !ROUTINE: hswf_init --- Initialization for Held-Suarez!! !INTERFACE:subroutine hswf_init! !USES: implicit none! !DESCRIPTION:! ! {\bf Purpose:} Initialization of the Held-Suarez Forcing! ! !REVISION HISTORY: ! 01.06.06 Sawyer Creation!!EOP!-----------------------------------------------------------------------!BOC!! !LOCAL VARIABLES: integer j, k real (r8) c1, pc, tmp real (r8) pdt ! Time-step in seconds pdt = int(dtime) ! dtime is a variable internal to this module do j=2,plat-1 sinp2(j) = sinp(j)**2 cosp2(j) = cosp(j)**2 enddo sinp2(1) = ( 0.5*(-1.+sine(2)) )**2 sinp2(plat) = sinp2(1) cosp2(1) = ( 0.5*cose(2) ) **2 cosp2(plat) = cosp2(1) do j=1,plat cosp4(j) = cosp2(j)**2 enddo if ( rayf ) then c1 = 1. / (12.*3600) pc = 1. do k=1,ks ! ks is a dynamics_vars variable set by set_eta tmp = 0.5*(ak(k) + ak(k+1)) rf(k) = c1*(1.+tanh(1.5*log10(pc/tmp))) rf(k) = 1./(1.+pdt*rf(k)) enddo endif return!EOCend subroutine hswf_init!-----------------------------------------------------------------------!----------------------------------------------------------------------- !BOP! !ROUTINE: dynpkg_init --- Initialization for dynamics package!! !INTERFACE:subroutine dynpkg_init! !USES: implicit none! !DESCRIPTION:! ! {\bf Purpose:} Initialization of the Rayleigh friction! ! !REVISION HISTORY: ! 00.01.10 Grant Creation using code from SJ Lin! 01.03.26 Sawyer Added ProTeX documentation! 01.06.06 Sawyer Modified for dynamics_vars!!EOP!-----------------------------------------------------------------------!BOC!! !LOCAL VARIABLES: integer i, j, imh real (r8) zam5, zamda if( iord <= 2 ) then icd = 1 else icd = -2 endif if( jord <= 2 ) then jcd = 1 else jcd = -2 endif#if defined( SPMD )!! Calculate the ghost region sizes for the SPMD version (tricky stuff)! ng_c = min(abs(jcd ), 2) ng_d = min(abs(jord), 3) ! SJL: number of max ghost latitudes ng_d = max(ng_d, 2) ng_s = max( ng_c+1, ng_d )#else ng_c = 0 ng_d = 0 ! No ghosting necessary for pure SMP runs ng_s = 0#endif!! Pole cap area and inverse acap = plon*(1.+sine(2)) / dp rcap = 1.d0 / acap imh = plon/2 if(plon .ne. 2*imh) then write(6,*) 'plon must be an even integer' stop endif ! Define logitude at the center of the volume! i=1, Zamda = -pi do i=1,imh zam5 = ((i-1)-0.5d0) * dl cosl5(i) = cos(zam5) cosl5(i+imh) = -cosl5(i) sinl5(i) = sin(zam5) sinl5(i+imh) = -sinl5(i) zamda = (i-1)*dl coslon(i) = cos(zamda) coslon(i+imh) = -coslon(i) sinlon(i) = sin(zamda) sinlon(i+imh) = -sinlon(i) enddo do j=2,plat-1 acosp(j) = 1.d0 / cosp(j) enddo acosp( 1) = rcap * plon acosp(plat) = rcap * plon return!EOCend subroutine dynpkg_init!-----------------------------------------------------------------------!-----------------------------------------------------------------------!BOP! !ROUTINE: d_split --- find proper value for nsplit if not specified!! !INTERFACE: subroutine d_split(nsplit_in)!! !USES: implicit none! !INPUT PARAMETERS: integer, intent(in) :: nsplit_in ! Small time steps in dtime! !DESCRIPTION:!! If nsplit=0 (module variable) then determine a good value ! for ns (used in dynpkg) based on resolution and the large-time-step ! (pdt). The user may have to set this manually if instability occurs.!! !REVISION HISTORY:! 00.10.19 Lin Creation! 01.03.26 Sawyer ProTeX documentation! 01.06.10 Sawyer Modified for dynamics_init framework!!EOP!-----------------------------------------------------------------------!BOC! !LOCAL VARIABLES: real (r8) pdt ! Time-step in seconds ! Negative dt (backward in time ! integration) is allowed real (r8) dim real (r8) dim0 ! base dimension real (r8) dt0 ! base time step real (r8) ns0 ! base nsplit for base dimension parameter ( dim0 = 180. ) parameter ( dt0 = 1800. ) parameter ( ns0 = 4. ) if ( nsplit_in == 0 ) then pdt = int(dtime) ! dtime is a variable internal to this module dim = max ( plon, 2*(plat-1) ) ns = int ( ns0*abs(pdt)*dim/(dt0*dim0) + 0.75 ) ns = max ( 1, ns ) ! for cases in which dt or dim is too small else ns = nsplit_in endif write(6,*) 'Lagrangian time splits (NSPLIT) =', ns return!EOC end subroutine d_split!---------------------------------------------------------------------end module dynamics_vars
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -