LCOV - code coverage report
Current view: top level - star/other - other_mesh_functions.f90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 23 0
Test Date: 2025-05-08 18:23:42 Functions: 0.0 % 4 0

            Line data    Source code
       1              : ! ***********************************************************************
       2              : !
       3              : !   Copyright (C) 2010-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 other_mesh_functions
      21              : 
      22              :    ! consult star/other/README for general usage instructions
      23              :    ! control name: use_other_mesh_functions = .true.
      24              :    ! procedure pointer: s% other_mesh_fcn_data => my_routine
      25              : 
      26              :    ! remember to set use_other_mesh_functions = .true. to enable this.
      27              :    ! edit the extras_controls routine to set the procedure pointers
      28              :    ! e.g.,
      29              :    ! s% how_many_other_mesh_fcns => how_many_my_other_mesh_fcns
      30              :    ! s% other_mesh_fcn_data => my_other_mesh_fcn_data
      31              : 
      32              :    implicit none
      33              : 
      34              : contains
      35              : 
      36            0 :    subroutine null_how_many_other_mesh_fcns(id, n)
      37              :       integer, intent(in) :: id
      38              :       integer, intent(out) :: n
      39            0 :       n = 0
      40            0 :    end subroutine null_how_many_other_mesh_fcns
      41              : 
      42            0 :    subroutine null_other_mesh_fcn_data( &
      43            0 :       id, nfcns, names, gval_is_xa_function, vals1, ierr)
      44              :       use const_def, only: dp
      45              :       integer, intent(in) :: id
      46              :       integer, intent(in) :: nfcns
      47              :       character(len=*) :: names(:)
      48              :       logical, intent(out) :: gval_is_xa_function(:)  ! (nfcns)
      49              :       real(dp), pointer :: vals1(:)  ! =(nz, nfcns)
      50              :       integer, intent(out) :: ierr
      51            0 :       gval_is_xa_function(1:nfcns) = .false.
      52            0 :       ierr = 0
      53            0 :    end subroutine null_other_mesh_fcn_data
      54              : 
      55              :    ! here is an example that adds a mesh function for log(opacity)
      56            0 :    subroutine how_many_other_mesh_fcns(id, n)
      57              :       integer, intent(in) :: id
      58              :       integer, intent(out) :: n
      59            0 :       n = 1
      60            0 :    end subroutine how_many_other_mesh_fcns
      61              : 
      62            0 :    subroutine other_mesh_fcn_data( &
      63            0 :       id, nfcns, names, gval_is_xa_function, vals1, ierr)
      64              :       use star_def
      65              :       use math_lib
      66              :       use const_def, only: dp
      67              :       integer, intent(in) :: id
      68              :       integer, intent(in) :: nfcns
      69              :       character(len=*) :: names(:)
      70              :       logical, intent(out) :: gval_is_xa_function(:)  ! (nfcns)
      71              :       real(dp), pointer :: vals1(:)  ! =(nz, nfcns)
      72              :       integer, intent(out) :: ierr
      73              :       integer :: nz, k
      74            0 :       real(dp), pointer :: vals(:, :)
      75              :       real(dp), parameter :: weight = 20
      76              :       type(star_info), pointer :: s
      77              :       ierr = 0
      78            0 :       call star_ptr(id, s, ierr)
      79            0 :       if (ierr /= 0) return
      80            0 :       names(1) = 'kap_function'
      81            0 :       gval_is_xa_function(1) = .false.
      82            0 :       nz = s%nz
      83            0 :       vals(1:nz, 1:nfcns) => vals1(1:nz*nfcns)
      84            0 :       do k = 1, nz
      85            0 :          vals(k, 1) = weight*log10(s%opacity(k))
      86              :       end do
      87            0 :    end subroutine other_mesh_fcn_data
      88              : 
      89              : end module other_mesh_functions
      90              : 
        

Generated by: LCOV version 2.0-1