Skip to content

Commit

Permalink
v3.2; added THEMIS dust emission model
Browse files Browse the repository at this point in the history
  • Loading branch information
cconroy20 committed Apr 29, 2021
1 parent ded5bc4 commit a9c0bd5
Show file tree
Hide file tree
Showing 23 changed files with 6,429 additions and 41 deletions.
Binary file modified doc/MANUAL.pdf
Binary file not shown.
6 changes: 5 additions & 1 deletion doc/REVISION_HISTORY
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,8 @@
- Release of v3.1
- major bug in tabulted SFHs identified and resolved
- New WMBasic O star grid courtesy of JJ Eldridge, Mason Ng, and Georgie Taylor
- Nebular emission (line and continuum) based on Cloudy tables provided by Nell Byler
- Nebular emission (line and continuum) based on Cloudy tables provided by Nell Byler

04/2/21
- Release of v3.2
- added THEMIS dust emission model
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
578 changes: 578 additions & 0 deletions dust/dustem/THEMIS_MW3.1_00.dat

Large diffs are not rendered by default.

578 changes: 578 additions & 0 deletions dust/dustem/THEMIS_MW3.1_10.dat

Large diffs are not rendered by default.

578 changes: 578 additions & 0 deletions dust/dustem/THEMIS_MW3.1_100.dat

Large diffs are not rendered by default.

578 changes: 578 additions & 0 deletions dust/dustem/THEMIS_MW3.1_20.dat

Large diffs are not rendered by default.

578 changes: 578 additions & 0 deletions dust/dustem/THEMIS_MW3.1_30.dat

Large diffs are not rendered by default.

578 changes: 578 additions & 0 deletions dust/dustem/THEMIS_MW3.1_40.dat

Large diffs are not rendered by default.

578 changes: 578 additions & 0 deletions dust/dustem/THEMIS_MW3.1_50.dat

Large diffs are not rendered by default.

578 changes: 578 additions & 0 deletions dust/dustem/THEMIS_MW3.1_60.dat

Large diffs are not rendered by default.

578 changes: 578 additions & 0 deletions dust/dustem/THEMIS_MW3.1_70.dat

Large diffs are not rendered by default.

578 changes: 578 additions & 0 deletions dust/dustem/THEMIS_MW3.1_80.dat

Large diffs are not rendered by default.

578 changes: 578 additions & 0 deletions dust/dustem/THEMIS_MW3.1_90.dat

Large diffs are not rendered by default.

38 changes: 16 additions & 22 deletions src/add_dust.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ SUBROUTINE ADD_DUST(pset,csp1,csp2,specdust,mdust,ncsp1,ncsp2,nebdust)
REAL(SP), DIMENSION(nemline) :: diff_dust_neb,ncspi
REAL(SP), DIMENSION(nspec) :: nu,dumin,dumax
REAL(SP), DIMENSION(nspec) :: mduste,duste,oduste,sduste,tduste
REAL(SP), DIMENSION(7) :: qpaharr
REAL(SP) :: clump_ave,lboln,lbold,labs,gamma,norm,dq,qpah,umin,du
REAL(SP), DIMENSION(numin_dl07) :: uminarr
REAL(SP) :: clump_ave,lboln,lbold,labs,gamma,norm,dq,du

!---------------------------------------------------------------!
!----------------------Test input params------------------------!
Expand Down Expand Up @@ -101,32 +99,28 @@ SUBROUTINE ADD_DUST(pset,csp1,csp2,specdust,mdust,ncsp1,ncsp2,nebdust)
ENDIF

!set up qpah interpolation
qpaharr = (/0.47,1.12,1.77,2.50,3.19,3.90,4.58/)
!set limits to qpah: 0.0<qpah<10.0
qpah = MAX(MIN(pset%duste_qpah,10.0),0.0)
qlo = MAX(MIN(locate(qpaharr,qpah),6),1)
dq = (qpah-qpaharr(qlo))/(qpaharr(qlo+1)-qpaharr(qlo))

qlo = MAX(MIN(locate(qpaharr,pset%duste_qpah),nqpah_dustem-1),1)
dq = (pset%duste_qpah-qpaharr(qlo))/(qpaharr(qlo+1)-qpaharr(qlo))
dq = MIN(MAX(dq,0.0),1.0) !no extrapolation

