Go to the documentation of this file.
79 if (verbose_level .gt. 2)
then
81 write(
debug_exp,
'(A)')
'# File for debugging subroutine expansion in expansion_module.f90'
82 write(
debug_exp,
'(*(A,4x))')
'# Time [s]',
'Density [g/ccm]',
'Radius [km]',
'Old Radius [km]', &
83 'Velocity [km/s]',
'Temperature [GK]'
89 //
") not implemented yet. "//&
90 "Set it to a supported value!",&
127 integer :: i, debug_vel
128 real(r_kind) :: er,ert,et,ets,det
133 ') should be smaller'//new_line(
"A")//&
134 'than the amount of trajectory points (zsteps = '//trim(adjustl(
int_to_str(
zsteps)))//
").",&
135 'residual_expansion',&
140 ') should be larger than 1.',&
141 'residual_expansion',&
157 ets = ets +
ztime(i)**2
158 er = er + exp(
zrad(i))
163 if (abs(det).gt.1e-20)
then
168 if (verbose_level.ge.1)
then
203 if (verbose_level .gt. 2)
then
206 write(debug_vel,
'(A)')
'# Velocity extrapolation info'
207 write(debug_vel,
'(A)')
'# 1:step 2:time[s] 3:R[km]'
209 write (debug_vel,
'(i4,2(1x,es15.7))') i,
ztime(i), exp(
zrad(i))
211 write (debug_vel,
'("vel = ",es15.7, " km/s")') v
216 'residual_expansion',&
239 subroutine expansion(t,dt,ye,dens,rad_in,temp,entropy,vel_in,abar)
245 real(r_kind),
intent(in) :: t
246 real(r_kind),
intent(in) :: dt
247 real(r_kind),
intent(in) :: abar
248 real(r_kind),
intent(inout) :: dens
249 real(r_kind),
intent(inout) :: rad_in
250 real(r_kind),
intent(inout) :: temp
251 real(r_kind),
intent(in) :: entropy
252 real(r_kind),
intent(inout) :: vel_in
253 real(r_kind),
intent(in) :: ye
255 real(r_kind) :: rold,dold
256 logical :: calc_temperature
257 integer :: eos_status
268 calc_temperature = ((heating_mode .eq. 0) .and. (temp .gt.
freeze_rate_temp))
276 rad_in =
rad_0 + time*vel_in
279 if (calc_temperature)
then
282 if(eos_status.ne.0)
call raise_exception(
'Error when calling the EOS.',
'expansion',&
287 rad_in =
rad_0 + time*vel_in
291 dens = max(dens,1d-99)
293 if (calc_temperature)
then
296 if(eos_status.ne.0)
call raise_exception(
'Error when calling the EOS.',
'expansion',&
301 rad_in =
rad_0 + time*vel_in
302 dens =
mdot/(rad_in**2)
304 if (calc_temperature)
then
307 if(eos_status.ne.0)
call raise_exception(
'Error when calling the EOS.',
'expansion',&
312 rad_in =
rad_0 + time*vel_in
316 if (calc_temperature)
then
319 if(eos_status.ne.0)
call raise_exception(
'Error when calling the EOS.',
'expansion',&
335 if (calc_temperature)
then
340 if (verbose_level .gt. 2)
then
341 write(
debug_exp,
'(*(10es23.14,4x))')time,dens,rad_in,rold,vel_in,temp
364 if ((verbose_level .gt. 2) .and. (
expand))
then
integer expand_count
1 for the first timestep 2 for following steps, 0 for no expansion yet
real(r_kind) s_0
Entropy at the end of the trajectory (deprecated)
real(r_kind) freeze_rate_temp
Tmperature at which rates get frozen (for reacl. rates this should be 1d-2GK)
subroutine expansion(t, dt, ye, dens, rad_in, temp, entropy, vel_in, abar)
Returns temperature, radius, density, and entropy after the trajectory has ended.
subroutine expansion_finalize()
Close debug files of the module.
type(timmes_eos_state) state
EOS state.
subroutine expansion_init()
Initialize the expansion module and open files for debugging.
integer expansiontype
defines prescription used for parametrized expansion after the last timestep of the hydro input
Subroutines to handle parametric evolution of hydrodynamic quantities after the final timestep of the...
integer termination_criterion
condition to terminate the simulation ([0]=trajectory_file, 1=final_time, 2=final_temp,...
real(r_kind) rad
radial distance [km]
integer, private debug_exp
file ID for debugging expansion
character(:) function, allocatable, public int_to_str(num)
Converts a given integer to a string.
subroutine timmes_eos(var, vin, d, Ye, state, status)
real(r_kind) final_dens
termination density [g/cm3]
subroutine, public raise_exception(msg, sub, error_code)
Raise a exception with a given error message.
real(r_kind) rho_0
Density [g/ccm] at the end of the trajectory.
real(r_kind) t9_0
Temperature [GK] at the end of the trajectory.
subroutine, public write_data_to_std_out(str_msg, value_str, unit)
Write data to the standard output (usually OUT)
real(r_kind), dimension(:), allocatable, public ztime
time information from trajectory
real(r_kind) t_0
Time at the end of the trajectory.
real(r_kind), dimension(:), allocatable, public zrad
radii from trajectory
real(r_kind) vel
velocity [km/s]
Provide some basic file-handling routines.
character *20 trajectory_mode
determines how trajectory is calculated (from_file|analytic|expand)
character(:) function, allocatable, public num_to_str(num)
Converts a given real to a string with format "(1pE10.2)".
integer heating_mode
Mode for heating: 0 - no heating, 1 - heating using an entropy equation, 2 - heating from the energy ...
integer init_index
Initial index in the trajectory.
real(r_kind) mdot
1/4pi*dM/dr = rho*r^2 = const
integer zsteps
number of timesteps in the hydro trajectory
Contains arrays representing thermodynamic conditions from hydro trajectory file.
real(r_kind), dimension(:), allocatable, public zdens
density information from trajectory
real(r_kind) rad_0
Radius [km] at the end of the trajectory.
real(r_kind) final_time
termination time in seconds
real(r_kind) final_temp
termination temperature [GK]
integer function, public open_outfile(file_name)
Shorthand for opening a new file for writing (output file)
subroutine residual_expansion
Calculates the velocity for trajectory extrapolation by linear regression on a few last points; the n...
subroutine, public close_io_file(unit_no, file_name)
Close an external file.
real(r_kind), dimension(:), allocatable, public ztemp
temperature information from trajectory
integer extrapolation_width
how many points from the end of trajectory to use when computing residual expansion
Contains all runtime parameters as well as phys and math constants.