<commit_before>!>----------------------------------------------------------
!! This module provides a wrapper to call various microphysics models
!! It sets up variables specific to the physics package to be used including 
!! history variables not currently stored in the domain level data structure
!!
!! The main entry point to the code is mp(domain,options,dt)
!!
!! <pre>
!! Call tree graph :
!!  mp_init->[ external initialization routines]
!!  mp->[   external microphysics routines]
!!  mp_finish
!! 
!! High level routine descriptions / purpose
!!   mp_init            - allocates module data and initializes physics package
!!   mp                 - sets up and calls main physics package
!!   mp_finish          - deallocates module memory, place to do the same for physics
!! 
!! Inputs: domain, options, dt
!!      domain,options  = as defined in data_structures
!!      dt              = time step (seconds)
!! </pre>
!!
!!  @author
!!  <NAME> (<EMAIL>)
!!
!!----------------------------------------------------------
module microphysics
    use data_structures
    use mod_wrf_constants
    use module_mp_thompson,         only: mp_gt_driver, thompson_init
    use module_mp_morr_two_moment,  only: MORR_TWO_MOMENT_INIT, MP_MORR_TWO_MOMENT
    use module_mp_wsm6,             only: wsm6, wsm6init
    use module_mp_simple,           only: mp_simple_driver
    use mod_wrf_constants !,          only: rhoair0, rhowater, rhosnow, cliq, cpv
    implicit none

    ! permit the microphysics to update on a longer time step than the advection
    integer :: update_interval
    real*8 :: last_model_time
    ! temporary variables
    real,allocatable,dimension(:,:) :: SR, last_rain, last_snow, this_precip,refl_10cm
    
    
    ! microphysics specific flag.  If it returns the current hourly precip (e.g. Morrison), then set this to false. 
    ! for use in "distributing" precipitation. 
    logical :: precip_delta
    
    ! amounts of precipitation to "distribute" to surrounding grid cells
    integer, parameter :: npoints=8
    real,    dimension(npoints) :: dist_fraction = [ 0.1,0.15,0.1, 0.15,0.15, 0.1,0.15,0.1]
    integer, dimension(npoints) :: x_list = [ -1,0,1, -1,1, -1,0,1]
    integer, dimension(npoints) :: y_list = [ 1,1,1, 0,0, -1,-1,-1]
contains
    
    
    !>----------------------------------------------------------
    !! Initialize microphysical routines
    !!
    !! This routine will call the initialization routines for the specified microphysics packages. 
    !! It also initializes any module level variables, e.g. update_interval
    !! 
    !! @param   options     ICAR model options to specify required initializations
    !!
    !!----------------------------------------------------------
    subroutine mp_init(options)
        implicit none
        type(options_type), intent(in)::options
        
        write(*,*) "Initializing Microphysics"
        if (options%physics%microphysics==kMP_THOMPSON) then
            write(*,*) "    Thompson Microphysics"
            call thompson_init(options%mp_options)
            precip_delta=.True.
        elseif (options%physics%microphysics==kMP_SB04) then 
            write(*,*) "    Simple Microphysics"
            precip_delta=.True.
        elseif (options%physics%microphysics==kMP_MORRISON) then 
            write(*,*) "    Morrison Microphysics"
            call MORR_TWO_MOMENT_INIT(hail_opt=0)
            precip_delta=.False.
        elseif (options%physics%microphysics==kMP_WSM6) then 
            call wsm6init(rhoair0,rhowater,rhosnow,cliq,cpv)
        endif

        update_interval = options%mp_options%update_interval
        last_model_time = -999
    end subroutine mp_init<commit_msg>Print WSM6 when initializeing wsm6 microphysics<commit_after>!>----------------------------------------------------------
!! This module provides a wrapper to call various microphysics models
!! It sets up variables specific to the physics package to be used including 
!! history variables not currently stored in the domain level data structure
!!
!! The main entry point to the code is mp(domain,options,dt)
!!
!! <pre>
!! Call tree graph :
!!  mp_init->[ external initialization routines]
!!  mp->[   external microphysics routines]
!!  mp_finish
!! 
!! High level routine descriptions / purpose
!!   mp_init            - allocates module data and initializes physics package
!!   mp                 - sets up and calls main physics package
!!   mp_finish          - deallocates module memory, place to do the same for physics
!! 
!! Inputs: domain, options, dt
!!      domain,options  = as defined in data_structures
!!      dt              = time step (seconds)
!! </pre>
!!
!!  @author
!!  <NAME> (<EMAIL>)
!!
!!----------------------------------------------------------
module microphysics
    use data_structures
    use mod_wrf_constants
    use module_mp_thompson,         only: mp_gt_driver, thompson_init
    use module_mp_morr_two_moment,  only: MORR_TWO_MOMENT_INIT, MP_MORR_TWO_MOMENT
    use module_mp_wsm6,             only: wsm6, wsm6init
    use module_mp_simple,           only: mp_simple_driver
    use mod_wrf_constants !,          only: rhoair0, rhowater, rhosnow, cliq, cpv
    implicit none

    ! permit the microphysics to update on a longer time step than the advection
    integer :: update_interval
    real*8 :: last_model_time
    ! temporary variables
    real,allocatable,dimension(:,:) :: SR, last_rain, last_snow, this_precip,refl_10cm
    
    
    ! microphysics specific flag.  If it returns the current hourly precip (e.g. Morrison), then set this to false. 
    ! for use in "distributing" precipitation. 
    logical :: precip_delta
    
    ! amounts of precipitation to "distribute" to surrounding grid cells
    integer, parameter :: npoints=8
    real,    dimension(npoints) :: dist_fraction = [ 0.1,0.15,0.1, 0.15,0.15, 0.1,0.15,0.1]
    integer, dimension(npoints) :: x_list = [ -1,0,1, -1,1, -1,0,1]
    integer, dimension(npoints) :: y_list = [ 1,1,1, 0,0, -1,-1,-1]
contains
    
    
    !>----------------------------------------------------------
    !! Initialize microphysical routines
    !!
    !! This routine will call the initialization routines for the specified microphysics packages. 
    !! It also initializes any module level variables, e.g. update_interval
    !! 
    !! @param   options     ICAR model options to specify required initializations
    !!
    !!----------------------------------------------------------
    subroutine mp_init(options)
        implicit none
        type(options_type), intent(in)::options
        
        write(*,*) "Initializing Microphysics"
        if (options%physics%microphysics==kMP_THOMPSON) then
            write(*,*) "    Thompson Microphysics"
            call thompson_init(options%mp_options)
            precip_delta=.True.
        elseif (options%physics%microphysics==kMP_SB04) then 
            write(*,*) "    Simple Microphysics"
            precip_delta=.True.
        elseif (options%physics%microphysics==kMP_MORRISON) then 
            write(*,*) "    Morrison Microphysics"
            call MORR_TWO_MOMENT_INIT(hail_opt=0)
            precip_delta=.False.
        elseif (options%physics%microphysics==kMP_WSM6) then 
            write(*,*) "    WSM6 Microphysics"
            call wsm6init(rhoair0,rhowater,rhosnow,cliq,cpv)
        endif

        update_interval = options%mp_options%update_interval
        last_model_time = -999
    end subroutine mp_init
{'fraction_non_alphanumeric': 0.14903268845897266, 'fraction_numerical': 0.014543028685790526, 'mean_word_length': 2.2862779482683036, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '76574', 'n_tokens_mistral': 2234, 'n_tokens_neox': 2161, 'n_words': 607}