Closed vitesh13 closed 3 years ago
This can be a way to pause the simulation - using SIGSTOP
and SIGCONT
cmd = "DAMASK_grid -l tensionX.yaml -g 20grains16x16x16.vtr"
with open('check.txt','wb') as f:
P = subprocess.Popen(cmd,stdout = subprocess.PIPE, stderr = subprocess.PIPE,shell=True)
r = re.compile(' increment 3 converged')
record = []
while P.poll() is None:
for count,line in enumerate(iter(P.stdout.readline, b'')):
record.append(line.decode('utf-8'))
if count > 1 and (count%300) == 0:
os.kill(P.pid+1, signal.SIGSTOP)
d = damask.Result('20grains16x16x16_tensionX.hdf5')
print(d.get_dataset_location('F'))
os.kill(P.pid+1, signal.SIGCONT)
This can be a sample code to access HDF5 while the simulation is running. To avoid the writting of the fly issues, better to pause the simulation when HDF5 is being accessed. The frequency at which HDF5 will be accessed will be equal to output frequency of the simulation.