Skip to content

Commit 5d277a1

Browse files
committed
rename ExponentialDisc, cancel disc shifting
1 parent 4cf4975 commit 5d277a1

4 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/AstroIC.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export
3737

3838
PlummerStarCluster,
3939
GasCloud,
40-
ExponentialDisk,
40+
ExponentialDisc,
4141
Bulge,
4242

4343
solarsystem,
@@ -73,7 +73,7 @@ Generate initial conditions in `units`
7373
# Usable IC configs
7474
- `PlummerStarCluster`
7575
- `GasCloud`
76-
- `ExponentialDisk`
76+
- `ExponentialDisc`
7777
7878
$_common_keywords
7979
"""

src/disk.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
$(TYPEDEF)
33
$(TYPEDFIELDS)
44
"""
5-
mutable struct ExponentialDisk{I, Len, MASS} <: InitialConditionConfig
5+
mutable struct ExponentialDisc{I, Len, MASS} <: InitialConditionConfig
66
collection::Collection
77
NumSamples::I
88

@@ -19,18 +19,18 @@ $(TYPEDSIGNATURES)
1919
- `collection` particle type
2020
- `NumSamples` amount of particles
2121
"""
22-
function ExponentialDisk(;
22+
function ExponentialDisc(;
2323
collection::Collection = STAR,
2424
NumSamples::Int64 = 1000,
2525
TotalMass::Number = 1.0e10u"Msun",
2626
ScaleRadius::Number = 2.0u"kpc",
2727
ScaleHeight::Number = 0.02u"kpc",
2828
HoleRadius::Number = 0.0u"kpc",
2929
)
30-
return ExponentialDisk(collection, NumSamples, TotalMass, ScaleRadius, ScaleHeight, HoleRadius)
30+
return ExponentialDisc(collection, NumSamples, TotalMass, ScaleRadius, ScaleHeight, HoleRadius)
3131
end
3232

33-
function Base.show(io::IO, config::ExponentialDisk)
33+
function Base.show(io::IO, config::ExponentialDisc)
3434
print(io,
3535
"Config of Exponential Disk Initial Conditions:",
3636
"\n Particle Collection: ", config.collection,
@@ -144,7 +144,7 @@ end
144144
$(TYPEDSIGNATURES)
145145
146146
"""
147-
function generate(config::ExponentialDisk, units = uAstro;
147+
function generate(config::ExponentialDisc, units = uAstro;
148148
RotationCurve = nothing,
149149
MaxRadius = 5 * config.ScaleRadius,
150150
MaxHeight = MaxRadius,
@@ -211,6 +211,12 @@ function generate(config::ExponentialDisk, units = uAstro;
211211
spl = Spline1D(ustrip.(uLen, xc), ustrip.(uVel, vc); k, bc)
212212
v = spl(ustrip.(uLen, R)) * uVel
213213
vel = rotational_velocity.(pos.x, pos.y, v, rotational_ratio)
214+
215+
# Cancel out shifting
216+
v0 = mean(vel)
217+
vel = vel .- v0
218+
uVel = getuVel(units)
219+
vel = uconvert.(uVel, vel)
214220
end
215221

216222
# Packing

src/precompile.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
@compile_workload begin
33
NumSamples = 5
44
data = generate(PlummerStarCluster(; NumSamples))
5-
data = generate(ExponentialDisk(; NumSamples))
6-
data = generate(ExponentialDisk(; NumSamples, HoleRadius = 0.2u"kpc"))
5+
data = generate(ExponentialDisc(; NumSamples))
6+
data = generate(ExponentialDisc(; NumSamples, HoleRadius = 0.2u"kpc"))
77
data = generate(Bulge(; NumSamples))
88
data = generate(Bulge(; NumSamples), RotationCurve = ([0.0, 5.0, 10.0]*u"kpc", [0.0, 200.0, 230.0]*u"km/s"))
99
p = sum(data.Pos)

test/disk.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@testset "Disk" begin
2-
config = ExponentialDisk(
2+
config = ExponentialDisc(
33
collection = STAR,
44
NumSamples = 100,
55
TotalMass = 1.0e8u"Msun",

0 commit comments

Comments
 (0)