-
Notifications
You must be signed in to change notification settings - Fork 24
/
planet.jl
46 lines (33 loc) · 1.42 KB
/
planet.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
abstract type AbstractPlanet <: AbstractModelComponent end
const DEFAULT_ROTATION = 7.29e-5 # default angular frequency of Earth's rotation [1/s]
const DEFAULT_GRAVITY = 9.81 # default gravitational acceleration on Earth [m/s²]
export Earth
"""
$(TYPEDSIGNATURES)
Create a struct `Earth<:AbstractPlanet`, with the following physical/orbital
characteristics. Note that `radius` is not part of it as this should be chosen
in `SpectralGrid`. Keyword arguments are
$(TYPEDFIELDS)
"""
Base.@kwdef mutable struct Earth{NF<:AbstractFloat} <: AbstractPlanet
"angular frequency of Earth's rotation [rad/s]"
rotation::NF = DEFAULT_ROTATION
"gravitational acceleration [m/s^2]"
gravity::NF = DEFAULT_GRAVITY
"switch on/off daily cycle"
daily_cycle::Bool = true
"Seconds in a daily rotation"
length_of_day::Second = Hour(24)
"switch on/off seasonal cycle"
seasonal_cycle::Bool = true
"Seconds in an orbit around the sun"
length_of_year::Second = Day(365.25)
"time of spring equinox (year irrelevant)"
equinox::DateTime = DateTime(2000, 3, 20)
"angle [˚] rotation axis tilt wrt to orbit"
axial_tilt::NF = 23.4
"Total solar irradiance at the distance of 1 AU [W/m²]"
solar_constant::NF = 1365
end
Earth(SG::SpectralGrid; kwargs...) = Earth{SG.NF}(; kwargs...)
Earth(::Type{NF}; kwargs...) where NF = Earth{NF}(; kwargs...)