CliMA / CliMA/ClimaCore.jl

`Upwind3rdOrderBiasedProductC2F` operator should work with a tuple of scalars

Open
#724 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Julia
Stars
117
Forks
19
Avg merge
3d 4h
Merged PRs (30d)
41

Description

**Is your feature request related to a problem? Please describe.**
At the moment, our `Upwind3rdOrderBiasedProductC2F` operator advects a simple scalar field `a` by a given velocity direction. There are use cases where it is convenient to advect multiple tracers at once. Hence, we should allow our `Upwind3rdOrderBiasedProductC2F` operator to use a tuple of scalars as an argument.

I discovered this necessity while working on #702 . I could work around this for now, but it created code duplication (copy/paste for each tracer flux definition) and therefore, it increases the maintenance burden.

**Describe the solution you'd like**
In the operator, we define the scalar as:
```
a = stencil_interior(RightBiased3rdOrderC2F(), loc, idx, hidx, arg)
```

and then

```
return Geometry.Contravariant3Vector(vᶠ * a)
```

This should be probably changed to:

```
return Geometry.Contravariant3Vector(vᶠ) ⊠ a
```

**Describe alternatives you've considered**
As I wrote above, this can be worked around for now but it would be nice to support and would simplify user code in the downstream packages that might want to use this operator (e.g., ClimaAtmos or Land)

Contributor guide

No contributing guide indexed for this repository

Research direction

Search for the Upwind3rdOrderBiasedProductC2F operator and inspect the stencil_interior call and returned Geometry.Contravariant3Vector expression shown in the issue. Verify the existing scalar behavior, then check how tuple-valued fields are represented and tested elsewhere in the repository. Done means the operator advects a tuple of scalars without breaking scalar inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
hpc
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.