Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2150,6 +2150,7 @@ sub write_filepath
print $fh "$camsrcdir/src/atmos_phys/schemes/cloud_fraction\n";
print $fh "$camsrcdir/src/atmos_phys/schemes/vertical_diffusion\n";
print $fh "$camsrcdir/src/atmos_phys/schemes/holtslag_boville\n";
print $fh "$camsrcdir/src/atmos_phys/schemes/beljaars_drag\n";

# Dynamics package and test utilities
print $fh "$camsrcdir/src/dynamics/$dyn\n";
Expand Down
152 changes: 0 additions & 152 deletions src/physics/cam/beljaars_drag.F90

This file was deleted.

57 changes: 36 additions & 21 deletions src/physics/cam/beljaars_drag_cam.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ module beljaars_drag_cam
! Is this module on at all?
logical, public, protected :: do_beljaars = .false.

! Tuning parameters for TMS.
real(r8) :: blj_orocnst
real(r8) :: blj_z0fac

! pbuf field indices
integer :: &
sgh30_idx = -1, &
Expand All @@ -34,7 +30,7 @@ module beljaars_drag_cam
subroutine beljaars_drag_readnl(nlfile)
use namelist_utils, only: find_group_name
use units, only: getunit, freeunit
use spmd_utils, only: masterprocid, mpi_logical, mpi_real8, mpicom
use spmd_utils, only: masterprocid, mpi_logical, mpicom

! filepath for file containing namelist input
character(len=*), intent(in) :: nlfile
Expand Down Expand Up @@ -79,23 +75,15 @@ end subroutine beljaars_drag_register
subroutine beljaars_drag_init()

use cam_history, only: addfld, add_default, horiz_only
use error_messages, only: handle_errmsg
use phys_control, only: phys_getopts
use physconst, only: karman, gravit, rair
use physics_buffer, only: pbuf_get_index
use beljaars_drag, only: init_blj

logical :: history_amwg

character(len=128) :: errstring

if (.not. do_beljaars) return

call phys_getopts(history_amwg_out=history_amwg)

call init_blj( r8, gravit, rair, errstring )
call handle_errmsg(errstring, subname="init_blj")

call addfld('DRAGBLJ', (/ 'lev' /) , 'A', '1/s', 'Drag profile from Beljaars SGO ')
call addfld('TAUBLJX', horiz_only, 'A', 'N/m2', 'Zonal integrated drag from Beljaars SGO')
call addfld('TAUBLJY', horiz_only, 'A', 'N/m2', 'Meridional integrated drag from Beljaars SGO')
Expand All @@ -112,21 +100,27 @@ subroutine beljaars_drag_init()

end subroutine beljaars_drag_init

subroutine beljaars_drag_tend(state, pbuf, cam_in)
subroutine beljaars_drag_tend(state, pbuf)
use physics_buffer, only: physics_buffer_desc, pbuf_get_field
use physics_types, only: physics_state
use camsrfexch, only: cam_in_t
use cam_history, only: outfld
use beljaars_drag, only: compute_blj

use physconst, only: gravit
use beljaars_drag, only: beljaars_drag_run

type(physics_state), intent(in) :: state
type(physics_buffer_desc), pointer, intent(in) :: pbuf(:)
type(cam_in_t), intent(in) :: cam_in

real(r8), pointer :: sgh30(:)
real(r8), pointer :: dragblj(:,:)
real(r8), pointer :: taubljx(:), taubljy(:)

integer :: ncol
character(len=512) :: errmsg
integer :: errflg

ncol = state%ncol

call pbuf_get_field(pbuf, dragblj_idx, dragblj)
call pbuf_get_field(pbuf, taubljx_idx, taubljx)
call pbuf_get_field(pbuf, taubljy_idx, taubljy)
Expand All @@ -140,10 +134,31 @@ subroutine beljaars_drag_tend(state, pbuf, cam_in)

call pbuf_get_field(pbuf, sgh30_idx, sgh30)

call compute_blj( pcols , pver , state%ncol , &
state%u , state%v , state%t , state%pmid , &
state%pdel , state%zm , sgh30 , dragblj , &
taubljx , taubljy , cam_in%landfrac )
! zero to pcols
dragblj(:, :) = 0._r8
taubljx(:) = 0._r8
taubljy(:) = 0._r8

! Call the CCPPized subroutine:
call beljaars_drag_run( &
do_beljaars = do_beljaars, &
ncol = state%ncol, &
pver = pver, &
u = state%u(:ncol, :), &
v = state%v(:ncol, :), &
delp = state%pdel(:ncol, :), &
zm = state%zm(:ncol, :), &
sgh30 = sgh30(:ncol), &
gravit = gravit, &
drag = dragblj(:ncol, :), &
taux = taubljx(:ncol), &
tauy = taubljy(:ncol), &
errmsg = errmsg, &
errflg = errflg)

if(errflg /= 0) then
call endrun('beljaars_drag_run: '//errmsg)
end if

call outfld("TAUBLJX", taubljx, pcols, state%lchnk)
call outfld("TAUBLJY", taubljy, pcols, state%lchnk)
Expand Down
2 changes: 1 addition & 1 deletion src/physics/cam/physpkg.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1689,7 +1689,7 @@ subroutine tphysac (ztodt, cam_in, &
end if

call trb_mtn_stress_tend(state, pbuf, cam_in)
call beljaars_drag_tend(state, pbuf, cam_in)
call beljaars_drag_tend(state, pbuf)

if (trim(cam_take_snapshot_after) == "orographic_form_drag_stress") then
call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,&
Expand Down
2 changes: 1 addition & 1 deletion src/physics/cam7/physpkg.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2204,7 +2204,7 @@ subroutine tphysac (ztodt, cam_in, &
fh2o, surfric, obklen, flx_heat, cmfmc, dlf, det_s, det_ice, net_flx)
end if

call beljaars_drag_tend(state, pbuf, cam_in)
call beljaars_drag_tend(state, pbuf)

! TMS is not active in CAM7 (it is only for CAM5), but the tms tend subroutine
! will initialize the pbuf fields to zero - no logic is computed below:
Expand Down
Loading