Source code for pymor.analyticalproblems.advection
# -*- coding: utf-8 -*-
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2017 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
import numpy as np
from pymor.core.interfaces import ImmutableInterface
from pymor.domaindescriptions.basic import RectDomain
from pymor.functions.basic import ConstantFunction
[docs]class InstationaryAdvectionProblem(ImmutableInterface):
"""Instationary advection problem.
The problem is to solve the scalar conservation law::
∂_t u(x, t, μ) + ∇ ⋅ f(u(x, t, μ), t, μ) = s(x, t, μ)
u(x, 0, μ) = u_0(x, μ)
for u with t in [0, T], x in Ω.
Parameters
----------
domain
A |DomainDescription| of the domain Ω the problem is posed on.
rhs
The |Function| s. Note that the current time is handled as an
additional `'_t'` component of the |Parameter| `mu` passed
to `rhs`.
flux_function
The |Function| f. Note that the current time is handled as an
additional `'_t'` component of the |Parameter| `mu` which is
passed to `flux_function`. `flux_function.dim_domain` has to be
1, whereas `flux_function.shape_range` has to be `(dim Ω,)`.
flux_function_derivative
The derivative of f with respect to u.
dirichlet_data
|Function| providing the Dirichlet boundary values.
initial_data
|Function| providing the initial values u_0.
T
The final time T.
parameter_space
The |ParameterSpace| for the problem.
name
Name of the problem.
Attributes
----------
domain
rhs
flux_function
flux_function_derivative
dirichlet_data
initial_data
T
parameter_space
"""
def __init__(self, domain=RectDomain(), rhs=ConstantFunction(dim_domain=2),
flux_function=ConstantFunction(value=np.array([0, 0]), dim_domain=1),
flux_function_derivative=ConstantFunction(value=np.array([0, 0]), dim_domain=1),
dirichlet_data=ConstantFunction(value=0, dim_domain=2),
initial_data=ConstantFunction(value=1, dim_domain=2), T=1,
parameter_space=None, name=None):
self.domain = domain
self.rhs = rhs
self.flux_function = flux_function
self.flux_function_derivative = flux_function_derivative
self.dirichlet_data = dirichlet_data
self.initial_data = initial_data
self.T = T
self.parameter_space = parameter_space
self.name = name