Skip to content

Commit

Permalink
Merge pull request #135 from mvertens/feature/pass_10mwind_to_ww3
Browse files Browse the repository at this point in the history
Add new 10m wind fields to be sent from cam to mediator and then to ww3dev

noresm_develop: Add new 10m wind fields to be sent from cam to mediator and then to ww3dev. This will need accompanying PRs in CMEPS and in WW3DEV

Summary: Add new 10m wind fields to be sent from cam to mediator and then to ww3dev
Contributors: mvertens
Reviewers: @gold2718 gold2718

Changes made to build system: None
Changes made to the namelist: None
Changes to the defaults for the boundary datasets: None
Substantial timing or memory changes: None

Issues resolved: #136 

Testing: 
Simulations with ww3dev were run with this new change and the results improved.
Ran aux_cam_noresm test suite. Results were bfb with baseline noresm_v9_cam6_3_123/ (except for new fields) and new baseline noresm_v10_cam6_3_123 was generated. 

Dependencies: This PR depends on the following PRs being **merged first**:
NorESMhub/CAM-Nor-physics#10
NorESMhub/CMEPS#16
  • Loading branch information
gold2718 authored Feb 27, 2024
2 parents 824a3ec + 322989b commit 2452bf7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 0 additions & 1 deletion bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2115,7 +2115,6 @@ sub write_filepath
print $fh "$camsrcdir/src/physics/camnor_phys/physics_cam6\n";
die "CAM6 not currently supported for NorESM configurations.\n";
}
print $fh "$camsrcdir/src/physics/camnor_phys/control\n";
if ($dyn eq 'fv') {
print $fh "$camsrcdir/src/physics/camnor_phys/fv\n";
}
Expand Down
18 changes: 18 additions & 0 deletions src/control/camsrfexch.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ module camsrfexch
real(r8) :: topo(pcols) ! surface topographic height (m)
real(r8) :: ubot(pcols) ! bot level u wind
real(r8) :: vbot(pcols) ! bot level v wind
real(r8) :: u10m(pcols) ! 10m u wind
real(r8) :: v10m(pcols) ! 10m v wind
real(r8) :: qbot(pcols,pcnst) ! bot level specific humidity
real(r8) :: pbot(pcols) ! bot level pressure
real(r8) :: rho(pcols) ! bot level density
Expand Down Expand Up @@ -286,6 +288,8 @@ subroutine atm2hub_alloc( cam_out )
cam_out(c)%topo(:) = 0._r8
cam_out(c)%ubot(:) = 0._r8
cam_out(c)%vbot(:) = 0._r8
cam_out(c)%u10m(:) = 0._r8
cam_out(c)%v10m(:) = 0._r8
cam_out(c)%qbot(:,:) = 0._r8
cam_out(c)%pbot(:) = 0._r8
cam_out(c)%rho(:) = 0._r8
Expand Down Expand Up @@ -426,6 +430,9 @@ subroutine cam_export(state,cam_out,pbuf)
integer :: prec_dp_idx, snow_dp_idx, prec_sh_idx, snow_sh_idx
integer :: prec_sed_idx,snow_sed_idx,prec_pcw_idx,snow_pcw_idx
integer :: srf_ozone_idx, lightning_idx
real(r8):: ubot, vbot, zm
real(r8):: wnd10m_mag, wnd10m_dir
real(r8), parameter :: z0= 0.0001_r8 ! [m] roughness length over ocean

real(r8), pointer :: psl(:)

Expand Down Expand Up @@ -493,7 +500,18 @@ subroutine cam_export(state,cam_out,pbuf)
cam_out%pbot(i) = state%pmid(i,pver)
cam_out%psl(i) = psl(i)
cam_out%rho(i) = cam_out%pbot(i)/(rair*cam_out%tbot(i))

! Assume that the direction of the wind at 10m is the same as
! at the bottom level
ubot = state%u(i,pver)
vbot = state%v(i,pver)
zm = state%zm(i,pver)
wnd10m_mag = sqrt(ubot**2 + vbot**2) * log(10._r8/z0)/log(zm/z0)
wnd10m_dir = atan2(vbot,ubot)
cam_out%u10m(i) = wnd10m_mag*cos(wnd10m_dir)
cam_out%v10m(i) = wnd10m_mag*sin(wnd10m_dir)
end do

do m = 1, pcnst
do i = 1, ncol
cam_out%qbot(i,m) = state%q(i,pver,m)
Expand Down
9 changes: 9 additions & 0 deletions src/cpl/nuopc/atm_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ subroutine advertise_fields(gcomp, flds_scalar_name, rc)
call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_z' )
call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_u' )
call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_v' )
call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_u10m' )
call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_v10m' )
call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_tbot' )
call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_ptem' )
call fldlist_add(fldsFrAtm_num, fldsFrAtm, 'Sa_shum' )
Expand Down Expand Up @@ -936,6 +938,7 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc)
real(r8), pointer :: fldptr_lwdn(:) , fldptr_swnet(:)
real(r8), pointer :: fldptr_topo(:) , fldptr_zbot(:)
real(r8), pointer :: fldptr_ubot(:) , fldptr_vbot(:)
real(r8), pointer :: fldptr_u10m(:) , fldptr_v10m(:)
real(r8), pointer :: fldptr_pbot(:) , fldptr_tbot(:)
real(r8), pointer :: fldptr_shum(:) , fldptr_dens(:)
real(r8), pointer :: fldptr_ptem(:) , fldptr_pslv(:)
Expand All @@ -960,6 +963,10 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call state_getfldptr(exportState, 'Sa_v' , fldptr=fldptr_vbot, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call state_getfldptr(exportState, 'Sa_u10m', fldptr=fldptr_u10m, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call state_getfldptr(exportState, 'Sa_v10m', fldptr=fldptr_v10m, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call state_getfldptr(exportState, 'Sa_tbot', fldptr=fldptr_tbot, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call state_getfldptr(exportState, 'Sa_pbot', fldptr=fldptr_pbot, rc=rc)
Expand All @@ -985,6 +992,8 @@ subroutine export_fields( gcomp, model_mesh, model_clock, cam_out, rc)
fldptr_dens(g) = cam_out(c)%rho(i)
fldptr_ptem(g) = cam_out(c)%thbot(i)
fldptr_pslv(g) = cam_out(c)%psl(i)
fldptr_u10m(g) = cam_out(c)%u10m(i)
fldptr_v10m(g) = cam_out(c)%v10m(i)
g = g + 1
end do
end do
Expand Down

0 comments on commit 2452bf7

Please sign in to comment.