|
| 1 | +module flux_atmocn_driver_mod |
| 2 | + |
| 3 | + use shr_kind_mod, only : R8=>SHR_KIND_R8, IN=>SHR_KIND_IN ! shared kinds |
| 4 | + use shr_const_mod, only : shr_const_spval |
| 5 | + use shr_sys_mod, only : shr_sys_abort |
| 6 | + use shr_strconvert_mod, only : toString |
| 7 | + use flux_atmocn_Large_mod, only : flux_atmocn_Large |
| 8 | + use flux_atmocn_COARE_mod, only : flux_atmocn_COARE |
| 9 | + use flux_atmocn_UA_mod, only : flux_atmocn_UA |
| 10 | + |
| 11 | + implicit none |
| 12 | + public |
| 13 | + |
| 14 | + integer, private, parameter :: ocn_flux_scheme_large_and_pond = 0 |
| 15 | + integer, private, parameter :: ocn_flux_scheme_coare = 1 |
| 16 | + integer, private, parameter :: ocn_flux_scheme_ua = 2 |
| 17 | + |
| 18 | +contains |
| 19 | + |
| 20 | + subroutine flux_atmOcn_driver(logunit, nMax, & |
| 21 | + zbot, ubot, vbot, thbot, & |
| 22 | + qbot, rainc, rbot, & |
| 23 | + tbot, us, vs, pslv, & |
| 24 | + ts, mask, seq_flux_atmocn_minwind, & |
| 25 | + sen, lat, lwup, evap, & |
| 26 | + taux, tauy, tref, qref, & |
| 27 | + ocn_surface_flux_scheme, & |
| 28 | + add_gusts, duu10n, ugust_out, u10res, & |
| 29 | + ustar_sv, re_sv, ssq_sv, missval) |
| 30 | + |
| 31 | + !--- input arguments -------------------------------- |
| 32 | + integer , intent(in) :: logunit |
| 33 | + integer , intent(in) :: nMax ! data vector length |
| 34 | + integer , intent(in) :: mask (nMax) ! ocn domain mask 0 <=> out of domain |
| 35 | + logical , intent(in) :: add_gusts |
| 36 | + real(R8) , intent(in) :: zbot (nMax) ! atm level height (m) |
| 37 | + real(R8) , intent(in) :: ubot (nMax) ! atm u wind (m/s) |
| 38 | + real(R8) , intent(in) :: vbot (nMax) ! atm v wind (m/s) |
| 39 | + real(R8) , intent(in) :: thbot(nMax) ! atm potential T (K) |
| 40 | + real(R8) , intent(in) :: qbot (nMax) ! atm specific humidity (kg/kg) |
| 41 | + real(R8) , intent(in) :: rainc(nMax) ! atm precip for convective gustiness (kg/m^3) - RBN 24Nov2008/MDF 31Jan2022 |
| 42 | + real(R8) , intent(in) :: rbot (nMax) ! atm air density (kg/m^3) |
| 43 | + real(R8) , intent(in) :: tbot (nMax) ! atm T (K) |
| 44 | + real(R8) , intent(in) :: pslv (nMax) ! atm sea level pressure(Pa) |
| 45 | + real(R8) , intent(in) :: us (nMax) ! ocn u-velocity (m/s) |
| 46 | + real(R8) , intent(in) :: vs (nMax) ! ocn v-velocity (m/s) |
| 47 | + real(R8) , intent(in) :: ts (nMax) ! ocn temperature (K) |
| 48 | + real(R8) , intent(in) :: seq_flux_atmocn_minwind ! minimum wind speed for atmocn (m/s) |
| 49 | + integer , intent(in) :: ocn_surface_flux_scheme |
| 50 | + |
| 51 | + !--- output arguments ------------------------------- |
| 52 | + real(R8),intent(out) :: sen (nMax) ! heat flux: sensible (W/m^2) |
| 53 | + real(R8),intent(out) :: lat (nMax) ! heat flux: latent (W/m^2) |
| 54 | + real(R8),intent(out) :: lwup (nMax) ! heat flux: lw upward (W/m^2) |
| 55 | + real(R8),intent(out) :: evap (nMax) ! water flux: evap ((kg/s)/m^2) |
| 56 | + real(R8),intent(out) :: taux (nMax) ! surface stress, zonal (N) |
| 57 | + real(R8),intent(out) :: tauy (nMax) ! surface stress, meridional (N) |
| 58 | + real(R8),intent(out) :: tref (nMax) ! diag: 2m ref height T (K) |
| 59 | + real(R8),intent(out) :: qref (nMax) ! diag: 2m ref humidity (kg/kg) |
| 60 | + real(R8),intent(out) :: duu10n(nMax) ! diag: 10m wind speed squared (m/s)^2 |
| 61 | + real(R8),intent(out) :: ugust_out(nMax) ! diag: gustiness addition to U10 (m/s) |
| 62 | + real(R8),intent(out) :: u10res(nMax) ! diag: gustiness addition to U10 (m/s) |
| 63 | + |
| 64 | + real(R8),intent(out),optional :: ustar_sv(nMax) ! diag: ustar |
| 65 | + real(R8),intent(out),optional :: re_sv (nMax) ! diag: sqrt of exchange coefficient (water) |
| 66 | + real(R8),intent(out),optional :: ssq_sv (nMax) ! diag: sea surface humidity (kg/kg) |
| 67 | + real(R8),intent(in) ,optional :: missval ! masked value |
| 68 | + |
| 69 | + !--- local variables -------------------------------- |
| 70 | + integer :: n |
| 71 | + real(R8) :: spval ! local missing value |
| 72 | + !-------------------------------------------------------------------------------- |
| 73 | + |
| 74 | + if (present(missval)) then |
| 75 | + spval = missval |
| 76 | + else |
| 77 | + spval = shr_const_spval |
| 78 | + endif |
| 79 | + |
| 80 | + !!................................................................. |
| 81 | + !! ocn_surface_flux_scheme = 0 : Large and Pond |
| 82 | + !! = 1 : COARE algorithm |
| 83 | + !! = 2 : UA algorithm |
| 84 | + !!................................................................. |
| 85 | + |
| 86 | + ! Default flux scheme. |
| 87 | + if (ocn_surface_flux_scheme == ocn_flux_scheme_large_and_pond) then |
| 88 | + |
| 89 | + call flux_atmOcn_Large( & |
| 90 | + logunit, spval, nMax, & |
| 91 | + zbot, ubot, vbot, thbot, & |
| 92 | + qbot, rainc, rbot, & |
| 93 | + tbot, us, vs, pslv, & |
| 94 | + ts, mask, seq_flux_atmocn_minwind, & |
| 95 | + sen, lat, lwup, evap, & |
| 96 | + taux, tauy, tref, qref, & |
| 97 | + add_gusts, duu10n, ugust_out, u10res, & |
| 98 | + ustar_sv=ustar_sv, re_sv=re_sv, ssq_sv=ssq_sv) |
| 99 | + |
| 100 | + else if (ocn_surface_flux_scheme == ocn_flux_scheme_coare) then |
| 101 | + |
| 102 | + call flux_atmOcn_COARE( & |
| 103 | + logunit, spval, nMax, & |
| 104 | + zbot, ubot, vbot, thbot, & |
| 105 | + qbot, rainc, rbot, & |
| 106 | + tbot, us, vs, pslv, & |
| 107 | + ts, mask, seq_flux_atmocn_minwind, & |
| 108 | + sen, lat, lwup, evap, & |
| 109 | + taux, tauy, tref, qref, & |
| 110 | + duu10n, ugust_out, u10res, & |
| 111 | + ustar_sv=ustar_sv, re_sv=re_sv, ssq_sv=ssq_sv) |
| 112 | + |
| 113 | + else if (ocn_surface_flux_scheme == ocn_flux_scheme_ua) then |
| 114 | + |
| 115 | + call flux_atmOcn_UA( & |
| 116 | + logunit, spval, nMax, & |
| 117 | + zbot, ubot, vbot, thbot, & |
| 118 | + qbot, rbot, tbot, us, vs, pslv, & |
| 119 | + ts, mask, sen, lat, lwup, evap, & |
| 120 | + taux, tauy, tref, qref, & |
| 121 | + duu10n, ustar_sv=ustar_sv, re_sv=re_sv, ssq_sv=ssq_sv) |
| 122 | + |
| 123 | + do n = 1,nMax |
| 124 | + if (mask(n) /= 0) then |
| 125 | + u10res(n) = sqrt(duu10n(n)) |
| 126 | + ugust_out(n) = 0._r8 |
| 127 | + else |
| 128 | + u10res (n) = spval |
| 129 | + ugust_out(n) = spval |
| 130 | + end if |
| 131 | + end do |
| 132 | + |
| 133 | + else |
| 134 | + |
| 135 | + call shr_sys_abort("ocn_srfuace_flux_scheme = "// toString(ocn_surface_flux_scheme)//" is not supported") |
| 136 | + |
| 137 | + end if |
| 138 | + |
| 139 | + end subroutine flux_atmOcn_driver |
| 140 | + |
| 141 | +end module flux_atmocn_driver_mod |
0 commit comments