lambda_ = LOCAL_TIME_GRID_SIZE / LOCAL_SPACE_GRID_SIZE
numerical_flux = LaxFriedrichsFlux(linear_transport_flux,
                                   linear_transport_flux_derivative, lambda_)

discretization = DiscontinuousGalerkin(numerical_flux, inverse_transformation,
                                       LOCAL_SPACE_GRID_SIZE)

grid_operator = GridOperator(space_time_grid,
                             discretization,
                             DGFunction,
                             u_0_function,
                             TimeStepperType=RungeKutta4,
                             local_space_grid_size=LOCAL_SPACE_GRID_SIZE,
                             local_time_grid_size=LOCAL_TIME_GRID_SIZE)

fom = SpacetimeModel(grid_operator, inverse_transformation, n_x=N_X, n_t=N_T)

N_train = 5
parameters = np.linspace(0.25, 1., N_train)
reference_parameter = 1.

gs_smoothing_params = {'alpha': 1000., 'exponent': 3}
registration_params = {'sigma': 0.1, 'epsilon': 0.1, 'iterations': 1500}
restarts = 10

reductor = NonlinearNeuralNetworkReductor(
    fom,
    parameters,
    reference_parameter,
    gs_smoothing_params=gs_smoothing_params)
rom, output_dict = reductor.reduce(return_all=True,
Beispiel #2
0
lambda_ = LOCAL_TIME_GRID_SIZE / LOCAL_SPACE_GRID_SIZE
numerical_flux = LaxFriedrichsFlux(linear_transport_flux,
                                   linear_transport_flux_derivative, lambda_)

discretization = DiscontinuousGalerkin(numerical_flux, inverse_transformation,
                                       LOCAL_SPACE_GRID_SIZE)

grid_operator = GridOperator(space_time_grid,
                             discretization,
                             DGFunction,
                             u_0_function,
                             TimeStepperType=RungeKutta4,
                             local_space_grid_size=LOCAL_SPACE_GRID_SIZE,
                             local_time_grid_size=LOCAL_TIME_GRID_SIZE)

fom = SpacetimeModel(grid_operator, inverse_transformation, n_x=N_X, n_t=N_T)

parameters = []
reference_parameter = 1.

gs_smoothing_params = {'alpha': 100., 'exponent': 3}
registration_params = {'sigma': 0.1, 'epsilon': 0.1, 'iterations': 5000}
trainer_params = {'learning_rate': 0.001}
training_params = {'number_of_epochs': int(1e5)}
restarts = 100

NUM_WORKERS = 2
MAX_BASIS_SIZE = 10

reductor = NonlinearNeuralNetworkReductor(
    fom,
Beispiel #3
0
space_time_grid = perform_tent_pitching(grid,
                                        T_MAX,
                                        characteristic_speed,
                                        n_max=1000)

lambda_ = LOCAL_TIME_GRID_SIZE / LOCAL_SPACE_GRID_SIZE
numerical_flux = LaxFriedrichsFlux(linear_transport_flux,
                                   linear_transport_flux_derivative, lambda_)

discretization = DiscontinuousGalerkin(numerical_flux, inverse_transformation,
                                       LOCAL_SPACE_GRID_SIZE)

grid_operator = GridOperator(space_time_grid,
                             discretization,
                             DGFunction,
                             u_0_function,
                             TimeStepperType=RungeKutta4,
                             local_space_grid_size=LOCAL_SPACE_GRID_SIZE,
                             local_time_grid_size=LOCAL_TIME_GRID_SIZE)

fom = SpacetimeModel(grid_operator, inverse_transformation, n_x=N_X, n_t=N_T)

N_train = 20
parameters = np.linspace(0.25, 1., N_train)

full_solutions = [(mu, fom.solve(mu)) for mu in parameters]

with open('outputs/full_solutions', 'wb') as output_file:
    pickle.dump(full_solutions, output_file)