!
!
!
module TerrainFCoordinate_helper
  !
  !
  use dc_types, only: &
    & DP

  use Field_Grid1D_Manager, only: &
    & Field_Grid1D
  !
  !
  implicit none
  private

  !
  !
  !
  public :: TF_to_Z, Z_to_TF

contains

function TF_to_Z(xi, z_s, z_T) result(z)

  ! 宣言文 ; Declaration statments
  !
  real(DP), intent(in) :: xi
  real(DP), intent(in) :: z_s
  real(DP), intent(in) :: z_T
  real(DP) z

  ! 実行文 ; Executable statements
  !

  z = ( 1.0d0 - z_s / z_T ) * xi + z_s

end function TF_to_Z

function Z_to_TF(z, z_s, z_T) result(xi)

  ! 宣言文 ; Declaration statments
  !
  real(DP), intent(in) :: z
  real(DP), intent(in) :: z_s
  real(DP), intent(in) :: z_T
  real(DP) xi

  ! 実行文 ; Executable statements
  !

  xi = z_T * ( z - z_s ) / ( z_T - z_s )

end function Z_to_TF

end module TerrainFCoordinate_helper
