!fpx3_header(0.13_3a)
!
!dependencies
!   dir: ~/devel/gyre-4/src/utils 
!   sources: -
!   includes: ../extern/core/core.inc
!   uses: core_spline gyre_cocache core_kinds gyre_model core_parallel ISO_FORTRAN_ENV
!   provides: gyre_poly_model
!end dependencies
!
!end fpx3_header
! Module   : gyre_poly_model
! Purpose  : stellar polytropic model
!
! Copyright 2013 Rich Townsend
!
! This file is part of GYRE. GYRE is free software: you can
! redistribute it and/or modify it under the terms of the GNU General
! Public License as published by the Free Software Foundation, version 3.
!
! GYRE is distributed in the hope that it will be useful, but WITHOUT
! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
! or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
! License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program.  If not, see <http://www.gnu.org/licenses/>.

! Incfile  : core
! Purpose  : fpx3 macros

!****

!****

!****

!****

!****

!****

!****

!****

!****

module gyre_poly_model

  ! Uses

  use core_kinds
  use core_parallel
  use core_spline

  use gyre_model
  use gyre_cocache

  use ISO_FORTRAN_ENV

  ! No implicit typing

  implicit none

  ! Derived-type definitions

  type, extends(model_t) :: poly_model_t
     private
     type(spline_t)   :: sp_Theta
     type(spline_t)   :: sp_dTheta
     type(spline_t)   :: sp_Omega_rot
     real(WP)         :: dt_Gamma_1
     real(WP), public :: n_poly
     real(WP), public :: xi_1
   contains
     private

    procedure :: V_1_
    procedure :: V_v_

    procedure :: As_1_
    procedure :: As_v_

    procedure :: U_1_
    procedure :: U_v_

    procedure :: c_1_1_
    procedure :: c_1_v_

    procedure :: Gamma_1_1_
    procedure :: Gamma_1_v_

    procedure :: nabla_ad_1_
    procedure :: nabla_ad_v_

    procedure :: delta_1_
    procedure :: delta_v_

    procedure :: c_rad_1_
    procedure :: c_rad_v_

    procedure :: dc_rad_1_
    procedure :: dc_rad_v_

    procedure :: c_thm_1_
    procedure :: c_thm_v_

    procedure :: c_dif_1_
    procedure :: c_dif_v_

    procedure :: c_eps_ad_1_
    procedure :: c_eps_ad_v_

    procedure :: c_eps_S_1_
    procedure :: c_eps_S_v_

    procedure :: nabla_1_
    procedure :: nabla_v_

    procedure :: kappa_ad_1_
    procedure :: kappa_ad_v_

    procedure :: kappa_S_1_
    procedure :: kappa_S_v_

    procedure :: tau_thm_1_
    procedure :: tau_thm_v_

    procedure :: Omega_rot_1_
    procedure :: Omega_rot_v_

     procedure, public :: pi_c => pi_c_
     procedure, public :: is_zero => is_zero_
     procedure, public :: attach_cache => attach_cache_
     procedure, public :: detach_cache => detach_cache_
     procedure, public :: fill_cache => fill_cache_
  end type poly_model_t

  ! Interfaces

  interface poly_model_t
     module procedure poly_model_t_
  end interface poly_model_t

  ! Access specifiers

  private

  public :: poly_model_t

  ! Procedures

