pymor.discretizers package

Submodules

advection module


pymor.discretizers.advection.discretize_nonlinear_instationary_advection_fv(analytical_problem, diameter=None, nt=100, num_flux='lax_friedrichs', lxf_lambda=1.0, eo_gausspoints=5, eo_intervals=1, num_values=None, domain_discretizer=None, grid=None, boundary_info=None)[source]

Discretizes an InstationaryAdvectionProblem using the finite volume method.

Explicit Euler time-stepping is used for time discretization.

Parameters

analytical_problem
The InstationaryAdvectionProblem to discretize.
diameter
If not None, diameter is passed as an argument to the domain_discretizer.
nt
The number of time steps.
num_flux
The numerical flux to use in the finite volume formulation. Allowed values are 'lax_friedrichs', 'engquist_osher', 'simplified_engquist_osher' (see pymor.operators.fv).
lxf_lambda
The stabilization parameter for the Lax-Friedrichs numerical flux (ignored, if different flux is chosen).
eo_gausspoints
Number of Gauss points for the Engquist-Osher numerical flux (ignored, if different flux is chosen).
eo_intervals
Number of sub-intervals to use for integration when using Engquist-Osher numerical flux (ignored, if different flux is chosen).
num_values
The number of returned vectors of the solution trajectory. If None, each intermediate vector that is calculated is returned.
domain_discretizer
Discretizer to be used for discretizing the analytical domain. This has to be a function domain_discretizer(domain_description, diameter). If None, discretize_domain_default is used.
grid
Instead of using a domain discretizer, the Grid can also be passed directly using this parameter.
boundary_info
A BoundaryInfo specifying the boundary types of the grid boundary entities. Must be provided if grid is specified.

Returns

discretization
The Discretization that has been generated.
data

Dictionary with the following entries:

grid:The generated Grid.
boundary_info:The generated BoundaryInfo.

disk module


pymor.discretizers.disk.discretize_instationary_from_disk(parameter_file, T=None, steps=None, u0=None, time_stepper=None)[source]

Load a linear affinely decomposed InstationaryDiscretization from file.

Similarly to discretize_stationary_from_disk, the discretization is specified via an ini.-file of the following form

[system-matrices]
L_1.mat: l_1(μ_1,...,μ_n)
L_2.mat: l_2(μ_1,...,μ_n)
...

[rhs-vectors]
F_1.mat: f_1(μ_1,...,μ_n)
F_2.mat: f_2(μ_1,...,μ_n)
...

[mass-matrix]
D.mat

[initial-solution]
u0: u0.mat

[parameter]
μ_1: a_1,b_1
...
μ_n: a_n,b_n

[products]
Prod1: P_1.mat
Prod2: P_2.mat
...

[time]
T: final time
steps: number of time steps

Parameters

parameter_file
Path to the ‘.ini’ parameter file.
T
End-time of desired solution. If None, the value specified in the parameter file is used.
steps
Number of time steps to. If None, the value specified in the parameter file is used.
u0
Initial solution. If None the initial solution is obtained from parameter file.
time_stepper
The desired time stepper to use. If None, implicit Euler time stepping is used.

Returns

discretization
The InstationaryDiscretization that has been generated.

pymor.discretizers.disk.discretize_stationary_from_disk(parameter_file)[source]

Load a linear affinely decomposed StationaryDiscretization from file.

The discretization is defined via an .ini-style file as follows

[system-matrices]
L_1.mat: l_1(μ_1,...,μ_n)
L_2.mat: l_2(μ_1,...,μ_n)
...

[rhs-vectors]
F_1.mat: f_1(μ_1,...,μ_n)
F_2.mat: f_2(μ_1,...,μ_n)
...

[parameter]
μ_1: a_1,b_1
...
μ_n: a_n,b_n

[products]
Prod1: P_1.mat
Prod2: P_2.mat
...

Here, L_1.mat, L_2.mat, ..., F_1.mat, F_2.mat, ... are files containing matrices L_1, L_2, ... and vectors F_1.mat, F_2.mat, ... which correspond to the affine components of the operator and right-hand side functional. The respective coefficient functionals, are given via the string expressions l_1(...), l_2(...), ..., f_1(...) in the (scalar-valued) Parameter components w_1, ..., w_n. The allowed lower and upper bounds a_i, b_i for the component μ_i are specified in the [parameters] section. The resulting operator and right-hand side are then of the form

L(μ) = l_1(μ)*L_1 + l_2(μ)*L_2+ ...
F(μ) = f_1(μ)*F_1 + f_2(μ)*L_2+ ...

In the [products] section, an optional list of inner products Prod1, Prod2, .. with corresponding matrices P_1.mat, P_2.mat can be specified.

