Skip to content
Snippets Groups Projects
sfx_data.f90 5.37 KiB
Newer Older
module sfx_data
    !> @brief surface flux module data

    ! macro defs.
    ! --------------------------------------------------------------------------------
    ! --------------------------------------------------------------------------------

    ! modules used
    ! --------------------------------------------------------------------------------
    ! --------------------------------------------------------------------------------

    ! directives list
    ! --------------------------------------------------------------------------------
    implicit none
    private
    ! --------------------------------------------------------------------------------

    ! public interface
    ! --------------------------------------------------------------------------------
Evgeny Mortikov's avatar
Evgeny Mortikov committed
    public :: push_sfx_data
    ! --------------------------------------------------------------------------------

    ! --------------------------------------------------------------------------------
    type, public :: meteoDataType
        !> @brief meteorological input for surface flux calculation

        real :: h       !> constant flux layer height [m]
        real :: U       !> abs(wind speed) at 'h' [m/s]
        real :: dT      !> difference between potential temperature at 'h' and at surface [K]
        real :: Tsemi   !> semi-sum of potential temperature at 'h' and at surface [K]
        real :: dQ      !> difference between humidity at 'h' and at surface [g/g]
        real :: z0_m    !> surface aerodynamic roughness (should be < 0 for water bodies surface)
    end type

    type, public :: meteoDataVecType
        !> @brief meteorological input for surface flux calculation
        !> &details using arrays as input

        real, allocatable :: h(:)       !> constant flux layer height [m]
        real, allocatable :: U(:)       !> abs(wind speed) at 'h' [m/s]
        real, allocatable :: dT(:)      !> difference between potential temperature at 'h' and at surface [K]
        real, allocatable :: Tsemi(:)   !> semi-sum of potential temperature at 'h' and at surface [K]
        real, allocatable :: dQ(:)      !> difference between humidity at 'h' and at surface [g/g]
        real, allocatable :: z0_m(:)    !> surface aerodynamic roughness (should be < 0 for water bodies surface)
    end type
    ! --------------------------------------------------------------------------------

    ! --------------------------------------------------------------------------------
    type, public :: sfxDataType
        !> @brief surface flux output data

        real :: zeta            !> = z/L [n/d]
        real :: Rib             !> bulk Richardson number [n/d]
        real :: Re              !> Reynolds number [n/d]
        real :: B               !> = log(z0_m / z0_h) [n/d]
        real :: z0_m            !> aerodynamic roughness [m]
        real :: z0_t            !> thermal roughness [m]
        real :: Rib_conv_lim    !> Ri-bulk convection critical value [n/d]
        real :: Cm              !> transfer coefficient for momentum [n/d]
        real :: Ct              !> transfer coefficient for heat [n/d]
        real :: Km              !> eddy viscosity coeff. at h [m^2/s]
        real :: Pr_t_inv        !> inverse turbulent Prandtl number at h [n/d]
    end type

    type, public :: sfxDataVecType
        !> @brief surface flux output data
        !> &details using arrays as output

        real, allocatable :: zeta(:)            !> = z/L [n/d]
        real, allocatable :: Rib(:)             !> bulk Richardson number [n/d]
        real, allocatable :: Re(:)              !> Reynolds number [n/d]
        real, allocatable :: B(:)               !> = log(z0_m / z0_h) [n/d]
        real, allocatable :: z0_m(:)            !> aerodynamic roughness [m]
        real, allocatable :: z0_t(:)            !> thermal roughness [m]
        real, allocatable :: Rib_conv_lim(:)    !> Ri-bulk convection critical value [n/d]
        real, allocatable :: Cm(:)              !> transfer coefficient for momentum [n/d]
        real, allocatable :: Ct(:)              !> transfer coefficient for heat [n/d]
        real, allocatable :: Km(:)              !> eddy viscosity coeff. at h [m^2/s]
        real, allocatable :: Pr_t_inv(:)        !> inverse turbulent Prandtl number at h [n/d]
    end type
    ! --------------------------------------------------------------------------------

Evgeny Mortikov's avatar
Evgeny Mortikov committed
contains

    ! --------------------------------------------------------------------------------
    subroutine push_sfx_data(sfx, sfx_cell, idx)
        !> @brief helper subroutine for copying data in sfxDataVecType
        ! ----------------------------------------------------------------------------
        type (sfxDataVecType), intent(inout) :: sfx
        type (sfxDataType), intent(in) :: sfx_cell
        integer, intent(in) :: idx
        ! ----------------------------------------------------------------------------

        sfx%zeta(idx) = sfx_cell%zeta
        sfx%Rib(idx) = sfx_cell%Rib
        sfx%Re(idx) = sfx_cell%Re
        sfx%B(idx) = sfx_cell%B
        sfx%z0_m(idx) = sfx_cell%z0_m
        sfx%z0_t(idx) = sfx_cell%z0_t
        sfx%Rib_conv_lim(idx) = sfx_cell%Rib_conv_lim
        sfx%Cm(idx) = sfx_cell%Cm
        sfx%Ct(idx) = sfx_cell%Ct
        sfx%Km(idx) = sfx_cell%Km
        sfx%Pr_t_inv(idx) = sfx_cell%Pr_t_inv

    end subroutine push_sfx_data
    ! --------------------------------------------------------------------------------