Skip to content

Commit

Permalink
Merge pull request #168 from FourierFlows/ncc/increase-singlelayerqg-…
Browse files Browse the repository at this point in the history
…coverage

Increases coverage for SingleLayerQG
  • Loading branch information
navidcy authored Dec 18, 2020
2 parents f547423 + 17be845 commit c3d081f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
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

0 comments on commit c3d081f

Please sign in to comment.