Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vertical advection granule with PPM #605

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class VerticalAdvectionType(Enum):

#: no vertical advection
NO_ADVECTION = auto()
#: 1st order upwind
UPWIND_1ST_ORDER = auto()
#: 3rd order PPM
PPM_3RD_ORDER = auto()


class VerticalAdvectionLimiter(Enum):
Expand All @@ -84,6 +88,8 @@ class VerticalAdvectionLimiter(Enum):

#: no vertical limiter
NO_LIMITER = auto()
#: semi-monotonic vertical limiter
SEMI_MONOTONIC = auto()


@dataclasses.dataclass(frozen=True)
Expand Down Expand Up @@ -393,7 +399,7 @@ def convert_config_to_horizontal_vertical_advection(

match config.horizontal_advection_type:
case HorizontalAdvectionType.NO_ADVECTION:
horizontal_advection = advection_horizontal.NoAdvection(grid=grid)
horizontal_advection = advection_horizontal.NoAdvection(grid=grid, backend=backend)
case HorizontalAdvectionType.LINEAR_2ND_ORDER:
tracer_flux = advection_horizontal.SecondOrderMiura(
grid=grid,
Expand All @@ -417,13 +423,32 @@ def convert_config_to_horizontal_vertical_advection(

match config.vertical_advection_limiter:
case VerticalAdvectionLimiter.NO_LIMITER:
...
vertical_limiter = advection_vertical.NoLimiter(grid=grid, backend=backend)
case VerticalAdvectionLimiter.SEMI_MONOTONIC:
vertical_limiter = advection_vertical.SemiMonotonicLimiter(grid=grid, backend=backend)
case _:
raise NotImplementedError(f"Unknown vertical advection limiter.")

match config.vertical_advection_type:
case VerticalAdvectionType.NO_ADVECTION:
vertical_advection = advection_vertical.NoAdvection(grid=grid, backend=backend)
case VerticalAdvectionType.UPWIND_1ST_ORDER:
boundary_conditions = advection_vertical.NoFluxCondition(grid=grid, backend=backend)
vertical_advection = advection_vertical.FirstOrderUpwind(
boundary_conditions=boundary_conditions,
grid=grid,
metric_state=metric_state,
backend=backend,
)
case VerticalAdvectionType.PPM_3RD_ORDER:
boundary_conditions = advection_vertical.NoFluxCondition(grid=grid, backend=backend)
vertical_advection = advection_vertical.PiecewiseParabolicMethod(
boundary_conditions=boundary_conditions,
vertical_limiter=vertical_limiter,
grid=grid,
metric_state=metric_state,
backend=backend,
)
case _:
raise NotImplementedError(f"Unknown vertical advection type.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,6 @@ class AdvectionMetricState:

#: metrical modification factor for vertical part of divergence at full levels (KDim)
deepatmo_divzu: fa.KField[ta.wpfloat]

#: vertical grid spacing at full levels
ddqz_z_full: fa.CellKField[ta.wpfloat]
Loading
Loading