z_centremass_gauss_func Subroutine

public subroutine z_centremass_gauss_func(sigma, h, z_pbl, z_c)

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: sigma
real, intent(in) :: h
real, intent(in) :: z_pbl
real, intent(out) :: z_c

Called by

proc~~z_centremass_gauss_func~~CalledByGraph proc~z_centremass_gauss_func z_centremass_gauss_func proc~uemep_create_wind_field uEMEP_create_wind_field proc~uemep_create_wind_field->proc~z_centremass_gauss_func proc~uemep_set_dispersion_sigma_kz uEMEP_set_dispersion_sigma_Kz proc~uemep_set_dispersion_sigma_kz->proc~z_centremass_gauss_func proc~uemep_subgrid_deposition uEMEP_subgrid_deposition proc~uemep_subgrid_deposition->proc~z_centremass_gauss_func proc~uemep_subgrid_deposition->proc~uemep_create_wind_field proc~uemep_subgrid_deposition->proc~uemep_set_dispersion_sigma_kz proc~uemep_subgrid_dispersion uEMEP_subgrid_dispersion proc~uemep_subgrid_dispersion->proc~z_centremass_gauss_func proc~uemep_subgrid_dispersion->proc~uemep_set_dispersion_sigma_kz proc~uemep_subgrid_dispersion_integral uEMEP_subgrid_dispersion_integral proc~uemep_subgrid_dispersion->proc~uemep_subgrid_dispersion_integral proc~uemep_subgrid_dispersion_integral->proc~z_centremass_gauss_func proc~uemep_subgrid_dispersion_integral->proc~uemep_set_dispersion_sigma_kz program~uemep uEMEP program~uemep->proc~uemep_subgrid_deposition program~uemep->proc~uemep_subgrid_dispersion

Source Code

    subroutine z_centremass_gauss_func(sigma,h,z_pbl,z_c)

        implicit none
        real, intent(in) :: sigma,h,z_pbl
        real, intent(out) :: z_c
        real z_loop(5)
        real H_c
        integer i_loop,i
        real sqrt_2pi,sqrt_2
        real pi
        parameter (pi=3.141592653589793)

        sqrt_2pi=sqrt(2.*pi)
        sqrt_2=sqrt(2.)

        i_loop=5
        z_loop(1)=h;z_loop(2)=-h;z_loop(3)=2.*z_pbl-h;z_loop(4)=2.*z_pbl+h;z_loop(5)=-2.*z_pbl+h
        z_c=0.
        !c_z=0.;c_av=0.
        H_c=z_pbl

        !If the emission height h is greater than the boundary layer height then only allow reflection from the surface
        !and set the top of the integration H_c to infinity
        if (h.gt.z_pbl) then
            H_c=1.e16
            i_loop=2
        endif

        !Reduce the loop size when the reflection from the boundary layer is not important
        if (sigma+h.lt.z_pbl/3.) then
            i_loop=2
        endif

        !Remove this after finished testing
        !i_loop=5

        do i=1,i_loop

            z_c=z_c+sigma/sqrt_2pi*(exp(-0.5*(z_loop(i)/sigma)*(z_loop(i)/sigma))-exp(-0.5*((H_c-z_loop(i))/sigma)*((H_c-z_loop(i))/sigma))) &
                +z_loop(i)/2*(erf((H_c-z_loop(i))/sqrt_2/sigma)+erf((z_loop(i))/sqrt_2/sigma))

            !c_av=c_av+0.5*(erf((z_pbl-z_loop(i))/sqrt_2/sigma)+erf((z_loop(i))/sqrt_2/sigma))/z_pbl

            !c_z=c_z+1./sigma/sqrt_2pi*exp(-0.5*((z-z_loop(i))/sigma)*((z-z_loop(i))/sigma))

        enddo

        !if (sigma.gt.0.9*z_pbl) then
        !c_z=1./z_pbl
        !c_av=1./z_pbl
        !endif

    end subroutine z_centremass_gauss_func