Skip to content

Commit 294ad07

Browse files
authored
Added the santos_step to SWFlow test suite for code coverage. (#1227)
* added santos_step.py csv file and updated test
1 parent 27634d3 commit 294ad07

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1998408467913111,0.1998324697151817,0.1998231648597691,0.19981275844152835,0.19980107414262002,0.1997877751913415,0.19977275449988957,0.19975498933013713,0.19973557469236924,0.19970938195814386,0.19968795702313766,0.19963382099129556,0.19966113276397168,0.19940320006589363,0.20058261179001396,0.20567129170507392,0.23084616807403724,0.21314089083446353,0.19980086476695702,0.1969896733580424,0.15003365248550748,0.10316810759201064,0.10159490762842505,0.10105982875286194,0.100796182700852,0.10063645297075544,0.10053052536676269,0.1004546903751942,0.10039787187047278,0.10035366248801625,0.10031829975059275,0.10028936458726913,0.10026525215069465,0.10024484891966917,0.10022736034532234,0.10021220344544374,0.10019894108973566,0.10018723894965523,0.10017683700655888,0.10016752997210418,0.10015915361687805,0.1998408465728825,0.19983246934049398,0.19982316388179877,0.1998127557031092,0.1998010662701007,0.1997877550874972,0.19977269446273543,0.19975485399080795,0.19973510710629186,0.19970859846974012,0.19968346915873902,0.19963316218168092,0.19960024771749074,0.19952282980138436,0.19976763248035692,0.20653489681095635,0.2332180444793978,0.21614480861599517,0.20029532414697757,0.1968357196142843,0.1500373905214749,0.10316031048907133,0.10159286151316331,0.10105893392417278,0.10079588515627838,0.10063634576585388,0.10053049337282528,0.10045467951072315,0.10039786883895868,0.10035366151635715,0.10031829947018409,0.10028936450187055,0.10026525212097404,0.10024484891066295,0.10022736034131416,0.10021220344417017,0.10019894108910915,0.10018723894944646,0.10017683700645855,0.10016752997206563,0.1001591536168489,0.19984084679218367,0.19983246971021765,0.1998231648470128,0.19981275850467645,0.19980107383585663,0.19978777633544836,0.1997727509114239,0.1997550006748563,0.19973554566244114,0.19970944747924504,0.1996877970863895,0.19963423966210825,0.19966080963371216,0.19940558947522832,0.2005630472238583,0.20571175303956082,0.23075810804116056,0.21314282771053988,0.19995483401622188,0.19696657891064234,0.1500362235477683,0.10316776641125805,0.10159498087050772,0.10105980288127522,0.10079619427535727,0.10063644695030857,0.10053052725406256,0.10045468953462133,0.10039787207019354,0.10035366241708153,0.10031829976193264,0.10028936458577997,0.10026525215000442,0.10024484892043173,0.10022736034500163,0.10021220344562841,0.10019894108967606,0.10018723894968382,0.10017683700655042,0.10016752997210807,0.100159153616876,0.19984084657287793,0.19983246934049748,0.19982316388180296,0.19981275570301615,0.19980106627042135,0.1997877550856898,0.1997726944669342,0.1997548539752738,0.19973510712344147,0.1997085984819747,0.1996834693882229,0.1996331619719352,0.19960024718910704,0.19952280578080261,0.19976762421372848,0.20653489631335417,0.23321804516854247,0.21614480859245772,0.20029532416201365,0.1968357196153337,0.1500373905214689,0.10316031048925732,0.10159286151308598,0.10105893392422188,0.10079588515626439,0.10063634576586064,0.10053049337282352,0.1004546795107239,0.10039786883895849,0.10035366151635723,0.10031829947018409,0.10028936450187056,0.10026525212097404,0.10024484891066297,0.10022736034131416,0.10021220344417017,0.10019894108910916,0.10018723894944645,0.10017683700645853,0.10016752997206561,0.10015915361684889,0.19984084679130326,0.19983246971519156,0.1998231648597779,0.19981275844147334,0.19980107414325393,0.19978777518911,0.19977275451008508,0.19975498929177504,0.19973557478258852,0.19970938161086763,0.19968795734465153,0.19963381761018736,0.19966112283480858,0.19940335372800397,0.20058262091172105,0.20567129231023543,0.23084616766950683,0.21314089096146413,0.1998008647560002,0.19698967335445292,0.15003365248522743,0.10316810759203707,0.10159490762826696,0.1010598287529152,0.10079618270082398,0.10063645297076326,0.10053052536675922,0.10045469037519505,0.10039787187047244,0.10035366248801636,0.10031829975059267,0.10028936458726913,0.10026525215069462,0.1002448489196692,0.1002273603453223,0.10021220344544374,0.10019894108973565,0.10018723894965523,0.10017683700655886,0.10016752997210415,0.10015915361687809

proteus/tests/SWFlow/santos_step.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111

1212
"""
13-
This is a simple benchmark of a solitary wave propagating over a flat bottom.
13+
This is the set up of a solitary wave propagating over a step. Reference is:
14+
'Numerical and experimental study of the transformation of a solitary wave
15+
over a shelf or isolated obstacle'
1416
"""
1517

1618
# *************************** #
@@ -44,8 +46,8 @@
4446
if opts.structured:
4547
domain = rectangle
4648
else:
47-
rectangle.writePoly("solitary")
48-
domain = PlanarStraightLineGraphDomain(fileprefix="solitary")
49+
rectangle.writePoly("step")
50+
domain = PlanarStraightLineGraphDomain(fileprefix="step")
4951
domain.MeshOptions.triangleOptions = "pAq30Dena%f" % (0.5 * opts.he**2,)
5052
nnx = None
5153
nny = None
@@ -96,12 +98,11 @@ def uOfXT(self, X, t):
9698
return 0.
9799

98100
"""
99-
heta and hw are needed for the modified green naghdi equations.
100-
For initial conditions, heta -> h^2 and hw -> h^2div(u).
101-
Note that the BCs for the heta and hw should be same as h.
102-
For more details see: 'Robust explicit relaxation techinque for solving
103-
the Green-Naghdi equations' by Guermond, Popov, Tovar, Kees.
104-
JCP 2019
101+
heta, hw and hbeta are needed for the dispersive Serre--Saint-Venant equations
102+
(ie shallow water equations). For initial conditions, heta -> h^2, hw -> h^2*div(u),
103+
hbeta->hu * grad(Z) (hbeta can just be 0 for simplicity).
104+
For boundary conditions, heta and hw should have same flags as h and hbeta
105+
same flags as hu.
105106
"""
106107

107108
class heta_at_t0(object):
@@ -182,8 +183,4 @@ def hbeta_DBC(X, flag):
182183
domain=domain,
183184
initialConditions=initialConditions,
184185
boundaryConditions=boundaryConditions,
185-
bathymetry=bathymetry_function,
186-
analyticalSolution=analytical_Solution)
187-
mySWFlowProblem.physical_parameters['LINEAR_FRICTION'] = 0
188-
mySWFlowProblem.physical_parameters['mannings'] = 0.0
189-
# mySWFlowProblem.swe_parameters['LUMPED_MASS_MATRIX'] = 1
186+
bathymetry=bathymetry_function)

