!c Description:
!c  空気塊の分子量の計算
!c
!c Current Code Owner: 
!c   sugiyama@gfd-dennou.org
!c
!c Histry: 
!c   Version    Date          Comment
!c   -------    ----------    --------
!c   1.0        2003-06-02    作成
!c
!c Copyright (C) SUGIYAMA Ko-ichiro, 2003, All rights reserved

module interface_molweight
  interface
     
     subroutine molweight(molfr, property, molwt_air)
       use prm_type, only: type_property
       real(8), intent(in)              :: molfr(:)
       real(8), intent(out)             :: molwt_air
       type(type_property), intent(in)  :: property(:)
     end subroutine molweight

  end interface
end module interface_molweight



subroutine molweight(molfr, property, molwt_air)
  use prm_type, only: type_property

  implicit none
  real(8), intent(in)              :: molfr(:)
  real(8), intent(out)             :: molwt_air
  type(type_property), intent(in)  :: property(:)
  integer                          :: num


  !気相の数を計算
  num = count(property%phase == 1)
  
  !空気塊の分子量を計算
  molwt_air = dot_product(molfr(1:num), property(1:num)%molwt)

!  call display(molfr, "モル比")
!  call display(molwt_air, "molwt [g/mol]")


end subroutine molweight


