CliMA / ClimateMachine.jl

Climate Machine: an Earth System Model that automatically learns from data
https://clima.github.io/ClimateMachine.jl/latest/
Other
454 stars 78 forks source link

In DG, what dz should be used for determining a flux based on a dirichlet BC? #2058

Open kmdeck opened 3 years ago

kmdeck commented 3 years ago

Description

In FV, a boundary flux can be calculated from a state boundary condition using a finite difference estimate of the derivative - e.g. F_bc = [v_bc - v-]/dz, where the flux is z^ dot grad(v), v- is the first point (in the middle of the first layer), and dz = layer width/2. Although this F_bc depends on the resolution, numerical tests show that as dz->0, this converges (and it also agrees with the simulation carried out using the dirichlet v = v_bc condition).

In DG, it is less clear what to use. the first point is at the surface/at the same location as the boundary. However, simulations indicate that the same exact approach seems to work (defining dz in the same way). It may be because for small enough dz, v-(z=boundary-dz) ~ v-(boundary) + O(dz) can be approximated by dropping the O(dz) term. Or, it may almost be like we are pretending like the actual boundary is dz above the surface, and then the resulting flux at the surface is given by the same formula.

This affects PR 1981, runoff boundary conditions. Because these two approaches both seem to work (FV and DG), we are merging the PR to keep making progress, but our intent is to revisit the DG option and make sure it is doing the right thing in all cases. For the most part, we expect the land model to use FV.

@Zhengyu-Huang @jakebolewski @kmdeck

kmdeck commented 3 years ago

oh, at the time we come back to this, we may also want to compute it from the grid as well (since it will change if we stretch the grid)