Example:

[system-matrices]
matrix1.mat: 1.
matrix2.mat: 1. - theta**2

[rhs-vectors]
rhs.mat: 1.

[parameter]
theta: 0, 0.5

[products]
h1: h1.mat
l2: mass.mat

Parameters

parameter_file
Path to the parameter file.

Returns

discretization
The StationaryDiscretization that has been generated.

elliptic module


pymor.discretizers.elliptic.discretize_elliptic_cg(analytical_problem, diameter=None, domain_discretizer=None, grid=None, boundary_info=None)[source]

Discretizes an EllipticProblem using finite elements.

Parameters

analytical_problem
The EllipticProblem to discretize.
diameter
If not None, diameter is passed as an argument to the domain_discretizer.
domain_discretizer
Discretizer to be used for discretizing the analytical domain. This has to be a function domain_discretizer(domain_description, diameter, ...). If None, discretize_domain_default is used.
grid
Instead of using a domain discretizer, the Grid can also be passed directly using this parameter.
boundary_info
A BoundaryInfo specifying the boundary types of the grid boundary entities. Must be provided if grid is specified.

Returns

discretization
The Discretization that has been generated.
data

Dictionary with the following entries:

grid:The generated Grid.
boundary_info:The generated BoundaryInfo.

pymor.discretizers.elliptic.discretize_elliptic_fv(analytical_problem, diameter=None, domain_discretizer=None, grid=None, boundary_info=None)[source]

Discretizes an EllipticProblem using the finite volume method.

Parameters

analytical_problem
The EllipticProblem to discretize.
diameter
If not None, diameter is passed as an argument to the domain_discretizer.
domain_discretizer
Discretizer to be used for discretizing the analytical domain. This has to be a function domain_discretizer(domain_description, diameter, ...). If None, discretize_domain_default is used.
grid
Instead of using a domain discretizer, the Grid can also be passed directly using this parameter.
boundary_info
A BoundaryInfo specifying the boundary types of the grid boundary entities. Must be provided if grid is specified.

Returns

discretization
The Discretization that has been generated.
data

Dictionary with the following entries:

grid:The generated Grid.
boundary_info:The generated BoundaryInfo.

parabolic module


pymor.discretizers.parabolic.discretize_parabolic_cg(analytical_problem, diameter=None, domain_discretizer=None, grid=None, boundary_info=None, num_values=None, time_stepper=None, nt=None)[source]

Discretizes an ParabolicProblem using finite elements.

Parameters

analytical_problem
The ParabolicProblem to discretize.
diameter
If not None, diameter is passed as an argument to the domain_discretizer.
domain_discretizer
Discretizer to be used for discretizing the analytical domain. This has to be a function domain_discretizer(domain_description, diameter, ...). If None, discretize_domain_default is used.
grid
Instead of using a domain discretizer, the Grid can also be passed directly using this parameter.
boundary_info
A BoundaryInfo specifying the boundary types of the grid boundary entities. Must be provided if grid is specified.
num_values
The number of returned vectors of the solution trajectory. If None, each intermediate vector that is calculated is returned.
time_stepper
The time-stepper to be used by solve.
nt
If time_stepper is not specified, the number of time steps for implicit Euler time stepping.

Returns

discretization
The Discretization that has been generated.
data

Dictionary with the following entries:

grid:The generated Grid.
boundary_info:The generated BoundaryInfo.

pymor.discretizers.parabolic.discretize_parabolic_fv(analytical_problem, diameter=None, domain_discretizer=None, grid=None, boundary_info=None, num_values=None, time_stepper=None, nt=None)[source]

Discretizes an ParabolicProblem using the finite volume method.

Parameters

analytical_problem
The ParabolicProblem to discretize.
diameter
If not None, diameter is passed to the domain_discretizer.
domain_discretizer
Discretizer to be used for discretizing the analytical domain. This has to be a function domain_discretizer(domain_description, diameter, ...). If further arguments should be passed to the discretizer, use functools.partial. If None, discretize_domain_default is used.
grid
Instead of using a domain discretizer, the Grid can also be passed directly using this parameter.
boundary_info
A BoundaryInfo specifying the boundary types of the grid boundary entities. Must be provided if grid is specified.
num_values
The number of returned vectors of the solution trajectory. If None, each intermediate vector that is calculated is returned.
time_stepper
The time-stepper to be used by solve.
nt
If time_stepper is not specified, the number of time steps for implicit Euler time stepping.

Returns

discretization
The Discretization that has been generated.
data

Dictionary with the following entries:

grid:The generated Grid.
boundary_info:The generated BoundaryInfo.