[mesa-users] extra_controls seemingly not redirecting a pointer to new subroutine

Orsola De Marco orsola.demarco at mq.edu.au
Wed Mar 20 23:17:02 EDT 2013


Dear MESA users,

I am trying to add extra heat to my model. I have followed pretty much an example of altering run_star_extras.f in the src directory within my working directory. Here is the modification:

    subroutine extras_controls(s, ierr)
         type (star_info), pointer :: s
         integer, intent(out) :: ierr
         ierr = 0
         write(6,*) 'Before energy routine'
         s% other_energy => energy_routine
         write(6,*) 'after energy routine'

         ! this is the place to set any procedure pointers you want to change
         ! e.g., other_wind, other_mixing, other_energy  (see star_data.inc)

    end subroutine extras_controls


The pointer redirection in in bold and the two write statements let me know that the code did go through that redirection. The energy_routine is this:

      subroutine energy_routine(id, ierr)
         use const_def, only: Rsun
         integer, intent(in) :: id
         integer, intent(out) :: ierr
         type (star_info), pointer :: s
         integer :: k
         ierr = 0
         write(6,*) 'From inside my energy_routine'
         call star_ptr(id, s, ierr)
         if (ierr /= 0) return
         s% extra_heat(:) = 1 ! erg/g/sec
         return
         ! here is an example of calculating extra_heat for each cell.
         do k = 1, s% nz
            if (s% r(k) > 0.7*Rsun .and. s% r(k) < 0.9*Rsun) then
               s% extra_heat(k) = 1d3*exp(-10*(s% r(k) - 0.8*Rsun)**2)
            end if
         end do
      end subroutine energy_routine


Where the write statement let's me know if the routine is entered at all.

The routine is not used, as if the pointer redirection did not work. The write statement is never executed and the extra_heat are all zeros in my profile output.

I tried to think of the obvious, such as "have i recompiled the code?" and there is nothing that figures.... Before I do what I know I should not do, namely start touching code that should not be touched, does anybody know what the issue could be due to?

Thanks, Orsola

Orsola De Marco, Ph.D.
Associate Professor
and Future Fellow
Department of Physics & Astronomy
Macquarie University 
Sydney, NSW 2109
Australia
Tel: +61 2 9850 4241
Fax: +61 2 9850 8115
http://web.science.mq.edu.au/~orsola/
orsola.demarco at mq.edu.au





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20130321/349e4aab/attachment.html>


More information about the Mesa-users mailing list