contains

  function poly_model_t_ (xi, Theta, dTheta, Omega_rot, n_poly, Gamma_1, deriv_type) result (ml)

    real(WP), intent(in)         :: xi(:)
    real(WP), intent(in)         :: Theta(:)
    real(WP), intent(in)         :: dTheta(:)
    real(WP), intent(in)         :: Omega_rot(:)
    real(WP), intent(in)         :: n_poly
    real(WP), intent(in)         :: Gamma_1
    character(LEN=*), intent(in) :: deriv_type
    type(poly_model_t)           :: ml

    integer  :: n
    real(WP) :: d2Theta(SIZE(xi))

  if(SIZE(Theta)/= SIZE(xi)) then
    write(UNIT=ERROR_UNIT, FMT=*) 'SIZE(Theta) :', SIZE(Theta)
    write(UNIT=ERROR_UNIT, FMT=*) 'SIZE(xi) :', SIZE(xi)
    write(UNIT=ERROR_UNIT, FMT=*) 'CHECK_BOUNDS SIZE(Theta)==SIZE(xi) failed at line 119 <gyre_poly_model:poly_model_t_>'
    stop
  endif

  if(SIZE(Omega_rot)/= SIZE(xi)) then
    write(UNIT=ERROR_UNIT, FMT=*) 'SIZE(Omega_rot) :', SIZE(Omega_rot)
    write(UNIT=ERROR_UNIT, FMT=*) 'SIZE(xi) :', SIZE(xi)
    write(UNIT=ERROR_UNIT, FMT=*) 'CHECK_BOUNDS SIZE(Omega_rot)==SIZE(xi) failed at line 120 <gyre_poly_model:poly_model_t_>'
    stop
  endif

    ! Construct the poly_model_t from the polytrope functions

    n = SIZE(xi)

    if(n_poly /= 0._WP) then

       where (xi /= 0._WP)
          d2Theta = -2._WP*dTheta/xi - Theta**n_poly
       elsewhere
          d2Theta = -1._WP/3._WP
       end where

    else

       d2Theta = -1._WP/3._WP

    endif

    ml%sp_Theta = spline_t(xi, Theta, dTheta)
    ml%sp_dTheta = spline_t(xi, dTheta, d2Theta)

    ml%sp_Omega_rot = spline_t(xi/xi(n), Omega_rot, deriv_type, dy_dx_a=0._WP, dy_dx_b=0._WP)

    ml%n_poly = n_poly
    ml%dt_Gamma_1 = Gamma_1
    ml%xi_1 = xi(n)

    ! Finish

    return

  end function poly_model_t_

!****

  function V_1_ (this, x) result (V)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: V

    real(WP) :: xi
    real(WP) :: Theta
    real(WP) :: dTheta

    ! Calculate V

    xi = x*this%xi_1

    Theta = this%sp_Theta%interp(xi)
    dTheta = this%sp_dTheta%interp(xi)

    V = -(this%n_poly + 1._WP)*xi*dTheta/Theta

    ! Finish

    return

  end function V_1_

!****

  function V_v_ (this, x) result (V)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)             :: x(:)
    real(WP)                         :: V(SIZE(x))

    integer :: i

    ! Calculate V

    x_loop : do i = 1,SIZE(x)
       V(i) = this%V(x(i))
    end do x_loop

    ! Finish

    return

  end function V_v_

!****

  function As_1_ (this, x) result (As)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: As

    ! Calculate As

    As = this%V(x)*(this%n_poly/(this%n_poly + 1._WP) - 1._WP/this%Gamma_1(x))

    ! Finish

    return

  end function As_1_

!****

  function As_v_ (this, x) result (As)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: As(SIZE(x))

    integer :: i

    ! Calculate As

    x_loop : do i = 1,SIZE(x)
       As(i) = this%As(x(i))
    end do x_loop

    ! Finish

    return

  end function As_v_

!****

  function U_1_ (this, x) result (U)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: U

    real(WP) :: xi
    real(WP) :: Theta
    real(WP) :: dTheta

    ! Calculate U

    xi = x*this%xi_1

    Theta = this%sp_Theta%interp(xi)
    dTheta = this%sp_dTheta%interp(xi)

    if(x /= 0._WP) then
       U = -xi*Theta**this%n_poly/dTheta
    else
       U = 3._WP
    endif

    ! Finish

    return

  end function U_1_

!****

  function U_v_ (this, x) result (U)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: U(SIZE(x))

    integer :: i

    ! Calculate U

    x_loop : do i = 1,SIZE(x)
       U(i) = this%U(x(i))
    end do x_loop

    ! Finish

    return

  end function U_v_

!****

  function c_1_1_ (this, x) result (c_1)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: c_1

    real(WP) :: xi
    real(WP) :: dTheta
    real(WP) :: dTheta_1

    ! Calculate c_1

    xi = x*this%xi_1

    dTheta = this%sp_dTheta%interp(xi)
    dTheta_1 = this%sp_dTheta%interp(this%xi_1)

    if(x /= 0._WP) then
       c_1 = x*dTheta_1/dTheta
    else
       c_1 = -3._WP*dTheta_1/this%xi_1
    endif

    ! Finish

    return

  end function c_1_1_

