Coverage for src/pymor/analyticalproblems/burgers : 64%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
# -*- coding: utf-8 -*- # This file is part of the pyMOR project (http://www.pymor.org). # Copyright Holders: Rene Milk, Stephan Rave, Felix Schindler # License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
'''One-dimensional Burgers-type problem.
The problem is to solve ::
∂_t u(x, t, μ) + ∂_x (v * u(x, t, μ)^μ) = 0 u(x, 0, μ) = u_0(x)
for u with t in [0, 0.3], x in [0, 2].
Parameters ---------- v The velocity v. circle If `True` impose periodic boundary conditions. Otherwise Dirichlet left, outflow right. initial_data_type Type of initial data (`'sin'` or `'bump'`). parameter_range The interval in which μ is allowed to vary. '''
U_exp = np.sign(U) * np.power(np.abs(U), mu['exponent']) R = U_exp * v return R
U_exp = mu['exponent'] * (np.sign(U) * np.power(np.abs(U), mu['exponent']-1)) R = U_exp * v return R
parameter_type={'exponent': 0}, name='burgers_flux')
parameter_type={'exponent': 0}, name='burgers_flux')
return 0.5 * (np.sin(2 * np.pi * x[..., 0]) + 1.) else: def initial_data(x): return (x[..., 0] >= 0.5) * (x[..., 0] <= 1) * 1 inject_sid(initial_data, str(BurgersProblem) + '.initial_data_bump') dirichlet_data = ConstantFunction(dim_domain=1, value=0)
else: domain = LineDomain([0, 2], right=None)
rhs=None, flux_function=flux_function, flux_function_derivative=flux_function_derivative, initial_data=initial_data, dirichlet_data=dirichlet_data, T=0.3, name='BurgersProblem')
'''Two-dimensional Burgers-type problem.
The problem is to solve ::
∂_t u(x, t, μ) + ∇ ⋅ (v * u(x, t, μ)^μ) = 0 u(x, 0, μ) = u_0(x)
for u with t in [0, 0.3], x in [0, 2] x [0, 1].
Parameters ---------- vx The x component of the velocity vector v. vy The y component of the velocity vector v. torus If `True` impose periodic boundary conditions. Otherwise Dirichlet left and bottom, outflow top and right. initial_data_type Type of initial data (`'sin'` or `'bump'`). parameter_range The interval in which μ is allowed to vary. '''
U = U.reshape(U.shape[:-1]) U_exp = np.sign(U) * np.power(np.abs(U), mu['exponent']) R = np.empty(U.shape + (2,)) R[..., 0] = U_exp * vx R[..., 1] = U_exp * vy return R
U = U.reshape(U.shape[:-1]) U_exp = mu['exponent'] * (np.sign(U) * np.power(np.abs(U), mu['exponent']-1)) R = np.empty(U.shape + (2,)) R[..., 0] = U_exp * vx R[..., 1] = U_exp * vy return R
parameter_type={'exponent': 0}, name='burgers_flux')
parameter_type={'exponent': 0}, name='burgers_flux')
return 0.5 * (np.sin(2 * np.pi * x[..., 0]) * np.sin(2 * np.pi * x[..., 1]) + 1.) else: def initial_data(x): return (x[..., 0] >= 0.5) * (x[..., 0] <= 1) * 1 inject_sid(initial_data, str(Burgers2DProblem) + '.initial_data_bump') dirichlet_data = ConstantFunction(dim_domain=2, value=0)
rhs=None, flux_function=flux_function, flux_function_derivative=flux_function_derivative, initial_data=initial_data, dirichlet_data=dirichlet_data, T=0.3, name='Burgers2DProblem')
|