-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
358045a
commit 260e3f3
Showing
4 changed files
with
50 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cn ← { | ||
_p ⇐ {(-´𝔽¨)⋈(+´𝔽¨)⟜⌽} | ||
Cis ⇐ (⍉•math.Cos≍•math.Sin)¯π×↕⊸÷ | ||
} | ||
FFT ← {𝕊⁼: ⋈⟜-´˘{≠÷˜·𝔽𝔾∘𝔽}𝕊𝕩; (1=≠)◶⟨(+∾-)⟜(⊢×cn._p˘cn.Cis∘≠)´(𝕊¨⊢⊔˜2|⊒˜), ⊢⟩𝕩} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- eval: (face-remap-add-relative 'default '(:family "BQN386 Unicode" :height 180)); -*- | ||
#+TITLE: Navier-Stokes simulator (WIP) | ||
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="assets/style.css"/> | ||
#+HTML_HEAD: <link rel="icon" href="assets/favicon.ico" type="image/x-icon"> | ||
#+HTML_HEAD: <style> | ||
#+HTML_HEAD: mjx-container[jax="CHTML"] { | ||
#+HTML_HEAD: overflow-x: auto !important; | ||
#+HTML_HEAD: } | ||
#+HTML_HEAD: </style> | ||
|
||
** Foreword | ||
|
||
We want to solve the following [[https://en.wikipedia.org/wiki/Derivation_of_the_Navier%E2%80%93Stokes_equations][system]] of partial differential equations | ||
in two dimensions for an incompressible fluid, imposing periodic boundary conditions: | ||
|
||
\begin{equation*} | ||
\begin{aligned} | ||
\nabla \cdot \mathbf{q} &= 0,\\ | ||
\frac{\partial \mathbf{q}}{\partial t} | ||
+ \nabla \cdot (\mathbf{q} \otimes \mathbf{q}) &= | ||
-\nabla p + \frac{1}{\text{Re}} \nabla^2 \mathbf{q}, | ||
\end{aligned} | ||
\end{equation*} | ||
|
||
** Simulator | ||
|
||
The numerical solution will be obtained using this zero-dependency BQN code: | ||
|
||
#+begin_src bqn :tangle bqn/ns.bqn :exports code | ||
cn ← { | ||
_p ⇐ {(-´𝔽¨)⋈(+´𝔽¨)⟜⌽} | ||
Cis ⇐ (⍉•math.Cos≍•math.Sin)¯π×↕⊸÷ | ||
} | ||
FFT ← {𝕊⁼: ⋈⟜-´˘{≠÷˜·𝔽𝔾∘𝔽}𝕊𝕩; (1=≠)◶⟨(+∾-)⟜(⊢×cn._p˘cn.Cis∘≠)´(𝕊¨⊢⊔˜2|⊒˜), ⊢⟩𝕩} | ||
#+end_src | ||
|
||
#+RESULTS: | ||
: (function block) | ||
|
||
#+BEGIN_EXPORT html | ||
<div style="text-align: center; font-size: 2em; padding: 20px 0;"> | ||
<a href="https://panadestein.github.io/blog/" style="text-decoration: none;">⊑∘∞</a> | ||
</div> | ||
#+END_EXPORT |