| 1 | !!****if* source/physics/sourceTerms/Heat/HeatMain/Neutrino/Heat
|
|---|
| 2 | !!
|
|---|
| 3 | !! NAME
|
|---|
| 4 | !!
|
|---|
| 5 | !! Heat
|
|---|
| 6 | !!
|
|---|
| 7 | !!
|
|---|
| 8 | !! SYNOPSIS
|
|---|
| 9 | !!
|
|---|
| 10 | !! call Heat (integer(IN) :: blockCount,
|
|---|
| 11 | !! integer(IN) :: blockList(blockCount),
|
|---|
| 12 | !! real(IN) :: dt,
|
|---|
| 13 | !! real(IN) :: time)
|
|---|
| 14 | !!
|
|---|
| 15 | !!
|
|---|
| 16 | !!
|
|---|
| 17 | !! DESCRIPTION
|
|---|
| 18 | !!
|
|---|
| 19 | !! Calculates local heating and cooling due to neutrinos
|
|---|
| 20 | !! according to the approach of Murphy & Burrows (2008, ApJ, 688, 1159).
|
|---|
| 21 | !!
|
|---|
| 22 | !! NOTES
|
|---|
| 23 | !! The FLASH implementation of this method is described in
|
|---|
| 24 | !! S.M. Couch (2013, ApJ, 765, 29). Citation of this latter
|
|---|
| 25 | !! reference is appreciated if this unit is used in published work.
|
|---|
| 26 | !!
|
|---|
| 27 | !! ARGUMENTS
|
|---|
| 28 | !!
|
|---|
| 29 | !! blockCount : number of blocks to operate on
|
|---|
| 30 | !! blockList : list of blocks to operate on
|
|---|
| 31 | !! dt : current timestep
|
|---|
| 32 | !! time : current time
|
|---|
| 33 | !!
|
|---|
| 34 | !!***
|
|---|
| 35 | !
|
|---|
| 36 | !==============================================================================
|
|---|
| 37 | !
|
|---|
| 38 | subroutine Heat(blockCount, blockList, dt, time)
|
|---|
| 39 |
|
|---|
| 40 | #include "Flash.h"
|
|---|
| 41 | #include "constants.h"
|
|---|
| 42 |
|
|---|
| 43 | use Heat_data, ONLY : useHeat, ht_Lneut, ht_Tneut, ht_bounceTime, ht_postBounce, &
|
|---|
| 44 | ht_useEntr
|
|---|
| 45 | use Eos_interface, ONLY : Eos_wrapped, Eos_nucOneZone
|
|---|
| 46 | use Grid_interface, ONLY : Grid_getBlkPtr, Grid_releaseBlkPtr, &
|
|---|
| 47 | Grid_getBlkIndexLimits, Grid_getCellCoords
|
|---|
| 48 | use Deleptonize_interface, ONLY : Deleptonize_getBounce
|
|---|
| 49 |
|
|---|
| 50 | implicit none
|
|---|
| 51 |
|
|---|
| 52 | integer,intent(IN) :: blockCount
|
|---|
| 53 | integer,dimension(blockCount),intent(IN)::blockList
|
|---|
| 54 | real,intent(IN) :: dt,time
|
|---|
| 55 |
|
|---|
| 56 | real, pointer, dimension(:,:,:,:) :: solnData
|
|---|
| 57 | integer, dimension(LOW:HIGH,MDIM) :: blkLimits, blkLimitsGC
|
|---|
| 58 |
|
|---|
| 59 | integer :: blockID
|
|---|
| 60 | integer :: i,j,k,n
|
|---|
| 61 | integer,dimension(MDIM) :: dimSize
|
|---|
| 62 | real,allocatable, dimension(:) :: xCenter, yCenter, zCenter
|
|---|
| 63 | real :: xx, yy, zz
|
|---|
| 64 | logical :: gcell = .true.
|
|---|
| 65 | real :: radius, dEneut, ek, tauNu
|
|---|
| 66 | real, parameter :: MeVtoK = 1.16045221d10
|
|---|
| 67 |
|
|---|
| 68 | real :: bounceTime, temp
|
|---|
| 69 |
|
|---|
| 70 | real :: xDens, xTemp, xEner, xEntr, xYe, outYe
|
|---|
| 71 | real :: del_ye, del_entr
|
|---|
| 72 | real :: abar, zbar, sumY, Ye0, Ye, dXneut, abarInv
|
|---|
| 73 | real :: xPres, mu_nu, xCs2
|
|---|
| 74 | real :: xXp, xXn, xXa, xXh,xdedt,xdpderho, tmp
|
|---|
| 75 | logical :: threadBlockList
|
|---|
| 76 | logical :: eosCall2
|
|---|
| 77 |
|
|---|
| 78 | #ifdef ST_THREAD_BLOCK_LIST
|
|---|
| 79 | threadBlockList = .true.
|
|---|
| 80 |
|
|---|
| 81 | #ifdef ST_THREAD_WITHIN_BLOCK
|
|---|
| 82 | call Driver_abortFlash("Cannot include both threading strategies")
|
|---|
| 83 | #endif
|
|---|
| 84 |
|
|---|
| 85 | #else
|
|---|
| 86 | threadBlockList = .false.
|
|---|
| 87 | #endif
|
|---|
| 88 |
|
|---|
| 89 | if (.NOT. useHeat) return
|
|---|
| 90 |
|
|---|
| 91 | if (.NOT. ht_postBounce) &
|
|---|
| 92 | call Deleptonize_getBounce(ht_postBounce, ht_bounceTime)
|
|---|
| 93 |
|
|---|
| 94 | if (.NOT. ht_postBounce) return
|
|---|
| 95 |
|
|---|
| 96 | !$omp parallel if(threadBlockList) &
|
|---|
| 97 | !$omp default(none) &
|
|---|
| 98 | !$omp private(n,blockID,k,j,i,solnData,dimSize,zCenter,yCenter, &
|
|---|
| 99 | !$omp xCenter,radius,dEneut,ek,blkLimits,blkLimitsGC,tmp,xDens,xTemp, &
|
|---|
| 100 | !$omp xYe,xEner,xPres,xEntr,xdedt,xdpderho,mu_nu,xXp,xXn,xXa,xXh,xCs2,temp) &
|
|---|
| 101 | !$omp shared(blockCount,blockList,ht_Lneut,ht_Tneut,dt,ht_postBounce, &
|
|---|
| 102 | !$omp gcell,eosCall2)
|
|---|
| 103 |
|
|---|
| 104 | !$omp do schedule(static)
|
|---|
| 105 | do n = 1, blockCount
|
|---|
| 106 | blockID = blockList(n)
|
|---|
| 107 |
|
|---|
| 108 | call Grid_getBlkIndexLimits(blockID,blkLimits,blkLimitsGC)
|
|---|
| 109 | call Grid_getBlkPtr(blockID,solnData)
|
|---|
| 110 | dimSize(:)=blkLimitsGC(HIGH,:)-blkLimitsGC(LOW,:)+1
|
|---|
| 111 | if (NDIM > 2)then
|
|---|
| 112 | allocate(zCenter(dimSize(KAXIS)))
|
|---|
| 113 | call Grid_getCellCoords(KAXIS,blockID,&
|
|---|
| 114 | CENTER,gcell,zCenter,dimSize(KAXIS))
|
|---|
| 115 | end if
|
|---|
| 116 | if (NDIM > 1)then
|
|---|
| 117 | allocate(yCenter(dimSize(JAXIS)))
|
|---|
| 118 | call Grid_getCellCoords(JAXIS,blockID,&
|
|---|
| 119 | CENTER,gcell,yCenter,dimSize(JAXIS))
|
|---|
| 120 | end if
|
|---|
| 121 |
|
|---|
| 122 | allocate(xCenter(dimSize(IAXIS)))
|
|---|
| 123 | call Grid_getCellCoords(IAXIS,blockID,&
|
|---|
| 124 | CENTER,gcell,xCenter,dimSize(IAXIS))
|
|---|
| 125 |
|
|---|
| 126 | #ifdef DELE_VAR
|
|---|
| 127 | solnData(DELE_VAR,:,:,:) = 0.0
|
|---|
| 128 | #endif
|
|---|
| 129 |
|
|---|
| 130 | do k = blkLimits(LOW,KAXIS), blkLimits(HIGH,KAXIS)
|
|---|
| 131 | do j = blkLimits(LOW,JAXIS), blkLimits(HIGH,JAXIS)
|
|---|
| 132 | do i = blkLimits(LOW,IAXIS), blkLimits(HIGH,IAXIS)
|
|---|
| 133 |
|
|---|
| 134 | dEneut = 0.
|
|---|
| 135 |
|
|---|
| 136 | xDens = solnData(DENS_VAR,i,j,k)
|
|---|
| 137 | xTemp = solnData(TEMP_VAR,i,j,k)
|
|---|
| 138 | xYe = solnData(YE_MSCALAR,i,j,k)
|
|---|
| 139 | xEner = solnData(EINT_VAR,i,j,k)
|
|---|
| 140 |
|
|---|
| 141 | radius = (xCenter(i))**2
|
|---|
| 142 | if (NDIM > 1) then
|
|---|
| 143 | radius = radius + (yCenter(j))**2
|
|---|
| 144 | endif
|
|---|
| 145 | if (NDIM > 2) then
|
|---|
| 146 | radius = radius + zCenter(k)**2
|
|---|
| 147 | endif
|
|---|
| 148 | radius = sqrt(radius)
|
|---|
| 149 |
|
|---|
| 150 | ! Calculate heating
|
|---|
| 151 | dEneut = 1.544e20 * (ht_Lneut/1.e52) * (1.e7 / radius)**2 * (ht_Tneut / 4.)**2
|
|---|
| 152 |
|
|---|
| 153 | ! Now subtract cooling
|
|---|
| 154 | dEneut = dEneut - 1.399e20 * (xTemp / (2.*MeVtoK))**6
|
|---|
| 155 |
|
|---|
| 156 | dEneut = dEneut * exp(-tauNu(xDens))
|
|---|
| 157 |
|
|---|
| 158 | ! Now call Eos to get Yp and Yn
|
|---|
| 159 | call Eos_nucOneZone(xDens,xTemp,xYe,xEner,xPres,xEntr,&
|
|---|
| 160 | tmp,tmp,tmp,tmp,tmp,tmp,xXp,16,MODE_DENS_TEMP)
|
|---|
| 161 | call Eos_nucOneZone(xDens,xTemp,xYe,xEner,xPres,xEntr,&
|
|---|
| 162 | tmp,tmp,tmp,tmp,tmp,tmp,xXn,15,MODE_DENS_TEMP)
|
|---|
| 163 |
|
|---|
| 164 | dEneut = dEneut * (xXp + xXn)
|
|---|
| 165 |
|
|---|
| 166 | solnData(EINT_VAR,i,j,k) = solnData(EINT_VAR,i,j,k) + dEneut*dt
|
|---|
| 167 |
|
|---|
| 168 | ek = 0.5e0*(solnData(VELX_VAR,i,j,k)**2 + &
|
|---|
| 169 | solnData(VELY_VAR,i,j,k)**2 + &
|
|---|
| 170 | solnData(VELZ_VAR,i,j,k)**2)
|
|---|
| 171 |
|
|---|
| 172 | solnData(ENER_VAR,i,j,k) = solnData(EINT_VAR,i,j,k) + ek
|
|---|
| 173 |
|
|---|
| 174 | ! Now store any auxilliary variables
|
|---|
| 175 | #ifdef DELE_VAR
|
|---|
| 176 | solnData(DELE_VAR,i,j,k) = dEneut
|
|---|
| 177 | #endif
|
|---|
| 178 | #ifdef TAUN_VAR
|
|---|
| 179 | solnData(TAUN_VAR,i,j,k) = tauNu(xDens)
|
|---|
| 180 | #endif
|
|---|
| 181 | #ifdef YP_VAR
|
|---|
| 182 | solnData(YP_VAR,i,j,k) = xXp
|
|---|
| 183 | #endif
|
|---|
| 184 | #ifdef YN_VAR
|
|---|
| 185 | solnData(YN_VAR,i,j,k) = xXn
|
|---|
| 186 | #endif
|
|---|
| 187 | #ifdef YA_VAR
|
|---|
| 188 | solnData(YA_VAR,i,j,k) = xXa
|
|---|
| 189 | #endif
|
|---|
| 190 | #ifdef YH_VAR
|
|---|
| 191 | solnData(YH_VAR,i,j,k) = xXh
|
|---|
| 192 | #endif
|
|---|
| 193 | enddo
|
|---|
| 194 | enddo
|
|---|
| 195 | enddo
|
|---|
| 196 |
|
|---|
| 197 | call Grid_releaseBlkPtr(blockID,solndata)
|
|---|
| 198 | call Eos_wrapped(MODE_DENS_EI,blkLimits,blockID)
|
|---|
| 199 |
|
|---|
| 200 | deallocate(xCenter)
|
|---|
| 201 | if(NDIM>1)deallocate(yCenter)
|
|---|
| 202 | if(NDIM>2)deallocate(zCenter)
|
|---|
| 203 |
|
|---|
| 204 | enddo
|
|---|
| 205 | !$omp enddo
|
|---|
| 206 | !$omp end parallel
|
|---|
| 207 |
|
|---|
| 208 | return
|
|---|
| 209 | end subroutine Heat
|
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 | function tauNu(dens)
|
|---|
| 213 |
|
|---|
| 214 | implicit none
|
|---|
| 215 |
|
|---|
| 216 | real, intent(IN) :: dens
|
|---|
| 217 | real :: tauNu
|
|---|
| 218 |
|
|---|
| 219 | ! Other optical depth approximations may be used here.
|
|---|
| 220 | tauNu = dens * 1.0e-11
|
|---|
| 221 |
|
|---|
| 222 | return
|
|---|
| 223 | end function tauNu |
|---|