proteus/tests/SWFlow/solitary_wave.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,5 +181,3 @@ def hbeta_DBC(X, flag):
181181
boundaryConditions=boundaryConditions,
182182
bathymetry=bathymetry_function,
183183
analyticalSolution=analytical_Solution)
184-
mySWFlowProblem.physical_parameters['LINEAR_FRICTION'] = 0
185-
mySWFlowProblem.physical_parameters['mannings'] = 0.0

proteus/tests/SWFlow/test_SWFlows.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def compare_vs_saved_files(self,name):
3131
actual = tables.open_file(name+'.h5','r')
3232
expected_path = 'comparison_files/' + 'comparison_' + name + '_h_t2.csv'
3333
#write comparison file
34-
# write_path = './' + 'comparison_' + name + '_h_t2.csv'
34+
# write_path = './comparison_files/' + 'comparison_' + name + '_h_t2.csv'
3535
# np.array(actual.root.h_t2).tofile(os.path.join(self._scriptdir, write_path),sep=",")
3636
#
3737
np.testing.assert_almost_equal(np.fromfile(os.path.join(self._scriptdir, expected_path),sep=","),np.array(actual.root.h_t2).flatten(),decimal=7)
@@ -84,3 +84,8 @@ def test_obstacle_flow(self):
8484
os.system("parun --SWEs --path " + self.path + " "
8585
"-l1 -v obstacle_flow.py -C 'he=4.0 final_time=0.1 dt_output=0.1'")
8686
self.compare_vs_saved_files("obstacle_flow")
87+
88+
def test_santos_step(self):
89+
os.system("parun --SWEs --path " + self.path + " "
90+
"-l1 -v santos_step.py -C 'refinement=3 final_time=0.1 dt_output=0.1'")
91+
self.compare_vs_saved_files("santos_step")

0 commit comments

Comments
 (0)