Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tillotson EOS #593

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4303043
(tillotson) added module and subroutines for tillotson eos
Ambionce Aug 7, 2024
7131412
merge
Ambionce Aug 7, 2024
ea43d24
(Tillotson) wrote psuedocode for EOS
Ambionce Aug 12, 2024
91c9f0d
(units) added earth radii to unit options
Ambionce Aug 12, 2024
9db149c
(units) added earth radii to unit options
Ambionce Aug 12, 2024
c8c7280
(tillotson) added psuedocode - tillotson eos parameters for basalt an…
Ambionce Aug 13, 2024
93466fa
(tillotson) compiled code and params for basalt from benz & asphaug 1999
Ambionce Aug 14, 2024
665fcb3
(tillotson) added initialise eos case 23 subroutine
Ambionce Aug 15, 2024
00c42fe
(tillotson) update init and read eos subroutines for case 23
Ambionce Aug 15, 2024
bf14df6
(tillotson) updated eos and readwrite infile to include case 23 eos
Ambionce Aug 15, 2024
03f8493
(tillotson) remove unit conversion from write options eos
Ambionce Aug 17, 2024
cd8df39
(setup_solarsystem) added mass of sun in binary system setup
Ambionce Aug 20, 2024
0a5f901
(setup_binary) removed hardcoded eos in subroutine
Ambionce Aug 20, 2024
19a988b
(tillotson) fixed units read-write functions and updated condensed-ev…
Ambionce Aug 21, 2024
14b9bc2
(tillotson) added calculation of temp to internal energy to eos subro…
Ambionce Sep 3, 2024
5063782
(solarsystem) included asteroid apophis into ephemeris and solarsyste…
Ambionce Sep 3, 2024
73c34cb
Merge remote-tracking branch 'origin' into Tillotson
Ambionce Sep 6, 2024
03b50a9
(tillotson) fix windows crap
Ambionce Sep 10, 2024
db69327
(solarsystem) initial change from multiple binary setups to single st…
Ambionce Sep 11, 2024
a7ad58f
(tillotson) update eos to include hybrid phase and fix greek paramete…
Ambionce Sep 13, 2024
40d7cb2
(tillotson) updated internal energy calculation
Ambionce Sep 13, 2024
fa0b709
(tillotson) updated pressure and energy conditional calculations
Ambionce Sep 16, 2024
4eec9e7
(tillotson) quadratic equation fix for internal energy subroutine
Ambionce Sep 18, 2024
211829a
(tillotson) in Makefile changed order for reading in cubicsolve
Ambionce Sep 18, 2024
3bf2555
(tillotson) update piecewise pressure and internal energy
Ambionce Sep 20, 2024
47d5663
(tillotson) add calc u from prho to testing suite
Ambionce Sep 24, 2024
56d18c4
Merge branch 'danieljprice:master' into Tillotson
AmberTilly Sep 24, 2024
e3091aa
(tillotson) removed unnecessary code
Ambionce Sep 24, 2024
6e4764f
(Tillotson) updated eos piecewise and testing of eos
Ambionce Oct 1, 2024
5034e52
(tillotson) fixed piecewise eos to within 1.E-12 tol
Ambionce Oct 4, 2024
f59bfd1
(tillotson) removed low energy cold expansion state as negative press…
Ambionce Oct 9, 2024
8318ad2
(tillotson) update set star utils and eos to ensure zero initial inte…
Ambionce Oct 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,10 @@ SRCCHEM= fs_data.f90 mol_data.f90 utils_spline.f90 \
# equations of state
#
SRCMESA= eos_mesa_microphysics.f90 eos_mesa.f90
SRCEOS = eos_barotropic.f90 eos_stratified.f90 eos_piecewise.f90 ${SRCMESA} eos_shen.f90 eos_helmholtz.f90 eos_idealplusrad.f90 ionization.F90 eos_gasradrec.f90 eos_HIIR.f90 eos.f90

SRCEOS = eos_tillotson.f90 eos_barotropic.f90 eos_stratified.f90 eos_piecewise.f90 ${SRCMESA} \
eos_shen.f90 eos_helmholtz.f90 eos_idealplusrad.f90 \
ionization.F90 eos_gasradrec.f90 eos_HIIR.f90 eos.f90

ifeq ($(HDF5), yes)
SRCREADWRITE_DUMPS= utils_hdf5.f90 utils_dumpfiles_hdf5.f90 readwrite_dumps_common.f90 readwrite_dumps_fortran.F90 readwrite_dumps_hdf5.F90 readwrite_dumps.F90
Expand All @@ -521,7 +524,7 @@ endif

