CliMA / TurbulenceConvection.jl

A turbulence-convection single column model cloud parameterization.
https://clima.github.io/TurbulenceConvection.jl/dev/
Apache License 2.0
33 stars 5 forks source link

Implement implicit solvers using OrdinaryDiffEq.jl #493

Open charleskawczynski opened 3 years ago

charleskawczynski commented 3 years ago

Over the course of our development, we've moved to fully explicit time stepping in order to

The relavent PRs (and their slow downs, pending) are:

We should now effectively revert this PRs, by using OrdinaryDiffEq.jl and treating specific terms (or all terms) implicitly in time.

charleskawczynski commented 2 years ago

When first pulling apart the implicit solver, I wrote this brief summary:

    N_a terms = 1 (diffusion)
    N_diagonal terms = 6 (unsteady+upwind_advection+2diffusion+entr_detr+dissipation)
    N_c terms = 2 (diffusion+upwind_advection)
    ∂_t ρa*tke                              ✓ unsteady
      + ∂_z(ρaw*tke) =                      ✓ advection
      + ρaK*(∂²_z(u)+∂²_z(v)+∂²_z(w̄))
      + ρawΣᵢ(εᵢ(wⱼ-w₀)²-δ₀*tke)            ✓ entr_detr
      + ∂_z(ρa₀K ∂_z(tke))                  ✓ diffusion
      + ρa₀*w̅₀b̅₀
      - a₀(u⋅∇p)
      + ρa₀D                                ✓ dissipation
Zhengyu-Huang commented 2 years ago

The advection and diffusion term can be approximated as

∂_z(ρaw*tke)  = ∂_z(ρaw^{n}*tke^{n+1}) 
∂_z(ρa₀K ∂_z(tke))  = ∂_z(ρa₀K^{n}∂_z(tke)^{n+1})      

superscripts indicate time, then this will give you a tridiagonal matrix about tke^{n+1}

The source term is a diagonal matrix ?

charleskawczynski commented 2 years ago

Some useful lines:

cc @Zhengyu-Huang

yairchn commented 2 years ago

The advection and diffusion term can be approximated as

∂_z(ρaw*tke)  = ∂_z(ρaw^{n}*tke^{n+1}) 
∂_z(ρa₀K ∂_z(tke))  = ∂_z(ρa₀K^{n}∂_z(tke)^{n+1})      

This is indeed what we did in SCAMPy, but be mindful that K is a. function of tke so that you are mixing time steps (it worked reasonably well). The same is true for the buoyancy gradient and shear sources where K is used