subroutine lmd_swfrac_tile (Istr,Iend,Jstr,Jend, Zscale,Z,swdk) implicit none integer*4 LLm,Lm,MMm,Mm,N, LLm0,MMm0 parameter (LLm0=503, MMm0=601, N=42) parameter (LLm=LLm0, MMm=MMm0) integer*4 Lmmpi,Mmmpi,iminmpi,imaxmpi,jminmpi,jmaxmpi common /comm_setup_mpi1/ Lmmpi,Mmmpi common /comm_setup_mpi2/ iminmpi,imaxmpi,jminmpi,jmaxmpi integer*4 NSUB_X, NSUB_E, NPP integer*4 NP_XI, NP_ETA, NNODES parameter (NP_XI=2, NP_ETA=2, NNODES=NP_XI*NP_ETA) parameter (NPP=1) parameter (NSUB_X=1, NSUB_E=1) integer*4 NWEIGHT parameter (NWEIGHT=1000) integer*4 stdout, Np, padd_X,padd_E common /stdout/stdout parameter (Np=N+1) parameter (Lm=(LLm+NP_XI-1)/NP_XI, Mm=(MMm+NP_ETA-1)/NP_ETA) parameter (padd_X=(Lm+2)/2-(Lm+1)/2) parameter (padd_E=(Mm+2)/2-(Mm+1)/2) integer*4 NSA, N2d,N3d, size_XI,size_ETA integer*4 se,sse, sz,ssz parameter (NSA=28) parameter (size_XI=7+(Lm+NSUB_X-1)/NSUB_X) parameter (size_ETA=7+(Mm+NSUB_E-1)/NSUB_E) parameter (sse=size_ETA/Np, ssz=Np/size_ETA) parameter (se=sse/(sse+ssz), sz=1-se) parameter (N2d=size_XI*(se*size_ETA+sz*Np)) parameter (N3d=size_XI*size_ETA*Np) real Vtransform parameter (Vtransform=2) integer*4 NT, NTA, itemp, NTot integer*4 ntrc_temp, ntrc_salt, ntrc_pas, ntrc_bio, ntrc_sed integer*4 ntrc_subs, ntrc_substot parameter (itemp=1) parameter (ntrc_temp=1) parameter (ntrc_salt=1) parameter (ntrc_pas=0) parameter (ntrc_bio=0) parameter (ntrc_subs=0, ntrc_substot=0) parameter (ntrc_sed=0) parameter (NTA=itemp+ntrc_salt) parameter (NT=itemp+ntrc_salt+ntrc_pas+ntrc_bio+ntrc_sed) parameter (NTot=NT) integer*4 ntrc_diats, ntrc_diauv, ntrc_diabio integer*4 ntrc_diavrt, ntrc_diaek, ntrc_diapv integer*4 ntrc_diaeddy, ntrc_surf & , isalt parameter (isalt=itemp+1) parameter (ntrc_diabio=0) parameter (ntrc_diats=0) parameter (ntrc_diauv=0) parameter (ntrc_diavrt=0) parameter (ntrc_diaek=0) parameter (ntrc_diapv=0) parameter (ntrc_diaeddy=0) parameter (ntrc_surf=0) real dt, dtfast, time, time2, time_start, tdays, start_time integer*4 ndtfast, iic, kstp, krhs, knew, next_kstp & , iif, nstp, nrhs, nnew, nbstep3d logical PREDICTOR_2D_STEP common /time_indices/ dt,dtfast, time, time2,time_start, tdays, & ndtfast, iic, kstp, krhs, knew, next_kstp, & start_time, & iif, nstp, nrhs, nnew, nbstep3d, & PREDICTOR_2D_STEP real time_avg, time2_avg, rho0 & , rdrg, rdrg2, Cdb_min, Cdb_max, Zobt & , xl, el, visc2, visc4, gamma2 real theta_s, theta_b, Tcline, hc real sc_w(0:N), Cs_w(0:N), sc_r(N), Cs_r(N) real rx0, rx1 real tnu2(NT),tnu4(NT) real weight(6,0:NWEIGHT) real x_sponge, v_sponge real tauT_in, tauT_out, tauM_in, tauM_out integer*4 numthreads, ntstart, ntimes, ninfo & , nfast, nrrec, nrst, nwrt & , ntsavg, navg logical ldefhis logical got_tini(NT) common /scalars_main/ & time_avg, time2_avg, rho0, rdrg, rdrg2 & , Zobt, Cdb_min, Cdb_max & , xl, el, visc2, visc4, gamma2 & , theta_s, theta_b, Tcline, hc & , sc_w, Cs_w, sc_r, Cs_r & , rx0, rx1 & , tnu2, tnu4 & , weight & , x_sponge, v_sponge & , tauT_in, tauT_out, tauM_in, tauM_out & , numthreads, ntstart, ntimes, ninfo & , nfast, nrrec, nrst, nwrt & , ntsavg, navg & , got_tini & , ldefhis logical synchro_flag common /sync_flag/ synchro_flag integer*4 may_day_flag integer*4 tile_count, first_time, bc_count common /communicators_i/ & may_day_flag, tile_count, first_time, bc_count real hmin, hmax, grdmin, grdmax, Cu_min, Cu_max common /communicators_r/ & hmin, hmax, grdmin, grdmax, Cu_min, Cu_max real lonmin, lonmax, latmin, latmax common /communicators_lonlat/ & lonmin, lonmax, latmin, latmax real*8 Cu_Adv3d, Cu_W, Cu_Nbq_X, Cu_Nbq_Y, Cu_Nbq_Z integer*4 i_cx_max, j_cx_max, k_cx_max common /diag_vars/ Cu_Adv3d, Cu_W, & i_cx_max, j_cx_max, k_cx_max real*8 volume, avgke, avgpe, avgkp, bc_crss common /communicators_rq/ & volume, avgke, avgpe, avgkp, bc_crss real*4 CPU_time(0:31,0:NPP) integer*4 proc(0:31,0:NPP),trd_count common /timers_roms/CPU_time,proc,trd_count logical EAST_INTER2, WEST_INTER2, NORTH_INTER2, SOUTH_INTER2 logical EAST_INTER, WEST_INTER, NORTH_INTER, SOUTH_INTER logical CORNER_SW,CORNER_NW,CORNER_NE,CORNER_SE integer*4 mynode, mynode2, ii,jj, p_W,p_E,p_S,p_N, p_SW,p_SE, & p_NW,p_NE,NNODES2 common /comm_setup/ mynode, mynode2, ii,jj, p_W,p_E,p_S,p_N, & p_SW,p_SE, p_NW,p_NE, EAST_INTER, WEST_INTER, NORTH_INTER, & SOUTH_INTER, EAST_INTER2, WEST_INTER2, NORTH_INTER2, & SOUTH_INTER2, & CORNER_SW,CORNER_NW,CORNER_NE,CORNER_SE,NNODES2 real pi, deg2rad, rad2deg parameter (pi=3.14159265358979323846D0, deg2rad=pi/180.D0, & rad2deg=180.D0/pi) real Eradius, Erotation, g, day2sec,sec2day, jul_off, & year2day,day2year parameter (Eradius=6371315.0D0, Erotation=7.292115090D-5, & day2sec=86400.D0, sec2day=1.D0/86400.D0, & year2day=365.25D0, day2year=1.D0/365.25D0, & jul_off=2440000.D0) parameter (g=9.81D0) real Cp parameter (Cp=3985.0D0) real vonKar parameter (vonKar=0.41D0) real spval parameter (spval=-999.0D0) logical mask_val parameter (mask_val = .true.) integer*4 Jwtype(-1:Lm+2+padd_X,-1:Mm+2+padd_E) common /nils_jerlov/ Jwtype integer*4 Istr,Iend,Jstr,Jend, i,j,indx real Zscale, Z(Istr-2:Iend+2,Jstr-2:Jend+2), & swdk(Istr-2:Iend+2,Jstr-2:Jend+2) integer*4 lmd_Jwt real lmd_mu1(5), lmd_mu2(5), lmd_r1(5), cff1, cff2, cff3 ,cff4 lmd_mu1(1)=0.35D0 lmd_mu1(2)=0.6D0 lmd_mu1(3)=1.0D0 lmd_mu1(4)=1.5D0 lmd_mu1(5)=1.4D0 lmd_mu2(1)=23.0D0 lmd_mu2(2)=20.0D0 lmd_mu2(3)=17.0D0 lmd_mu2(4)=14.0D0 lmd_mu2(5)=7.9D0 lmd_r1(1)=0.58D0 lmd_r1(2)=0.62D0 lmd_r1(3)=0.67D0 lmd_r1(4)=0.77D0 lmd_r1(5)=0.78D0 lmd_Jwt=1 if (iic.eq.ntstart) then do j=Jstr,Jend do i=Istr,Iend Jwtype(i,j)=lmd_Jwt enddo enddo endif do j=Jstr,Jend do i=Istr,Iend indx=Jwtype(i,j) cff1=Z(i,j)*Zscale/lmd_mu1(indx) cff2=Z(i,j)*Zscale/lmd_mu2(indx) if (cff1.ge.-20.D0) then cff3=lmd_r1(indx) *exp(cff1) else cff3=0.D0 endif if (cff2.ge.-20.D0) then cff4=(1.D0-lmd_r1(indx)) *exp(cff2) else cff4=0.D0 endif swdk(i,j)=cff3+cff4 enddo enddo return end subroutine lmd_swfrac_ER_tile (Istr,Iend,Jstr,Jend, Zscale,Z,swdk) implicit none integer*4 LLm,Lm,MMm,Mm,N, LLm0,MMm0 parameter (LLm0=503, MMm0=601, N=42) parameter (LLm=LLm0, MMm=MMm0) integer*4 Lmmpi,Mmmpi,iminmpi,imaxmpi,jminmpi,jmaxmpi common /comm_setup_mpi1/ Lmmpi,Mmmpi common /comm_setup_mpi2/ iminmpi,imaxmpi,jminmpi,jmaxmpi integer*4 NSUB_X, NSUB_E, NPP integer*4 NP_XI, NP_ETA, NNODES parameter (NP_XI=2, NP_ETA=2, NNODES=NP_XI*NP_ETA) parameter (NPP=1) parameter (NSUB_X=1, NSUB_E=1) integer*4 NWEIGHT parameter (NWEIGHT=1000) integer*4 stdout, Np, padd_X,padd_E common /stdout/stdout parameter (Np=N+1) parameter (Lm=(LLm+NP_XI-1)/NP_XI, Mm=(MMm+NP_ETA-1)/NP_ETA) parameter (padd_X=(Lm+2)/2-(Lm+1)/2) parameter (padd_E=(Mm+2)/2-(Mm+1)/2) integer*4 NSA, N2d,N3d, size_XI,size_ETA integer*4 se,sse, sz,ssz parameter (NSA=28) parameter (size_XI=7+(Lm+NSUB_X-1)/NSUB_X) parameter (size_ETA=7+(Mm+NSUB_E-1)/NSUB_E) parameter (sse=size_ETA/Np, ssz=Np/size_ETA) parameter (se=sse/(sse+ssz), sz=1-se) parameter (N2d=size_XI*(se*size_ETA+sz*Np)) parameter (N3d=size_XI*size_ETA*Np) real Vtransform parameter (Vtransform=2) integer*4 NT, NTA, itemp, NTot integer*4 ntrc_temp, ntrc_salt, ntrc_pas, ntrc_bio, ntrc_sed integer*4 ntrc_subs, ntrc_substot parameter (itemp=1) parameter (ntrc_temp=1) parameter (ntrc_salt=1) parameter (ntrc_pas=0) parameter (ntrc_bio=0) parameter (ntrc_subs=0, ntrc_substot=0) parameter (ntrc_sed=0) parameter (NTA=itemp+ntrc_salt) parameter (NT=itemp+ntrc_salt+ntrc_pas+ntrc_bio+ntrc_sed) parameter (NTot=NT) integer*4 ntrc_diats, ntrc_diauv, ntrc_diabio integer*4 ntrc_diavrt, ntrc_diaek, ntrc_diapv integer*4 ntrc_diaeddy, ntrc_surf & , isalt parameter (isalt=itemp+1) parameter (ntrc_diabio=0) parameter (ntrc_diats=0) parameter (ntrc_diauv=0) parameter (ntrc_diavrt=0) parameter (ntrc_diaek=0) parameter (ntrc_diapv=0) parameter (ntrc_diaeddy=0) parameter (ntrc_surf=0) real dt, dtfast, time, time2, time_start, tdays, start_time integer*4 ndtfast, iic, kstp, krhs, knew, next_kstp & , iif, nstp, nrhs, nnew, nbstep3d logical PREDICTOR_2D_STEP common /time_indices/ dt,dtfast, time, time2,time_start, tdays, & ndtfast, iic, kstp, krhs, knew, next_kstp, & start_time, & iif, nstp, nrhs, nnew, nbstep3d, & PREDICTOR_2D_STEP real time_avg, time2_avg, rho0 & , rdrg, rdrg2, Cdb_min, Cdb_max, Zobt & , xl, el, visc2, visc4, gamma2 real theta_s, theta_b, Tcline, hc real sc_w(0:N), Cs_w(0:N), sc_r(N), Cs_r(N) real rx0, rx1 real tnu2(NT),tnu4(NT) real weight(6,0:NWEIGHT) real x_sponge, v_sponge real tauT_in, tauT_out, tauM_in, tauM_out integer*4 numthreads, ntstart, ntimes, ninfo & , nfast, nrrec, nrst, nwrt & , ntsavg, navg logical ldefhis logical got_tini(NT) common /scalars_main/ & time_avg, time2_avg, rho0, rdrg, rdrg2 & , Zobt, Cdb_min, Cdb_max & , xl, el, visc2, visc4, gamma2 & , theta_s, theta_b, Tcline, hc & , sc_w, Cs_w, sc_r, Cs_r & , rx0, rx1 & , tnu2, tnu4 & , weight & , x_sponge, v_sponge & , tauT_in, tauT_out, tauM_in, tauM_out & , numthreads, ntstart, ntimes, ninfo & , nfast, nrrec, nrst, nwrt & , ntsavg, navg & , got_tini & , ldefhis logical synchro_flag common /sync_flag/ synchro_flag integer*4 may_day_flag integer*4 tile_count, first_time, bc_count common /communicators_i/ & may_day_flag, tile_count, first_time, bc_count real hmin, hmax, grdmin, grdmax, Cu_min, Cu_max common /communicators_r/ & hmin, hmax, grdmin, grdmax, Cu_min, Cu_max real lonmin, lonmax, latmin, latmax common /communicators_lonlat/ & lonmin, lonmax, latmin, latmax real*8 Cu_Adv3d, Cu_W, Cu_Nbq_X, Cu_Nbq_Y, Cu_Nbq_Z integer*4 i_cx_max, j_cx_max, k_cx_max common /diag_vars/ Cu_Adv3d, Cu_W, & i_cx_max, j_cx_max, k_cx_max real*8 volume, avgke, avgpe, avgkp, bc_crss common /communicators_rq/ & volume, avgke, avgpe, avgkp, bc_crss real*4 CPU_time(0:31,0:NPP) integer*4 proc(0:31,0:NPP),trd_count common /timers_roms/CPU_time,proc,trd_count logical EAST_INTER2, WEST_INTER2, NORTH_INTER2, SOUTH_INTER2 logical EAST_INTER, WEST_INTER, NORTH_INTER, SOUTH_INTER logical CORNER_SW,CORNER_NW,CORNER_NE,CORNER_SE integer*4 mynode, mynode2, ii,jj, p_W,p_E,p_S,p_N, p_SW,p_SE, & p_NW,p_NE,NNODES2 common /comm_setup/ mynode, mynode2, ii,jj, p_W,p_E,p_S,p_N, & p_SW,p_SE, p_NW,p_NE, EAST_INTER, WEST_INTER, NORTH_INTER, & SOUTH_INTER, EAST_INTER2, WEST_INTER2, NORTH_INTER2, & SOUTH_INTER2, & CORNER_SW,CORNER_NW,CORNER_NE,CORNER_SE,NNODES2 real pi, deg2rad, rad2deg parameter (pi=3.14159265358979323846D0, deg2rad=pi/180.D0, & rad2deg=180.D0/pi) real Eradius, Erotation, g, day2sec,sec2day, jul_off, & year2day,day2year parameter (Eradius=6371315.0D0, Erotation=7.292115090D-5, & day2sec=86400.D0, sec2day=1.D0/86400.D0, & year2day=365.25D0, day2year=1.D0/365.25D0, & jul_off=2440000.D0) parameter (g=9.81D0) real Cp parameter (Cp=3985.0D0) real vonKar parameter (vonKar=0.41D0) real spval parameter (spval=-999.0D0) logical mask_val parameter (mask_val = .true.) integer*4 Jwtype(-1:Lm+2+padd_X,-1:Mm+2+padd_E) common /nils_jerlov/ Jwtype integer*4 Istr,Iend,Jstr,Jend, i,j,indx integer*4 imin,imax,jmin,jmax real Zscale, Z(Istr-2:Iend+2,Jstr-2:Jend+2), & swdk(Istr-2:Iend+2,Jstr-2:Jend+2) integer*4 lmd_Jwt real lmd_mu1(5), lmd_mu2(5), lmd_r1(5), cff1, cff2, cff3 ,cff4 lmd_mu1(1)=0.35D0 lmd_mu1(2)=0.6D0 lmd_mu1(3)=1.0D0 lmd_mu1(4)=1.5D0 lmd_mu1(5)=1.4D0 lmd_mu2(1)=23.0D0 lmd_mu2(2)=20.0D0 lmd_mu2(3)=17.0D0 lmd_mu2(4)=14.0D0 lmd_mu2(5)=7.9D0 lmd_r1(1)=0.58D0 lmd_r1(2)=0.62D0 lmd_r1(3)=0.67D0 lmd_r1(4)=0.77D0 lmd_r1(5)=0.78D0 lmd_Jwt=1 if (.not.WEST_INTER) then imin=Istr else imin=Istr-1 endif if (.not.EAST_INTER) then imax=Iend else imax=Iend+1 endif if (.not.SOUTH_INTER) then jmin=Jstr else jmin=Jstr-1 endif if (.not.NORTH_INTER) then jmax=Jend else jmax=Jend+1 endif if (iic.eq.ntstart) then do j=jmin,jmax do i=imin,imax Jwtype(i,j)=lmd_Jwt enddo enddo endif do j=jmin,jmax do i=imin,imax indx=Jwtype(i,j) cff1=Z(i,j)*Zscale/lmd_mu1(indx) cff2=Z(i,j)*Zscale/lmd_mu2(indx) if (cff1.ge.-20.D0) then cff3=lmd_r1(indx) *exp(cff1) else cff3=0.D0 endif if (cff2.ge.-20.D0) then cff4=(1.D0-lmd_r1(indx)) *exp(cff2) else cff4=0.D0 endif swdk(i,j)=cff3+cff4 enddo enddo return end