pymor.discretizers package¶
Submodules¶
cg module¶

pymor.discretizers.cg.
discretize_instationary_cg
(analytical_problem, diameter=None, domain_discretizer=None, grid_type=None, grid=None, boundary_info=None, num_values=None, time_stepper=None, nt=None, preassemble=True)[source]¶ Discretizes an
InstationaryProblem
with anStationaryProblem
as stationary part using finite elements.Parameters
 analytical_problem
 The
InstationaryProblem
to discretize.  diameter
 If not
None
,diameter
is passed as an argument to thedomain_discretizer
.  domain_discretizer
 Discretizer to be used for discretizing the analytical domain. This has
to be a function
domain_discretizer(domain_description, diameter, ...)
. IfNone
,discretize_domain_default
is used.  grid_type
 If not
None
, this parameter is forwarded todomain_discretizer
to specify the type of the generatedGrid
.  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 ifgrid
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
timestepper
to be used bysolve
.  nt
 If
time_stepper
is not specified, the number of time steps for implicit Euler time stepping.  preassemble
 If
True
, preassemble all operators in the resultingDiscretization
.
Returns
 d
 The
Discretization
that has been generated.  data
Dictionary with the following entries:
grid: The generated Grid
.boundary_info: The generated BoundaryInfo
.

pymor.discretizers.cg.
discretize_stationary_cg
(analytical_problem, diameter=None, domain_discretizer=None, grid_type=None, grid=None, boundary_info=None, preassemble=True)[source]¶ Discretizes an
StationaryProblem
using finite elements.Parameters
 analytical_problem
 The
StationaryProblem
to discretize.  diameter
 If not
None
,diameter
is passed as an argument to thedomain_discretizer
.  domain_discretizer
 Discretizer to be used for discretizing the analytical domain. This has
to be a function
domain_discretizer(domain_description, diameter, ...)
. IfNone
,discretize_domain_default
is used.  grid_type
 If not
None
, this parameter is forwarded todomain_discretizer
to specify the type of the generatedGrid
.  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 ifgrid
is specified.  preassemble
 If
True
, preassemble all operators in the resultingDiscretization
.
Returns
 d
 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 anini.
file of the following form[systemmatrices] L_1.mat: l_1(μ_1,...,μ_n) L_2.mat: l_2(μ_1,...,μ_n) ... [rhsvectors] F_1.mat: f_1(μ_1,...,μ_n) F_2.mat: f_2(μ_1,...,μ_n) ... [massmatrix] D.mat [initialsolution] 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
 Endtime 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. IfNone
, implicit Euler time stepping is used.
Returns
 d
 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[systemmatrices] L_1.mat: l_1(μ_1,...,μ_n) L_2.mat: l_2(μ_1,...,μ_n) ... [rhsvectors] 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 matricesL_1
,L_2
, ... and vectorsF_1.mat
,F_2.mat
, ... which correspond to the affine components of the operator and righthand side functional. The respective coefficient functionals, are given via the string expressionsl_1(...)
,l_2(...)
, ...,f_1(...)
in the (scalarvalued)Parameter
componentsw_1
, ...,w_n
. The allowed lower and upper boundsa_i, b_i
for the componentμ_i
are specified in the[parameters]
section. The resulting operator and righthand side are then of the formL(μ) = 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 productsProd1
,Prod2
, .. with corresponding matricesP_1.mat
,P_2.mat
can be specified.Example:
[systemmatrices] matrix1.mat: 1. matrix2.mat: 1.  theta**2 [rhsvectors] rhs.mat: 1. [parameter] theta: 0, 0.5 [products] h1: h1.mat l2: mass.mat
Parameters
 parameter_file
 Path to the parameter file.
Returns
 d
 The
StationaryDiscretization
that has been generated.
fv module¶

pymor.discretizers.fv.
discretize_instationary_fv
(analytical_problem, diameter=None, domain_discretizer=None, grid_type=None, num_flux='lax_friedrichs', lxf_lambda=1.0, eo_gausspoints=5, eo_intervals=1, grid=None, boundary_info=None, num_values=None, time_stepper=None, nt=None, preassemble=True)[source]¶ Discretizes an
InstationaryProblem
with anStationaryProblem
as stationary part using the finite volume method.Parameters
 analytical_problem
 The
InstationaryProblem
to discretize.  diameter
 If not
None
,diameter
is passed to thedomain_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, usefunctools.partial
. IfNone
,discretize_domain_default
is used.  grid_type
 If not
None
, this parameter is forwarded todomain_discretizer
to specify the type of the generatedGrid
.  num_flux
 The numerical flux to use in the finite volume formulation. Allowed
values are
'lax_friedrichs'
,'engquist_osher'
,'simplified_engquist_osher'
(seepymor.operators.fv
).  lxf_lambda
 The stabilization parameter for the LaxFriedrichs numerical flux (ignored, if different flux is chosen).
 eo_gausspoints
 Number of Gauss points for the EngquistOsher numerical flux (ignored, if different flux is chosen).
 eo_intervals
 Number of subintervals to use for integration when using EngquistOsher numerical flux (ignored, if different flux is chosen).
 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 ifgrid
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
timestepper
to be used bysolve
.  nt
 If
time_stepper
is not specified, the number of time steps for implicit Euler time stepping.  preassemble
 If
True
, preassemble all operators in the resultingDiscretization
.
Returns
 d
 The
Discretization
that has been generated.  data
Dictionary with the following entries:
grid: The generated Grid
.boundary_info: The generated BoundaryInfo
.

pymor.discretizers.fv.
discretize_stationary_fv
(analytical_problem, diameter=None, domain_discretizer=None, grid_type=None, num_flux='lax_friedrichs', lxf_lambda=1.0, eo_gausspoints=5, eo_intervals=1, grid=None, boundary_info=None, preassemble=True)[source]¶ Discretizes an
StationaryProblem
using the finite volume method.Parameters
 analytical_problem
 The
StationaryProblem
to discretize.  diameter
 If not
None
,diameter
is passed as an argument to thedomain_discretizer
.  domain_discretizer
 Discretizer to be used for discretizing the analytical domain. This has
to be a function
domain_discretizer(domain_description, diameter, ...)
. IfNone
,discretize_domain_default
is used.  grid_type
 If not
None
, this parameter is forwarded todomain_discretizer
to specify the type of the generatedGrid
.  num_flux
 The numerical flux to use in the finite volume formulation. Allowed
values are
'lax_friedrichs'
,'engquist_osher'
,'simplified_engquist_osher'
(seepymor.operators.fv
).  lxf_lambda
 The stabilization parameter for the LaxFriedrichs numerical flux (ignored, if different flux is chosen).
 eo_gausspoints
 Number of Gauss points for the EngquistOsher numerical flux (ignored, if different flux is chosen).
 eo_intervals
 Number of subintervals to use for integration when using EngquistOsher numerical flux (ignored, if different flux is chosen).
 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 ifgrid
is specified.  preassemble
 If
True
, preassemble all operators in the resultingDiscretization
.
Returns
 d
 The
Discretization
that has been generated.  data
Dictionary with the following entries:
grid: The generated Grid
.boundary_info: The generated BoundaryInfo
.