-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #775 from galacticusorg/featMassDistributionsTabul…
…ated Add an abstract class which automates tabulation of parametric, spherically-symmetric, collisionless mass distributions
- Loading branch information
Showing
9 changed files
with
1,716 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
source/kinematic_distributions.collisionless.tabulated.F90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
!! Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, | ||
!! 2019, 2020, 2021, 2022, 2023, 2024, 2025 | ||
!! 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/>. | ||
|
||
!!{ | ||
Implementation of a kinematic distribution class for collisionless mass distributions using tabulated solutions. | ||
!!} | ||
|
||
!![ | ||
<kinematicsDistribution name="kinematicsDistributionCollisionlessTabulated"> | ||
<description>A kinematic distribution class for collisionless mass distributions using tabulated solutions.</description> | ||
</kinematicsDistribution> | ||
!!] | ||
type, public, extends(kinematicsDistributionClass) :: kinematicsDistributionCollisionlessTabulated | ||
!!{ | ||
A kinematics distribution for collisionless distributions using tabulated solutions. | ||
!!} | ||
contains | ||
procedure :: isCollisional => collisionlessTabulatedIsCollisional | ||
procedure :: velocityDispersion1D => collisionlessTabulatedVelocityDispersion1D | ||
end type kinematicsDistributionCollisionlessTabulated | ||
|
||
interface kinematicsDistributionCollisionlessTabulated | ||
!!{ | ||
Constructors for the {\normalfont \ttfamily collisionless} kinematic distribution class. | ||
!!} | ||
module procedure collisionlessTabulatedConstructorParameters | ||
module procedure collisionlessTabulatedConstructorInternal | ||
module procedure collisionlessTabulatedConstructorDecorated | ||
end interface kinematicsDistributionCollisionlessTabulated | ||
|
||
contains | ||
|
||
function collisionlessTabulatedConstructorParameters(parameters) result(self) | ||
!!{ | ||
Constructor for the {\normalfont \ttfamily collisionlessTabulated} kinematic distribution class which builds the object from a parameter | ||
set. | ||
!!} | ||
use :: Input_Parameters, only : inputParameters | ||
implicit none | ||
type (kinematicsDistributionCollisionlessTabulated) :: self | ||
type (inputParameters ), intent(inout) :: parameters | ||
double precision :: toleranceRelativeVelocityDispersion, toleranceRelativeVelocityDispersionMaximum | ||
|
||
!![ | ||
<inputParameter> | ||
<name>toleranceRelativeVelocityDispersion</name> | ||
<defaultValue>1.0d-6</defaultValue> | ||
<source>parameters</source> | ||
<description>The relative tolerance to use in numerical solutions for the velocity dispersion in dark-matter-only density profiles.</description> | ||
</inputParameter> | ||
<inputParameter> | ||
<name>toleranceRelativeVelocityDispersionMaximum</name> | ||
<defaultValue>1.0d-3</defaultValue> | ||
<source>parameters</source> | ||
<description>The maximum relative tolerance to use in numerical solutions for the velocity dispersion in dark-matter-only density profiles.</description> | ||
</inputParameter> | ||
!!] | ||
self=kinematicsDistributionCollisionlessTabulated(toleranceRelativeVelocityDispersion,toleranceRelativeVelocityDispersionMaximum) | ||
!![ | ||
<inputParametersValidate source="parameters"/> | ||
!!] | ||
return | ||
end function collisionlessTabulatedConstructorParameters | ||
|
||
function collisionlessTabulatedConstructorInternal(toleranceRelativeVelocityDispersion,toleranceRelativeVelocityDispersionMaximum) result(self) | ||
!!{ | ||
Internal constructor for the {\normalfont \ttfamily collisionlessTabulated} kinematic distribution class. | ||
!!} | ||
implicit none | ||
type (kinematicsDistributionCollisionlessTabulated) :: self | ||
double precision , intent(in ), optional :: toleranceRelativeVelocityDispersion, toleranceRelativeVelocityDispersionMaximum | ||
!![ | ||
<constructorAssign variables="toleranceRelativeVelocityDispersion, toleranceRelativeVelocityDispersionMaximum"/> | ||
!!] | ||
|
||
return | ||
end function collisionlessTabulatedConstructorInternal | ||
|
||
function collisionlessTabulatedConstructorDecorated(kinematicsDistribution_) result(self) | ||
!!{ | ||
Internal constructor for the {\normalfont \ttfamily collisionlessTabulated} kinematic distribution class. | ||
!!} | ||
implicit none | ||
type (kinematicsDistributionCollisionlessTabulated) :: self | ||
class(kinematicsDistributionClass ), intent(in ) :: kinematicsDistribution_ | ||
|
||
self%toleranceRelativeVelocityDispersion =kinematicsDistribution_%toleranceRelativeVelocityDispersion | ||
self%toleranceRelativeVelocityDispersionMaximum=kinematicsDistribution_%toleranceRelativeVelocityDispersionMaximum | ||
return | ||
end function collisionlessTabulatedConstructorDecorated | ||
|
||
logical function collisionlessTabulatedIsCollisional(self) | ||
!!{ | ||
Return false indicating that the tabulated collisionless kinematic distribution represents collisionless particles. | ||
!!} | ||
implicit none | ||
class(kinematicsDistributionCollisionlessTabulated), intent(inout) :: self | ||
|
||
collisionlessTabulatedIsCollisional=.false. | ||
return | ||
end function collisionlessTabulatedIsCollisional | ||
|
||
double precision function collisionlessTabulatedVelocityDispersion1D(self,coordinates,massDistributionEmbedding) result(velocityDispersion) | ||
!!{ | ||
Return the 1D velocity dispersion at the specified {\normalfont \ttfamily coordinates} in a tabulated collisionless kinematic distribution. | ||
!!} | ||
implicit none | ||
class(kinematicsDistributionCollisionlessTabulated), intent(inout), target :: self | ||
class(coordinate ), intent(in ) :: coordinates | ||
class(massDistributionClass ), intent(inout) :: massDistributionEmbedding | ||
|
||
select type (massDistributionEmbedding) | ||
class is (massDistributionSphericalTabulated) | ||
if (.not.massDistributionEmbedding%isTabulating()) then | ||
velocityDispersion=massDistributionEmbedding%velocityDispersion1D (coordinates ) | ||
else | ||
velocityDispersion=self %velocityDispersion1DNumerical(coordinates,massDistributionEmbedding) | ||
end if | ||
class default | ||
velocityDispersion =self %velocityDispersion1DNumerical(coordinates,massDistributionEmbedding) | ||
end select | ||
return | ||
end function collisionlessTabulatedVelocityDispersion1D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
2a8a5af
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark 'Decaying dark matter-only subhalos benchmarks (τ=20 Gyr; vₖ=20 km/s)'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
3
.(τ=20.0 Gyr; vₖ=20.0 km/s) - Likelihood - mass function
55.654310581503694
-logℒ6.025134942152011
-logℒ9.24
(τ=20.0 Gyr; vₖ=20.0 km/s) - Likelihood - orbital radius function
137.17284820154703
-logℒ3.40178187219096
-logℒ40.32
This comment was automatically generated by workflow using github-action-benchmark.
CC: @abensonca
2a8a5af
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark 'Decaying dark matter-only subhalos benchmarks (τ=40 Gyr; vₖ=40 km/s)'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
2.50
.(τ=40.0 Gyr; vₖ=40.0 km/s) - Likelihood - mass function
36.448625136101384
-logℒ4.463686761083651
-logℒ8.17
(τ=40.0 Gyr; vₖ=40.0 km/s) - Likelihood - orbital radius function
176.25647803568833
-logℒ6.2279371559721755
-logℒ28.30
This comment was automatically generated by workflow using github-action-benchmark.
CC: @abensonca