Line data Source code
1 : ! ***********************************************************************
2 : !
3 : ! Copyright (C) 2010 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 photo_out
21 :
22 : use star_private_def
23 :
24 : implicit none
25 :
26 : private
27 : public :: output_star_photo
28 :
29 : contains
30 :
31 1 : subroutine output_star_photo(s,iounit,ierr)
32 : use rates_def,only:num_rvs
33 : use rsp_def, only: rsp_photo_out
34 : use alloc
35 : type (star_info), pointer :: s
36 : integer, intent(in) :: iounit
37 : integer, intent(out) :: ierr
38 :
39 : integer :: part_number, nz, len_history_col_spec
40 : integer :: k
41 :
42 : include 'formats'
43 :
44 1 : ierr = 0
45 1 : nz = s% nz
46 :
47 1 : part_number = 0 ! part_numbers are just a consistency check on the data file
48 :
49 1 : write(iounit) star_def_version
50 :
51 1 : call write_part_number(iounit)
52 : write(iounit) &
53 1 : s% initial_z, & ! need this since read_model can change what is in the inlist
54 1 : s% total_num_solver_iterations, &
55 1 : s% nz, s% nvar_hydro, s% nvar_chem, s% nvar_total, &
56 1 : s% v_flag, s% u_flag, s% rotation_flag, s% RSP2_flag, s% RSP_flag, &
57 1 : s% RTI_flag, s% w_div_wc_flag, s% j_rot_flag, s% D_omega_flag, s% am_nu_rot_flag, &
58 1 : s% have_mlt_vc, s% species, s% num_reactions, &
59 1 : s% model_number, s% star_mass, &
60 1 : s% mstar, s% xmstar, s% M_center, s% v_center, s% R_center, s% L_center, &
61 1 : s% time, s% dt, s% have_previous_conv_vel, &
62 1 : s% was_in_implicit_wind_limit, &
63 1 : s% using_revised_net_name, &
64 1 : s% revised_net_name, &
65 1 : s% using_revised_max_yr_dt, &
66 1 : s% revised_max_yr_dt, &
67 1 : s% astero_using_revised_max_yr_dt, &
68 1 : s% astero_revised_max_yr_dt, &
69 1 : s% cumulative_energy_error, s% cumulative_extra_heating, &
70 1 : s% have_initial_energy_integrals, s% total_energy_initial, &
71 1 : s% force_tau_factor, s% force_Tsurf_factor, s% force_opacity_factor, &
72 2 : s% crystal_core_boundary_mass
73 :
74 1 : write(iounit) s% net_name
75 :
76 1 : call write_part_number(iounit)
77 : write(iounit) &
78 1 : s% dq(1:nz), s% xa(:,1:nz), s% xh(:,1:nz), &
79 1 : s% omega(1:nz), s% j_rot(1:nz), s% mlt_vc(1:nz), s% conv_vel(1:nz), &
80 1 : s% D_ST_start(1:nz), s% nu_ST_start(1:nz), & ! needed for ST time smoothing
81 2 : s% have_ST_start_info
82 :
83 1 : call write_part_number(iounit)
84 : write(iounit) &
85 1 : s% rsp_num_periods, s% rsp_dt, s% rsp_period, s% RSP_have_set_velocities, &
86 2 : s% dt_limit_ratio, s% tau_base
87 :
88 : write(iounit) &
89 1 : s% i_lnd, s% i_lnT, s% i_lnR, s% i_lum, s% i_Et_RSP, s% i_erad_RSP, s% i_Fr_RSP, &
90 1 : s% i_v, s% i_u, s% i_alpha_RTI, s% i_w, s% i_Hp, s% i_w_div_wc, s% i_j_rot, &
91 1 : s% i_dv_dt, s% i_equL, s% i_dlnd_dt, s% i_dlnE_dt, &
92 1 : s% i_dEt_RSP_dt, s% i_derad_RSP_dt, s% i_dFr_RSP_dt, s% i_du_dt, s% i_dlnR_dt, &
93 2 : s% i_dalpha_RTI_dt, s% i_detrb_dt, s% i_equ_Hp
94 :
95 : write(iounit) &
96 1 : s% model_controls_filename, s% model_data_filename, &
97 1 : s% most_recent_profile_filename, s% most_recent_controls_filename, &
98 2 : s% most_recent_model_data_filename
99 :
100 1 : call write_part_number(iounit)
101 : write(iounit) &
102 1 : s% recent_log_header, s% phase_of_evolution, s% dt_next, s% dt_next_unclipped
103 :
104 1 : call write_part_number(iounit)
105 : write(iounit) &
106 1 : s% num_skipped_setvars, s% num_retries, s% num_setvars, &
107 1 : s% total_num_solver_iterations, &
108 1 : s% total_num_solver_relax_iterations, &
109 1 : s% total_num_solver_calls_made, &
110 1 : s% total_num_solver_relax_calls_made, &
111 1 : s% total_num_solver_calls_converged, &
112 1 : s% total_num_solver_relax_calls_converged, &
113 1 : s% total_step_attempts, s% total_relax_step_attempts, &
114 1 : s% total_step_retries, s% total_relax_step_retries, &
115 1 : s% total_step_redos, s% total_relax_step_redos, &
116 1 : s% total_steps_finished, s% total_relax_steps_finished, &
117 1 : s% num_hydro_merges, s% num_hydro_splits, s% num_solver_setvars, &
118 1 : s% mesh_call_number, s% solver_call_number, s% diffusion_call_number, &
119 1 : s% gradT_excess_alpha, s% gradT_excess_alpha_old, s% Teff, s% mstar_dot, &
120 1 : s% power_nuc_burn, s% power_h_burn, s% power_he_burn, s% power_z_burn, s% power_photo, &
121 1 : s% why_Tlim, s% dt_why_count(1:numTlim), s% dt_why_retry_count(1:numTlim), &
122 1 : s% timestep_hold, s% model_number_for_last_retry, s% model_number_for_last_retry_old, &
123 1 : s% init_model_number, s% most_recent_photo_name, &
124 2 : s% rand_i97, s% rand_j97, s% rand_u(1:rand_u_len), s% rand_c, s% rand_cd, s% rand_cm
125 :
126 1 : call write_part_number(iounit)
127 1 : write(iounit) s% len_extra_iwork, s% len_extra_work
128 1 : if (s% len_extra_iwork > 0) then
129 0 : write(iounit) s% extra_iwork(1:s% len_extra_iwork)
130 : !write(iounit) s% extra_iwork_old(1:s% len_extra_iwork)
131 : end if
132 1 : if (s% len_extra_work > 0) then
133 0 : write(iounit) s% extra_work(1:s% len_extra_work)
134 : !write(iounit) s% extra_work_old(1:s% len_extra_work)
135 : end if
136 :
137 1 : write(iounit) s% ixtra
138 1 : write(iounit) s% xtra
139 1 : write(iounit) s% lxtra
140 :
141 1 : if (associated(s% history_column_spec)) then
142 1 : len_history_col_spec = size(s% history_column_spec)
143 1 : write(iounit) len_history_col_spec
144 1 : write(iounit) s% history_column_spec(1:len_history_col_spec)
145 : else
146 0 : write(iounit) 0 ! len_log_col_spec
147 : end if
148 :
149 : write(iounit) &
150 1 : s% number_of_history_columns, s% model_number_of_history_values, &
151 2 : s% need_to_set_history_names_etc
152 1 : if (s% number_of_history_columns > 0) then
153 1 : write(iounit) s% history_value_is_integer(1:s% number_of_history_columns)
154 61 : do k=1,s% number_of_history_columns
155 61 : write(iounit) s% history_names(k)
156 : end do
157 : end if
158 :
159 1 : if (s% rsp_flag) call rsp_photo_out(s, iounit)
160 :
161 1 : call write_part_number(iounit)
162 :
163 1 : call s% other_photo_write(s% id, iounit)
164 :
165 1 : call write_part_number(iounit)
166 :
167 1 : s% need_to_setvars = .true.
168 :
169 : contains
170 :
171 8 : subroutine write_part_number(iounit)
172 : integer, intent(in) :: iounit
173 8 : part_number = part_number + 1
174 8 : write(iounit) part_number
175 1 : end subroutine write_part_number
176 :
177 : end subroutine output_star_photo
178 :
179 : end module photo_out
|