Skip to content

Commit

Permalink
fix hot starts for h5py archiving
Browse files Browse the repository at this point in the history
  • Loading branch information
cekees committed Sep 24, 2017
1 parent b40d88b commit c8467b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 10 additions & 1 deletion proteus/FemTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3623,7 +3623,16 @@ def readFunctionXdmf(self,ar,u,tCount=0):
del array
else:
if ar.has_h5py:
u.dof[:]=ar.hdfFile["/"+u.name+"_p"+`ar.comm.rank()`+"_t"+str(tCount)]
if ar.global_sync:
#this is known to be slow but it scales with
#respect to memory (as opposed to the faster
#approach of pulling in the entire array)
permute = np.argsort(self.mesh.globalMesh.nodeNumbering_subdomain2global)
u.dof[permute] = ar.hdfFile["/"+u.name+"_t"+str(tCount)][self.mesh.globalMesh.nodeNumbering_subdomain2global[permute].tolist()]
#faster way
#u.dof[:] = ar.hdfFile["/"+u.name+"_t"+str(tCount)].value[self.mesh.globalMesh.nodeNumbering_subdomain2global]
else:
u.dof[:]=ar.hdfFile["/"+u.name+"_p"+`ar.comm.rank()`+"_t"+str(tCount)]
else:
u.dof[:]=ar.hdfFile.getNode("/",u.name+str(tCount))
else:
Expand Down
11 changes: 4 additions & 7 deletions proteus/NumericalSolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,9 @@ def __init__(self,so,pList,nList,sList,opts,simFlagsList=None):
if comm.isMaster() and p.genMesh:
tmesh.readFromPolyFile(p.domain.polyfile)
tmesh.writeToFile(p.domain.polyfile)
logEvent("Converting to Proteus Mesh")
mesh=tmesh.convertToProteusMesh(verbose=1)
comm.barrier()
if p.genMesh:
mesh = MeshTools.TriangularMesh()
mesh.generateFromTriangleFiles(filebase=p.domain.polyfile,base=1)
mesh = MeshTools.TriangularMesh()
mesh.generateFromTriangleFiles(filebase=p.domain.polyfile,base=1)
mlMesh = MeshTools.MultilevelTriangularMesh(0,0,0,skipInit=True,
nLayersOfOverlap=n.nLayersOfOverlapForParallel,
parallelPartitioningType=n.parallelPartitioningType)
Expand Down Expand Up @@ -1147,7 +1144,7 @@ def calculateSolution(self,runName):
if self.opts.hotStart:
logEvent("Setting initial conditions from hot start file for "+p.name)
tCount = int(self.ar[index].tree.getroot()[-1][-1][-1][0].attrib['Name'])
self.ar[index].n_datasets = tCount+1
self.ar[index].n_datasets = tCount + 1
time = float(self.ar[index].tree.getroot()[-1][-1][-1][0].attrib['Value'])
if len(self.ar[index].tree.getroot()[-1][-1]) > 1:
dt = time - float(self.ar[index].tree.getroot()[-1][-1][-2][0].attrib['Value'])
Expand All @@ -1162,7 +1159,7 @@ def calculateSolution(self,runName):
lm.timeIntegration.tLast = time
lm.timeIntegration.t = time
lm.timeIntegration.dt = dt
self.tCount = tCount+1
self.tCount = tCount
elif p.initialConditions is not None:
logEvent("Setting initial conditions for "+p.name)
m.setInitialConditions(p.initialConditions,self.tnList[0])
Expand Down

0 comments on commit c8467b4

Please sign in to comment.