-
Notifications
You must be signed in to change notification settings - Fork 188
/
make.jl
178 lines (156 loc) · 6.68 KB
/
make.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
pushfirst!(LOAD_PATH, joinpath(@__DIR__, "..")) # add Oceananigans to environment stack
using Documenter
using DocumenterCitations
using Literate
using Plots # to avoid capturing precompilation output by Literate
using Glob
using Oceananigans
using Oceananigans.Operators
using Oceananigans.Diagnostics
using Oceananigans.OutputWriters
using Oceananigans.TurbulenceClosures
using Oceananigans.TimeSteppers
using Oceananigans.AbstractOperations
using Oceananigans.BoundaryConditions: Flux, Value, Gradient, Open
bib_filepath = joinpath(dirname(@__FILE__), "oceananigans.bib")
bib = CitationBibliography(bib_filepath)
# Gotta set this environment variable when using the GR run-time on a remote machine.
# This happens as examples will use Plots.jl to make plots and movies.
# See: https://github.com/jheinen/GR.jl/issues/278
ENV["GKSwstype"] = "100"
#####
##### Generate examples
#####
const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples")
const OUTPUT_DIR = joinpath(@__DIR__, "src/generated")
examples = [
"one_dimensional_diffusion.jl",
"geostrophic_adjustment.jl",
"two_dimensional_turbulence.jl",
"internal_wave.jl",
"convecting_plankton.jl",
"ocean_wind_mixing_and_convection.jl",
"langmuir_turbulence.jl",
"eady_turbulence.jl",
"kelvin_helmholtz_instability.jl",
"shallow_water_Bickley_jet.jl",
"horizontal_convection.jl"
]
for example in examples
example_filepath = joinpath(EXAMPLES_DIR, example)
Literate.markdown(example_filepath, OUTPUT_DIR; flavor = Literate.DocumenterFlavor())
end
#####
##### Organize page hierarchies
#####
example_pages = [
"One-dimensional diffusion" => "generated/one_dimensional_diffusion.md",
"Geostrophic adjustment" => "generated/geostrophic_adjustment.md",
"Two-dimensional turbulence" => "generated/two_dimensional_turbulence.md",
"Internal wave" => "generated/internal_wave.md",
"Convecting plankton" => "generated/convecting_plankton.md",
"Ocean wind mixing and convection" => "generated/ocean_wind_mixing_and_convection.md",
"Langmuir turbulence" => "generated/langmuir_turbulence.md",
"Eady turbulence" => "generated/eady_turbulence.md",
"Kelvin-Helmholtz instability" => "generated/kelvin_helmholtz_instability.md",
"Shallow water Bickley jet" => "generated/shallow_water_Bickley_jet.md",
"Horizontal convection" => "generated/horizontal_convection.md"
]
model_setup_pages = [
"Overview" => "model_setup/overview.md",
"Architecture" => "model_setup/architecture.md",
"Number type" => "model_setup/number_type.md",
"Grid" => "model_setup/grids.md",
"Clock" => "model_setup/clock.md",
"Coriolis (rotation)" => "model_setup/coriolis.md",
"Tracers" => "model_setup/tracers.md",
"Buoyancy models and equation of state" => "model_setup/buoyancy_and_equation_of_state.md",
"Boundary conditions" => "model_setup/boundary_conditions.md",
"Forcing functions" => "model_setup/forcing_functions.md",
"Background fields" => "model_setup/background_fields.md",
"Turbulent diffusivity closures and LES models" => "model_setup/turbulent_diffusivity_closures_and_les_models.md",
"Lagrangian particles" => "model_setup/lagrangian_particles.md",
"Diagnostics" => "model_setup/diagnostics.md",
"Output writers" => "model_setup/output_writers.md",
"Checkpointing" => "model_setup/checkpointing.md",
"Setting initial conditions" => "model_setup/setting_initial_conditions.md"
]
physics_pages = [
"Coordinate system and notation" => "physics/notation.md",
"Boussinesq approximation" => "physics/boussinesq.md",
"`NonhydrostaticModel`" => [
"Nonhydrostatic model" => "physics/nonhydrostatic_model.md",
],
"`HydrostaticFreeSurfaceModel`" => [
"Hydrostatic model with a free surface" => "physics/hydrostatic_free_surface_model.md"
],
"`ShallowWaterModel`" => [
"Shallow water model" => "physics/shallow_water_model.md"
],
"Buoyancy models and equations of state" => "physics/buoyancy_and_equations_of_state.md",
"Coriolis forces" => "physics/coriolis_forces.md",
"Turbulence closures" => "physics/turbulence_closures.md",
"Surface gravity waves and the Craik-Leibovich approximation" => "physics/surface_gravity_waves.md"
]
numerical_pages = [
"Finite volume method" => "numerical_implementation/finite_volume.md",
"Spatial operators" => "numerical_implementation/spatial_operators.md",
"Pressure decomposition" => "numerical_implementation/pressure_decomposition.md",
"Time stepping" => "numerical_implementation/time_stepping.md",
"Boundary conditions" => "numerical_implementation/boundary_conditions.md",
"Poisson solvers" => "numerical_implementation/poisson_solvers.md",
"Large eddy simulation" => "numerical_implementation/large_eddy_simulation.md"
]
appendix_pages = [
"Staggered grid" => "appendix/staggered_grid.md",
"Fractional step method" => "appendix/fractional_step.md",
"Convergence tests" => "appendix/convergence_tests.md",
"Performance benchmarks" => "appendix/benchmarks.md",
"Library" => "appendix/library.md",
"Function index" => "appendix/function_index.md",
]
pages = [
"Home" => "index.md",
"Installation instructions" => "installation_instructions.md",
"Using GPUs" => "using_gpus.md",
"Examples" => example_pages,
"Physics" => physics_pages,
"Numerical implementation" => numerical_pages,
"Model setup" => model_setup_pages,
"Simulation tips" => "simulation_tips.md",
"Contributor's guide" => "contributing.md",
"Gallery" => "gallery.md",
"References" => "references.md",
"Appendix" => appendix_pages,
]
#####
##### Build and deploy docs
#####
format = Documenter.HTML(
collapselevel = 1,
prettyurls = get(ENV, "CI", nothing) == "true",
canonical = "https://clima.github.io/OceananigansDocumentation/stable/",
mathengine = MathJax3()
)
makedocs(bib,
sitename = "Oceananigans.jl",
authors = "Ali Ramadhan, Gregory Wagner, John Marshall, Jean-Michel Campin, Chris Hill",
format = format,
pages = pages,
modules = [Oceananigans],
doctest = true,
strict = true,
clean = true,
checkdocs = :none # Should fix our docstring so we can use checkdocs=:exports with strict=true.
)
deploydocs(
repo = "github.com/CliMA/OceananigansDocumentation.git",
versions = ["stable" => "v^", "v#.#.#", "dev" => "dev"],
forcepush = true,
push_preview = true,
devbranch = "main"
)
@info "Cleaning up temporary .jld2 and .nc files created by doctests..."
for file in vcat(glob("docs/*.jld2"), glob("docs/*.nc"))
rm(file)
end