simPath, simNo = ph.getNextSimPath(simNo, basePath)

    # add some more info for json file
    ph.paramDict["simNo"] = simNo
    ph.paramDict["type"] = "smoke"
    ph.paramDict["name"] = "gen6combined"
    ph.paramDict["version"] = printBuildInfo()
    ph.paramDict["creation_date"] = datetime.now().strftime(
        "%Y-%m-%d %H:%M:%S")
    ph.writeParams(simPath + "description.json")  # export sim parameters

    sys.stdout = ph.Logger(simPath)
    print("Called on machine '" + os.uname()[1] + "' with: " +
          str(" ".join(sys.argv)))
    print("Saving to " + simPath + ", " + str(simNo))
    uniio.backupFile(__file__, simPath)

if (npSeed < 0):
    npSeed = np.random.randint(0, 2**32 - 1)
print("Random seed %d" % npSeed)
np.random.seed(npSeed)

# Init solvers -------------------------------------------------------------------#
sm_gs = vec3(res, res, res)
xl_gs = sm_gs * float(scaleFactor)
if (dim == 2): xl_gs.z = sm_gs.z = 1  # 2D

#buoy    = vec3(0,-9e-4,0)
buoyFac = 0.1 + np.random.rand()
if buoyFac < 0.4:
    buoyFac = 0.  # make sure we have some sims without buoyancy
Beispiel #2
0
        for currModel in range(0, 200):
            if os.path.isfile(basePath + 'test_%04d/model_%04d.ckpt.index' %
                              (loadModelTest, currModel)):
                loadModelNo = currModel
        if loadModelNo == -1:
            print(
                'ERROR: Model with id below 200 does not exist. Please specify model id as "loadModelNo".'
            )
            exit()
        # print('Latest model: %d.' % loadModelNo)

    load_path = basePath + 'test_%04d/model_%04d.ckpt' % (loadModelTest,
                                                          loadModelNo)

(test_path, test_folder_no) = ph.getNextTestPath(testPathStartNo, basePath)
if not outputOnly: uniio.backupFile(__file__, test_path)

sys.stdout = ph.Logger(test_path)


# print Variables to log
def print_variables():
    print('\nUsing variables:')
    print('fromSim: {}'.format(fromSim))
    print('toSim: {}'.format(toSim))
    print('simSizeLow: {}'.format(simSizeLow))
    print('tileSizeLow: {}'.format(tileSizeLow))
    print('cropOverlap: {}'.format(cropOverlap))
    print('cropTileSizeLow: {}'.format(cropTileSizeLow))
    print('upRes: {}'.format(upRes))
    print('emptyTileValue: {}'.format(emptyTileValue))
Beispiel #3
0
    ph.paramDict["res"] = baseRes
    ph.paramDict["fac"] = setupFactor
    ph.paramDict["simNo"] = simNo
    ph.paramDict["dim"] = dim
    ph.paramDict["type"] = "smoke"
    ph.paramDict["name"] = "plume3006"
    ph.paramDict["version"] = printBuildInfo()
    ph.paramDict["creation_date"] = datetime.now().strftime(
        "%Y-%m-%d %H:%M:%S")
    ph.writeParams(outputpath + "description.json")  # export sim parameters

    sys.stdout = ph.Logger(outputpath)
    print("Called on machine '" + os.uname()[1] + "' with: " +
          str(" ".join(sys.argv)))
    print("Saving to " + outputpath + ", " + str(simNo))
    uniio.backupFile(__file__, outputpath)

#if(not os.path.exists(outputpath)):
#	os.mkdir( outputpath )
#nowtstr = time.strftime('%Y%m%d_%H%M%S')
#logfilepath = '%sscene_%s.py' % (outputpath, nowtstr)
#shutil.copyfile( sys.argv[0], logfilepath )

for t in range(400):

    mantaMsg('\nFrame %i, simulation time %f' % (targs.frame, targs.timeTotal))

    for substep in range(int(targs.timestep / sm.timestep)):
        cubeStep(vel, flags, density, pressure, bWidth)
        if (t < 160):
            densityInflow(flags=flags,