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 aStationaryProblem
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
time-stepper
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 resultingModel
.
Returns
- m
The
Model
that has been generated.- data
Dictionary with the following entries:
- grid
The generated
Grid
.- boundary_info
The generated
BoundaryInfo
.- unassembled_m
In case
preassemble
isTrue
, the generatedModel
before preassembling operators.
-
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 a
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 resultingModel
.
Returns
- m
The
Model
that has been generated.- data
Dictionary with the following entries:
- grid
The generated
Grid
.- boundary_info
The generated
BoundaryInfo
.- unassembled_m
In case
preassemble
isTrue
, the generatedModel
before preassembling operators.
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
InstationaryModel
from file.Similarly to
discretize_stationary_from_disk
, the model is specified via anini.
-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. IfNone
, implicit Euler time stepping is used.
Returns
- m
The
InstationaryModel
that has been generated.
-
pymor.discretizers.disk.
discretize_stationary_from_disk
(parameter_file)[source]¶ Load a linear affinely decomposed
StationaryModel
from file.The model 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 matricesL_1
,L_2
, … and vectorsF_1.mat
,F_2.mat
, … which correspond to the affine components of the operator and right-hand side. The respective coefficient functionals, are given via the string expressionsl_1(...)
,l_2(...)
, …,f_1(...)
in the (scalar-valued)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 right-hand 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:
[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
- m
The
StationaryModel
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 aStationaryProblem
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 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).
- 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
time-stepper
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 resultingModel
.
Returns
- m
The
Model
that has been generated.- data
Dictionary with the following entries:
- grid
The generated
Grid
.- boundary_info
The generated
BoundaryInfo
.- unassembled_m
In case
preassemble
isTrue
, the generatedModel
before preassembling operators.
-
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 a
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 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).
- 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 resultingModel
.
Returns
- m
The
Model
that has been generated.- data
Dictionary with the following entries:
- grid
The generated
Grid
.- boundary_info
The generated
BoundaryInfo
.- unassembled_m
In case
preassemble
isTrue
, the generatedModel
before preassembling operators.