Commit d77c565f authored by Anthony's avatar Anthony
Browse files

Some clean-up

parent f8c324bd
......@@ -111,10 +111,14 @@ if DumpHydroSuper :
INFO("Dumping HydroSuper")
hsuper.dumpnetcdf(OutGraphFile.replace(".nc","_HydroSuper.nc"), gg, modelgrid, part)
hsuper.check_inflows()
INFO("=================== Truncate ====================")
print("Rank : {0} - Basin_count Before Truncate : ".format(part.rank), hsuper.basin_count)
hs = TR(hsuper, part, comm, modelgrid, numop = numop)
print("Rank : {0} - Basin_count After Truncate : ".format(part.rank), hsuper.basin_count)
INFO("=================== HydroGraph ====================")
hgraph = IF.HydroGraph(nbasmax, hsuper, part, modelgrid)
hgraph.dumpnetcdf(OutGraphFile, gg, modelgrid, part)
......
......@@ -16,6 +16,9 @@ from inspect import currentframe, getframeinfo
localdir=os.path.dirname(getframeinfo(currentframe()).filename)
sys.path.append(localdir+'/F90subroutines')
import routing_interface
import getargs
log_master, log_world = getargs.getLogger()
INFO, DEBUG, ERROR = log_master.info, log_master.debug, log_world.error
######################
......@@ -47,7 +50,6 @@ class trunc:
self.landhalolist_f=[l+1 for l in range(hydrosuper.nbpt) if l not in self.landcorelist]
self.numop = numop
# Step 1 : coastal flow
self.max_ops_num = numop
i = 1
......@@ -57,12 +59,11 @@ class trunc:
max_bas = part.domainmax(np.max(self.basin_count))
if part.rank == 0:
print("Step 1 iter. {0}, maxops: {1}->max_bas : {2}".format(i, self.max_ops_num, max_bas))
INFO("Step 1 iter. {0}, maxops: {1}->max_bas : {2}".format(i, self.max_ops_num, max_bas))
i+=1
hydrosuper.fetch(part)
comm.Barrier()
hydrosuper.fetch(part)
comm.Barrier()
# Step 2 : HTUs going to the same neighbour
i = 1
self.max_ops_num_halo = self.numop; self.max_ops_num_core = self.numop
......@@ -72,23 +73,24 @@ class trunc:
if self.max_ops_num_core == self.numop:
self.step2(hydrosuper, part, "core")
hydrosuper.killbas(self.tokill, self.totakeover, self.numops)
#print("Step 2,iter {0} Rank {1}, maxops : {2}".format(i,part.rank,np.max(self.numops)))
max_bas = part.domainmax(np.max(self.basin_count))
if part.rank == 0:
print("Step 2 iter. {0} (core) maxops: {1}->max_bas : {2}".format(i, self.max_ops_num_core, max_bas))
hydrosuper.fetch(part)
INFO("Step 2 iter. {0} (core) maxops: {1}->max_bas : {2}".format(i, self.max_ops_num_core, max_bas))
comm.Barrier()
hydrosuper.fetch(part)
#comm.Barrier()
# Points with outflow in the halo
if self.max_ops_num_halo == self.numop:
self.step2(hydrosuper, part, "halo")
hydrosuper.killbas(self.tokill, self.totakeover, self.numops)
max_bas = part.domainmax(np.max(self.basin_count))
if part.rank == 0:
print("Step 2 iter. {0} (halo) maxops: {1}->max_bas : {2}".format(i, self.max_ops_num_halo, max_bas))
hydrosuper.fetch(part)
INFO("Step 2 iter. {0} (halo) maxops: {1}->max_bas : {2}".format(i, self.max_ops_num_halo, max_bas))
comm.Barrier()
hydrosuper.fetch(part)
#comm.Barrier()
i += 1
......@@ -103,7 +105,7 @@ class trunc:
max_bas = part.domainmax(np.max(self.basin_count))
if part.rank == 0:
print("Step 3 iter. {0} (core) maxops: {1}->max_bas : {2}".format(i, self.max_ops_num_core, max_bas))
INFO("Step 3 iter. {0} (core) maxops: {1}->max_bas : {2}".format(i, self.max_ops_num_core, max_bas))
hydrosuper.fetch(part)
comm.Barrier()
......@@ -113,7 +115,7 @@ class trunc:
hydrosuper.killbas(self.tokill, self.totakeover, self.numops)
max_bas = part.domainmax(np.max(self.basin_count))
if part.rank == 0:
print("Step 3 iter. {0} (halo) maxops: {1}->max_bas : {2}".format(i, self.max_ops_num_halo, max_bas))
INFO("Step 3 iter. {0} (halo) maxops: {1}->max_bas : {2}".format(i, self.max_ops_num_halo, max_bas))
hydrosuper.fetch(part)
comm.Barrier()
i += 1
......@@ -127,7 +129,7 @@ class trunc:
hydrosuper.killbas(self.tokill, self.totakeover, self.numops)
max_bas = part.domainmax(np.max(self.basin_count))
if part.rank == 0:
print("Step 4 iter. {0} (core) maxops: {1}->max_bas : {2}".format(i, self.max_ops_num, max_bas))
INFO("Step 4 iter. {0} (core) maxops: {1}->max_bas : {2}".format(i, self.max_ops_num, max_bas))
hydrosuper.fetch(part)
comm.Barrier()
i += 1
......@@ -138,7 +140,7 @@ class trunc:
hydrosuper.killbas(self.tokill, self.totakeover, self.numops)
max_bas = part.domainmax(np.max(self.basin_count))
if part.rank == 0:
print("Step 5, maxops: {0}->max_bas : {1}".format(self.numopmax, max_bas))
INFO("Step 5, maxops: {0}->max_bas : {1}".format(self.numopmax, max_bas))
hydrosuper.fetch(part)
comm.Barrier()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment