def main(): # Read hcready dumpfiles after 002_anisopy and change derivatives type # Same particle placement but different diffusion ddwt = "2nw_sd" hc12 = Context() hc12.ReadDumpFile("output/dm.hcready", "output/fd.hcready") hc12.setup.ddw = hc12.esd[ddwt] hc12.Apply() hc12.ContinueRun() hc12.BackupOutput("output-002-1") # print("Done: | ", ddwt, " | ", outrest , "|", # hc12.PrintCell(hc12.setup.resultfile, -1, 3)) print("Error: ", hc12.PrintCell(hc12.setup.resultfile, -1, 3))
def main(): ddwt = "2nw_sd" relax = Context() resfile = relax.GetDateTimeString() relax.setup = defaultSetup() relax.SetThreadsOMP(4) relax.SimpleMake() relax.setup.resolution = 64 relax.setup.ddw = ddwt relax.CleanRun() relax.ReadFinalDump() fd = "output/" + "fd-" + str(ddwt) + ".relaxed" dm = "output/" + "dm-" + str(ddwt) + ".relaxed" relax.BackupDumps(fd, dm) hc12 = relax.CopyContext() hc12.setup.eqs = hc12.eeq['diffusion'] hc12.setup.tfinish = 0.05 hc12.setup.dtprint = hc12.setup.tfinish / 10. hc12.setup.process = hc12.epc['backcompatibility'] hc12.setup.time = 0.0 # hc12.setup.au = -1 hc12.setup.artts = hc12.eif["no"] hc12.setup.au = -1.0 addedN = hc12.AddParticles(dim='x', type='fixed', method='periodic') hc12.setup.fixedpn = addedN initialTemp = lambda rx: 1.0 if (rx <= 0.0) else 2.0 # if (hc12.setup.artts == hc12.eif["no"]): # h = 2./relax.setup.resolution # hc12.setup.time = h*h/4. # initialTemp = lambda rx: 1.5 + 0.5 * math.erf(rx/h) # else: # initialTemp = lambda rx: 1.0 if (rx <= 0.0) else 2.0 hc12.ModifyParticles(condition=lambda rx: True, condarg='rx', properties=['u', 't'], value=initialTemp, valuearg='rx') hc12.ModifyParticles(condition=lambda rx: True, condarg='rx', properties=[ 'dtdx', 'dtdy', 'dtdz', 'vx', 'vy', 'vz', 'ax', 'ay', 'az' ], value=lambda rx: 0.0, valuearg='rx') # hc12.PrintState() hc12.Apply() hc12.BackupDumps("output/" + "fd.hcready", "output/" + "dm.hcready") hc12.ContinueRun() relax.BackupOutput("output-002") # print("Done: | ", ddwt, " | ", outrest , "|", # hc12.PrintCell(hc12.setup.resultfile, -1, 3)) print(hc12.PrintCell(hc12.setup.resultfile, -1, 3))
def main(): tmp = Context() resfile = tmp.GetDateTimeString() tmp.setup = defaultSetup() tmp.SetThreadsOMP(4) tmp.SimpleMake() ddwt = "2nw_sd" relax = Context() relax.setup = defaultSetup() relax.setup.resolution = 64 relax.setup.ddw = ddwt relax.setup.resultfile = resfile + "-" + ddwt + ".info" relax.CleanRun() relax.ReadFinalDump() fd = "output/" + "fd-" + str(ddwt) + ".relaxed" dm = "output/" + "dm-" + str(ddwt) + ".relaxed" relax.BackupDumps(fd, dm) for rest in [p / 4 for p in range(0, 21 * 4)]: hc12 = relax.CopyContext() hc12.setup.eqs = hc12.eeq['diffusion'] hc12.setup.tfinish = 0.05 hc12.setup.dtprint = hc12.setup.tfinish / 10. hc12.setup.process = hc12.epc['backcompatibility'] hc12.setup.time = 0.0 hc12.setup.au = rest addedN = hc12.AddParticles(dim='x', type='fixed', method='periodic') hc12.setup.fixedpn = addedN hc12.ModifyParticles(condition=lambda rx: True, condarg='rx', properties=['u', 't'], value=lambda rx: 1.0 if (rx <= 0.0) else 2.0, valuearg='rx') hc12.ModifyParticles(condition=lambda rx: True, condarg='rx', properties=[ 'dtdx', 'dtdy', 'dtdz', 'vx', 'vy', 'vz', 'ax', 'ay', 'az' ], value=lambda rx: 0.0, valuearg='rx') # hc12.PrintState() hc12.Apply() outrest = '{0:0^6}'.format(rest) hc12.BackupDumps("output/" + "fd-" + outrest + ".hcready", "output/" + "dm-" + outrest + ".hcready") hc12.ContinueRun() relax.BackupOutput("output-" + outrest) # print("Done: | ", ddwt, " | ", outrest , "|", # hc12.PrintCell(hc12.setup.resultfile, -1, 3)) print(outrest, " ", hc12.PrintCell(hc12.setup.resultfile, -1, 3))
def main(): tmp = Context() resfile = tmp.GetDateTimeString() tmp.setup = defaultSetup() tmp.SetThreadsOMP(6) tmp.SimpleMake() # for rest in [16, 32]: for rest in [16, 32, 64, 128, 256, 512, 1024]: relax = Context() relax.setup = defaultSetup() relax.setup.resolution = rest relax.setup.ddw = "fab" relax.CleanRun() relax.ReadFinalDump() fd = "output/" + "fd-" + str(rest) + ".relaxed" dm = "output/" + "dm-" + str(rest) + ".relaxed" relax.BackupDumps(fd, dm) for ddwt in ["2nw_sd", "2nw_ds"]: for s_artts in ["no", "smoothed", "artterm"]: hc12 = relax.CopyContext() hc12.setup.ddw = hc12.esd[ddwt] hc12.setup.eqs = hc12.eeq['diffusion'] hc12.setup.tfinish = 0.025 hc12.setup.dtprint = hc12.setup.tfinish / 10. hc12.setup.resultfile = resfile + "-" + ddwt + '-' + s_artts + ".info" hc12.setup.process = hc12.epc['backcompatibility'] hc12.setup.time = 0.0 addedN = hc12.AddParticles(dim='x', type='fixed', method='periodic') hc12.setup.fixedpn = addedN initialTemp = lambda rx: 1.0 if (rx <= 0.0) else 2.0 if (s_artts == "no"): hc12.setup.artts = hc12.eif['no'] elif (s_artts == "smoothed"): hc12.setup.artts = hc12.eif['no'] h = 2. / relax.setup.resolution initialTemp = lambda rx: 1.5 + 0.5 * math.erf(rx / h) elif (s_artts == "artterm"): hc12.setup.artts = hc12.eif['yes'] hc12.setup.au = -1 hc12.ModifyParticles(condition=lambda rx: True, condarg='rx', properties=['u', 't'], value=initialTemp, valuearg='rx') hc12.ModifyParticles(condition=lambda rx: True, condarg='rx', properties=[ 'dtdx', 'dtdy', 'dtdz', 'vx', 'vy', 'vz', 'ax', 'ay', 'az' ], value=lambda rx: 0.0, valuearg='rx') # hc12.PrintState() hc12.Apply() hc12.BackupDumps( "output/" + "fd-" + str(ddwt) + "-" + str(rest) + ".hcready", "output/" + "dm-" + str(ddwt) + "-" + str(rest) + ".hcready") hc12.ContinueRun() ds = str(ddwt) rs = str(rest) ss = str(s_artts) relax.BackupOutput("output-" + ds + "-" + rs + "-" + ss) print("Done: | ", ds, " | ", rs, "|", ss, "|", hc12.PrintCell(hc12.setup.resultfile, -1, 3)) print('\n')
def main(): place = Context() resfile = place.GetDateTimeString() place.setup = defaultSetup() place.CleanAllLogs() place.SetThreadsOMP(4) place.SimpleMake() place.CleanRun() place.ReadFinalDump() place.setup.eqs = place.eeq['hydro'] place.setup.tfinish = 100.0 place.setup.dtprint = place.setup.tfinish / 100. place.setup.resultfile = resfile + ".info" place.setup.process = place.epc['fullyperiodic'] place.setup.time = 0.0 place.setup.gamma = 5. / 3. place.setup.disotropic = 1.0 place.setup.dcondconst = 1.0 # place.PrintState() def c(i): return lambda x: i rho = 1.0 mass = place.CalcUniformMass(rho) h = place.setup.hfac * place.setup.spacing prs = 1.0 u = prs / (place.setup.gamma - 1) / rho place.ModifyParticlesProperties( properties=['kappa', 'c', 'm', 'den', 'h', 'p', 'u'], value=[c(1.0), c(1.235e+8), c(mass), c(rho), c(h), c(prs), c(u)]) place.Apply() place.ContinueRun()
def main(): tmp = Context() resfile = tmp.GetDateTimeString() tmp.setup = defaultSetup() tmp.SetThreadsOMP(6) tmp.SimpleMake() # for rest in [256]: for rest in [16, 32, 64, 128, 256, 512, 1024]: relax = Context() relax.setup = defaultSetup() relax.setup.resolution = rest relax.setup.ddw = "fab" relax.CleanRun() relax.ReadFinalDump() fd = "output/" + "fd-" + str(rest) + ".relaxed" dm = "output/" + "dm-" + str(rest) + ".relaxed" relax.BackupDumps(fd, dm) # for ddwt in ["2nw_ds"]: for ddwt in ["2nw_ds", "2nw_ds", "n2w", "fab", "fw"]: if ddwt == "2nw_ds": smlist = ["no", "artterm"] else: smlist = ["no"] for s_artts in smlist: diff = relax.CopyContext() diff.setup.ddw = diff.esd[ddwt] diff.setup.eqs = diff.eeq['diffusion'] diff.setup.tfinish = 0.025 diff.setup.dtprint = diff.setup.tfinish / 10. diff.setup.resultfile = resfile + "-" + ddwt + '-' + s_artts + ".info" diff.setup.process = diff.epc['backcompatibility'] diff.setup.time = 0.0 diff.setup.disotropic = diff.eif['no'] addedN = diff.AddParticles(dim='x', type='fixed', method='periodic') diff.setup.fixedpn = addedN initialTemp = lambda rx, ry, rz: ( (2. * math.pi)**(-setup.dim / 2.)) / ( (0.1**2)**(setup.dim / 2.)) * math.exp(-0.5 * ( rx * rx + ry * ry + rz * rz) / (0.1**2)) if (s_artts == "no"): diff.setup.artts = diff.eif['no'] elif (s_artts == "artterm"): diff.setup.artts = diff.eif['yes'] diff.setup.au = -1 diff.ModifyParticles(properties=['u', 't'], value=initialTemp, valuearg=['rx', 'ry', 'rz']) diff.ModifyParticles( properties=[ 'dtdx', 'dtdy', 'dtdz', 'vx', 'vy', 'vz', 'ax', 'ay', 'az', 'by, bz' ], value=lambda rx: 0.0, ) hc12.ModifyParticles( properties=['bx'], value=lambda rx: 1.0, ) # diff.PrintState() diff.Apply() ds = str(ddwt) rs = '{0:0>4}'.format(rest) ss = str(s_artts) diff.BackupDumps( "output/" + "fd-" + ds + "-" + rs + "-" + ss + ".hcready", "output/" + "dm-" + ds + "-" + rs + "-" + ss + ".hcready") diff.ContinueRun() relax.BackupOutput("output-" + ds + "-" + rs + "-" + ss) print("Done: | ", ds, " | ", rs, "|", ss, "|", diff.PrintCell(diff.setup.resultfile, -1, 3)) print('\n')