LCOV - code coverage report
Current view: top level - ionization/public - ionization_lib.f90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 76.2 % 21 16
Test Date: 2025-06-06 17:08:43 Functions: 60.0 % 5 3

            Line data    Source code
       1              : ! ***********************************************************************
       2              : !
       3              : !   Copyright (C) 2010  Bill Paxton & 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 ionization_lib
      21              : 
      22              :       use const_def, only: dp
      23              : 
      24              :       implicit none
      25              : 
      26              : 
      27              :       contains
      28              : 
      29              : 
      30            3 :       subroutine ionization_init( &
      31              :             file_prefix, Z1_suffix, ionization_cache_dir, use_cache, ierr)
      32              :          use ionization_def, only: ion_def_init
      33              :          use ion_tables_load, only: Init_ion_tables
      34              :          use mod_ionization, only: do_init_ionization
      35              :          character(len=*), intent(in) :: file_prefix, Z1_suffix
      36              :          character(len=*), intent(in) :: ionization_cache_dir  ! '' means use default
      37              :          logical, intent(in) :: use_cache
      38              :          integer, intent(out) :: ierr
      39            3 :          ierr = 0
      40            3 :          call ion_def_init(ionization_cache_dir)
      41            3 :          call Init_ion_tables(file_prefix, Z1_suffix, use_cache, ierr)
      42            3 :          if (ierr /= 0) return
      43            3 :          call do_init_ionization(ionization_cache_dir, use_cache, ierr)
      44            3 :       end subroutine ionization_init
      45              : 
      46              :       ! EXPERIMENTAL
      47              :       ! This routine is currently undocumented, not recommended for publishable work.
      48              :       ! Element diffusion uses eval_typical_charge, not eval_ionization.
      49            2 :       subroutine eval_ionization(Z, X, Rho, log10Rho, T, log10T, res, ierr)
      50            3 :          use ionization_def, only: num_ion_vals
      51              :          use ion_tables_eval, only: Get_ion_Results
      52              :          real(dp), intent(in) :: Z  ! metals mass fraction
      53              :          real(dp), intent(in) :: X  ! hydrogen mass fraction
      54              :          real(dp), intent(in) :: Rho, log10Rho  ! the density
      55              :             ! provide both if you have them.
      56              :             ! else pass one and set the other to = arg_not_provided
      57              :          real(dp), intent(in) :: T, log10T  ! the temperature
      58              :             ! provide both if you have them.
      59              :             ! else pass one and set the other to = arg_not_provided
      60              :          real(dp), intent(inout) :: res(num_ion_vals)  ! see ionization_def
      61              :          integer, intent(out) :: ierr
      62            2 :          call Get_ion_Results(Z, X, Rho, log10Rho, T, log10T, res, ierr)
      63            2 :       end subroutine eval_ionization
      64              : 
      65              :       ! EXPERIMENTAL
      66            6 :       real(dp) function eval_charge_of_Fe56_in_He4(log10_ne, log10_T, ierr)
      67            2 :          use mod_ionization, only: charge_of_Fe56_in_He4
      68              :          real(dp), intent(in) :: log10_ne  ! ne=avo*rho*free_e
      69              :          real(dp), intent(in) :: log10_T
      70              :          integer, intent(out) :: ierr
      71            6 :          eval_charge_of_Fe56_in_He4 = charge_of_Fe56_in_He4(log10_ne, log10_T, ierr)
      72            6 :       end function eval_charge_of_Fe56_in_He4
      73              : 
      74              : 
      75            0 :       subroutine create_ion_table_files( &
      76              :             in_dir, out_dir_ion, out_dir_eosDT, out_dir_eosPT)
      77              :          !use mod_ion_create_tables, only: do_create_ion_table_files
      78              :          character (len=*), intent(in) :: &
      79              :             in_dir, out_dir_ion, out_dir_eosDT, out_dir_eosPT
      80            0 :          stop 'create_ion_table_files not currently supported -- need to fix interpolation calls'
      81              :          !call do_create_ion_table_files( &
      82              :          !   in_dir, out_dir_ion, out_dir_eosDT, out_dir_eosPT)
      83            6 :       end subroutine create_ion_table_files
      84              : 
      85              : 
      86            0 :       subroutine create_table_plot_files
      87              :          use ion_table_plot, only: do_create_table_plot_files
      88            0 :          call do_create_table_plot_files
      89            0 :       end subroutine create_table_plot_files
      90              : 
      91              :       end module ionization_lib
      92              : 
        

Generated by: LCOV version 2.0-1