1
!% Contains a module which implements stellar population properties in the instantaneous recycling approximation.
3
module Stellar_Population_Properties_Instantaneous
4
!% Implements stellar population properties in the instantaneous recycling approximation.
6
public :: Stellar_Population_Properties_Instantaneous_Initialize
10
!# <stellarPopulationPropertiesMethod>
11
!# <unitName>Stellar_Population_Properties_Instantaneous_Initialize</unitName>
12
!# </stellarPopulationPropertiesMethod>
13
subroutine Stellar_Population_Properties_Instantaneous_Initialize(stellarPopulationPropertiesMethod &
14
&,Stellar_Population_Properties_Rates_Get,Stellar_Population_Properties_History_Count_Get&
15
&,Stellar_Population_Properties_History_Create_Do)
16
!% Initializes the instantaneous recycling approximation stellar population properties module.
17
use ISO_Varying_String
19
type(varying_string), intent(in) :: stellarPopulationPropertiesMethod
20
procedure(), pointer, intent(inout) :: Stellar_Population_Properties_Rates_Get&
21
&,Stellar_Population_Properties_History_Count_Get,Stellar_Population_Properties_History_Create_Do
23
if (stellarPopulationPropertiesMethod == 'instantaneous') then
24
Stellar_Population_Properties_Rates_Get => Stellar_Population_Properties_Rates_Instantaneous
25
Stellar_Population_Properties_History_Count_Get => Stellar_Population_Properties_History_Count_Instantaneous
26
Stellar_Population_Properties_History_Create_Do => Stellar_Population_Properties_History_Create_Instantaneous
29
end subroutine Stellar_Population_Properties_Instantaneous_Initialize
31
integer function Stellar_Population_Properties_History_Count_Instantaneous()
32
!% Returns the number of histories required by the instantaneous stellar populations properties module.
35
! We require no histories.
36
Stellar_Population_Properties_History_Count_Instantaneous=0
38
end function Stellar_Population_Properties_History_Count_Instantaneous
40
subroutine Stellar_Population_Properties_Rates_Instantaneous(starFormationRate,fuelAbundances,thisNode,thisHistory,stellarMassRate&
41
&,stellarAbundancesRates,stellarLuminositiesRates,fuelMassRate,fuelAbundancesRates,energyInputRate)
42
!% Return an array of stellar population property rates of change given a star formation rate and fuel abundances.
45
use Abundances_Structure
47
use Star_Formation_IMF
48
use Stellar_Population_Properties_Luminosities
51
double precision, intent(out) :: stellarMassRate,fuelMassRate,energyInputRate
52
type(abundancesStructure), intent(out) :: stellarAbundancesRates,fuelAbundancesRates
53
double precision, intent(out), dimension(:) :: stellarLuminositiesRates
54
double precision, intent(in) :: starFormationRate
55
type(abundancesStructure), intent(in) :: fuelAbundances
56
type(treeNode), intent(inout), pointer :: thisNode
57
type(history), intent(inout) :: thisHistory
58
integer :: imfSelected
59
double precision :: recycledFractionInstantaneous,yieldInstantaneous,fuelMetallicity&
60
&,stellarMetalsRateOfChange,fuelMetalsRateOfChange,time
62
! Get the instantaneous recycling rate for the IMF.
63
recycledFractionInstantaneous=IMF_Recycled_Fraction_Instantaneous(starFormationRate,fuelAbundances)
65
! Get the yield for this IMF.
66
yieldInstantaneous=IMF_Yield_Instantaneous(starFormationRate,fuelAbundances)
68
! Get the metallicity of the fuel supply.
69
fuelMetallicity=Abundances_Get_Metallicity(fuelAbundances)
71
! Set the stellar and fuel mass rates of change.
72
stellarMassRate= (1.0d0-recycledFractionInstantaneous)*starFormationRate
73
fuelMassRate =-stellarMassRate
75
! Set energy input rate to canonical value assuming that all energy is injected instantaneously.
76
energyInputRate=starFormationRate*feedbackEnergyInputAtInfinityCanonical
78
! Set the rates of change of the stellar and fuel metallicities.
79
stellarMetalsRateOfChange=stellarMassRate*fuelMetallicity
80
fuelMetalsRateOfChange =-stellarMetalsRateOfChange+yieldInstantaneous*starFormationRate
81
call stellarAbundancesRates%metallicitySet(stellarMetalsRateOfChange)
82
call fuelAbundancesRates %metallicitySet(fuelMetalsRateOfChange )
85
imfSelected=IMF_Select(starFormationRate,fuelAbundances)
87
! Get the current cosmological time for this node.
88
time=Tree_Node_Time(thisNode)
90
! Set luminosity rates of change.
91
if (size(stellarLuminositiesRates) > 0) stellarLuminositiesRates=starFormationRate&
92
&*Stellar_Population_Luminosities_Get(imfSelected,time,fuelAbundances)
95
end subroutine Stellar_Population_Properties_Rates_Instantaneous
97
subroutine Stellar_Population_Properties_History_Create_Instantaneous(thisNode,thisHistory)
98
!% Create any history required for storing stellar population properties. The instantaneous method requires none, so just return.
102
type(treeNode), intent(inout), pointer :: thisNode
103
type(history), intent(inout) :: thisHistory
106
end subroutine Stellar_Population_Properties_History_Create_Instantaneous
108
end module Stellar_Population_Properties_Instantaneous