-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
48 additions
and
2 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,41 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
|
||
def test_1d_sill(): | ||
"""test_1d_sill | ||
tests against expected classic solution of shallow water equations over | ||
a sill.""" | ||
|
||
import sill | ||
|
||
def verify_expected(expected): | ||
""" given an expected value, returns a verification function """ | ||
def sill_verify(claw): | ||
from clawpack.pyclaw.util import check_diff | ||
import numpy as np | ||
|
||
q0 = claw.frames[0].state.get_q_global() | ||
qfinal = claw.frames[claw.num_output_times].state.get_q_global() | ||
|
||
if q0 != None and qfinal != None: | ||
dx = claw.solution.domain.grid.delta[0] | ||
test = dx * np.linalg.norm(qfinal - q0, 1) | ||
return check_diff(expected, test, reltol=1e-4) | ||
else: | ||
return | ||
return sill_verify | ||
|
||
from clawpack.pyclaw.util import gen_variants | ||
classic_tests = gen_variants(sill.setup, verify_expected(4.04169269142e-4), | ||
kernel_languages=["Python"], | ||
solver_type='classic', | ||
outdir=None) | ||
|
||
from itertools import chain | ||
for test in chain(classic_tests): | ||
yield test | ||
|
||
if __name__=='__main__': | ||
import nose | ||
nose.main() |