Changes in src/mean_mod.f90 [4c64400:6a678e3] in flexpart.git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mean_mod.f90
r4c64400 r6a678e3 29 29 module procedure mean_sp 30 30 module procedure mean_dp 31 module procedure mean_mixed_dss 32 module procedure mean_mixed_dsd 33 31 module procedure mean_mixed_prec 34 32 end interface mean 35 33 … … 66 64 ! real(sp),parameter :: eps=1.0e-30 67 65 68 integer,intent(in) :: number69 66 real(sp), intent(in) :: x_sp(number) 70 67 real(sp), intent(out) ::xm,xs 68 integer,intent(in) :: number 71 69 real(sp) :: xl,xq,xaux 72 70 real(sp),parameter :: eps=1.0e-30 … … 118 116 implicit none 119 117 120 integer,intent(in) :: number121 118 real(dp), intent(in) :: x_dp(number) 122 119 real(dp), intent(out) ::xm,xs 120 integer,intent(in) :: number 123 121 real(dp) :: xl,xq,xaux 124 122 real(dp),parameter :: eps=1.0e-30 … … 144 142 end subroutine mean_dp 145 143 146 subroutine mean_mixed_ dss(x_dp,xm,xs,number)144 subroutine mean_mixed_prec(x_dp,xm,xs,number) 147 145 148 146 !***************************************************************************** … … 152 150 ! AUTHOR: Andreas Stohl, 25 January 1994 * 153 151 ! * 154 ! Mixed precision version ESO 2016 (dp in , sp out, sp out)*152 ! Mixed precision version ESO 2016 (dp input, sp output) * 155 153 !***************************************************************************** 156 154 ! * … … 170 168 implicit none 171 169 172 integer,intent(in) :: number173 170 real(dp), intent(in) :: x_dp(number) 174 171 real(sp), intent(out) ::xm,xs 172 integer,intent(in) :: number 175 173 real(sp) :: xl,xq,xaux 176 174 real(sp),parameter :: eps=1.0e-30 … … 194 192 endif 195 193 196 end subroutine mean_mixed_dss 197 198 subroutine mean_mixed_dsd(x_dp,xm,xs_dp,number) 199 200 !***************************************************************************** 201 ! * 202 ! This subroutine calculates mean and standard deviation of a given element.* 203 ! * 204 ! AUTHOR: Andreas Stohl, 25 January 1994 * 205 ! * 206 ! Mixed precision version ESO 2016 (dp in, sp out, dp out) * 207 !***************************************************************************** 208 ! * 209 ! Variables: * 210 ! x_dp(number) field of input data * 211 ! xm mean * 212 ! xs_dp standard deviation * 213 ! number number of elements of field x_dp * 214 ! * 215 ! Constants: * 216 ! eps tiny number * 217 ! * 218 !***************************************************************************** 219 220 use par_mod, only: sp,dp 221 222 implicit none 223 224 integer,intent(in) :: number 225 real(dp), intent(in) :: x_dp(number) 226 real(sp), intent(out) ::xm 227 real(dp), intent(out) ::xs_dp 228 real(dp) :: xl,xq,xaux 229 real(dp),parameter :: eps=1.0e-30_dp 230 integer :: i 231 232 xl=0._dp 233 xq=0._dp 234 do i=1,number 235 xl=xl+x_dp(i) 236 xq=xq+x_dp(i)*x_dp(i) 237 end do 238 239 xm=xl/real(number,kind=sp) 240 241 xaux=xq-xl*xl/real(number,kind=dp) 242 243 if (xaux.lt.eps) then 244 xs_dp=0._dp 245 else 246 xs_dp=sqrt(xaux/real(number-1,kind=dp)) 247 endif 248 249 end subroutine mean_mixed_dsd 250 194 end subroutine mean_mixed_prec 251 195 end module mean_mod
Note: See TracChangeset
for help on using the changeset viewer.