Skip to content

Instantly share code, notes, and snippets.

@komasaru
Last active November 19, 2018 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komasaru/92dbbc03ddc533889bdeb1b8cf95afae to your computer and use it in GitHub Desktop.
Save komasaru/92dbbc03ddc533889bdeb1b8cf95afae to your computer and use it in GitHub Desktop.
Fortran 95 source code to compute the rosseland-maen.(Ver.2)
!****************************************************
! 1次元配列の各要素の逆数平均(Rosseland mean)を計算
!
! date name version
! 2018.08.20 mk-mode.com 1.00 新規作成
!
! Copyright(C) 2018 mk-mode.com All Rights Reserved.
!****************************************************
!
program rosseland_mean
implicit none
real(8) :: a(3) = (/1.0_8, 2.0_8, 3.0_8/)
interface
real(8) function rmean(x)
real(8) :: x(:) ! 形状仮定配列
end function rmean
end interface
write (*,*) rmean(a)
stop
end program rosseland_mean
! Rosseland-mean 計算
!
! :param integer x
! :return read(8)
real(8) function rmean(x)
implicit none
real(8), intent(IN) :: x(:) ! 形状仮定配列
rmean = size(x) / sum(1.0_8 / x)
end function rmean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment