58 REAL(sp),
ALLOCATABLE,
TARGET ::
c_lcl(:)
61 REAL(sp),
ALLOCATABLE,
TARGET ::
h_lcl(:)
64 INTEGER,
ALLOCATABLE,
TARGET ::
n_spg(:)
68 PRIVATE :: sigma_geometric, sigma_generalized, sigma_tanh
76 INTEGER I,J,IERR,STATUS,SENDID
80 REAL(DP) VX1,VY1,VX2,VY2,VX3,VY3
81 REAL(DP) EVX12,EVX13,EVX23,EVY12,EVY13,EVY23,EVXY
82 REAL(DP) VX12,VY12,VX23,VY23,VX31,VY31
86 REAL(SP),
allocatable :: xc_buf(:), lonc_buf(:)
87 REAL(SP),
allocatable :: yc_buf(:), latc_buf(:)
106 vx(0) = 0.0_sp ;
vy(0) = 0.0_sp
120 & ,projection_reference,
lonc(1:nt),
latc(1:nt),nt)
136 if (horizontal_mixing_kind .eq. sttc)
THEN 140 write(ipt,*)
"! Setting Staticly Variable viscosity" 146 else if(horizontal_mixing_kind .eq. cnstnt)
THEN 148 cc_hvc=horizontal_mixing_coefficient
150 nn_hvc=horizontal_mixing_coefficient
155 &(
"HORIZONTAL_MIXING_KIND ERROR",&
156 &
"This should not happen")
168 if (bottom_roughness_kind .eq. sttc)
THEN 172 write(ipt,*)
"! Setting Staticly Variable Bottom Roughness" 177 else if(bottom_roughness_kind .eq. cnstnt)
THEN 179 cc_z0b = bottom_roughness_lengthscale
184 &(
"HORIZONTAL_MIXING_KIND ERROR",&
185 &
"This should not happen")
200 hmax = maxval(
h_lcl(1:mt))
201 hmin = minval(
h_lcl(1:mt))
223 cor = 2.*7.292e-5_sp * sin(
cor * deg2rad)
226 IF(.NOT. equator_beta_plane)
THEN 227 WHERE(
cor < 1.e-5_sp .AND.
cor > 0.0_sp)
cor = 1.e-5_sp
228 WHERE(
cor > -1.e-5_sp .AND.
cor < 0.0_sp)
cor = -1.e-5_sp
259 REAL(SP) TEMP,DTMP,C_SPONGE
260 INTEGER :: I1, I, SENDER, IERR
261 REAL(DP) X1_DP,Y1_DP,X2_DP,Y2_DP,DTMP_DP
277 dtmp=sqrt(dtmp)/
r_spg(i1)
279 IF(dtmp <= 1.0_sp)
THEN 280 c_sponge=
c_spg(i1)*(1.0_sp-dtmp)
301 REAL(SP),
ALLOCATABLE :: XL(:),YL(:)
305 REAL(SP),
allocatable :: x_buf(:), lon_buf(:)
306 REAL(SP),
allocatable :: y_buf(:), lat_buf(:)
312 IF (grid_file_units ==
'degrees')
THEN 322 & projection_reference,
vx(1:mt),
vy(1:mt),mt)
329 CALL fatal_error(
'You must specify a valid projection reference'&
330 &,
'and compile with PROJ to use files with latitude and longitue in cartesian mode')
334 ELSE IF(grid_file_units ==
'meters')
THEN 346 & projection_reference,
lon(1:mt),
lat(1:mt),mt)
352 CALL fatal_error(
'UNRECOGNIZED GRID_FILE_UNITS: '//trim(grid_file_units))
409 REAL(SP):: DR,RCL,RCU
415 WRITE(ipt,*)
"===================" 416 WRITE(ipt,*)
" SET_SIGMA IO" 417 WRITE(ipt,*)
" STYPE = "//trim(stype)
418 WRITE(ipt,*)
" P_SIGMA = ", p_sigma
419 WRITE(ipt,*)
" KB = ", kb
420 WRITE(ipt,*)
"===================" 430 IF(p_sigma > 1 .AND. mod(kb,2) == 0) &
431 CALL fatal_error(
'SETUP_SIGMA: COORDINATE TYPE:'//trim(stype)&
432 &,
'kb shoude be an odd number for this type of sigma coordinates....' )
436 CASE(stype_geometric)
439 IF(p_sigma > 1 .AND. mod(kb,2) == 0) &
440 CALL fatal_error(
'SETUP_SIGMA: COORDINATE TYPE:'//trim(stype)&
441 &,
'kb shoude be an odd number for this type of sigma coordinates....' )
450 CASE(stype_generalized)
452 CALL sigma_generalized
462 CALL fatal_error(
"SET_SIGMA: REACHED DEFAULT CASE FOR SIGMA COOR& 474 SUBROUTINE sigma_geometric
481 ztmp(k) = -((k-1)/float(kb-1))**p_sigma
485 ztmp(k) = -((k-1)/float((kb+1)/2-1))**p_sigma/2
488 ztmp(k) = ((kb-k)/float((kb+1)/2-1))**p_sigma/2-1.0
500 z1(i,k)=(
z(
nv(i,1),k)+
z(
nv(i,2),k)+
z(
nv(i,3),k))/3.0_sp
503 END SUBROUTINE sigma_geometric
505 SUBROUTINE sigma_generalized
509 REAL(SP):: DR,RCL,RCU
523 z(i,k+1)=(x1+x2)/x3-1.0_sp
526 dr=(
h(i)-duu-dll)/
h(i)/(kb-ku-kl-1)
531 z(i,k)=
z(i,k-1)-zku(k-1)/
h(i)
541 z(i,k)=
z(i,k-1)-zkl(kk)/
h(i)
548 z1(i,k)=(
z(
nv(i,1),k)+
z(
nv(i,2),k)+
z(
nv(i,3),k))/3.0_sp
551 END SUBROUTINE sigma_generalized
553 SUBROUTINE sigma_tanh
567 z(i,k+1)=(x1+x2)/x3-1.0_sp
570 z1(i,k+1)=(x1+x2)/x3-1.0_sp
573 END SUBROUTINE sigma_tanh
645 dz(i,k) =
z(i,k)-
z(i,k+1)
646 zz(i,k) = .5_sp*(
z(i,k)+
z(i,k+1))
650 zz1(i,k) = .5_sp*(
z1(i,k)+
z1(i,k+1))
655 zz(i,kb) = 2.0_sp*
zz(i,kb-1)-
zz(i,kb-2)
658 zz1(i,kb) = 2.0_sp*
zz1(i,kb-1)-
zz1(i,kb-2)
672 dzz1(:,kbm1) = 0.0_sp
681 WRITE(ipt,*)
'! SIGMA LAYER INFO ' 682 WRITE(ipt,*)
"SIGMA TYPE:",trim(stype)
687 WRITE(ipt,80) k,
z(1,k),
zz(1,k),
dz(1,k),
dzz(1,k)
691 WRITE(ipt,80) k,
z(1,k),
zz(1,k),
dz(1,k),
dzz(1,k)
693 CASE(stype_geometric)
695 WRITE(ipt,80) k,
z(1,k),
zz(1,k),
dz(1,k),
dzz(1,k)
699 WRITE(ipt,80) k,
z(1,k),
zz(1,k),
dz(1,k),
dzz(1,k)
701 CASE(stype_generalized)
702 WRITE(ipt,*)
"SET CASE SPECIFIC GENERALIZED SIGMA LAYER OUTPUT TO SCREEN & 712 70
FORMAT(2x,
'k',13x,
'z',11x,
'zz',11x,
'dz',11x,
'dzz')
713 80
FORMAT(
' ',i5,4f13.8)
subroutine coordinate_units(XL, YL)
real(sp), dimension(:), allocatable, target cor
real(sp), dimension(:), allocatable, target x_gbl
real(sp), dimension(:), allocatable, target h
subroutine setup_center_coords
logical function dbg_set(vrb)
real(sp), dimension(:), allocatable, target h_lcl
real(sp), dimension(:), allocatable, target yc
real(sp), dimension(:), allocatable cc_hvc
real(sp), dimension(:), allocatable, target x_lcl
real(sp), dimension(:), allocatable, target ymc
real(sp), dimension(:), allocatable, target c_spg
real(sp), dimension(:,:), allocatable, target dzz1
real(sp), dimension(:), allocatable, target latc
real(sp), dimension(:), allocatable, target r_spg
real(sp), dimension(:), allocatable, target y_spg
subroutine setup_bottom_roughness
real(sp), dimension(:), allocatable, target vx
real(sp), dimension(:), allocatable, target grav_e
subroutine setup_coriolis
real(sp), dimension(:), allocatable nn_hvc
real(sp), dimension(:), allocatable, target vy
real(sp), dimension(:), allocatable, target xmc
real(sp), dimension(:), allocatable, target lonc
integer, parameter dbg_sbrio
real(sp), dimension(:), allocatable, target cc_z0b
real(sp), dimension(:), allocatable, target x_spg
integer, dimension(:,:), allocatable, target nv
real(sp), dimension(:), allocatable, target c_lcl
integer, dimension(:), allocatable, target n_spg
real(sp), dimension(:), allocatable, target xm
real(sp), dimension(:), allocatable, target y_lcl
real(sp), dimension(:,:), allocatable, target zz1
real(sp), dimension(:,:), allocatable, target dzz
subroutine n2e2d(NVAR, EVAR)
real(sp), dimension(:,:), allocatable, target dz
real(sp), dimension(:), allocatable, target lat
real(sp), dimension(:,:), allocatable, target z
subroutine fatal_error(ER1, ER2, ER3, ER4)
real(sp), dimension(:), allocatable, target lon
real(sp), dimension(:), allocatable, target xc
real(sp), dimension(:), allocatable, target y_gbl
real(sp), dimension(:,:), allocatable, target dz1
real(sp), dimension(:,:), allocatable, target z1
real(sp), dimension(:), allocatable, target grav_n
real(sp), dimension(:), allocatable, target cc_sponge
integer, parameter dbg_sbr
real(sp), dimension(:,:), allocatable, target zz
subroutine setup_horizontal_mixing_coefficient
subroutine setup_sigma_derivatives
integer, parameter dbg_log
real(sp), dimension(:), allocatable, target ym