ClimaAtmos/ClimaLand migration toward CC v1
- Dominant language
- Julia
- Stars
- 117
- Forks
- 19
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 38
Description
This list is to help with the ClimaAtmos.jl and ClimaLand.jl migration toward CC v1, covering
CC `main` since the finite-difference boundary-condition rework and the CG/DG discretization
work. Caveat lector: It was in part produced by Claude and may not be complete or entirely
correct.
## Renames
- `LeftBiasedC2F`/`LeftBiasedF2C` → `BottomBiasedC2F`/`BottomBiasedF2C`;
`RightBiasedC2F`/`RightBiasedF2C` → `TopBiasedC2F`/`TopBiasedF2C`.
- `WeakDivergence()`/`WeakGradient()`/`WeakCurl()` →
`Divergence{WeakForm}()`/`Gradient{WeakForm}()`/`Curl{WeakForm}()`.
- `add_numerical_flux_internal!`/`add_lifting_flux_internal!`/
`add_ldg_laplacian_flux_internal!` → the `_interior!` spellings.
- `discontinuous = true` grid/space keyword → `discretization = Grids.DG()`.
- `recursive_bottom_eltype` → `ClimaCore.Utilities.recursive_bottom_eltype`
(the `RecursiveArrayTools`/SciML compatibility layer is gone).
## Boundary conditions
- Keep `SetValue`, `SetGradient`, `SetDivergence` and `SetCurl` wherever the
boundary prescribes a value, gradient, divergence or curl — their semantics
are unchanged.
- Replace `FirstOrderOneSided()` with `Extrapolate()` and
`ThirdOrderOneSided()` with `Extrapolate(1)` on the advection operators
(`UpwindBiasedProductC2F`, `Upwind3rdOrderBiasedProductC2F`,
`LinVanLeerC2F`, `FCTBorisBook`, `FCTZalesak`, `TVDLimitedFluxC2F`).
Re-baseline regression tests involving these operators:
`Extrapolate` pads the interior stencil's ghost points rather than
substituting a fixed one-sided reconstruction, so the two faces nearest each
boundary change value.
- Use `Operators.Outflow(; order)` **only** where the boundary physically
models outflow — e.g., precipitation falling out through the model bottom.
It is a physically named alias for `Extrapolate{order}` on the advection
operators; everywhere else the extrapolation is a numerical ghost-point
closure and stays as `Extrapolate`.
- Leave `Extrapolate` unchanged on `InterpolateC2F`, `WeightedInterpolateC2F`
and `DivergenceF2C`: on the interpolations, it copies the nearest interior input,
on `DivergenceF2C`, it replicates the operator's output.
- Replace `Extrapolate` on `GradientF2C` with `SetGradient` (`GradientF2C` now
accepts only `SetValue` and `SetGradient`).
- Subtype custom boundary conditions from `Operators.VerticalBoundaryCondition`
(finite-difference operators) or `Operators.HorizontalBoundaryCondition` (DG
numerical-flux operators) instead of `AbstractBoundaryCondition` directly.
- `SetValue` is no longer accepted on `GradientC2F`, `DivergenceC2F`,
`CurlC2F` or `UpwindBiasedProductC2F` (which now take `SetGradient`,
`SetDivergence`, `SetCurl` and `Extrapolate` respectively). Where a
Dirichlet value is what is wanted on one of those four, use
`Operators.gradient_c2f_dirichlet`, `divergence_c2f_dirichlet`,
`curl_c2f_dirichlet` or `upwind_biased_product_c2f_dirichlet`.
## Operator call sites
- Drop any code reading the `u³` component of a `CurlC2F` result (the result
type is now `Contravariant12Vector`).
- Rewrite calls to `FCTZalesak(A, Φ, Φᵗᵈ)` as `FCTZalesak(A, tuple.(Φ, Φᵗᵈ))`.
- Pass `TVDLimitedFluxC2F`'s velocity argument as contravariant-3 data: a
`Contravariant3Vector` field or
`Geometry.contravariant3.(u, Fields.local_geometry_field(face_space))`.
- Rewrite any use of `AdvectionC2C`, `AdvectionF2F`, `FluxCorrectionC2C`,
`FluxCorrectionF2F`, `UpwindBiasedGradient`, `LeftBiased3rdOrderC2F`/`F2C`,
`RightBiased3rdOrderC2F`/`F2C`, or `Operators.columnwise!` in terms of the
new primitives (exact replacement stencils in
`test/Operators/finitedifference/unit_column.jl`).
- Check any `vec(::Field)` call: it now returns a vector over the field's
values, so its eltype is the field's rather than the backing array's.
- Remove any `Operators.use_fd_shmem() = true` override (the code path it
gated is gone).
## Adopt the new Laplacian atoms
Rewrite ∇⁴ hyperdiffusion tendencies on the shared CG/DG atoms:
```julia
Operators.scalar_laplacian!(ᶜχ, ᶜh_tot)
ᶜχuₕ .= Operators.vector_laplacian(ᶜuₕ)
Spaces.weighted_dss!(ᶜχ => buf.χ, ᶜχuₕ => buf.χuₕ)
Yₜ.c.ρe .-= κ₄ .* Operators.scalar_laplacian(ᶜχ; weight = ᶜρ)
Yₜ.c.uₕ .-= κ₄ .* Operators.vector_laplacian(ᶜχuₕ; divergence_factor = divergence_damping_factor)
```
`vector_laplacian` is not yet implemented for DG.
## Adopt the CG↔DG tendency switch
For any tendency that should run on both discretizations, build a completion
once and call it after the element-local weak form:
```julia
completion = Operators.tendency_completion(dydt; numflux) # once, at model setup
@. dydt = -wdiv(physical_flux(y, params))
Operators.complete_tendency!(completion, dydt, y, params)
```
Pass `boundary_numflux` if domain-boundary faces need a nonzero flux (default
is a zero-flux closure). Use a single `Field` with a composite eltype (not a
`FieldVector`) for a DG tendency.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.