149 lines
2.7 KiB
Typst
149 lines
2.7 KiB
Typst
#import "@preview/diatypst:0.2.0": *
|
|
#import "@preview/based:0.2.0": base64
|
|
|
|
#set text(font: "Cantarell")
|
|
// #set heading(numbering: (..nums)=>"")
|
|
|
|
#show: slides.with(
|
|
title: "N-Body project ",
|
|
subtitle: "Computational Astrophysics, HS24",
|
|
date: "04.02.2024",
|
|
authors: ("Rémy Moll"),
|
|
toc: false,
|
|
// layout: "large",
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// Helpers for code block displaying
|
|
|
|
#let cell_matcher(cell, cell_tag) = {
|
|
if cell.cell_type != "code" {
|
|
return false
|
|
}
|
|
let metadata = cell.metadata
|
|
if metadata.keys().contains("tags") == false {
|
|
return false
|
|
}
|
|
|
|
return cell.metadata.tags.contains(cell_tag)
|
|
}
|
|
|
|
#let code_cell(fcontent, cell_tag) = {
|
|
let cells = fcontent.cells
|
|
let matching_cell = cells.find(x => cell_matcher(x, cell_tag))
|
|
|
|
let cell_content = matching_cell.source
|
|
// format the cell content
|
|
let single_line = cell_content.fold("", (acc, x) => acc + x)
|
|
|
|
text(
|
|
raw(
|
|
single_line,
|
|
lang: "python",
|
|
block: true
|
|
),
|
|
size: 0.8em
|
|
)
|
|
}
|
|
|
|
|
|
|
|
#let image_cell(fcontent, cell_tag) = {
|
|
let cells = fcontent.cells
|
|
let matching_cell = cells.find(x => cell_matcher(x, cell_tag))
|
|
|
|
let outputs = matching_cell.outputs
|
|
for output in outputs {
|
|
let image_data = output.at("data", default: (:)).at("image/png", default: none)
|
|
if image_data != none {
|
|
align(
|
|
center,
|
|
image.decode(
|
|
base64.decode(image_data),
|
|
// format: "png",
|
|
height: 70%
|
|
)
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// Where is the code?
|
|
#let t1 = json("../task1.ipynb")
|
|
#let t2 = json("../task2-particle-mesh.ipynb")
|
|
|
|
|
|
|
|
// Content
|
|
= N-body forces and analytical solutions
|
|
|
|
== Objective
|
|
Implement naive N-body force computation and get an intuition of the challenges:
|
|
- accuracy
|
|
- computation time
|
|
- stability
|
|
|
|
$=>$ still useful to compute basic quantities of the system, but too limited for large systems or the dynamical evolution of the system
|
|
|
|
|
|
== Overview - the system
|
|
Get a feel for the particles and their distribution. [Code at @task1:plot_particle_distribution[]]
|
|
#image_cell(t1, "plot_particle_distribution")
|
|
|
|
#code_cell(t1, "plotting")
|
|
|
|
== Inspecting the data
|
|
#code_cell(t2, "plotting")
|
|
|
|
#image_cell(t2, "plotting")
|
|
|
|
|
|
== Density
|
|
Some images about the density
|
|
|
|
== N Body and variations
|
|
sdsd
|
|
|
|
== Relaxation
|
|
sd
|
|
|
|
|
|
= Default Styling in diatypst
|
|
|
|
== Terms, Code, Lists
|
|
|
|
_diatypst_ defines some default styling for elements, e.g Terms created with ```typc / Term: Definition``` will look like this
|
|
|
|
/ *Term*: Definition
|
|
|
|
A code block like this
|
|
|
|
```python
|
|
// Example Code
|
|
print("Hello World!")
|
|
```
|
|
|
|
Lists have their marker respect the `title-color`
|
|
|
|
#columns(2)[
|
|
- A
|
|
- AAA
|
|
- B
|
|
#colbreak()
|
|
1. AAA
|
|
2. BBB
|
|
3. CCC
|
|
]
|
|
|
|
|
|
|
|
|
|
= Appendix - Code
|
|
== Code
|
|
<task1:plot_particle_distribution>
|
|
#code_cell(t1, "plot_particle_distribution")
|