SOURCES= physcon.f90 ${CONFIG} ${SRCKERNEL} io.F90 units.f90 \
mpi_dens.F90 mpi_force.F90 mpi_utils.F90 dtype_kdtree.F90 utils_omp.F90 utils_cpuinfo.f90 \
utils_infiles.f90 utils_allocate.f90 icosahedron.f90 quartic.f90 \
utils_infiles.f90 utils_allocate.f90 icosahedron.f90 cubicsolve.f90 quartic.f90 \
utils_system.f90 utils_mathfunc.f90 part.F90 ${DOMAIN} boundary.f90 boundary_dynamic.f90 utils_timing.f90 mpi_balance.F90 \
setup_params.f90 timestep.f90 utils_dumpfiles.f90 utils_indtimesteps.F90 \
utils_sort.f90 utils_supertimestep.F90 utils_tables.f90 utils_gravwave.f90 \
Expand Down Expand Up @@ -611,7 +614,7 @@ SRCDUMP= physcon.f90 ${CONFIG} ${SRCKERNEL} utils_omp.F90 io.F90 units.f90 mpi_u
utils_timing.f90 utils_infiles.f90 dtype_kdtree.f90 utils_allocate.f90 part.F90 \
${DOMAIN} mpi_dens.F90 mpi_force.F90 boundary.f90 boundary_dynamic.f90 \
mpi_balance.F90 mpi_memory.f90 mpi_derivs.F90 mpi_tree.F90 kdtree.F90 linklist_kdtree.F90 \
utils_dumpfiles.f90 utils_vectors.f90 utils_mathfunc.f90 \
utils_dumpfiles.f90 utils_vectors.f90 utils_mathfunc.f90 cubicsolve.f90 \
utils_datafiles.f90 utils_filenames.f90 utils_system.f90 utils_tables.f90 datafiles.f90 gitinfo.f90 \
centreofmass.f90 \
timestep.f90 ${SRCEOS} cullendehnen.f90 dust_formation.f90 \
Expand Down
39 changes: 35 additions & 4 deletions src/main/eos.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module eos
! 16 = Shen eos
! 17 = polytropic EOS with varying mu (depending on H2 formation)
! 20 = Ideal gas + radiation + various forms of recombination energy from HORMONE (Hirai et al., 2020)
! 23 = Hypervelocity Impact of solids-fluids from Tillotson EOS (Tillotson 1962 - implemented by Brundage A. 2013
!
! :References:
! Lodato & Pringle (2007)
Expand All @@ -49,7 +50,7 @@ module eos
use part, only:ien_etotal,ien_entropy,ien_type
use dim, only:gr
implicit none
integer, parameter, public :: maxeos = 22
integer, parameter, public :: maxeos = 23
real, public :: polyk, polyk2, gamma
real, public :: qfacdisc = 0.75, qfacdisc2 = 0.75
logical, public :: extract_eos_from_hdr = .false.
Expand Down Expand Up @@ -116,6 +117,7 @@ subroutine equationofstate(eos_type,ponrhoi,spsoundi,rhoi,xi,yi,zi,tempi,eni,gam
use eos_stratified, only:get_eos_stratified
use eos_barotropic, only:get_eos_barotropic
use eos_piecewise, only:get_eos_piecewise
use eos_tillotson, only:equationofstate_tillotson
use eos_HIIR, only:get_eos_HIIR_iso,get_eos_HIIR_adiab
integer, intent(in) :: eos_type
real, intent(in) :: rhoi,xi,yi,zi
Expand Down Expand Up @@ -434,7 +436,16 @@ subroutine equationofstate(eos_type,ponrhoi,spsoundi,rhoi,xi,yi,zi,tempi,eni,gam

call get_eos_HIIR_adiab(polyk,temperature_coef,mui,tempi,ponrhoi,rhoi,eni,gammai,spsoundi,isionisedi)


case(23)
!
!-- Tillotson EOS from Tillotson (1962); Implementation from Benz and Asphaug (1999)
!
cgsrhoi = rhoi * unit_density
cgseni = eni * unit_ergg
call equationofstate_tillotson(cgsrhoi,cgseni,cgspresi,cgsspsoundi,gammai)
ponrhoi = real(cgspresi / (unit_pressure * rhoi))
spsoundi = real(cgsspsoundi / unit_velocity)
! tempi = 0. !temperaturei

case default
spsoundi = 0. ! avoids compiler warnings
Expand Down Expand Up @@ -462,6 +473,7 @@ subroutine init_eos(eos_type,ierr)
use eos_gasradrec, only:init_eos_gasradrec
use eos_HIIR, only:init_eos_HIIR
use dim, only:maxvxyzu,do_radiation
use eos_tillotson, only:init_eos_tillotson
integer, intent(in) :: eos_type
integer, intent(out) :: ierr
integer :: ierr_mesakapp
Expand Down Expand Up @@ -542,6 +554,10 @@ subroutine init_eos(eos_type,ierr)

call init_eos_HIIR()

case(23)

call init_eos_tillotson(ierr)

end select
done_init_eos = .true.

Expand Down Expand Up @@ -844,13 +860,15 @@ subroutine calc_temp_and_ene(eos_type,rho,pres,ene,temp,ierr,guesseint,mu_local,
use eos_idealplusrad, only:get_idealgasplusrad_tempfrompres,get_idealplusrad_enfromtemp
use eos_mesa, only:get_eos_eT_from_rhop_mesa
use eos_gasradrec, only:calc_uT_from_rhoP_gasradrec
use eos_tillotson, only:calc_uT_from_rhoP_tillotson
use units, only:unit_ergg,unit_pressure,unit_density
integer, intent(in) :: eos_type
real, intent(in) :: rho,pres
real, intent(inout) :: ene,temp
real, intent(in), optional :: guesseint,X_local,Z_local
real, intent(inout), optional :: mu_local
integer, intent(out) :: ierr
real :: mu,X,Z
real :: mu,X,Z,cgseni,cgsrhoi,cgspresi

ierr = 0
mu = gmw
Expand All @@ -871,6 +889,11 @@ subroutine calc_temp_and_ene(eos_type,rho,pres,ene,temp,ierr,guesseint,mu_local,
case(20) ! Ideal gas + radiation + recombination (from HORMONE, Hirai et al., 2020)
call calc_uT_from_rhoP_gasradrec(rho,pres,X,1.-X-Z,temp,ene,mu,ierr)
if (present(mu_local)) mu_local = mu
case(23) ! tillotson
cgsrhoi = rho * unit_density
cgspresi = pres * unit_pressure
call calc_uT_from_rhoP_tillotson(cgsrhoi,cgspresi,temp,cgseni,ierr)
ene = cgseni / unit_ergg
case default
ierr = 1
end select
Expand Down Expand Up @@ -1451,6 +1474,7 @@ subroutine write_options_eos(iunit)
use eos_barotropic, only:write_options_eos_barotropic
use eos_piecewise, only:write_options_eos_piecewise
use eos_gasradrec, only:write_options_eos_gasradrec
use eos_tillotson, only:write_options_eos_tillotson
integer, intent(in) :: iunit

write(iunit,"(/,a)") '# options controlling equation of state'
Expand All @@ -1476,6 +1500,8 @@ subroutine write_options_eos(iunit)
call write_inopt(X_in,'X','H mass fraction (ignored if variable composition)',iunit)
call write_inopt(Z_in,'Z','metallicity (ignored if variable composition)',iunit)
endif
case(23)
call write_options_eos_tillotson(iunit)
end select

end subroutine write_options_eos
Expand All @@ -1491,17 +1517,20 @@ subroutine read_options_eos(name,valstring,imatch,igotall,ierr)
use eos_barotropic, only:read_options_eos_barotropic
use eos_piecewise, only:read_options_eos_piecewise
use eos_gasradrec, only:read_options_eos_gasradrec
use eos_tillotson, only:read_options_eos_tillotson
character(len=*), intent(in) :: name,valstring
logical, intent(out) :: imatch,igotall
integer, intent(out) :: ierr
integer, save :: ngot = 0
character(len=30), parameter :: label = 'read_options_eos'
logical :: igotall_barotropic,igotall_piecewise,igotall_gasradrec
logical :: igotall_tillotson

imatch = .true.
igotall_barotropic = .true.
igotall_piecewise = .true.
igotall_gasradrec = .true.
igotall_tillotson = .true.

select case(trim(name))
case('ieos')
Expand Down Expand Up @@ -1530,9 +1559,11 @@ subroutine read_options_eos(name,valstring,imatch,igotall,ierr)
if (.not.imatch .and. ieos== 8) call read_options_eos_barotropic(name,valstring,imatch,igotall_barotropic,ierr)
if (.not.imatch .and. ieos== 9) call read_options_eos_piecewise( name,valstring,imatch,igotall_piecewise, ierr)
if (.not.imatch .and. ieos==20) call read_options_eos_gasradrec( name,valstring,imatch,igotall_gasradrec, ierr)
if (.not.imatch .and. ieos==23) call read_options_eos_tillotson(name,valstring,imatch,igotall_tillotson,ierr)

!--make sure we have got all compulsory options (otherwise, rewrite input file)
igotall = (ngot >= 1) .and. igotall_piecewise .and. igotall_barotropic .and. igotall_gasradrec
igotall = (ngot >= 1) .and. igotall_piecewise .and. igotall_barotropic .and. igotall_gasradrec &
.and. igotall_tillotson

end subroutine read_options_eos

Expand Down
Loading
Loading