sampling_interval=sampling_interval) if not tracerEW.obspy_available(): print( "\nWARNING: obspy not available, SEGY files will not be written\n") elif getMPISizeWorld() > 1: print( "\nWARNING: SEGY files cannot be written with multiple processes\n" ) t = 0. mkDir('tmp') n = 0 while t < t_end: t, p = sw.update(t + sampling_interval) tracerEW.addRecord(locEW(p)) if DIM == 3: tracerNS.addRecord(locNS(p)) print(t, locEW(p)[:4], wl.getValue(t)) try: if n % 5 == 0: saveSilo("tmp/u_%d.silo" % (n // 5, ), p=p) except: print( "Failed saving silo file. Was escript build without Silo support?" ) n += 1 if tracerEW.obspy_available() and getMPISizeWorld() == 1: tracerEW.write('lineEW.sgy') if DIM == 3: tracerNS.write('lineNS.sgy') else: # no speckley
sw.setQ(q) locEW = Locator(domain, rcvEW_locations) if DIM == 3: locNS = Locator(domain, rcvNS_locations) mkDir('output') t = 0. n = 0 k = 0 u = None while t < t_end: start = time() t, u = sw.update(t + sampling_interval) tracerEW_x.addRecord(locEW(u[0])) tracerEW_z.addRecord(locEW(u[DIM - 1])) if DIM == 3: tracerEW_y.addRecord(locEW(u[1])) tracerNS_x.addRecord(locNS(u[0])) tracerNS_y.addRecord(locNS(u[1])) tracerNS_z.addRecord(locNS(u[2])) print(t, locEW(u[DIM - 1])[len(rgEW) // 2 - 4:len(rgEW) // 2 + 1], wl.getValue(t)) k += 1 if k % 5 == 0: saveSilo("output/normalHTI_%d.silo" % (n, ), v_p=v_p, u=u, cycle=k,
receiver_group=rgNS, source=src_loc_2D, sampling_interval=sampling_interval, text="z-displacement - north-south line", ) if not tracerEW_x.obspy_available(): print("\nWARNING: obspy not available, SEGY files will not be written\n") elif getMPISizeWorld() > 1: print("\nWARNING: SEGY files cannot be written with multiple processes\n") t = 0.0 mkDir("tmp") n = 0 while t < t_end: t, u = sw.update(t + sampling_interval) tracerEW_x.addRecord(locEW(u[0])) tracerEW_z.addRecord(locEW(u[DIM - 1])) if DIM == 3: tracerEW_y.addRecord(locEW(u[1])) tracerNS_x.addRecord(locNS(u[0])) tracerNS_y.addRecord(locNS(u[1])) tracerNS_z.addRecord(locNS(u[2])) print(t, locEW(u[DIM - 1])[len(rgEW) // 2 - 4 : len(rgEW) // 2 + 1], wl.getValue(t)) # if n%5 == 0 : saveSilo("tmp/u_%d.silo"%(n/5,), u=u) saveSilo("tmp/u_%d.silo" % (n,), u=u, cycle=n, time=t) n += 1 if tracerEW_x.obspy_available() and getMPISizeWorld() == 1: tracerEW_x.write("lineEW_x.sgy") tracerEW_z.write("lineEW_z.sgy") if DIM == 3: tracerEW_y.write("lineEW_y.sgy")
tracer_x=SimpleSEGYWriter(receiver_group=grploc, source=srcloc, sampling_interval=sampling_interval, text='x-displacement') tracer_z=SimpleSEGYWriter(receiver_group=grploc, source=srcloc, sampling_interval=sampling_interval, text='z-displacement') if not tracer_x.obspy_available(): print("\nWARNING: obspy not available, SEGY files will not be written\n") elif getMPISizeWorld() > 1: print("\nWARNING: SEGY files cannot be written with multiple processes\n") t=0. mkDir('output') n=0 k_out=0 print("calculation starts @ %s"%(time.asctime(),)) while t < t_end: t,u = sw.update(t+sampling_interval) tracer_x.addRecord(srclog(u[0])) tracer_z.addRecord(srclog(u[1])) print("t=%s, src=%s: \t %s \t %s \t %s"%(t, wl.getValue(t),srclog(u[1])[0], srclog(u[1])[src_id], srclog(u[1])[-1])) if not n_out is None and n%n_out == 0: print("time step %s written to file %s"%(n_out, "output/u_%d.silo"%(k_out,))) saveSilo("output/u_%d.silo"%(k_out,), u=u) k_out+=1 n+=1 if tracer_x.obspy_available() and getMPISizeWorld() == 1: tracer_x.write('output/lineX.sgy') tracer_z.write('output/lineZ.sgy') print("calculation completed @ %s"%(time.asctime(),)) else: # no speckley print("The Speckley module is not available")
print( "\nWARNING: obspy not available, SEGY files will not be written\n") elif getMPISizeWorld() > 1: print( "\nWARNING: SEGY files cannot be written with multiple processes\n" ) t = 0. OUT_DIR = "out%sm%smus" % (int( width_x / ne_x), int(sw.getTimeStepSize() * 1000000)) mkDir(OUT_DIR) n = 0 k = 0 timer1 = time.time() while t < t_end: t, u = sw.update(t + sampling_interval) Plog = loc(u[1]) Qlog = loc(u[0]) tracerP.addRecord(Plog) tracerQ.addRecord(Qlog) print(t, wl.getValue(t), " :", Plog[0], Plog[srcEW], Plog[-1]) timer1 = time.time() - timer1 print("time= %e sec; %s sec per step" % (timer1, timer1 / max(sw.n, 1))) if tracerP.obspy_available() and getMPISizeWorld() == 1: tracerP.write(os.path.join(OUT_DIR, 'lineP.sgy')) tracerQ.write(os.path.join(OUT_DIR, 'lineQ.sgy')) else: # no ripley print("The Ripley module is not available")
if not tracer_x.obspy_available(): print( "\nWARNING: obspy not available, SEGY files will not be written\n") elif getMPISizeWorld() > 1: print( "\nWARNING: SEGY files cannot be written with multiple processes\n" ) t = 0. mkDir('output') n = 0 k_out = 0 print("calculation starts @ %s" % (time.asctime(), )) while t < t_end: t, u = sw.update(t + sampling_interval) tracer_x.addRecord(srclog(u[0])) tracer_z.addRecord(srclog(u[1])) print("t=%s, src=%s: \t %s \t %s \t %s" % (t, wl.getValue(t), srclog(u[1])[0], srclog( u[1])[src_id], srclog(u[1])[-1])) if not n_out is None and n % n_out == 0: print("time step %s written to file %s" % (n_out, "output/u_%d.silo" % (k_out, ))) saveSilo("output/u_%d.silo" % (k_out, ), u=u) k_out += 1 n += 1 if tracer_x.obspy_available() and getMPISizeWorld() == 1: tracer_x.write('output/lineX.sgy') tracer_z.write('output/lineZ.sgy') print("calculation completed @ %s" % (time.asctime(), ))
tracerQ=SimpleSEGYWriter(receiver_group=rg, source=src_loc_2D, sampling_interval=sampling_interval, text='Q') if not tracerP.obspy_available(): print("\nWARNING: obspy not available, SEGY files will not be written\n") elif getMPISizeWorld() > 1: print("\nWARNING: SEGY files cannot be written with multiple processes\n") t=0. OUT_DIR="out%sm%smus"%(int(width_x/ne_x),int(sw.getTimeStepSize()*1000000)) mkDir(OUT_DIR) n=0 k=0 timer1=time.time() while t < t_end: t,u = sw.update(t+sampling_interval) Plog=loc(u[1]) Qlog=loc(u[0]) tracerP.addRecord(Plog) tracerQ.addRecord(Qlog) print(t, wl.getValue(t)," :", Plog[0], Plog[srcEW], Plog[-1]) timer1=time.time()-timer1 print("time= %e sec; %s sec per step"%(timer1,timer1/max(sw.n,1))) if tracerP.obspy_available() and getMPISizeWorld() == 1: tracerP.write(os.path.join(OUT_DIR,'lineP.sgy')) tracerQ.write(os.path.join(OUT_DIR,'lineQ.sgy')) else: # no ripley print("The Ripley module is not available")
locEW=Locator(domain,rcvEW_locations) tracerEW=SimpleSEGYWriter(receiver_group=rgEW, source=src_loc_2D, sampling_interval=sampling_interval) if DIM==3: locNS=Locator(domain,rcvNS_locations) tracerNS=SimpleSEGYWriter(receiver_group=rgNS, source=src_loc_2D, sampling_interval=sampling_interval) if not tracerEW.obspy_available(): print("\nWARNING: obspy not available, SEGY files will not be written\n") elif getMPISizeWorld() > 1: print("\nWARNING: SEGY files cannot be written with multiple processes\n") t=0. mkDir('tmp') n=0 while t < t_end: t,p = sw.update(t+sampling_interval) tracerEW.addRecord(locEW(p)) if DIM==3: tracerNS.addRecord(locNS(p)) print(t, locEW(p)[:4], wl.getValue(t)) if n%5 == 0 : saveSilo("tmp/u_%d.silo"%(n//5,), p=p) n+=1 if tracerEW.obspy_available() and getMPISizeWorld() == 1: tracerEW.write('lineEW.sgy') if DIM == 3: tracerNS.write('lineNS.sgy') else: # no speckley print("The Speckley module is not available")