Skip to content

Commit

Permalink
Merge pull request #410 from galacticusorg/postprocessSED
Browse files Browse the repository at this point in the history
Improve SED calculation
  • Loading branch information
abensonca committed May 9, 2023
2 parents 6e8872e + bdf62e4 commit 0c31f3f
Show file tree
Hide file tree
Showing 6 changed files with 384 additions and 110 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ jobs:
name: galacticus-exec
- name: Install tools
run: |
apt -y update
apt -y update && apt -y upgrade
apt install -y time
- name: Create test suite output directory
run: mkdir -p $GALACTICUS_EXEC_PATH/testSuite/outputs
Expand Down Expand Up @@ -962,7 +962,7 @@ jobs:
name: galacticus-exec
- name: Install tools
run: |
apt -y update
apt -y update && apt -y upgrade
apt install -y time
- name: Mark time for cache accesses
run: |
Expand Down Expand Up @@ -1025,7 +1025,7 @@ jobs:
name: galacticus-exec
- name: Install tools
run: |
apt -y update
apt -y update && apt -y upgrade
apt install -y linux-tools-$(uname -r) linux-tools-generic bzip2
- name: Create test suite output directory
run: mkdir -p $GALACTICUS_EXEC_PATH/testSuite/outputs
Expand Down Expand Up @@ -1079,7 +1079,7 @@ jobs:
name: galacticus-exec
- name: Install tools
run: |
apt -y update
apt -y update && apt -y upgrade
apt install -y linux-tools-$(uname -r) linux-tools-generic bzip2
- name: Create test suite output directory
run: mkdir -p $GALACTICUS_EXEC_PATH/testSuite/outputs
Expand Down Expand Up @@ -1147,7 +1147,7 @@ jobs:
name: galacticus-exec
- name: Install tools
run: |
apt -y update
apt -y update && apt -y upgrade
apt install -y linux-tools-$(uname -r) linux-tools-generic bzip2
- name: Create test suite output directory
run: mkdir -p $GALACTICUS_EXEC_PATH/testSuite/outputs
Expand Down Expand Up @@ -1208,7 +1208,7 @@ jobs:
name: galacticus-exec-instrumented
- name: Install tools
run: |
apt -y update
apt -y update && apt -y upgrade
apt install -y bzip2
- name: Create test suite output directory
run: mkdir -p $GALACTICUS_EXEC_PATH/testSuite/outputs
Expand Down Expand Up @@ -1263,7 +1263,7 @@ jobs:
name: galacticus-exec-instrumented
- name: Install tools
run: |
apt -y update
apt -y update && apt -y upgrade
apt install -y bzip2
- name: Create test suite output directory
run: mkdir -p $GALACTICUS_EXEC_PATH/testSuite/outputs
Expand Down Expand Up @@ -1332,7 +1332,7 @@ jobs:
name: galacticus-exec-instrumented
- name: Install tools
run: |
apt -y update
apt -y update && apt -y upgrade
apt install -y bzip2
- name: Create test suite output directory
run: mkdir -p $GALACTICUS_EXEC_PATH/testSuite/outputs
Expand Down Expand Up @@ -5108,7 +5108,7 @@ jobs:
name: test-execs
- name: Install valgrind
run: |
apt -y update
apt -y update && apt -y upgrade
apt -y install valgrind
- name: Create test suite output directory
run: mkdir -p $GALACTICUS_EXEC_PATH/testSuite/outputs
Expand Down Expand Up @@ -5148,7 +5148,7 @@ jobs:
name: test-execs
- name: Install valgrind
run: |
apt -y update
apt -y update && apt -y upgrade
apt -y install valgrind
- name: Create test suite output directory
run: mkdir -p $GALACTICUS_EXEC_PATH/testSuite/outputs
Expand Down Expand Up @@ -9319,7 +9319,7 @@ jobs:
name: galacticus-exec-non-static
- name: Install valgrind
run: |
apt -y update
apt -y update && apt -y upgrade
apt -y install valgrind
- name: Create test suite output directory
run: mkdir -p $GALACTICUS_EXEC_PATH/testSuite/outputs
Expand Down Expand Up @@ -9362,7 +9362,7 @@ jobs:
name: galacticus-exec-MPI
- name: Install valgrind
run: |
apt -y update
apt -y update && apt -y upgrade
apt -y install valgrind
- name: Create test suite output directory
run: mkdir -p $GALACTICUS_EXEC_PATH/testSuite/outputs
Expand Down Expand Up @@ -9397,7 +9397,7 @@ jobs:
echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
- name: Install Python2
run: |
apt -y update
apt -y update && apt -y upgrade
apt -y install python2.7
- name: Download library
uses: actions/download-artifact@v3
Expand Down
17 changes: 17 additions & 0 deletions doc/Galacticus.bib
Original file line number Diff line number Diff line change
Expand Up @@ -4494,6 +4494,23 @@ @article{lacey_merger_1994
file = {NASA/ADS Full Text PDF:/home/abenson/.mozilla/firefox/f54gqgdx.default/zotero/storage/MH4X3KIQ/Lacey and Cole - 1994 - Merger Rates in Hierarchical Models of Galaxy Form.pdf:application/pdf}
}

