Skip to content

Commit

Permalink
Merge pull request #616 from galacticusorg/fixCoolingRateDiscontinuous
Browse files Browse the repository at this point in the history
Catch cases where the cooling rate is discontinuous
  • Loading branch information
abensonca authored Jun 3, 2024
2 parents 69ac594 + c3184c6 commit c658b26
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions source/cooling.cooling_radius.simple.F90
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ double precision function simpleRadiusGrowthRate(self,node)
& coolingTimeAvailableIncreaseRate, coolingTimeDensityLogSlope, &
& coolingTimeTemperatureLogSlope , density , &
& densityLogSlope , outerRadius , &
& temperature , temperatureLogSlope
& temperature , temperatureLogSlope , &
& slope

! Check if node differs from previous one for which we performed calculations.
if (node%uniqueID() /= self%lastUniqueID) call self%calculationReset(node,node%uniqueID())
Expand Down Expand Up @@ -293,13 +294,18 @@ double precision function simpleRadiusGrowthRate(self,node)
coolingTimeTemperatureLogSlope=self%coolingTime_%gradientTemperatureLogarithmic(node,temperature,density,abundancesGas_,fractionsChemical_*density,self%radiation)
! Compute rate at which cooling radius grows.
if (coolingRadius > 0.0d0) then
self%radiusGrowthRateStored=+coolingRadius &
& /coolingTimeAvailable &
& *coolingTimeAvailableIncreaseRate &
& /( &
& + densityLogSlope*coolingTimeDensityLogSlope &
& +temperatureLogSlope*coolingTimeTemperatureLogSlope &
& )
slope =+ densityLogSlope*coolingTimeDensityLogSlope &
& +temperatureLogSlope*coolingTimeTemperatureLogSlope
if (slope /= 0.0d0) then
self%radiusGrowthRateStored=+coolingRadius &
& /coolingTimeAvailable &
& *coolingTimeAvailableIncreaseRate &
& /slope
else
! The slope of the cooling radius vs. time available curve can be zero in cases where there are discontinuities in
! the cooling function. Catch such behavior here.
self%radiusGrowthRateStored=0.0d0
end if
else
self%radiusGrowthRateStored=0.0d0
end if
Expand Down

0 comments on commit c658b26

Please sign in to comment.