Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
Switch to using CentralNumericalFluxFirstOrder for ShallowWaterModel
Browse files Browse the repository at this point in the history
This matches up numerical fluxes for the continuity equation in the
baroclinic and barotropic models

Fix `shallow_boundary_state!` numerical flux signatures.
  • Loading branch information
blallen committed Jul 21, 2020
1 parent 3f96096 commit 7a55938
Show file tree
Hide file tree
Showing 5 changed files with 799 additions and 179 deletions.
47 changes: 24 additions & 23 deletions src/Ocean/ShallowWater/ShallowWaterModel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ function init_state_conservative!(m::SWModel, state::Vars, aux::Vars, coords, t)
shallow_init_state!(m, m.problem, state, aux, coords, t)
end

function shallow_boundary_state! end
function boundary_state!(
nf,
m::SWModel,
Expand All @@ -283,8 +284,25 @@ function boundary_state!(
shallow_boundary_state!(nf, m, m.turbulence, q⁺, a⁺, n⁻, q⁻, a⁻, t)
end

function boundary_state!(
nf,
m::SWModel,
q⁺::Vars,
σ⁺::Vars,
α⁺::Vars,
n⁻,
q⁻::Vars,
σ⁻::Vars,
α⁻::Vars,
bctype,
t,
_...,
)
shallow_boundary_state!(nf, m, m.turbulence, q⁺, σ⁺, α⁺, n⁻, q⁻, σ⁻, α⁻, t)
end

@inline function shallow_boundary_state!(
::RusanovNumericalFlux,
::NumericalFluxFirstOrder,
m::SWModel,
::LinearDrag,
q⁺,
Expand All @@ -304,38 +322,21 @@ end
end

shallow_boundary_state!(
::CentralNumericalFluxGradient,
::NumericalFluxGradient,
m::SWModel,
::LinearDrag,
_...,
) = nothing

shallow_boundary_state!(
::CentralNumericalFluxSecondOrder,
::NumericalFluxSecondOrder,
m::SWModel,
::LinearDrag,
_...,
) = nothing

function boundary_state!(
nf,
m::SWModel,
q⁺::Vars,
σ⁺::Vars,
α⁺::Vars,
n⁻,
q⁻::Vars,
σ⁻::Vars,
α⁻::Vars,
bctype,
t,
_...,
)
shallow_boundary_state!(nf, m, m.turbulence, q⁺, σ⁺, α⁺, n⁻, q⁻, σ⁻, α⁻, t)
end

@inline function shallow_boundary_state!(
::RusanovNumericalFlux,
::NumericalFluxFirstOrder,
m::SWModel,
::ConstantViscosity,
q⁺,
Expand All @@ -352,7 +353,7 @@ end
end

@inline function shallow_boundary_state!(
::CentralNumericalFluxGradient,
::NumericalFluxGradient,
m::SWModel,
::ConstantViscosity,
q⁺,
Expand All @@ -369,7 +370,7 @@ end
end

@inline function shallow_boundary_state!(
::CentralNumericalFluxSecondOrder,
::NumericalFluxSecondOrder,
m::SWModel,
::ConstantViscosity,
q⁺,
Expand Down
2 changes: 1 addition & 1 deletion test/Ocean/ShallowWater/2D_hydrostatic_spindown.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function run_hydrostatic_spindown(; refDat = ())
dg_2D = DGModel(
model_2D,
grid_2D,
RusanovNumericalFlux(),
CentralNumericalFluxFirstOrder(),
CentralNumericalFluxSecondOrder(),
CentralNumericalFluxGradient(),
)
Expand Down
7 changes: 3 additions & 4 deletions test/Ocean/SplitExplicit/hydrostatic_spindown.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function run_hydrostatic_spindown(;
dg_2D = DGModel(
model_2D,
grid_2D,
RusanovNumericalFlux(),
CentralNumericalFluxFirstOrder(),
CentralNumericalFluxSecondOrder(),
CentralNumericalFluxGradient(),
)
Expand Down Expand Up @@ -315,9 +315,9 @@ function make_callbacks(
cbcs_dg = ClimateMachine.StateCheck.sccreate(
[
(Q_slow, "3D state"),
# (dg_slow.state_auxiliary, "3D aux"),
(dg_slow.state_auxiliary, "3D aux"),
(Q_fast, "2D state"),
# (dg_fast.state_auxiliary, "2D aux"),
(dg_fast.state_auxiliary, "2D aux"),
],
nout;
prec = 12,
Expand Down Expand Up @@ -357,7 +357,6 @@ const cᶻ = 0
include("../refvals/hydrostatic_spindown_refvals.jl")

@testset "Multi-rate" begin
# run_hydrostatic_spindown(coupling = PartiallyCoupled())

@testset "Fully Coupled" begin
@testset "Δt = 30 mins" begin
Expand Down
24 changes: 12 additions & 12 deletions test/Ocean/refvals/2D_hydrostatic_spindown_refvals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ explicit = [
[
"2D state",
,
-8.52722863677453757347e-01,
8.52828186384614328475e-01,
-2.32169838909612754587e-16,
6.03454974395413956678e-01,
-8.52722969951589915283e-01,
8.52846676313531282254e-01,
-2.49578135935735214742e-16,
6.03454239990563690021e-01,
],
[
"2D state",
"U[1]",
-3.15402615071803076319e+01,
3.15402615071801157853e+01,
6.16398876385204608714e-15,
2.24269405191038053715e+01,
-3.15431401945821825450e+01,
3.15431401945818628008e+01,
6.11504145930918957291e-15,
2.24273815174625497093e+01,
],
[
"2D state",
"U[2]",
-4.60204855830197230363e-13,
5.29714995818968166418e-13,
1.33362479920413591115e-14,
1.36912259776863805290e-13,
-7.62224398365580242501e-13,
9.72156930292624284356e-13,
1.39269607441935025982e-14,
1.95606703846656748360e-13,
],
]

Expand Down
Loading

0 comments on commit 7a55938

Please sign in to comment.