'friction': 'manning', # I/O 'plot_bathymetry': True, 'plot_pvd': True, 'input_dir': inputdir, 'output_dir': outputdir, } op = BeachOptions(**kwargs) if os.getenv('REGRESSION_TEST') is not None: op.end_time = op.dt * op.dt_per_export swp = AdaptiveProblem(op) t1 = time.time() swp.solve_forward() t2 = time.time() if os.getenv('REGRESSION_TEST') is not None: sys.exit(0) print(t2 - t1) new_mesh = RectangleMesh(880, 20, 220, 10) bath = Function(FunctionSpace(new_mesh, "CG", 1)).project(swp.fwd_solutions_bathymetry[0]) bath_real = initialise_bathymetry(new_mesh, 'hydrodynamics_beach_bath_new_880') print('L2') print(fire.errornorm(bath, bath_real))
print(fac_x) print(alpha) print(beta) print(gamma) new_mesh = RectangleMesh(880, 20, 220, 10) bath = Function(FunctionSpace(new_mesh, "CG", 1)).project(swp.fwd_solutions_bathymetry[0]) fpath = "hydrodynamics_beach_bath_mov_{:d}_{:d}_{:d}_{:d}_{:d}" fpath = fpath.format(op.dt_per_export, int(fac_x * 220), alpha, beta, gamma) export_bathymetry(bath, os.path.join("adapt_output", fpath), op=op) bath_real = initialise_bathymetry( new_mesh, 'fixed_output/hydrodynamics_beach_bath_fixed_440_10') print('L2') print(fire.errornorm(bath, bath_real)) print(kappa) V = FunctionSpace(new_mesh, 'CG', 1) x, y = SpatialCoordinate(new_mesh) bath_mod = Function(V).interpolate(conditional(x > 70, bath, Constant(0.0))) bath_real_mod = Function(V).interpolate( conditional(x > 70, bath_real, Constant(0.0))) print('subdomain')
swp.set_monitor_functions(gradient_interface_monitor) t1 = time.time() swp.solve_forward() t2 = time.time() new_mesh = RectangleMesh(16 * 5 * 4, 5 * 4, 16, 1.1) bath = Function(FunctionSpace(new_mesh, "CG", 1)).project(swp.fwd_solutions_bathymetry[0]) fpath = "hydrodynamics_trench_slant_bath_" + str(alpha) + "_" + str( beta) + "_" + str(gamma) + "_" + str(fac_x) export_bathymetry(bath, os.path.join("adapt_output", fpath), op=op) bath_real = initialise_bathymetry(new_mesh, 'hydrodynamics_trench_slant_bath_new_4.0') print(fac_x) print(fac_y) print(alpha) print('L2') print(fire.errornorm(bath, bath_real)) print("total time: ") print(t2 - t1) print(beta) print(gamma)