!****

  function c_1_v_ (this, x) result (c_1)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: c_1(SIZE(x))

    integer :: i

    ! Calculate c_1

    x_loop : do i = 1,SIZE(x)
       c_1(i) = this%c_1(x(i))
    end do x_loop

    ! Finish

    return

  end function c_1_v_

!****

  function Gamma_1_1_ (this, x) result (Gamma_1)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: Gamma_1

    ! Calculate Gamma_1

    Gamma_1 = this%dt_Gamma_1

    ! Finish

    return

  end function Gamma_1_1_

!****

  function Gamma_1_v_ (this, x) result (Gamma_1)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: Gamma_1(SIZE(x))

    integer :: i

    ! Calculate Gamma_1

    x_loop : do i = 1,SIZE(x)
       Gamma_1(i) = this%Gamma_1(x(i))
    end do x_loop

    ! Finish

    return

  end function Gamma_1_v_

!****

  function nabla_ad_1_ (this, x) result (nabla_ad)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: nabla_ad

    ! Calculate nabla_ad (assume ideal gas)

    nabla_ad = 2._WP/5._WP

    ! Finish

    return

  end function nabla_ad_1_

!****

  function nabla_ad_v_ (this, x) result (nabla_ad)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: nabla_ad(SIZE(x))

    integer :: i

    ! Calculate nabla_ad

    x_loop : do i = 1,SIZE(x)
       nabla_ad(i) = this%nabla_ad(x(i))
    end do x_loop

    ! Finish

    return

  end function nabla_ad_v_

!****

  function delta_1_ (this, x) result (delta)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: delta

    ! Calculate delta (assume ideal gas)

    delta = 1._WP

    ! Finish

    return

  end function delta_1_

!****

  function delta_v_ (this, x) result (delta)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: delta(SIZE(x))

    integer :: i

    ! Calculate delta

    x_loop : do i = 1,SIZE(x)
       delta(i) = this%delta(x(i))
    end do x_loop

    ! Finish

    return

  end function delta_v_

!****

  function c_rad_1_ (this, x) result (c_rad)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: c_rad

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 512 <gyre_poly_model:c_rad_1_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'c_rad is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function c_rad_1_

!****

  function c_rad_v_ (this, x) result (c_rad)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: c_rad(SIZE(x))

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 512 <gyre_poly_model:c_rad_v_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'c_rad is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function c_rad_v_

  function dc_rad_1_ (this, x) result (dc_rad)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: dc_rad

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 513 <gyre_poly_model:dc_rad_1_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'dc_rad is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function dc_rad_1_

!****

  function dc_rad_v_ (this, x) result (dc_rad)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: dc_rad(SIZE(x))

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 513 <gyre_poly_model:dc_rad_v_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'dc_rad is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function dc_rad_v_

  function c_thm_1_ (this, x) result (c_thm)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: c_thm

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 514 <gyre_poly_model:c_thm_1_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'c_thm is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function c_thm_1_

!****

  function c_thm_v_ (this, x) result (c_thm)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: c_thm(SIZE(x))

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 514 <gyre_poly_model:c_thm_v_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'c_thm is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function c_thm_v_

  function c_dif_1_ (this, x) result (c_dif)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: c_dif

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 515 <gyre_poly_model:c_dif_1_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'c_dif is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function c_dif_1_

!****

  function c_dif_v_ (this, x) result (c_dif)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: c_dif(SIZE(x))

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 515 <gyre_poly_model:c_dif_v_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'c_dif is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function c_dif_v_

  function c_eps_ad_1_ (this, x) result (c_eps_ad)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: c_eps_ad

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 516 <gyre_poly_model:c_eps_ad_1_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'c_eps_ad is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function c_eps_ad_1_

!****

  function c_eps_ad_v_ (this, x) result (c_eps_ad)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: c_eps_ad(SIZE(x))

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 516 <gyre_poly_model:c_eps_ad_v_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'c_eps_ad is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function c_eps_ad_v_

  function c_eps_S_1_ (this, x) result (c_eps_S)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: c_eps_S

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 517 <gyre_poly_model:c_eps_S_1_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'c_eps_S is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function c_eps_S_1_

!****

  function c_eps_S_v_ (this, x) result (c_eps_S)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: c_eps_S(SIZE(x))

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 517 <gyre_poly_model:c_eps_S_v_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'c_eps_S is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function c_eps_S_v_

  function nabla_1_ (this, x) result (nabla)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: nabla

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 518 <gyre_poly_model:nabla_1_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'nabla is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function nabla_1_

!****

  function nabla_v_ (this, x) result (nabla)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: nabla(SIZE(x))

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 518 <gyre_poly_model:nabla_v_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'nabla is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function nabla_v_

  function kappa_S_1_ (this, x) result (kappa_S)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: kappa_S

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 519 <gyre_poly_model:kappa_S_1_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'kappa_S is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function kappa_S_1_

!****

  function kappa_S_v_ (this, x) result (kappa_S)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: kappa_S(SIZE(x))

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 519 <gyre_poly_model:kappa_S_v_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'kappa_S is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function kappa_S_v_

  function kappa_ad_1_ (this, x) result (kappa_ad)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: kappa_ad

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 520 <gyre_poly_model:kappa_ad_1_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'kappa_ad is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function kappa_ad_1_

!****

  function kappa_ad_v_ (this, x) result (kappa_ad)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: kappa_ad(SIZE(x))

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 520 <gyre_poly_model:kappa_ad_v_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'kappa_ad is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function kappa_ad_v_

  function tau_thm_1_ (this, x) result (tau_thm)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: tau_thm

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 521 <gyre_poly_model:tau_thm_1_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'tau_thm is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function tau_thm_1_

!****

  function tau_thm_v_ (this, x) result (tau_thm)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: tau_thm(SIZE(x))

    ! Abort with $NAME undefined

    write(UNIT=ERROR_UNIT, FMT=*) 'ABORT at line 521 <gyre_poly_model:tau_thm_v_>:'
    write(UNIT=ERROR_UNIT, FMT=*) 'tau_thm is undefined'

  stop 'Program aborted'

    ! Finish

    return

  end function tau_thm_v_

!****

  function Omega_rot_1_ (this, x) result (Omega_rot)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    real(WP)                        :: Omega_rot

    ! Interpolate Omega_rot

    Omega_rot = this%sp_Omega_rot%interp(x)

    ! Finish

    return

  end function Omega_rot_1_

!****

  function Omega_rot_v_ (this, x) result (Omega_rot)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x(:)
    real(WP)                        :: Omega_rot(SIZE(x))

    integer :: j

    ! Interpolate Omega_rot

    Omega_rot = this%sp_Omega_rot%interp(x)

    ! Finish

    return

  end function Omega_rot_v_

!****

  function pi_c_ (this) result (pi_c)

    class(poly_model_t), intent(in) :: this
    real(WP)                        :: pi_c

    ! Calculate pi_c = V/x^2 as x -> 0

    pi_c =  (this%n_poly + 1._WP)*this%xi_1**2/3._WP

    ! Finish

    return

  end function pi_c_

!****

  function is_zero_ (this, x) result (is_zero)

    class(poly_model_t), intent(in) :: this
    real(WP), intent(in)            :: x
    logical                         :: is_zero

    real(WP) :: xi

    ! Determine whether the point at x has a vanishing pressure and/or density

    xi = x*this%xi_1

    is_zero = this%sp_Theta%interp(xi) == 0._WP

    ! Finish

    return

  end function is_zero_

!****

  subroutine attach_cache_ (this, cc)

    class(poly_model_t), intent(inout)    :: this
    class(cocache_t), pointer, intent(in) :: cc

    ! Enable a coefficient cache (no-op, since we don't cache)

    ! Finish

    return

  end subroutine attach_cache_

!****

  subroutine detach_cache_ (this)

    class(poly_model_t), intent(inout) :: this

    ! Detach the coefficient cache (no-op, since we don't cache)

    ! Finish

    return

  end subroutine detach_cache_

!****

  subroutine fill_cache_ (this, x)

    class(poly_model_t), intent(inout) :: this
    real(WP), intent(in)               :: x(:)

    ! Fill the coefficient cache (no-op, since we don't cache)

    ! Finish

    return

  end subroutine fill_cache_

!****

end module gyre_poly_model
