Skip to content

Commit

Permalink
Merge pull request #406 from danieljprice/radiation
Browse files Browse the repository at this point in the history
(radiation) control flux limiter with switch; read additional radiation quantities from dumps
  • Loading branch information
danieljprice committed Apr 23, 2023
2 parents 6defda3 + 5612f12 commit 29790d8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
20 changes: 13 additions & 7 deletions src/main/force.F90
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ subroutine compute_forces(i,iamgasi,iamdusti,xpartveci,hi,hi1,hi21,hi41,gradhi,g
use part, only:ibin_old,iamboundary
#endif
use timestep, only:bignumber
use options, only:overcleanfac,use_dustfrac,ireconav
use options, only:overcleanfac,use_dustfrac,ireconav,limit_radiation_flux
use units, only:get_c_code
#ifdef GR
use metric_tools,only:imet_minkowski,imetric
Expand Down Expand Up @@ -1694,8 +1694,12 @@ subroutine compute_forces(i,iamgasi,iamdusti,xpartveci,hi,hi1,hi21,hi41,gradhi,g
radkappaj = radprop(ikappa,j)
radenj = rad(iradxi,j)
radRj = get_rad_R(rhoj,radenj,radFj,radkappaj)
!radlambdaj = (2. + radRj)/(6. + 3*radRj + radRj*radRj)
radlambdaj = 1./3.

if (limit_radiation_flux) then
radlambdaj = (2. + radRj)/(6. + 3*radRj + radRj*radRj)
else
radlambdaj = 1./3.
endif

radDj = c_code*radlambdaj/radkappaj/rhoj

Expand Down Expand Up @@ -2018,7 +2022,7 @@ subroutine start_cell(cell,iphase,xyzh,vxyzu,gradh,divcurlv,divcurlB,dvdx,Bevol,
rad,radprop,dens,metrics)

use io, only:fatal
use options, only:alpha,use_dustfrac
use options, only:alpha,use_dustfrac,limit_radiation_flux
use dim, only:maxp,ndivcurlv,ndivcurlB,maxdvdx,maxalpha,maxvxyzu,mhd,mhd_nonideal,&
use_dustgrowth,gr
use part, only:iamgas,maxphase,rhoanddhdrho,igas,massoftype,get_partinfo,&
Expand Down Expand Up @@ -2271,9 +2275,11 @@ subroutine start_cell(cell,iphase,xyzh,vxyzu,gradh,divcurlv,divcurlB,dvdx,Bevol,
cell%xpartvec(iradxii,cell%npcell) = rad(iradxi,i)
cell%xpartvec(iradfxi:iradfzi,cell%npcell) = radprop(ifluxx:ifluxz,i)
cell%xpartvec(iradkappai,cell%npcell) = radprop(ikappa,i)
!cell%xpartvec(iradlambdai,cell%npcell) = &
! (2. + radRi)/(6. + 3*radRi + radRi*radRi)
cell%xpartvec(iradlambdai,cell%npcell) = 1./3.
if (limit_radiation_flux) then
cell%xpartvec(iradlambdai,cell%npcell) = (2. + radRi)/(6. + 3.*radRi + radRi*radRi)
else
cell%xpartvec(iradlambdai,cell%npcell) = 1./3.
endif
cell%xpartvec(iradrbigi,cell%npcell) = radRi
endif

Expand Down
8 changes: 6 additions & 2 deletions src/main/readwrite_dumps_fortran.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1136,9 +1136,9 @@ subroutine read_phantom_arrays(i1,i2,noffset,narraylengths,nums,npartread,nparto
Bevol,Bxyz,Bxyz_label,nabundances,iphase,idust,dustfrac_label, &
eos_vars,eos_vars_label,dustprop,dustprop_label,divcurlv,divcurlv_label,iX,iZ,imu, &
VrelVf,VrelVf_label,dustgasprop,dustgasprop_label,pxyzu,pxyzu_label,dust_temp, &
rad,rad_label,radprop,radprop_label,do_radiation,maxirad,maxradprop, &
rad,rad_label,radprop,radprop_label,do_radiation,maxirad,maxradprop,ifluxx,ifluxy,ifluxz, &
nucleation,nucleation_label,n_nucleation,ikappa,tau,itau_alloc,tau_lucy,itauL_alloc,&
ithick,itemp,igasP,iorig
ithick,itemp,igasP,ilambda,iorig
use sphNGutils, only:mass_sphng,got_mass,set_gas_particle_mass
use eos, only:ieos,eos_is_non_ideal,eos_outputs_gasP
#ifdef IND_TIMESTEPS
Expand Down Expand Up @@ -1292,6 +1292,10 @@ subroutine read_phantom_arrays(i1,i2,noffset,narraylengths,nums,npartread,nparto
call read_array(rad,rad_label,got_raden,ik,i1,i2,noffset,idisk1,tag,match,ierr)
call read_array(radprop(ikappa,:),radprop_label(ikappa),got_kappa,ik,i1,i2,noffset,idisk1,tag,match,ierr)
call read_array(radprop(ithick,:),radprop_label(ithick),got_kappa,ik,i1,i2,noffset,idisk1,tag,match,ierr)
call read_array(radprop(ilambda,:),radprop_label(ilambda),got_kappa,ik,i1,i2,noffset,idisk1,tag,match,ierr)
call read_array(radprop(ifluxx,:),radprop_label(ifluxx),got_kappa,ik,i1,i2,noffset,idisk1,tag,match,ierr)
call read_array(radprop(ifluxy,:),radprop_label(ifluxy),got_kappa,ik,i1,i2,noffset,idisk1,tag,match,ierr)
call read_array(radprop(ifluxz,:),radprop_label(ifluxz),got_kappa,ik,i1,i2,noffset,idisk1,tag,match,ierr)
endif
case(2)
call read_array(xyzmh_ptmass,xyzmh_ptmass_label,got_sink_data,ik,1,nptmass,0,idisk1,tag,match,ierr)
Expand Down

0 comments on commit 29790d8

Please sign in to comment.