Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new optional mapping of taux and tauy from ocean to wave #382

Merged
merged 35 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4cf3e05
Added Fwxx_taux and Fwxx_tauy, based on Foxx_taux and Foxx_tauy
phall-brown Apr 12, 2023
e68d9bc
Trying simpler form of sharing Foxx to compwav
phall-brown Apr 14, 2023
eb18694
Turning off Foxx export to waves for testing
phall-brown Apr 14, 2023
c791efc
Adding Fwxx_taux to get wind stress to pass to wave model
phall-brown Apr 17, 2023
8db2449
Adding Fwxx_taux, using Foxx_taux as a model
phall-brown Apr 17, 2023
a599c2f
Comment out unnecessary line
phall-brown Apr 17, 2023
17fa9d5
Adding custom field subroutine for waves with cesm, based on equivale…
phall-brown Apr 25, 2023
5712122
Passing So_ofrac to wav component
phall-brown Apr 25, 2023
e6451a4
Changing merge to Fwxx_taux to copy
phall-brown Apr 25, 2023
bdd726a
Fixed syntax of addmrg_to call for Fwxx_taux
phall-brown Apr 25, 2023
dec4bfb
Reverted earlier modifications
phall-brown Apr 25, 2023
d4b8441
Substituting Foxx_taux for Faox_taux
phall-brown Apr 25, 2023
d666f83
Revert "Substituting Foxx_taux for Faox_taux"
phall-brown Apr 26, 2023
3925710
Removed export of So_ofrac to wav component (unnecessary), and other …
phall-brown Apr 26, 2023
e142b2d
Cleaning up earlier, temporary code
phall-brown Apr 26, 2023
14bd205
Removed unnecessary fldList variable
phall-brown Apr 26, 2023
abc5658
Adding stress from ice to Fwxx_taux
phall-brown Apr 26, 2023
cb585c5
Removed mrg_fracname from Fwxx merges
phall-brown Apr 26, 2023
95c5188
Added ifrac and ofrac to FBFrac for wave component
phall-brown Apr 26, 2023
5633ff2
Using ifrac and ofrac weights for Fbww merge
phall-brown Apr 26, 2023
a3c13d2
Updated comments to include wave component
phall-brown Apr 26, 2023
68baf9f
Added new fractions (ifrac, ofrac) for wave component
phall-brown Apr 28, 2023
04296bd
Added compwav declaration to med_fraction_set subroutine
phall-brown Apr 28, 2023
5bc4403
Corrected two typos where compice was being passed instead of compwav
phall-brown Apr 28, 2023
69317cb
Removing previous additions for wavcomp
phall-brown Apr 29, 2023
baaf12c
Removing stress from compice from Fwxx_taux
phall-brown Apr 29, 2023
f1dedf5
Changed Fwxx_taux merge to use 'wfrac'
phall-brown May 9, 2023
2685626
Adding merge to wave component Fwxx_taux based on Foxx_taux
phall-brown May 10, 2023
9d4e81c
Fixed a compocn that should have been compwav
phall-brown May 10, 2023
3ca2795
Adding ifrac and ofrac to fraclist_w
phall-brown May 10, 2023
a587023
updates for new stresses sent to wave
May 16, 2023
3dbbda3
merged to head of escomp/main
May 16, 2023
ca8ca8b
udpates needed to pass taux and tauxy to wave
May 16, 2023
d64ffe9
fixed compile bugs
May 16, 2023
488b8d9
fixed compile bugs
May 16, 2023
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
8 changes: 8 additions & 0 deletions mediator/esmFldsExchange_cesm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2986,6 +2986,14 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
end if
end if

! ---------------------------------------------------------------------
! to wav: zonal and meridional wind stress
! ---------------------------------------------------------------------
if (phase == 'advertise') then
call addfld_to(compwav , 'Fwxx_taux')
call addfld_to(compwav , 'Fwxx_tauy')
end if

!=====================================================================
! FIELDS TO RIVER (comprof)
!=====================================================================
Expand Down
15 changes: 15 additions & 0 deletions mediator/fd_cesm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,21 @@
canonical_units: m2/s
description: wave elevation spectrum

#
#-----------------------------------
# section: wave import
#-----------------------------------
#
- standard_name: Fwxx_taux
alias: mean_zonal_moment_flx
canonical_units: N m-2
description: wave import - zonal surface stress
#
- standard_name: Fwxx_tauy
alias: mean_merid_moment_flx
canonical_units: N m-2
description: wave import - meridional surface stress

