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

Increases coverage for SingleLayerQG #168

Merged
merged 1 commit into from
Dec 18, 2020
Merged
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
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ for dev in devices
@test test_1layerqg_deterministicforcing_enstrophybudget(dev)
@test test_1layerqg_stochasticforcing_enstrophybudget(dev)
@test SingleLayerQG.nothingfunction() == nothing
@test_throws ErrorException("not implemented for finite deformation radius") test_1layerqg_energy_dissipation(dev; deformation_radius=2.23)
@test_throws ErrorException("not implemented for finite deformation radius") test_1layerqg_enstrophy_dissipation(dev; deformation_radius=2.23)
@test_throws ErrorException("not implemented for finite deformation radius") test_1layerqg_energy_work(dev; deformation_radius=2.23)
@test_throws ErrorException("not implemented for finite deformation radius") test_1layerqg_enstrophy_work(dev; deformation_radius=2.23)
@test_throws ErrorException("not implemented for finite deformation radius") test_1layerqg_energy_drag(dev; deformation_radius=2.23)
@test_throws ErrorException("not implemented for finite deformation radius") test_1layerqg_enstrophy_drag(dev; deformation_radius=2.23)
end

@testset "BarotropicQGQL" begin
Expand Down
38 changes: 37 additions & 1 deletion test/test_singlelayerqg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ function test_1layerqg_energyenstrophy_BarotropicQG(dev::Device=CPU())
energyq₀ = SingleLayerQG.energy(prob)
enstrophyq₀ = SingleLayerQG.enstrophy(prob)

return isapprox(energyq₀, energy_calc, rtol=rtol_singlelayerqg) && isapprox(enstrophyq₀, enstrophy_calc, rtol=rtol_singlelayerqg) &&
return isapprox(energyq₀, energy_calc, rtol=rtol_singlelayerqg) && isapprox(enstrophyq₀, enstrophy_calc, rtol=rtol_singlelayerqg) && SingleLayerQG.potential_energy(prob)==0 &&
SingleLayerQG.addforcing!(prob.timestepper.N, sol, clock.t, clock, vars, params, grid) == nothing
end

Expand Down Expand Up @@ -406,3 +406,39 @@ function test_streamfunctionfrompv(dev; deformation_radius=1.23)

return (prob_barotropicQG.vars.ψ ≈ ψ && prob_equivalentbarotropicQG.vars.ψ ≈ ψ)
end

function test_1layerqg_energy_dissipation(dev; deformation_radius=2.23)
prob = SingleLayerQG.Problem(dev; nx=16, deformation_radius=deformation_radius)
SingleLayerQG.energy_dissipation(prob)
return nothing
end

function test_1layerqg_enstrophy_dissipation(dev; deformation_radius=2.23)
prob = SingleLayerQG.Problem(dev; nx=16, deformation_radius=deformation_radius)
SingleLayerQG.enstrophy_dissipation(prob)
return nothing
end

function test_1layerqg_energy_work(dev; deformation_radius=2.23)
prob = SingleLayerQG.Problem(dev; nx=16, deformation_radius=deformation_radius)
SingleLayerQG.energy_work(prob)
return nothing
end

function test_1layerqg_enstrophy_work(dev; deformation_radius=2.23)
prob = SingleLayerQG.Problem(dev; nx=16, deformation_radius=deformation_radius)
SingleLayerQG.enstrophy_work(prob)
return nothing
end

function test_1layerqg_energy_drag(dev; deformation_radius=2.23)
prob = SingleLayerQG.Problem(dev; nx=16, deformation_radius=deformation_radius)
SingleLayerQG.energy_drag(prob)
return nothing
end

function test_1layerqg_enstrophy_drag(dev; deformation_radius=2.23)
prob = SingleLayerQG.Problem(dev; nx=16, deformation_radius=deformation_radius)
SingleLayerQG.enstrophy_drag(prob)
return nothing
end