@article{lacey_unified_2016,
title = {A unified multiwavelength model of galaxy formation},
volume = {462},
issn = {0035-8711},
url = {https://ui.adsabs.harvard.edu/abs/2016MNRAS.462.3854L},
doi = {10.1093/mnras/stw1888},
abstract = {We present a new version of the GALFORM semi-analytical model of galaxy formation. This brings together several previous developments of GALFORM into a single unified model, including a different initial mass function (IMF) in quiescent star formation and in starbursts, feedback from active galactic nuclei suppressing gas cooling in massive haloes, and a new empirical star formation law in galaxy discs based on their molecular gas content. In addition, we have updated the cosmology, introduced a more accurate treatment of dynamical friction acting on satellite galaxies, and updated the stellar population model. The new model is able to simultaneously explain both the observed evolution of the K-band luminosity function and stellar mass function, and the number counts and redshift distribution of sub-mm galaxies selected at 850 μm. This was not previously achieved by a single physical model within the Λcold dark matter framework, but requires having an IMF in starbursts that is somewhat top-heavy. The new model is tested against a wide variety of observational data covering wavelengths from the far-UV to sub-mm, and redshifts from z = 0 to 6, and is found to be generally successful. These observations include the optical and near-infrared (IR) luminosity functions, H I mass function, fraction of early type galaxies, Tully-Fisher, metallicity-luminosity and size-luminosity relations at z = 0, as well as far-IR number counts, and far-UV luminosity functions at z ∼ 3-6. Discrepancies are, however, found in galaxy sizes and metallicities at low luminosities, and in the abundance of low-mass galaxies at high-z, suggesting the need for a more sophisticated model of supernova feedback.},
urldate = {2023-05-04},
journal = {Monthly Notices of the Royal Astronomical Society},
author = {Lacey, Cedric G. and Baugh, Carlton M. and Frenk, Carlos S. and Benson, Andrew J. and Bower, Richard G. and Cole, Shaun and Gonzalez-Perez, Violeta and Helly, John C. and Lagos, Claudia D. P. and Mitchell, Peter D.},
month = nov,
year = {2016},
note = {ADS Bibcode: 2016MNRAS.462.3854L},
keywords = {Astrophysics - Astrophysics of Galaxies, galaxies: evolution, galaxies: formation, galaxies: high-redshift},
pages = {3854--3911},
}

@article{lam_modeling_2013,
title = {Modeling the phase-space distribution around massive halos},
volume = {88},
Expand Down
14 changes: 12 additions & 2 deletions perl/Galacticus/Build/SourceTree/Process/FunctionClass.pm
Original file line number Diff line number Diff line change
Expand Up @@ -877,13 +877,22 @@ CODE
# Add a "objectType" method.
$code::directiveName = $directive->{'name'};
my $objectTypeCode = fill_in_string(<<'CODE', PACKAGE => 'code');
logical :: short_
short_=.false.
if (present(short)) short_=short
select type (self)
CODE
foreach my $nonAbstractClass ( @nonAbstractClasses ) {
$code::type = $nonAbstractClass->{'name'};
$code::type = $nonAbstractClass->{'name'};
($code::typeShort = $nonAbstractClass->{'name'}) =~ s/^$directive->{'name'}//;
$code::typeShort = lcfirst($code::typeShort);
$objectTypeCode .= fill_in_string(<<'CODE', PACKAGE => 'code');
type is ({$type})
{$directiveName}ObjectType='{$type}'
if (short_) then
{$directiveName}ObjectType='{$typeShort}'
else
{$directiveName}ObjectType='{$type}'
end if
CODE
}
$objectTypeCode .= fill_in_string(<<'CODE', PACKAGE => 'code');
Expand All @@ -895,6 +904,7 @@ CODE
type => "type(varying_string)",
pass => "yes",
modules => "ISO_Varying_String",
argument => [ "logical, intent(in ), optional :: short" ],
code => $objectTypeCode
};
# Add "allowedParameters" method.
Expand Down
111 changes: 111 additions & 0 deletions source/merger_trees.evolve.timesteps.star_formation_history.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
!! Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018,
!! 2019, 2020, 2021, 2022, 2023
!! Andrew Benson <abenson@carnegiescience.edu>
!!
!! This file is part of Galacticus.
!!
!! Galacticus is free software: you can redistribute it and/or modify
!! it under the terms of the GNU General Public License as published by
!! the Free Software Foundation, either version 3 of the License, or
!! (at your option) any later version.
!!
!! Galacticus is distributed in the hope that it will be useful,
!! but WITHOUT ANY WARRANTY; without even the implied warranty of
!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!! GNU General Public License for more details.
!!
!! You should have received a copy of the GNU General Public License
!! along with Galacticus. If not, see <http://www.gnu.org/licenses/>.

!![
<mergerTreeEvolveTimestep name="mergerTreeEvolveTimestepStarFormationHistory">
<description>
A merger tree evolution timestepping class that limits the timestep to the next bin in the star formation history.
</description>
</mergerTreeEvolveTimestep>
!!]
type, extends(mergerTreeEvolveTimestepClass) :: mergerTreeEvolveTimestepStarFormationHistory
!!{
A merger tree evolution timestepping class that limits the timestep to the next bin in the star formation history.
!!}
private
contains
procedure :: timeEvolveTo => starFormationHistoryTimeEvolveTo
end type mergerTreeEvolveTimestepStarFormationHistory

interface mergerTreeEvolveTimestepStarFormationHistory
!!{
Constructors for the {\normalfont \ttfamily starFormationHistory} merger tree evolution timestep class.
!!}
module procedure starFormationHistoryConstructorParameters
end interface mergerTreeEvolveTimestepStarFormationHistory

contains

function starFormationHistoryConstructorParameters(parameters) result(self)
!!{
Constructor for the {\normalfont \ttfamily starFormationHistory} merger tree evolution timestep class which takes a parameter set as input.
!!}
use :: Input_Parameters, only : inputParameter, inputParameters
implicit none
type(mergerTreeEvolveTimestepStarFormationHistory) :: self
type(inputParameters ), intent(inout) :: parameters

self=mergerTreeEvolveTimestepStarFormationHistory()
!![
<inputParametersValidate source="parameters"/>
!!]
return
end function starFormationHistoryConstructorParameters

double precision function starFormationHistoryTimeEvolveTo(self,timeEnd,node,task,taskSelf,report,lockNode,lockType) result(timeEvolveTo)
!!{
Determine a suitable timestep for {\normalfont \ttfamily node} using the starFormationHistory method. This simply selects the smaller of {\normalfont \ttfamily
timeStepAbsolute} and {\normalfont \ttfamily timeStepRelative}$H^{-1}(t)$.
!!}
use, intrinsic :: ISO_C_Binding , only : c_size_t
use :: Arrays_Search , only : searchArray
use :: Evolve_To_Time_Reports, only : Evolve_To_Time_Report
use :: Galacticus_Nodes , only : nodeComponentBasic , nodeComponentDisk, nodeComponentSpheroid
use :: ISO_Varying_String , only : varying_string
use :: Histories , only : history
implicit none
class (mergerTreeEvolveTimestepStarFormationHistory), intent(inout), target :: self
double precision , intent(in ) :: timeEnd
type (treeNode ), intent(inout), target :: node
procedure (timestepTask ), intent( out), pointer :: task
class (* ), intent( out), pointer :: taskSelf
logical , intent(in ) :: report
type (treeNode ), intent( out), pointer, optional :: lockNode
type (varying_string ), intent( out) , optional :: lockType
class (nodeComponentBasic ) , pointer :: basic
class (nodeComponentDisk ) , pointer :: disk
class (nodeComponentSpheroid ) , pointer :: spheroid
type (history ) :: historyStarFormationDisk, historyStarFormationSpheroid
integer (c_size_t ) :: i
!$GLC attributes unused :: timeEnd


basic => node %basic ()
disk => node %disk ()
spheroid => node %spheroid ()
historyStarFormationDisk = disk %starFormationHistory()
historyStarFormationSpheroid = spheroid%starFormationHistory()
timeEvolveTo = huge(0.0d0)
if (historyStarFormationDisk %exists()) then
i=searchArray(historyStarFormationDisk%time,basic%time())+1
if (basic%time() < historyStarFormationDisk %time(i)) &
& timeEvolveTo=min(timeEvolveTo,historyStarFormationDisk %time(i))
end if
if (historyStarFormationSpheroid%exists()) then
i=searchArray(historyStarFormationSpheroid%time,basic%time())+1
if (basic%time() < historyStarFormationSpheroid%time(i)) &
& timeEvolveTo=min(timeEvolveTo,historyStarFormationSpheroid%time(i))
end if
task => null()
taskSelf => null()
if (present(lockNode)) lockNode => node
if (present(lockType)) lockType = "starFormationHistory"
if ( report ) call Evolve_To_Time_Report("starFormationHistory: ",timeEvolveTo)
return
end function starFormationHistoryTimeEvolveTo
Loading

1 comment on commit 0c31f3f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Milky Way model benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.10.

Benchmark suite Current: 0c31f3f Previous: 6e8872e Ratio
Milky Way model - Likelihood - localGroupMassVelocityDispersionRelation 1.18952076461701 -logℒ 1.05304502286597 -logℒ 1.13

This comment was automatically generated by workflow using github-action-benchmark.

CC: @abensonca

Please sign in to comment.