#-----------------------------------
# mediator fields
#-----------------------------------
Expand Down
40 changes: 37 additions & 3 deletions mediator/med_phases_aofluxes_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module med_phases_aofluxes_mod
use ESMF , only : ESMF_XGridGet, ESMF_MeshCreate, ESMF_MeshWrite, ESMF_KIND_R8
use med_kind_mod , only : CX=>SHR_KIND_CX, CS=>SHR_KIND_CS, CL=>SHR_KIND_CL, R8=>SHR_KIND_R8
use med_internalstate_mod , only : InternalState, maintask, logunit
use med_internalstate_mod , only : compatm, compocn, coupling_mode, aoflux_code, mapconsd, mapconsf, mapfcopy
use med_internalstate_mod , only : compatm, compocn, compwav, coupling_mode, aoflux_code, mapconsd, mapconsf, mapfcopy
use med_constants_mod , only : dbug_flag => med_constants_dbug_flag
use med_utils_mod , only : memcheck => med_memcheck
use med_utils_mod , only : chkerr => med_utils_chkerr
Expand Down Expand Up @@ -487,6 +487,7 @@ subroutine med_aofluxes_init_ogrid(gcomp, aoflux_in, aoflux_out, rc)
use esmFlds , only : med_fldlist_GetaofluxfldList
use esmFlds , only : med_fldList_type
use med_map_mod , only : med_map_packed_field_create
use med_methods_mod , only : FB_fldchk => med_methods_FB_FldChk

! Arguments
type(ESMF_GridComp) , intent(inout) :: gcomp
Expand Down Expand Up @@ -565,15 +566,13 @@ subroutine med_aofluxes_init_ogrid(gcomp, aoflux_in, aoflux_out, rc)
if (is_local%wrap%aoflux_grid == 'ogrid') then
if ( ESMF_FieldBundleIsCreated(is_local%wrap%FBMed_aoflux_o) .and. &
ESMF_FieldBundleIsCreated(is_local%wrap%FBMed_aoflux_a)) then

call med_map_packed_field_create(destcomp=compatm, &
flds_scalar_name=is_local%wrap%flds_scalar_name, &
fieldsSrc=fldListMed_aoflux, &
FBSrc=is_local%wrap%FBMed_aoflux_o, &
FBDst=is_local%wrap%FBMed_aoflux_a, &
packed_data=is_local%wrap%packed_data_aoflux_o2a(:), rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

end if
end if

Expand Down Expand Up @@ -950,6 +949,9 @@ subroutine med_aofluxes_update(gcomp, aoflux_in, aoflux_out, rc)
use ESMF , only : ESMF_GridComp
use ESMF , only : ESMF_LogWrite, ESMF_LogMsg_Info, ESMF_SUCCESS
use med_map_mod , only : med_map_field_packed, med_map_rh_is_created
use med_map_mod , only : med_map_routehandles_init
use med_methods_mod, only : FB_fldchk => med_methods_FB_fldchk
use med_methods_mod, only : FB_diagnose => med_methods_FB_diagnose
#ifdef CESMCOUPLED
use shr_flux_mod , only : flux_atmocn
#else
Expand All @@ -972,6 +974,9 @@ subroutine med_aofluxes_update(gcomp, aoflux_in, aoflux_out, rc)
real(r8), parameter :: p0 = 100000.0_r8 ! reference pressure in Pa
real(r8), parameter :: rcp = 0.286_r8 ! gas constant of air / specific heat capacity at a constant pressure
real(r8), parameter :: rdair = 287.058_r8 ! dry air gas constant in J/K/kg
integer :: maptype
type(ESMF_Field) :: field_src
type(ESMF_Field) :: field_dst
character(*),parameter :: subName = '(med_aofluxes_update) '
!-----------------------------------------------------------------------

Expand Down Expand Up @@ -1117,6 +1122,35 @@ subroutine med_aofluxes_update(gcomp, aoflux_in, aoflux_out, rc)

end if

! map taux and tauy from ocean to wave grid if stresses are needed on the wave grid
if ( FB_fldchk(is_local%wrap%FBExp(compwav), 'Fwxx_taux', rc=rc) .and. &
FB_fldchk(is_local%wrap%FBExp(compwav), 'Fwxx_tauy', rc=rc)) then
maptype = mapconsf
if (.not. med_map_RH_is_created(is_local%wrap%RH(compocn,compwav,:), maptype, rc=rc)) then
call med_map_routehandles_init( compocn, compwav, &
FBSrc=is_local%wrap%FBImp(compocn,compocn), &
FBDst=is_local%wrap%FBImp(compwav,compwav), &
mapindex=maptype, RouteHandle=is_local%wrap%RH, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if
call ESMF_FieldBundleGet(is_local%wrap%FBMed_aoflux_o, 'Faox_taux', field=field_src, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleGet(is_local%wrap%FBExp(compwav), 'Fwxx_taux', field=field_dst, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldRegrid(field_src, field_dst, &
routehandle=is_local%wrap%RH(compocn, compwav, maptype), &
termorderflag=ESMF_TERMORDER_SRCSEQ, zeroregion=ESMF_REGION_TOTAL, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleGet(is_local%wrap%FBMed_aoflux_o, 'Faox_tauy', field=field_src, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldBundleGet(is_local%wrap%FBExp(compwav), 'Fwxx_tauy', field=field_dst, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldRegrid(field_src, field_dst, &
routehandle=is_local%wrap%RH(compocn, compwav, maptype), &
termorderflag=ESMF_TERMORDER_SRCSEQ, zeroregion=ESMF_REGION_TOTAL, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
end if

call t_stopf('MED:'//subname)

end subroutine med_aofluxes_update
Expand Down