예제 #1
0
파일: script.py 프로젝트: IhmeGroup/quail
    if model_psr.tfinal != tfinal:
        search_and_replace(filename, f'tfinal = {model_psr.tfinal}',
                           f'tfinal = {tfinal}')
    time.sleep(1)

    solution = []
    importlib.reload(model_psr)

    # Run the simulation
    os.system("quail " + filename)

    # Access and process the final time step
    final_file = model_psr.prefix + '_final.pkl'

    # Read data file
    solver = readwritedatafiles.read_data_file(final_file)

    Uc = solver.state_coeffs
    basis_val = solver.elem_helpers.basis_val
    Uq = helpers.evaluate_state(Uc, basis_val)

    solution.append(Uq[0, 0, 0])  # Assumes 0D

    order = model_psr.order

    file_out = f'convergence_testing/{scheme_name}/{j}.pkl'
    write_file(file_out, solution)

    # text from previous case
    if j + 1 < dt.shape[0]:
        text_to_search = f'timestep = {dt[j]}'
예제 #2
0
plot.prepare_plot(linewidth=0.5)
fig = plt.figure()
ax = plt.gca()

imgs_all = []
j = 0
# Loop through data files
# Note: this loop only uses the first 15 frames. This is all that should be
# necessary to see the dynamics of the energy being damped.
for i in range(25):
    print(i)

    # Read data file
    fname = "Data_" + str(i) + ".pkl"
    solver = readwritedatafiles.read_data_file(fname)

    # Unpack
    mesh = solver.mesh
    physics = solver.physics

    # Plot solution
    plot.plot_solution(mesh,
                       physics,
                       solver,
                       "Pressure",
                       plot_numerical=True,
                       plot_exact=False,
                       plot_IC=False,
                       create_new_figure=False,
                       ylabel=None,