mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Added stand-alone implementation of complementary error function for compilers without F2008 support.
This commit is contained in:
parent
959dc18108
commit
9d3e994779
1 changed files with 28 additions and 0 deletions
|
|
@ -210,4 +210,32 @@ contains
|
|||
|
||||
end subroutine calculate_F
|
||||
|
||||
#ifdef NO_F2008
|
||||
!===============================================================================
|
||||
! ERFC computes the complementary error function of x
|
||||
!===============================================================================
|
||||
|
||||
function erfc(x) result(y)
|
||||
|
||||
real(8), intent(in) :: x
|
||||
real(8) :: y
|
||||
|
||||
real(8) :: a1 = 0.254829592_8
|
||||
real(8) :: a2 = -0.284496736_8
|
||||
real(8) :: a3 = 1.421413741_8
|
||||
real(8) :: a4 = -1.453152027_8
|
||||
real(8) :: a5 = 1.061405429_8
|
||||
real(8) :: p = 0.3275911_8
|
||||
real(8) :: t
|
||||
|
||||
! Abramowitz and Stegun formula 7.1.26
|
||||
t = 1.0_8/(1.0_8 + p*abs(x))
|
||||
y = (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x)
|
||||
|
||||
! Account for negative values of x
|
||||
y = sign(y,x)
|
||||
|
||||
end function erfc
|
||||
#endif
|
||||
|
||||
end module doppler
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue