LCOV - code coverage report
Current view: top level - eos/private - eosde_eval.f90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 38 0
Test Date: 2025-05-08 18:23:42 Functions: 0.0 % 1 0

            Line data    Source code
       1              : ! ***********************************************************************
       2              : !
       3              : !   Copyright (C) 2014-2019  The MESA Team
       4              : !
       5              : !   This program is free software: you can redistribute it and/or modify
       6              : !   it under the terms of the GNU Lesser General Public License
       7              : !   as published by the Free Software Foundation,
       8              : !   either version 3 of the License, or (at your option) any later version.
       9              : !
      10              : !   This program is distributed in the hope that it will be useful,
      11              : !   but WITHOUT ANY WARRANTY; without even the implied warranty of
      12              : !   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      13              : !   See the GNU Lesser General Public License for more details.
      14              : !
      15              : !   You should have received a copy of the GNU Lesser General Public License
      16              : !   along with this program. If not, see <https://www.gnu.org/licenses/>.
      17              : !
      18              : ! ***********************************************************************
      19              : 
      20              :       module eosDE_eval
      21              : 
      22              :          use eos_def
      23              :       use const_def, only: dp, avo, kerg, ln10
      24              :       use math_lib
      25              : 
      26              :       implicit none
      27              : 
      28              :       contains
      29              : 
      30            0 :       subroutine Get_eos_gamma_DE_Results( &
      31              :             rq, abar, energy, log10E, rho, log10Rho, gamma, &
      32            0 :             T, log10T, res, d_dlnRho_const_T, d_dlnT_const_Rho, &
      33              :             dlnT_dlnE_c_Rho, dlnT_dlnd_c_E, &
      34              :             dlnPgas_dlnE_c_Rho, dlnPgas_dlnd_c_E, ierr)
      35              :          use utils_lib, only: is_bad
      36              :          type (EoS_General_Info), pointer :: rq
      37              :          real(dp), intent(in) :: abar, energy, log10E, Rho, log10Rho, gamma
      38              :          real(dp), intent(out) :: T, log10T
      39              :          real(dp), intent(inout), dimension(:) :: &
      40              :             res, d_dlnRho_const_T, d_dlnT_const_Rho
      41              :          real(dp), intent(out) :: &
      42              :             dlnT_dlnE_c_Rho, dlnT_dlnd_c_E, &
      43              :             dlnPgas_dlnE_c_Rho, dlnPgas_dlnd_c_E
      44              :          integer, intent(out) :: ierr
      45              : 
      46            0 :          real(dp) :: avo_k_div_abar, P, entropy
      47              :          include 'formats'
      48              : 
      49            0 :          ierr = 0
      50              : 
      51            0 :          res(1:nv) = 0d0
      52            0 :          d_dlnRho_const_T(1:nv) = 0d0
      53            0 :          d_dlnT_const_Rho(1:nv) = 0d0
      54              : 
      55            0 :          avo_k_div_abar = avo*kerg/abar
      56              : 
      57            0 :          P = (gamma - 1d0)*energy*rho
      58            0 :          T = (gamma - 1d0)*energy/avo_k_div_abar
      59            0 :          log10T = log10(T)
      60              : 
      61            0 :          res(i_Cv) = avo_k_div_abar/(gamma - 1)  ! energy/T
      62              : 
      63            0 :          entropy = res(i_Cv)*log(P/pow(rho,gamma)) + 1d9  ! offset to keep it > 0
      64              : 
      65            0 :          if (is_bad(entropy) .or. entropy <= 0d0) then
      66              :             if (.false.) then
      67              : !$OMP critical (eosde_eval_crit1)
      68              :                write(*,1) 'entropy', entropy
      69              :                write(*,1) 'energy', energy
      70              :                write(*,1) 'T', T
      71              :                write(*,1) 'P', P
      72              :                write(*,1) 'rho', rho
      73              :                write(*,1) 'pow(rho,gamma)', pow(rho,gamma)
      74              :                write(*,1) 'res(i_Cv)', res(i_Cv)
      75              :                write(*,1) 'P/pow(rho,gamma)', P/pow(rho,gamma)
      76              :                write(*,1) 'log(P/pow(rho,gamma)', log(P/pow(rho,gamma))
      77              :                write(*,1) 'gamma', gamma
      78              :                call mesa_error(__FILE__,__LINE__,'bad gamma law entropy')
      79              : !$OMP end critical (eosde_eval_crit1)
      80              :             end if
      81            0 :             entropy = 1d-99
      82              :          end if
      83              : 
      84            0 :          res(i_lnPgas) = log(P)  ! treat P as Pgas
      85            0 :          res(i_lnE) = log10E*ln10
      86            0 :          res(i_lnS) = log(entropy)
      87            0 :          res(i_Cp) = gamma*res(i_Cv)
      88            0 :          res(i_grad_ad) = (gamma - 1d0)/gamma  ! dlnT_dlnP|S
      89            0 :          res(i_chiRho) = 1d0  ! dlnP_dlnRho|T
      90            0 :          res(i_chiT) = 1d0  ! dlnP_dlnT|Rho
      91            0 :          res(i_dE_dRho) = 0d0
      92            0 :          res(i_dS_dT) = 0d0
      93            0 :          res(i_dS_dRho) = 0d0
      94            0 :          res(i_mu) = 1d0/abar
      95            0 :          res(i_gamma1) = gamma
      96            0 :          res(i_gamma3) = gamma
      97            0 :          res(i_lnfree_e) = -1d99
      98            0 :          res(i_eta) = 0d0
      99              : 
     100            0 :          d_dlnRho_const_T(i_lnPgas) = 1
     101              : 
     102            0 :          d_dlnT_const_Rho(i_lnPgas) = 1
     103            0 :          d_dlnT_const_Rho(i_lnE) = 1
     104              : 
     105            0 :          dlnT_dlnd_c_E = 0
     106            0 :          dlnPgas_dlnd_c_E = 1
     107              : 
     108            0 :          dlnT_dlnE_c_Rho = 1
     109            0 :          dlnPgas_dlnE_c_Rho = 1
     110              : 
     111            0 :       end subroutine Get_eos_gamma_DE_Results
     112              : 
     113              :       end module eosDE_eval
        

Generated by: LCOV version 2.0-1