-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci-skip] First commit of the branch to add a refined mesh test for t…
…he Rosenbrock shallow water test case with the Williamson5 test configuration. This includes the Williamson 5 initial conditions and driver, as well as a change to the Rosenbrock solver to allow for bottom topography
- Loading branch information
1 parent
6603998
commit 913a1bc
Showing
3 changed files
with
157 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Initial conditions for the zonal flow over an isolated mountain ("Williamson 5") | ||
# shallow water test case. Involves a balanced geostrophic flow with a Gaussian | ||
# hill in the northern hemisphere. | ||
# reference: | ||
# D.L. Williamson, J.B. Drake, J.J. Hack, R. Jakob, P.N. Swarztrauber, | ||
# J. Comput. Phys. 102 (1992) 211–224. | ||
|
||
const Rₑ = 6371220.0 | ||
const gₑ = 9.80616 | ||
const U₀ = 20.0 | ||
const Ωₑ = 7.292e-5 | ||
const H₀ = 5960.0 | ||
const α₀ = 0.0 | ||
|
||
function uθ(θϕr) | ||
θ,ϕ,r = θϕr | ||
U₀*(cos(ϕ)*cos(α₀) + cos(θ)*sin(ϕ)*sin(α₀)) | ||
end | ||
|
||
function uϕ(θϕr) | ||
θ,ϕ,r = θϕr | ||
-U₀*sin(θ)*sin(α₀); | ||
end | ||
|
||
# Initial velocity | ||
function u₀(xyz) | ||
θϕr = xyz2θϕr(xyz) | ||
u = uθ(θϕr) | ||
v = uϕ(θϕr) | ||
spherical_to_cartesian_matrix(θϕr)⋅VectorValue(u,v,0) | ||
end | ||
|
||
# Topography | ||
function topography(xyz) | ||
θϕr = xyz2θϕr(xyz) | ||
θc = -π/2.0 | ||
ϕc = π/6.0 | ||
bo = 2000.0 | ||
rad = π/9.0 | ||
rsq = (ϕ - ϕc)*(ϕ - ϕc) + (θ - θc)*(θ - θc) | ||
r = sqrt(rsq) | ||
b = 0.0 | ||
if(r < rad) | ||
b = bo*(1.0 - r/rad) | ||
end | ||
b | ||
end | ||
|
||
# Initial fluid depth | ||
function h₀(xyz) | ||
θϕr = xyz2θϕr(xyz) | ||
b = -cos(θ)*cos(ϕ)*sin(α₀) + sin(ϕ)*cos(α₀) | ||
bt = topography(xyz) | ||
H₀ - (Rₑ*Ωₑ*U₀ + 0.5*U₀*U₀)*b*b/gₑ - bt | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
module Williamson5ShallowWaterRosenbrock | ||
|
||
using PartitionedArrays | ||
using Test | ||
using FillArrays | ||
using Gridap | ||
using GridapPETSc | ||
using GridapGeosciences | ||
using GridapDistributed | ||
using GridapP4est | ||
|
||
include("Williamson5InitialConditions.jl") | ||
|
||
function petsc_gamg_options() | ||
""" | ||
-ksp_type gmres -ksp_rtol 1.0e-06 -ksp_atol 0.0 | ||
-ksp_monitor -pc_type gamg -pc_gamg_type agg | ||
-mg_levels_esteig_ksp_type gmres -mg_coarse_sub_pc_type lu | ||
-mg_coarse_sub_pc_factor_mat_ordering_type nd -pc_gamg_process_eq_limit 50 | ||
-pc_gamg_square_graph 9 pc_gamg_agg_nsmooths 1 | ||
""" | ||
end | ||
function petsc_mumps_options() | ||
""" | ||
-ksp_type preonly -ksp_error_if_not_converged true | ||
-pc_type lu -pc_factor_mat_solver_type mumps | ||
""" | ||
end | ||
|
||
order = 0 | ||
degree = 4 | ||
|
||
# magnitude of the descent direction of the implicit solve; | ||
# neutrally stable for 0.5, L-stable for 1+sqrt(2)/2 | ||
λ = 1.0 + 0.5*sqrt(2.0) | ||
|
||
dt = 480.0 | ||
nstep = Int(24*60^2*20/dt) # 20 days | ||
|
||
function main(distribute,parts) | ||
ranks = distribute(LinearIndices((prod(parts),))) | ||
|
||
# Change directory to the location of the script, where the mesh data files are located | ||
cd(@__DIR__) | ||
|
||
coarse_model, cell_panels, coarse_cell_wise_vertex_coordinates= | ||
parse_cubed_sphere_coarse_model("williamson-5-C12/connectivity-gridapgeo.txt","williamson-5-C12/geometry-gridapgeo.txt") | ||
|
||
num_uniform_refinements=0 | ||
|
||
GridapPETSc.with(args=split(petsc_mumps_options())) do | ||
model=CubedSphereDiscreteModel(ranks, | ||
coarse_model, | ||
coarse_cell_wise_vertex_coordinates, | ||
cell_panels, | ||
num_uniform_refinements; | ||
radius=rₑ, | ||
adaptive=true, | ||
order=0) | ||
|
||
hf, uf = shallow_water_rosenbrock_time_stepper(model, order, degree, | ||
h₀, u₀, Ωₑ, gₑ, H₀, | ||
λ, dt, 60.0, nstep; | ||
t₀=topography, | ||
leap_frog=true, | ||
write_solution=true, | ||
write_solution_freq=45, | ||
write_diagnostics=true, | ||
write_diagnostics_freq=1, | ||
dump_diagnostics_on_screen=true) | ||
|
||
end | ||
end | ||
|
||
with_mpi() do distribute | ||
main(distribute,1) | ||
end | ||
end # module |