Skip to content

Commit

Permalink
feat: Check that satellite component position and velocity are …
Browse files Browse the repository at this point in the history
…gettable
  • Loading branch information
abensonca committed Nov 14, 2023
1 parent bb61226 commit f98787d
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion source/hot_halo.ram_pressure_force.orbital_position.F90
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ function orbitalPositionConstructorInternal(hotHaloMassDistribution_,galacticStr
!!{
Internal constructor for the {\normalfont \ttfamily orbitalPosition} hot halo ram pressure force class.
!!}
use :: Array_Utilities , only : operator(.intersection.)
use :: Error , only : Error_Report , Component_List
use :: Galacticus_Nodes, only : defaultSatelliteComponent
implicit none
type (hotHaloRamPressureForceOrbitalPosition) :: self
class(hotHaloMassDistributionClass ), intent(in ), target :: hotHaloMassDistribution_
Expand All @@ -95,6 +98,24 @@ function orbitalPositionConstructorInternal(hotHaloMassDistribution_,galacticStr
<constructorAssign variables="*hotHaloMassDistribution_, *galacticStructure_"/>
!!]

! Ensure that required methods are supported.
if ( &
& .not. &
& ( &
& defaultSatelliteComponent%positionIsGettable().and. &
& defaultSatelliteComponent%velocityIsGettable() &
& ) &
& ) call Error_Report &
& ( &
& 'this method requires that position, and velocity properties must all be gettable for the satellite component.'// &
& Component_List( &
& 'satellite' , &
& defaultSatelliteComponent%positionAttributeMatch(requireGettable=.true.).intersection. &
& defaultSatelliteComponent%velocityAttributeMatch(requireGettable=.true.) &
& ) // &
& {introspection:location} &
& )

return
end function orbitalPositionConstructorInternal

Expand Down Expand Up @@ -130,9 +151,13 @@ double precision function orbitalPositionForce(self,node)
! Get the satellite component.
satellite => node%satellite()
! Compute orbital position and velocity.

!! AJB HACK
if (any(abs(satellite%position()) > 1.0d100)) write (0,*) node%index(),satellite%position()

radiusOrbital = +Vector_Magnitude(satellite%position())
velocityOrbital = +Vector_Magnitude(satellite%velocity())
! Find the ram pressure force at pericenter.
! Find the ram pressure force at this orbital radius.
orbitalPositionForce = +self%hotHaloMassDistribution_%density (nodeHost,radiusOrbital) &
& * velocityOrbital **2
return
Expand Down

1 comment on commit f98787d

@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: f98787d Previous: d9ea36b Ratio
Milky Way model - Likelihood - localGroupStellarMassFunction 285.450796641662 -logℒ 121.211449594275 -logℒ 2.35

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

CC: @abensonca

Please sign in to comment.