Skip to content

Commit

Permalink
Demonstrate NS formulation with viscosity term
Browse files Browse the repository at this point in the history
  • Loading branch information
lukem12345 authored Dec 17, 2024
1 parent fc44257 commit 37240c3
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions docs/src/faq/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,40 @@ Plotting in DECAPODES is commonly done with the [Makie](https://github.com/Makie
- For [3D visualization](../ice_dynamics/ice_dynamics.md#2-manifold-in-3d)


## 5. How to add artificial diffusion for 0- or 1-forms to improve stability?
## 5. How to add artificial diffusion for 0- or 1-forms?

Without viscosity - i.e. when ``\mu = 0`` - the incompressible (inviscid) Navier-Stokes equations can be formulated like so:

```julia
eq11_inviscid_poisson = @decapode begin
d𝐮::DualForm2
𝐮::DualForm1
ψ::Form0

ψ == Δ⁻¹((d𝐮))
𝐮 == (d(ψ))

∂ₜ(d𝐮) == (-1) * (♭♯, ₁, d̃₁)(ᵈᵖ₁₀(𝐮, (d𝐮)))
end
```

Adding a viscosity term can be accomplished by simply added the appropriate term, and declaring the ``\mu`` constant:

```julia
eq11_viscid_poisson = @decapode begin
d𝐮::DualForm2
𝐮::DualForm1
ψ::Form0
μ::Constant

ψ == Δ⁻¹((d𝐮))
𝐮 == (d(ψ))

∂ₜ(d𝐮) == μ * (, d, , d)(d𝐮) + (-1) * (♭♯, ₁, d̃₁)(ᵈᵖ₁₀(𝐮, (d𝐮)))
end
```

More demonstrations on how to iterate between formulations of the same physics (the incompressible Navier-Stokes equations) is available in further detail on the [Vortices](../navier_stokes/ns.md) docs page and in the script available there.

## 6. How to use a Laplacian solver / multigrid?

Expand All @@ -43,4 +76,4 @@ To use multigrid methods in the Laplacian solver, you need to create a `PrimalGe

A common workflow is to iterate through multiple different models as is done in the [Vorticity Model page](../navier_stokes/ns.md). A formulation is first done with a direct vorticity formulation but a quick run finds that this setup is unstable. A second formulation introduces a Laplacian solve which produces nice results.

Similar workflows may retain the same model but may iterate on the types of meshes/initial conditions used. An excellent example of this is found in the [Glacial Flow page](../ice_dynamics/ice_dynamics.md) where the model is first run in a [1D](../ice_dynamics/ice_dynamics.md#Define-a-mesh) setting and then quickly promoted to both [2D](../ice_dynamics/ice_dynamics.md#Define-our-mesh) and [3D](../ice_dynamics/ice_dynamics.md#2-Manifold-in-3D). This allows either running some dynamics in a more complicated setting, as just discussed, or allows for simplifying higher dimensional models by some sort of symmetry.
Similar workflows may retain the same model but may iterate on the types of meshes/initial conditions used. An excellent example of this is found in the [Glacial Flow page](../ice_dynamics/ice_dynamics.md) where the model is first run in a [1D](../ice_dynamics/ice_dynamics.md#Define-a-mesh) setting and then quickly promoted to both [2D](../ice_dynamics/ice_dynamics.md#Define-our-mesh) and [3D](../ice_dynamics/ice_dynamics.md#2-Manifold-in-3D). This allows either running some dynamics in a more complicated setting, as just discussed, or allows for simplifying higher dimensional models by some sort of symmetry.

0 comments on commit 37240c3

Please sign in to comment.