Skip to content

Commit

Permalink
Merge pull request #211 from stoiver/anuga_py3
Browse files Browse the repository at this point in the history
We lost a little on coverage but otherwise ok.
  • Loading branch information
stoiver committed Oct 30, 2019
2 parents 62c44c4 + ea880ae commit 007f8ec
Show file tree
Hide file tree
Showing 15 changed files with 1,494 additions and 1,232 deletions.
13 changes: 9 additions & 4 deletions anuga/operators/rate_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def __init__(self,
description = None,
label = None,
logging = False,
verbose = False):
verbose = False,
monitor = False):


Operator.__init__(self, domain, description, label, logging, verbose)
Expand All @@ -63,6 +64,7 @@ def __init__(self,
#------------------------------------------
# Local variables
#------------------------------------------
self.monitor = monitor
self.factor = factor
self.relative_time = relative_time

Expand Down Expand Up @@ -116,9 +118,6 @@ def __call__(self):
else:
rate = self.get_non_spatial_rate(t)

if self.verbose is True:
log.critical('Rate of %s at time = %.2f = %f'
% (self.quantity_name, self.domain.get_time(), rate))


fid = self.full_indices
Expand Down Expand Up @@ -151,6 +150,12 @@ def __call__(self):
self.stage_c[indices] = self.stage_c[indices] + local_rates
# Update mass inflows from fractional steps
self.domain.fractional_step_volume_integral+=self.local_influx

if self.monitor:
log.critical('Local Flux at time %.2f = %f'
% (self.domain.get_time(), self.local_influx))



return

Expand Down
6 changes: 3 additions & 3 deletions anuga/parallel/sequential_distribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ def sequential_distribute_dump(domain, numprocs=1, verbose=False, partition_dir=
lst = list(tostore)

# Write points and triangles to their own files
num.save(pickle_name+".np1",tostore[1],allow_pickle=False) # this append .npy to filename
num.save(pickle_name+".np1",tostore[1]) # this append .npy to filename
lst[1] = pickle_name+".np1.npy"
num.save(pickle_name+".np2",tostore[2],allow_pickle=False)
num.save(pickle_name+".np2",tostore[2])
lst[2] = pickle_name+".np2.npy"

# Write each quantity to it's own file
for k in tostore[4]:
num.save(pickle_name+".np4."+k,num.array(tostore[4][k]),allow_pickle=False)
num.save(pickle_name+".np4."+k,num.array(tostore[4][k]))
lst[4][k] = pickle_name+".np4."+k+".npy"

cPickle.dump( tuple(lst), f, protocol=cPickle.HIGHEST_PROTOCOL)
Expand Down
7 changes: 3 additions & 4 deletions anuga/tsunami_source/tests/test_eq.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_Okada_func(self):

#print 'in test', z.test
assert num.allclose(z.test, -2205.904774487)

#print 'hello finished okada'

def test_earthquake_tsunami(self):
Expand All @@ -53,15 +53,14 @@ def test_earthquake_tsunami(self):
depth = 3500.
slip = 10.0
dip = 15.0

eq = earthquake_tsunami(length=length, width = width, depth=depth, \
strike = strike, dip = dip, slip = slip, \
x0 = x0, y0 = y0)

#-------------------------------------------------------------

if __name__ == "__main__":
suite = unittest.makeSuite(Test_eq,'test_Okada_func')
suite = unittest.makeSuite(Test_eq,'test_')
runner = unittest.TextTestRunner()
runner.run(suite)

0 comments on commit 007f8ec

Please sign in to comment.