~abenson/galacticus/v0.9.0

« back to all changes in this revision

Viewing changes to source/cooling.time_available.White-Frenk.F90

  • Committer: Andrew Benson
  • Date: 2010-05-27 14:18:28 UTC
  • Revision ID: abesnson@its.caltech.edu-20100527141828-dzvnjovtiq02impa
* Importing full Galacticus code as developed to date.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
!% Contains a module which implements the \cite{white_galaxy_1991} method for computing the time available for cooling in hot
 
2
!% halos.
 
3
 
 
4
module Cooling_Time_Available_White_Frenk
 
5
  !% Implements the \cite{white_galaxy_1991} method for computing the time available for cooling in hot halos.
 
6
  private
 
7
  public :: Cooling_Time_Available_WF_Initialize
 
8
 
 
9
  ! Parameter which interpolates between age of Universe and dynamical time for the time available for cooling.
 
10
  double precision :: coolingTimeAvailableAgeFactor
 
11
 
 
12
contains
 
13
 
 
14
  !# <coolingTimeAvailableMethod>
 
15
  !#  <unitName>Cooling_Time_Available_WF_Initialize</unitName>
 
16
  !# </coolingTimeAvailableMethod>
 
17
  subroutine Cooling_Time_Available_WF_Initialize(coolingTimeAvailableMethod,Cooling_Time_Available_Get&
 
18
       &,Cooling_Time_Available_Increase_Rate_Get)
 
19
    !% Initialize the \cite{white_galaxy_1991} cooling time available module.
 
20
    use ISO_Varying_String
 
21
    use Input_Parameters
 
22
    use Galacticus_Error
 
23
    implicit none
 
24
    type(varying_string),          intent(in)    :: coolingTimeAvailableMethod
 
25
    procedure(),          pointer, intent(inout) :: Cooling_Time_Available_Get,Cooling_Time_Available_Increase_Rate_Get
 
26
    
 
27
    if (coolingTimeAvailableMethod.eq.'White-Frenk') then
 
28
       Cooling_Time_Available_Get => Cooling_Time_Available_WF
 
29
       Cooling_Time_Available_Increase_Rate_Get => Cooling_Time_Available_Increase_Rate_WF
 
30
       !@ <inputParameter>
 
31
       !@   <name>coolingTimeAvailableAgeFactor</name>
 
32
       !@   <defaultValue>1</defaultValue>
 
33
       !@   <attachedTo>module</attachedTo>
 
34
       !@   <description>
 
35
       !@     Interpolates (geometrically) between the age of the Universe and the halo dynamical time for the time available for cooling in the {\tt White-Frenk} method.
 
36
       !@   </description>
 
37
       !@ </inputParameter>
 
38
       call Get_Input_Parameter('coolingTimeAvailableAgeFactor',coolingTimeAvailableAgeFactor,defaultValue=1.0d0)
 
39
       if (coolingTimeAvailableAgeFactor < 0.0d0 .or. coolingTimeAvailableAgeFactor > 1.0d0) call Galacticus_Error_Report('Cooling_Time_Available_WF_Initialize','0 <= coolingTimeAvailableAgeFactor <= 1 is required')
 
40
 
 
41
    end if
 
42
    return
 
43
  end subroutine Cooling_Time_Available_WF_Initialize
 
44
 
 
45
  double precision function Cooling_Time_Available_WF(thisNode)
 
46
    !% Compute the time available for cooling using the \cite{white_galaxy_1991} method. This is assumed to be equal to the
 
47
    !% dynamical timescale of the halo.
 
48
    use Tree_Nodes
 
49
    use Tree_Node_Methods
 
50
    use Dark_Matter_Halo_Scales
 
51
    implicit none
 
52
    type(treeNode), intent(inout), pointer :: thisNode
 
53
 
 
54
    ! Return the appropriate time.
 
55
    if (coolingTimeAvailableAgeFactor == 1.0d0) then
 
56
       ! Time available equals the age of the Universe, which is just the time for this node.
 
57
       Cooling_Time_Available_WF=Tree_Node_Time(thisNode)
 
58
    else if (coolingTimeAvailableAgeFactor == 0.0d0) then
 
59
       ! Time available equals the halo dynamical time.
 
60
       Cooling_Time_Available_WF=Dark_Matter_Halo_Dynamical_Timescale(thisNode)
 
61
    else
 
62
       ! Time is interpolated between age of Universe and dynamical time. Do the interpolation.
 
63
       Cooling_Time_Available_WF=dexp(dlog(Tree_Node_Time(thisNode))*coolingTimeAvailableAgeFactor&
 
64
            &+dlog(Dark_Matter_Halo_Dynamical_Timescale(thisNode))*(1.0d0-coolingTimeAvailableAgeFactor))
 
65
    end if
 
66
    return
 
67
  end function Cooling_Time_Available_WF
 
68
  
 
69
  double precision function Cooling_Time_Available_Increase_Rate_WF(thisNode)
 
70
    !% Compute the rate of increase of the time available for cooling using the \cite{white_galaxy_1991} method. We return a rate
 
71
    !% of 1, even though technically it can depend on halo properties.
 
72
    use Tree_Nodes
 
73
    implicit none
 
74
    type(treeNode), intent(inout), pointer :: thisNode
 
75
 
 
76
    ! Simply return unit rate.
 
77
    Cooling_Time_Available_Increase_Rate_WF=1.0d0
 
78
    return
 
79
  end function Cooling_Time_Available_Increase_Rate_WF
 
80
  
 
81
end module Cooling_Time_Available_White_Frenk