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

Set units for shock setup #481

Merged
merged 3 commits into from
Nov 27, 2023
Merged
Changes from 2 commits
Commits
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
14 changes: 14 additions & 0 deletions src/setup/setup_shock.F90
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ subroutine choose_shock (gamma,polyk,dtg,iexist)
use physcon, only:pi,Rg,au,solarm
use prompting, only:prompt
use units, only:udist,utime,unit_density,unit_pressure
use setunits, only:set_units_interactive
real, intent(inout) :: gamma,polyk
real, intent(out) :: dtg
logical, intent(in) :: iexist
Expand Down Expand Up @@ -436,6 +437,9 @@ subroutine choose_shock (gamma,polyk,dtg,iexist)
yright = 0.0
zright = 0.0
const = sqrt(4.*pi)

call set_units_interactive(gr)

!
!--list of shocks
!
Expand Down Expand Up @@ -679,6 +683,8 @@ end function get_conserved_density
subroutine write_setupfile(filename,iprint,numstates,gamma,polyk,dtg)
use infile_utils, only:write_inopt
use dim, only:tagline
use setunits, only:write_options_units
use part, only:gr
integer, intent(in) :: iprint,numstates
real, intent(in) :: gamma,polyk,dtg
character(len=*), intent(in) :: filename
Expand All @@ -690,6 +696,8 @@ subroutine write_setupfile(filename,iprint,numstates,gamma,polyk,dtg)
write(lu,"(a)") '# '//trim(tagline)
write(lu,"(a)") '# input file for Phantom shock tube setup'

call write_options_units(lu,gr)

write(lu,"(/,a)") '# shock tube'
do i=1,numstates
call write_inopt(leftstate(i), trim(var_label(i))//'left', trim(var_label(i))//' (left)', lu,ierr1)
Expand Down Expand Up @@ -754,6 +762,8 @@ end subroutine write_setupfile
!------------------------------------------
subroutine read_setupfile(filename,iprint,numstates,gamma,polyk,dtg,ierr)
use infile_utils, only:open_db_from_file,inopts,close_db,read_inopt
use setunits, only:read_options_and_set_units
use part, only:gr
character(len=*), intent(in) :: filename
integer, parameter :: lu = 21
integer, intent(in) :: iprint,numstates
Expand All @@ -767,6 +777,10 @@ subroutine read_setupfile(filename,iprint,numstates,gamma,polyk,dtg,ierr)
write(iprint, '(1x,2a)') 'Setup_shock: Reading setup options from ',trim(filename)

nerr = 0

! units
call read_options_and_set_units(db,nerr,gr)

do i=1,numstates
call read_inopt(leftstate(i), trim(var_label(i))//'left',db,errcount=nerr)
call read_inopt(rightstate(i),trim(var_label(i))//'right',db,errcount=nerr)
Expand Down
Loading