!set up Umin interpolation
uminarr = (/0.1,0.15,0.2,0.3,0.4,0.5,0.7,0.8,1.0,1.2,1.5,2.0,&
2.5,3.0,4.0,5.0,7.0,8.0,12.0,15.0,20.0,25.0/)
!set limits on Umin: 0.1<Umin<25.0
umin = MAX(MIN(pset%duste_umin,25.0),0.1)
ulo = MAX(MIN(locate(uminarr,umin),numin_dl07),1)
du = (umin-uminarr(ulo))/(uminarr(ulo+1)-uminarr(ulo))
ulo = MAX(MIN(locate(uminarr,pset%duste_umin),numin_dustem),1)
du = (pset%duste_umin-uminarr(ulo))/(uminarr(ulo+1)-uminarr(ulo))
du = MIN(MAX(du,0.0),1.0) !no extrapolation

!set limits to gamma (gamma is a fraction)
gamma = MAX(MIN(pset%duste_gamma,1.0),0.0)

!bi-linear interpolation over qpah and Umin
dumin = (1-dq)*(1-du)*dustem2_dl07(:,qlo,2*ulo-1) + &
dq*(1-du)*dustem2_dl07(:,qlo+1,2*ulo-1) + &
dq*du*dustem2_dl07(:,qlo+1,2*(ulo+1)-1) + &
(1-dq)*du*dustem2_dl07(:,qlo,2*(ulo+1)-1)
dumax = (1-dq)*(1-du)*dustem2_dl07(:,qlo,2*ulo) + &
dq*(1-du)*dustem2_dl07(:,qlo+1,2*ulo) + &
dq*du*dustem2_dl07(:,qlo+1,2*(ulo+1)) + &
(1-dq)*du*dustem2_dl07(:,qlo,2*(ulo+1))
dumin = (1-dq)*(1-du)*dustem2_dustem(:,qlo,2*ulo-1) + &
dq*(1-du)*dustem2_dustem(:,qlo+1,2*ulo-1) + &
dq*du*dustem2_dustem(:,qlo+1,2*(ulo+1)-1) + &
(1-dq)*du*dustem2_dustem(:,qlo,2*(ulo+1)-1)
dumax = (1-dq)*(1-du)*dustem2_dustem(:,qlo,2*ulo) + &
dq*(1-du)*dustem2_dustem(:,qlo+1,2*ulo) + &
dq*du*dustem2_dustem(:,qlo+1,2*(ulo+1)) + &
(1-dq)*du*dustem2_dustem(:,qlo,2*(ulo+1))

!combine both parts of P(U)dU
mduste = (1-gamma)*dumin + gamma*dumax
Expand Down
26 changes: 15 additions & 11 deletions src/sps_setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -744,34 +744,38 @@ SUBROUTINE SPS_SETUP(zin)
!--------Read in dust emission spectra from Draine & Li----------!
!----------------------------------------------------------------!

DO k=0,6

