Example #1
0
def main():

    printInfo()  # simple function to print info about package

    # Load data to test TBNN-s
    (x_r1, tb_r1, uc_r1, gradc_r1, nut_r1, x_r1p5, tb_r1p5, uc_r1p5,
     gradc_r1p5, nut_r1p5, x_r2, tb_r2, uc_r2, gradc_r2, nut_r2) = loadData()

    # train the TBNN-s on r=2 data (with r=1.5 as the dev set)
    print("")
    print("Training TBNN-s on baseline jet r=2 data...")
    trainNetwork(x_r2, tb_r2, uc_r2, gradc_r2, nut_r2, x_r1p5, tb_r1p5,
                 uc_r1p5, gradc_r1p5, nut_r1p5)

    # Apply the trained network on the r=1 data
    print("")
    print("Applying trained TBNN-s on baseline jet r=1 data...")
    applyNetwork(x_r1, tb_r1, uc_r1, gradc_r1, nut_r1)
Example #2
0
def main():

    printInfo()  # simple function to print info about package

    # Load data to test TBNN
    (x_r1, tb_r1, gradu_r1, b_r1, tke_r1, omg_r1, nut_r1, vol_r1, x_r1p5,
     tb_r1p5, gradu_r1p5, b_r1p5, tke_r1p5, omg_r1p5, nut_r1p5, vol_r1p5, x_r2,
     tb_r2, gradu_r2, b_r2, tke_r2, omg_r2, nut_r2, vol_r2) = loadData()

    # train the TBNN on r=2 data (with r=1.5 as the dev set)
    print("")
    print("Training TBNN on baseline jet r=2 data...")
    trainNetwork(x_r2, tb_r2, b_r2, x_r1p5, tb_r1p5, b_r1p5)
    #trainNetwork(x_r2, tb_r2, b_r2, x_r1p5, tb_r1p5, b_r1p5, vol_r2, vol_r1)
    # the last two arguments are optional; they consist of a weight that is applied
    # to the loss function. Uncomment to apply the computational cell volume as a weight

    # Apply the trained network on the r=1 data
    print("")
    print("Applying trained TBNN on baseline jet r=1 data...")
    applyNetwork(x_r1, tb_r1, b_r1, gradu_r1, nut_r1, tke_r1)
Example #3
0
_, bij_raw = pd.compute_bij(uus_raw, tke_raw, Ny)

# Eddy viscosity
nut_train = pd.compute_nut(aij_train, sij_train, Ntrain)
nut_dev = pd.compute_nut(aij_dev, sij_dev, Ndev)
nut_test = pd.compute_nut(aij_test, sij_test, Ntest)

# Compute QoIs: lam = scalar invariant, tb = tensor basis
lam_train, tb_train = pd.compute_qoi(sij_train, oij_train, Ntrain)
lam_dev, tb_dev = pd.compute_qoi(sij_dev, oij_dev, Ndev)
lam_test, tb_test = pd.compute_qoi(sij_test, oij_test, Ntest)

# save terminal output to file
fout = open('logs/channel5.txt', 'w')
sys.stdout = fout
printInfo()

# Train network
print("")
print("Training TBNN on baseline Re_tau=550 channel data...")
best_dev_loss, end_dev_loss, step_list, train_loss_list, dev_loss_list = apptb.trainNetwork(
    lam_train, tb_train, bij_train, lam_dev, tb_dev, bij_dev)
print("")

# Apply the trained network
print("")
print("Applying trained TBNN on baseline Re_tau=550 channel data...")
b_pred, g = apptb.applyNetwork(lam_test, tb_test, bij_test, gradu_test,
                               nut_test, tke_test)
fout.close()