source: LMDZ6/trunk/libf/phylmd/StratAer/stratdistrib.f90 @ 5354

Last change on this file since 5354 was 5268, checked in by abarral, 7 weeks ago

.f90 <-> .F90 depending on cpp key use

File size: 2.2 KB
Line 
1!
2! $Id: stratemit.F90  2022-07-04 mmarchand $
3!
4SUBROUTINE STRATDISTRIB(altLMDz,altemiss,sigma_alt,f_lay_emiss)
5!
6  USE dimphy, ONLY : klon,klev
7  USE strataer_local_var_mod
8  USE yomcst_mod_h, only : RPI
9
10  IMPLICIT NONE
11
12! Input argument
13!---------------
14    REAL,DIMENSION(klev+1)  :: altLMDz    ! altitude of layer interfaces in m
15    REAL                    :: sigma_alt
16    REAL                    :: altemiss
17
18! Local variables
19!----------------
20    REAL                 :: f_lay_sum     ! sum of layer emission fractions
21    REAL                 :: alt
22    INTEGER              :: k,i_int
23    INTEGER,PARAMETER    :: n_int_alt=10  ! subintervals nb for integration over Gaussian emission
24
25! Output argument
26!----------------
27    REAL,DIMENSION(klev) :: f_lay_emiss   ! emiss fraction for every emiss for every vertical layer
28   
29   
30! Inject distrib
31!----------------
32    SELECT CASE(flag_emit_distrib)
33       
34    CASE(0) ! Gaussian distribution
35            ! Compute distribution of emission to vertical model layers
36            ! (based on Gaussian peak in altitude)
37       f_lay_sum=0.0
38       DO k=1, klev
39          f_lay_emiss(k)=0.0
40          DO i_int=1, n_int_alt
41             alt=altLMDz(k)+float(i_int)*(altLMDz(k+1)-altLMDz(k))/float(n_int_alt)
42             f_lay_emiss(k)=f_lay_emiss(k)+1./(sqrt(2.*RPI)*sigma_alt)* &
43                   & exp(-0.5*((alt-altemiss)/sigma_alt)**2.)* &           
44                   & (altLMDz(k+1)-altLMDz(k))/float(n_int_alt)
45          ENDDO
46          f_lay_sum=f_lay_sum+f_lay_emiss(k)
47        ENDDO
48       
49     CASE(1) ! Uniform distribution
50             ! In this case, parameter sigma_alt is considered
51             ! to be half the
52             ! height of the injection, centered around altemiss)
53       f_lay_sum=0.0
54       DO k=1, klev
55          f_lay_emiss(k)=max(min(altemiss+sigma_alt,altLMDz(k+1))- &
56                      & max(altemiss-sigma_alt, &
57                      & altLMDz(k)),0.)/(2.*sigma_alt)
58          f_lay_sum=f_lay_sum+f_lay_emiss(k)
59       ENDDO
60
61       END SELECT        ! End CASE over flag_emit_distrib)
62       
63       WRITE(*,*) "IN stratdistrib f_lay_emiss=",f_lay_emiss
64
65       !correct for step integration error
66       f_lay_emiss(:)=f_lay_emiss(:)/f_lay_sum
67
68END SUBROUTINE STRATDISTRIB
Note: See TracBrowser for help on using the repository browser.