Skip to content

Commit

Permalink
surface: add namelist parameter for the minimum surface velocity
Browse files Browse the repository at this point in the history
New variable min_horv in NAMSURFACE. Default is 0.1 (as was hardcoded before).
Used as a minimum value when calculating the magnitude of the horizontal surface
wind for drag and surface processes. Required for RCEMIP.
  • Loading branch information
fjansson committed Nov 3, 2023
1 parent caa5ce8 commit f0ebf18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/modsurface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ subroutine surface
xpatches*ypatches,MPI_SUM, comm3d,mpierr)

horvpatch = sqrt(((Supatch/SNpatch) + cu) **2. + ((Svpatch/SNpatch) + cv) ** 2.)
horvpatch = max(horvpatch, 0.1)
horvpatch = max(horvpatch, min_horv)
endif


Expand Down Expand Up @@ -791,14 +791,14 @@ subroutine surface
upcu = 0.5 * (u0(i,j,1) + u0(i+1,j,1)) + cu
vpcv = 0.5 * (v0(i,j,1) + v0(i,j+1,1)) + cv
horv = sqrt(upcu ** 2. + vpcv ** 2.)
horv = max(horv, 0.1)
horv = max(horv, min_horv)
ra(i,j) = 1. / ( Cs(i,j) * horv )
else
if (lhetero) then
ra(i,j) = 1. / ( Cs(i,j) * horvpatch(patchx,patchy) )
else
horvav = sqrt(u0av(1) ** 2. + v0av(1) ** 2.)
horvav = max(horvav, 0.1)
horvav = max(horvav, min_horv)
ra(i,j) = 1. / ( Cs(i,j) * horvav )
endif
end if
Expand Down Expand Up @@ -838,9 +838,9 @@ subroutine surface
upcu = 0.5 * (u0(i,j,1) + u0(i+1,j,1)) + cu
vpcv = 0.5 * (v0(i,j,1) + v0(i,j+1,1)) + cv
horv = sqrt(upcu ** 2. + vpcv ** 2.)
horv = max(horv, 0.1)
horv = max(horv, min_horv)
horvav = sqrt(u0av(1) ** 2. + v0av(1) ** 2.)
horvav = max(horvav, 0.1)
horvav = max(horvav, min_horv)

if(lhetero) then
patchx = patchxnr(i)
Expand Down Expand Up @@ -911,7 +911,7 @@ subroutine surface
upcu = 0.5 * (u0(i,j,1) + u0(i+1,j,1)) + cu
vpcv = 0.5 * (v0(i,j,1) + v0(i,j+1,1)) + cv
horv = sqrt(upcu ** 2. + vpcv ** 2.)
horv = max(horv, 0.1)
horv = max(horv, min_horv)

dudz (i,j) = ustar(i,j) * phimzf / (fkar*zf(1))*(upcu/horv)
dvdz (i,j) = ustar(i,j) * phimzf / (fkar*zf(1))*(vpcv/horv)
Expand Down Expand Up @@ -950,9 +950,9 @@ subroutine surface
upcu = 0.5 * (u0(i,j,1) + u0(i+1,j,1)) + cu
vpcv = 0.5 * (v0(i,j,1) + v0(i,j+1,1)) + cv
horv = sqrt(upcu ** 2. + vpcv ** 2.)
horv = max(horv, 0.1)
horv = max(horv, min_horv)
horvav = sqrt(u0av(1) ** 2. + v0av(1) ** 2.)
horvav = max(horvav, 0.1)
horvav = max(horvav, min_horv)
if( isurf == 4) then
if(lmostlocal) then
ustar (i,j) = fkar * horv / (log(zf(1) / z0m(i,j)) - psim(zf(1) / obl(i,j)) + psim(z0m(i,j) / obl(i,j)))
Expand Down Expand Up @@ -1141,7 +1141,7 @@ subroutine getobl
upcu = 0.5 * (u0(i,j,1) + u0(i+1,j,1)) + cu
vpcv = 0.5 * (v0(i,j,1) + v0(i,j+1,1)) + cv
horv2 = upcu ** 2. + vpcv ** 2.
horv2 = max(horv2, 0.01)
horv2 = max(horv2, min_horv**2)

if(lhetero) then
patchx = patchxnr(i)
Expand Down Expand Up @@ -1228,7 +1228,7 @@ subroutine getobl
MPI_SUM, comm3d,mpierr)

horvpatch = sqrt(((Supatch/SNpatch) + cu) **2. + ((Svpatch/SNpatch) + cv) ** 2.)
horvpatch = max(horvpatch, 0.1)
horvpatch = max(horvpatch, min_horv)

thlpatch = thlpatch / SNpatch
qpatch = qpatch / SNpatch
Expand Down Expand Up @@ -1287,7 +1287,7 @@ subroutine getobl
thv = thl0av(1) * (1. + (rv/rd - 1.) * qt0av(1))

horv2 = u0av(1)**2. + v0av(1)**2.
horv2 = max(horv2, 0.01)
horv2 = max(horv2, min_horv**2)

Rib = grav / thvs * zf(1) * (thv - thvs) / horv2
if (Rib == 0) then
Expand Down
1 change: 1 addition & 0 deletions src/modsurfdata.f90
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ module modsurfdata
real, allocatable :: thlflux (:,:) !< Kinematic temperature flux [K m/s]
real, allocatable :: qtflux (:,:) !< Kinematic specific humidity flux [kg/kg m/s]
real, allocatable :: svflux (:,:,:) !< Kinematic scalar flux [- m/s]
real :: min_horv = .1 !< minimum surface wind speed for drag calculation

! Surface gradients of prognostic variables
real, allocatable :: dudz (:,:) !< U-wind gradient in surface layer [1/s]
Expand Down

0 comments on commit f0ebf18

Please sign in to comment.