calc_moments_1D Subroutine

subroutine calc_moments_1D(tab, mx, nb_mom, lg)

Arguments

Type IntentOptional Attributes Name
real(kind=R8), intent(in), dimension(1:lg) :: tab
type(moment_stat), intent(out) :: mx
integer(kind=I4), intent(in) :: nb_mom
integer(kind=I4), intent(in) :: lg

Called by

proc~~calc_moments_1d~~CalledByGraph proc~calc_moments_1d calc_moments_1D proc~profil_theo_trie_1d profil_theo_trie_1D proc~profil_theo_trie_1d->proc~calc_moments_1d program~test_algen test_algen program~test_algen->proc~profil_theo_trie_1d

Source Code

   subroutine calc_moments_1D(tab, mx, nb_mom, lg)
   implicit none
   integer(kind=I4) , intent(in )                  :: lg
   integer(kind=I4) , intent(in )                  :: nb_mom
   real(kind=R8)    , intent(in ), dimension(1:lg) :: tab
   type(moment_stat), intent(out)                  :: mx

      integer(kind=I4) :: i
      real(kind=R8)    :: tmp

      mx%mu = 0
      mx%si = 0
      mx%va = 0
      mx%Sk = 0
      mx%Ku = 0

      do i = 1, lg
         mx%mu = mx%mu +tab(i)/lg
      enddo
      if (nb_mom==1) return

      do i = 1, lg
         mx%va = mx%va +((tab(i) -mx%mu)**2)/lg
      enddo
      mx%si = sqrt( mx%va )
      if (nb_mom==2) return
      if (mx%si < 1.e-15_R8) then
         mx%Sk = 0
         mx%Ku = 0
      else
         do i = 1, lg
            tmp = (tab(i) -mx%mu)/mx%si
            mx%Sk = mx%Sk +(tmp**3)/lg
            mx%Ku = mx%Ku +(tmp**4)/lg
         enddo
      endif

   return
   endsubroutine calc_moments_1D