WRITE(sqpah,'(I1)') k
OPEN(99,FILE=TRIM(SPS_HOME)//'/dust/DL07/DL07_MW3.1_'//sqpah//'0.dat',&
STATUS='OLD',iostat=stat,ACTION='READ')
DO k=1,nqpah_dustem
WRITE(sqpah,'(I1)') k-1
IF (k-1.EQ.10) THEN
OPEN(99,FILE=TRIM(SPS_HOME)//'/dust/dustem/'//TRIM(str_dustem)//&
'_MW3.1_100.dat',STATUS='OLD',iostat=stat,ACTION='READ')
ELSE
OPEN(99,FILE=TRIM(SPS_HOME)//'/dust/dustem/'//TRIM(str_dustem)//&
'_MW3.1_'//sqpah//'0.dat',STATUS='OLD',iostat=stat,ACTION='READ')
ENDIF
IF (stat.NE.0) THEN
WRITE(*,*) 'SPS_SETUP ERROR: error opening dust emission file'
STOP
ENDIF
DO i=1,2 !burn the header
READ(99,*)
ENDDO
DO i=1,ndim_dl07
READ(99,*,IOSTAT=stat) lambda_dl07(i),dustem_dl07(i,:)
DO i=1,ndim_dustem
READ(99,*,IOSTAT=stat) lambda_dustem(i),dustem_dustem(i,:)
IF (stat.NE.0) THEN
WRITE(*,*) 'SPS_SETUP ERROR: error during dust emission read'
STOP
ENDIF
ENDDO
CLOSE(99)
lambda_dl07 = lambda_dl07*1E4 !convert to Ang
lambda_dustem = lambda_dustem*1E4 !convert to Ang

!now interpolate the dust spectra onto the master wavelength array
DO j=1,numin_dl07*2
DO j=1,numin_dustem*2
!the dust models only extend to 1um
jj = locate(spec_lambda/1E4,one)
dustem2_dl07(jj:,k+1,j) = linterparr(lambda_dl07,&
dustem_dl07(:,j),spec_lambda(jj:))
dustem2_dustem(jj:,k,j) = linterparr(lambda_dustem,&
dustem_dustem(:,j),spec_lambda(jj:))
ENDDO

ENDDO
Expand Down
42 changes: 35 additions & 7 deletions src/sps_vars.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ MODULE SPS_VARS
!so the spectral library, IMF, etc. is fixed in this case.
#ifndef BPASS
#define BPASS 0
#endif

!------set the dust emission model------!
#ifndef DL07
#define DL07 1
#endif

#ifndef THEMIS
#define THEMIS 0
#endif

!--------------------------------------------------------------!
Expand Down Expand Up @@ -283,10 +292,6 @@ MODULE SPS_VARS
INTEGER, PARAMETER :: ndim_wr=12
!dimensions of WMBasic grid
INTEGER, PARAMETER :: ndim_wmb_logt=11,ndim_wmb_logg=3
!wavelength dimension of the Draine & Li 2007 dust model
INTEGER, PARAMETER :: ndim_dl07=1001
!number of Umin models from Drain & Li 2007 dust model
INTEGER, PARAMETER :: numin_dl07=22
!parameters for circumstellar dust models
INTEGER, PARAMETER :: ntau_dagb=50, nteff_dagb=6
!number of emission lines and continuum emission points
Expand Down Expand Up @@ -446,11 +451,34 @@ MODULE SPS_VARS
REAL(SP), DIMENSION(nspec,ndim_wr,nz) :: wrn_spec=0.,wrc_spec=0.
REAL(SP), DIMENSION(ndim_wr) :: wrn_logt=0.,wrc_logt=0.

#if (DL07)
!dust emission model (Draine & Li 2007)
REAL(SP), DIMENSION(ndim_dl07) :: lambda_dl07=0.
REAL(SP), DIMENSION(ndim_dl07,numin_dl07*2) :: dustem_dl07=0.
REAL(SP), DIMENSION(nspec,7,numin_dl07*2) :: dustem2_dl07=0.
INTEGER, PARAMETER :: ndim_dustem=1001
INTEGER, PARAMETER :: numin_dustem=22, nqpah_dustem=7
CHARACTER(6), PARAMETER :: str_dustem='DL07'
REAL(SP), DIMENSION(nqpah_dustem), PARAMETER :: &
qpaharr = (/0.47,1.12,1.77,2.50,3.19,3.90,4.58/)
REAL(SP), DIMENSION(numin_dustem) :: uminarr = &
(/0.1,0.15,0.2,0.3,0.4,0.5,0.7,0.8,1.0,1.2,1.5,2.0,&
2.5,3.0,4.0,5.0,7.0,8.0,12.0,15.0,20.0,25.0/)
#elif (THEMIS)
!dust emission model (THEMIS; Jones et al. 2013, 2017)
INTEGER, PARAMETER :: ndim_dustem=576
INTEGER, PARAMETER :: numin_dustem=37, nqpah_dustem=11
CHARACTER(6), PARAMETER :: str_dustem='THEMIS'
REAL(SP), DIMENSION(nqpah_dustem), PARAMETER :: &
qpaharr = (/0.02,0.06,0.10,0.14,0.17,0.20,0.24,0.28,0.32,0.36,0.40/)/2.2*100
REAL(SP), DIMENSION(numin_dustem) :: uminarr = &
(/0.1,0.12,0.15,0.17,0.2,0.25,0.3,0.35,0.4,0.5,0.6,0.7,0.8,1.0,&
1.2,1.5,1.7, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 6.0, 7.0, 8.0, 10.0,&
12.0, 15.0, 17.0, 20.0, 25.0, 30.0, 35.0, 40.0, 50.0, 80.0/)
#endif

REAL(SP), DIMENSION(ndim_dustem) :: lambda_dustem=0.
REAL(SP), DIMENSION(ndim_dustem,numin_dustem*2) :: dustem_dustem=0.
REAL(SP), DIMENSION(nspec,nqpah_dustem,numin_dustem*2) :: dustem2_dustem=0.


!circumstellar AGB dust model (Villaume et al. 2015)
REAL(SP), DIMENSION(nspec,2,nteff_dagb,ntau_dagb) :: flux_dagb=0.
REAL(SP), DIMENSION(2,ntau_dagb) :: tau1_dagb=0.
Expand Down

0 comments on commit a9c0bd5

Please sign in to comment.