pymordemos package¶
Submodules¶
analyze_pickle module¶
-
pymordemos.analyze_pickle.
_bins
(start, stop, steps=100)[source]¶ numpy has a quirk in unreleased master where logspace might sometimes not return a 1d array
-
pymordemos.analyze_pickle.
convergence
(reduced_data: str = <typer.models.ArgumentInfo object>, detailed_data: str = <typer.models.ArgumentInfo object>, samples: int = <typer.models.ArgumentInfo object>, error_norm: str = <typer.models.OptionInfo object>, ndim: int = <typer.models.OptionInfo object>)[source]¶
-
pymordemos.analyze_pickle.
histogram
(reduced_data: str = <typer.models.ArgumentInfo object>, samples: int = <typer.models.ArgumentInfo object>, detailed_data: str = <typer.models.OptionInfo object>, error_norm: str = <typer.models.OptionInfo object>)[source]¶
burgers module¶
Burgers demo.
-
pymordemos.burgers.
main
(exp: float = <typer.models.ArgumentInfo object>, grid: int = <typer.models.OptionInfo object>, grid_type: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, initial_data: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, lxf_lambda: float = <typer.models.OptionInfo object>, periodic: bool = <typer.models.OptionInfo object>, nt: int = <typer.models.OptionInfo object>, num_flux: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, vx: float = <typer.models.OptionInfo object>, vy: float = <typer.models.OptionInfo object>)[source]¶ Solves a two-dimensional Burgers-type equation.
See pymor.analyticalproblems.burgers for more details.
burgers_ei module¶
-
pymordemos.burgers_ei.
main
(exp_min: float = <typer.models.ArgumentInfo object>, exp_max: float = <typer.models.ArgumentInfo object>, ei_snapshots: int = <typer.models.ArgumentInfo object>, ei_size: int = <typer.models.ArgumentInfo object>, snapshots: int = <typer.models.ArgumentInfo object>, rb_size: int = <typer.models.ArgumentInfo object>, cache_region: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, ei_alg: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, grid: int = <typer.models.OptionInfo object>, grid_type: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, initial_data: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, ipython_engines: int = <typer.models.OptionInfo object>, ipython_profile: str = <typer.models.OptionInfo object>, lxf_lambda: float = <typer.models.OptionInfo object>, periodic: bool = <typer.models.OptionInfo object>, nt: int = <typer.models.OptionInfo object>, num_flux: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, plot_err: bool = <typer.models.OptionInfo object>, plot_ei_err: bool = <typer.models.OptionInfo object>, plot_error_landscape: bool = <typer.models.OptionInfo object>, plot_error_landscape_M: int = <typer.models.OptionInfo object>, plot_error_landscape_N: int = <typer.models.OptionInfo object>, plot_solutions: bool = <typer.models.OptionInfo object>, test: int = <typer.models.OptionInfo object>, vx: float = <typer.models.OptionInfo object>, vy: float = <typer.models.OptionInfo object>)[source]¶ Model order reduction of a two-dimensional Burgers-type equation (see pymor.analyticalproblems.burgers) using the reduced basis method with empirical operator interpolation.
delay module¶
-
pymordemos.delay.
main
(tau: float = <typer.models.ArgumentInfo object>, r: int = <typer.models.ArgumentInfo object>)[source]¶ Delay demo.
Cascade of delay and integrator
elliptic module¶
-
pymordemos.elliptic.
main
(problem_number: int = <typer.models.ArgumentInfo object>, dirichlet_number: int = <typer.models.ArgumentInfo object>, neumann_number: int = <typer.models.ArgumentInfo object>, neumann_count: int = <typer.models.ArgumentInfo object>, fv: bool = <typer.models.OptionInfo object>, rect: bool = <typer.models.OptionInfo object>)[source]¶ Solves the Poisson equation in 2D using pyMOR’s builtin discreization toolkit.
elliptic2 module¶
-
pymordemos.elliptic2.
main
(problem_number: int = <typer.models.ArgumentInfo object>, n: int = <typer.models.ArgumentInfo object>, norm: str = <typer.models.ArgumentInfo object>, fv: bool = <typer.models.OptionInfo object>)[source]¶ Solves the Poisson equation in 2D using pyMOR’s builtin discreization toolkit.
elliptic_oned module¶
-
pymordemos.elliptic_oned.
main
(problem_number: int = <typer.models.ArgumentInfo object>, n: int = <typer.models.ArgumentInfo object>, fv: bool = <typer.models.OptionInfo object>)[source]¶ Solves the Poisson equation in 1D using pyMOR’s builtin discreization toolkit.
elliptic_unstructured module¶
-
pymordemos.elliptic_unstructured.
main
(angle: float = <typer.models.ArgumentInfo object>, num_points: int = <typer.models.ArgumentInfo object>, clscale: float = <typer.models.ArgumentInfo object>)[source]¶ Solves the Poisson equation in 2D on a circular sector domain of radius 1 using an unstructured mesh.
Note that Gmsh (http://geuz.org/gmsh/) is required for meshing.
fenics_nonlinear module¶
-
pymordemos.fenics_nonlinear.
main
(dim: int = <typer.models.ArgumentInfo object>, n: int = <typer.models.ArgumentInfo object>, order: int = <typer.models.ArgumentInfo object>)[source]¶ Reduces a FEniCS-based nonlinear diffusion problem using POD/DEIM.
hapod module¶
-
pymordemos.hapod.
main
(tol: float = <typer.models.ArgumentInfo object>, dist: int = <typer.models.ArgumentInfo object>, inc: int = <typer.models.ArgumentInfo object>, grid: int = <typer.models.OptionInfo object>, nt: int = <typer.models.OptionInfo object>, omega: float = <typer.models.OptionInfo object>, procs: int = <typer.models.OptionInfo object>, snap: int = <typer.models.OptionInfo object>, threads: int = <typer.models.OptionInfo object>)[source]¶ Compression of snapshot data with the HAPOD algorithm from [HLR18].
heat module¶
-
pymordemos.heat.
main
(diameter: float = <typer.models.ArgumentInfo object>, r: int = <typer.models.ArgumentInfo object>)[source]¶ 2D heat equation demo.
Discretization of the PDE:
\begin{align*} \partial_t z(x, y, t) &= \Delta z(x, y, t), & 0 < x, y < 1,\ t > 0 \\ -\nabla z(0, y, t) \cdot n &= z(0, y, t) - u(t), & 0 < y < 1, t > 0 \\ -\nabla z(1, y, t) \cdot n &= z(1, y, t), & 0 < y < 1, t > 0 \\ -\nabla z(0, x, t) \cdot n &= z(0, x, t), & 0 < x < 1, t > 0 \\ -\nabla z(1, x, t) \cdot n &= z(1, x, t), & 0 < x < 1, t > 0 \\ z(x, y, 0) &= 0 & 0 < x, y < 1 \\ y(t) &= \int_0^1 z(1, y, t) dy, & t > 0 \\ \end{align*}where \(u(t)\) is the input and \(y(t)\) is the output.
-
pymordemos.heat.
run_mor_method
(lti, w, reductor, reductor_short_name, r, **reduce_kwargs)[source]¶ Run a model order reduction method.
Parameters
- lti
The full-order
LTIModel
.- w
Array of frequencies.
- reductor
The reductor object.
- reductor_short_name
A short name for the reductor.
- r
The order of the reduced-order model.
- reduce_kwargs
Optional keyword arguments for the reduce method.
linear_optimization module¶
-
pymordemos.linear_optimization.
main
(grid_intervals: int = <typer.models.ArgumentInfo object>, training_samples: int = <typer.models.ArgumentInfo object>)[source]¶ Example script for solving linear PDE-constrained parameter optimization problems
neural_networks module¶
-
pymordemos.neural_networks.
main
(grid_intervals: int = <typer.models.ArgumentInfo object>, training_samples: int = <typer.models.ArgumentInfo object>, validation_samples: int = <typer.models.ArgumentInfo object>, fv: bool = <typer.models.OptionInfo object>, vis: bool = <typer.models.OptionInfo object>)[source]¶ Model oder reduction with neural networks (approach by Hesthaven and Ubbiali).
neural_networks_fenics module¶
-
pymordemos.neural_networks_fenics.
main
(training_samples: int = <typer.models.ArgumentInfo object>, validation_samples: int = <typer.models.ArgumentInfo object>)[source]¶ Reduction of a FEniCS model using neural networks (approach by Hesthaven and Ubbiali).
neural_networks_instationary module¶
-
pymordemos.neural_networks_instationary.
main
(grid_intervals: int = <typer.models.ArgumentInfo object>, time_steps: int = <typer.models.ArgumentInfo object>, training_samples: int = <typer.models.ArgumentInfo object>, validation_samples: int = <typer.models.ArgumentInfo object>)[source]¶ Model oder reduction with neural networks for an instationary problem (approach by Hesthaven and Ubbiali).
parabolic module¶
-
pymordemos.parabolic.
dar
(speed: float = <typer.models.ArgumentInfo object>, fv: bool = <typer.models.OptionInfo object>, grid: int = <typer.models.OptionInfo object>, nt: int = <typer.models.OptionInfo object>, rect: bool = <typer.models.OptionInfo object>)[source]¶
-
pymordemos.parabolic.
heat
(top: float = <typer.models.ArgumentInfo object>, fv: bool = <typer.models.OptionInfo object>, grid: int = <typer.models.OptionInfo object>, nt: int = <typer.models.OptionInfo object>, rect: bool = <typer.models.OptionInfo object>)[source]¶
parabolic_mor module¶
-
pymordemos.parabolic_mor.
main
(backend: pymor.tools.typer.Choices = <typer.models.ArgumentInfo object>, alg: pymor.tools.typer.Choices = <typer.models.ArgumentInfo object>, snapshots: int = <typer.models.ArgumentInfo object>, rbsize: int = <typer.models.ArgumentInfo object>, test: int = <typer.models.ArgumentInfo object>)[source]¶ Reduced basis approximation of the heat equation.
-
pymordemos.parabolic_mor.
reduce_adaptive_greedy
(fom, reductor, parameter_space, validation_mus, basis_size)[source]¶
-
pymordemos.parabolic_mor.
reduce_greedy
(fom, reductor, parameter_space, snapshots, basis_size)[source]¶
parametric_delay module¶
-
pymordemos.parametric_delay.
main
(r: int = <typer.models.ArgumentInfo object>)[source]¶ Parametric delay demo.
parametric_heat module¶
-
pymordemos.parametric_heat.
main
(diameter: float = <typer.models.ArgumentInfo object>, r: int = <typer.models.ArgumentInfo object>)[source]¶ Parametric 1D heat equation example.
-
pymordemos.parametric_heat.
run_mor_method_param
(fom, r, w, mus, reductor_cls, reductor_short_name, **reductor_kwargs)[source]¶ Plot reductor errors for different parameter values.
Parameters
- fom
The full-order
LTIModel
.- r
The order of the reduced-order model.
- w
Array of frequencies.
- mus
An array of parameter values.
- reductor_cls
The reductor class.
- reductor_short_name
A short name for the reductor.
- reductor_kwargs
Optional keyword arguments for the reductor class.
parametric_string module¶
-
pymordemos.parametric_string.
main
(n: int = <typer.models.ArgumentInfo object>, r: int = <typer.models.ArgumentInfo object>)[source]¶ Parametric string example.
parametric_synthetic module¶
-
pymordemos.parametric_synthetic.
main
(n: int = <typer.models.ArgumentInfo object>, r: int = <typer.models.ArgumentInfo object>)[source]¶ Synthetic parametric demo.
See the MOR Wiki page.
string_equation module¶
-
pymordemos.string_equation.
main
(n: int = <typer.models.ArgumentInfo object>, r: int = <typer.models.ArgumentInfo object>)[source]¶ String equation example.
thermalblock module¶
-
pymordemos.thermalblock.
discretize_fenics
(xblocks, yblocks, grid_num_intervals, element_order)[source]¶
-
pymordemos.thermalblock.
discretize_pymor
(xblocks, yblocks, grid_num_intervals, use_list_vector_array)[source]¶
-
pymordemos.thermalblock.
main
(xblocks: int = <typer.models.ArgumentInfo object>, yblocks: int = <typer.models.ArgumentInfo object>, snapshots: int = <typer.models.ArgumentInfo object>, rbsize: int = <typer.models.ArgumentInfo object>, adaptive_greedy_gamma: float = <typer.models.OptionInfo object>, adaptive_greedy_rho: float = <typer.models.OptionInfo object>, adaptive_greedy_theta: float = <typer.models.OptionInfo object>, alg: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, cache_region: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, extension_alg: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, fenics: bool = <typer.models.OptionInfo object>, greedy_with_error_estimator: bool = <typer.models.OptionInfo object>, grid: int = <typer.models.OptionInfo object>, ipython_engines: int = <typer.models.OptionInfo object>, ipython_profile: str = <typer.models.OptionInfo object>, list_vector_array: bool = <typer.models.OptionInfo object>, order: int = <typer.models.OptionInfo object>, pickle: str = <typer.models.OptionInfo object>, product: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, plot_err: bool = <typer.models.OptionInfo object>, plot_error_sequence: bool = <typer.models.OptionInfo object>, plot_solutions: bool = <typer.models.OptionInfo object>, reductor: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, test: int = <typer.models.OptionInfo object>)[source]¶ Thermalblock demo.
-
pymordemos.thermalblock.
reduce_adaptive_greedy
(fom, reductor, parameter_space, validation_mus, extension_alg_name, max_extensions, use_error_estimator, rho, gamma, theta, pool)[source]¶
-
pymordemos.thermalblock.
reduce_greedy
(fom, reductor, parameter_space, snapshots_per_block, extension_alg_name, max_extensions, use_error_estimator, pool)[source]¶
-
pymordemos.thermalblock.
reduce_pod
(fom, reductor, parameter_space, snapshots_per_block, basis_size)[source]¶
thermalblock_adaptive module¶
-
pymordemos.thermalblock_adaptive.
main
(rbsize: int = <typer.models.ArgumentInfo object>, cache_region: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, error_estimator: bool = <typer.models.OptionInfo object>, gamma: float = <typer.models.OptionInfo object>, grid: int = <typer.models.OptionInfo object>, ipython_engines: int = <typer.models.OptionInfo object>, ipython_profile: str = <typer.models.OptionInfo object>, list_vector_array: bool = <typer.models.OptionInfo object>, pickle: str = <typer.models.OptionInfo object>, plot_err: bool = <typer.models.OptionInfo object>, plot_solutions: bool = <typer.models.OptionInfo object>, plot_error_sequence: bool = <typer.models.OptionInfo object>, product: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, reductor: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, rho: float = <typer.models.OptionInfo object>, test: int = <typer.models.OptionInfo object>, theta: float = <typer.models.OptionInfo object>, validation_mus: int = <typer.models.OptionInfo object>, visualize_refinement: bool = <typer.models.OptionInfo object>)[source]¶ Modified thermalblock demo using adaptive greedy basis generation algorithm.
thermalblock_gui module¶
-
class
pymordemos.thermalblock_gui.
AllPanel
(parent, reduced_sim, detailed_sim)[source]¶ Bases:
QWidget
Methods
Attributes
staticMetaObject
customContextMenuRequested
,DrawChildren
,DrawWindowBackground
,IgnoreMask
,RenderFlag
,RenderFlags
,windowIconChanged
,windowIconTextChanged
,windowTitleChanged
destroyed
,objectNameChanged
PaintDeviceMetric
,painters
,PdmDepth
,PdmDevicePixelRatio
,PdmDevicePixelRatioScaled
,PdmDpiX
,PdmDpiY
,PdmHeight
,PdmHeightMM
,PdmNumColors
,PdmPhysicalDpiX
,PdmPhysicalDpiY
,PdmWidth
,PdmWidthMM
-
class
pymordemos.thermalblock_gui.
DetailedSim
(*args)[source]¶ Bases:
pymordemos.thermalblock_gui.SimBase
Methods
solve
-
class
pymordemos.thermalblock_gui.
ParamRuler
(parent, sim)[source]¶ Bases:
QWidget
Methods
Attributes
staticMetaObject
customContextMenuRequested
,DrawChildren
,DrawWindowBackground
,IgnoreMask
,RenderFlag
,RenderFlags
,windowIconChanged
,windowIconTextChanged
,windowTitleChanged
destroyed
,objectNameChanged
PaintDeviceMetric
,painters
,PdmDepth
,PdmDevicePixelRatio
,PdmDevicePixelRatioScaled
,PdmDpiX
,PdmDpiY
,PdmHeight
,PdmHeightMM
,PdmNumColors
,PdmPhysicalDpiX
,PdmPhysicalDpiY
,PdmWidth
,PdmWidthMM
-
class
pymordemos.thermalblock_gui.
RBGui
(*args)[source]¶ Bases:
QMainWindow
Methods
Attributes
staticMetaObject
AllowNestedDocks
,AllowTabbedDocks
,AnimatedDocks
,DockOption
,DockOptions
,ForceTabbedDocks
,GroupedDragging
,iconSizeChanged
,tabifiedDockWidgetActivated
,toolButtonStyleChanged
,VerticalTabs
customContextMenuRequested
,DrawChildren
,DrawWindowBackground
,IgnoreMask
,RenderFlag
,RenderFlags
,windowIconChanged
,windowIconTextChanged
,windowTitleChanged
destroyed
,objectNameChanged
PaintDeviceMetric
,painters
,PdmDepth
,PdmDevicePixelRatio
,PdmDevicePixelRatioScaled
,PdmDpiX
,PdmDpiY
,PdmHeight
,PdmHeightMM
,PdmNumColors
,PdmPhysicalDpiX
,PdmPhysicalDpiY
,PdmWidth
,PdmWidthMM
-
class
pymordemos.thermalblock_gui.
ReducedSim
(*args)[source]¶ Bases:
pymordemos.thermalblock_gui.SimBase
Methods
solve
-
class
pymordemos.thermalblock_gui.
SimBase
(xblocks, yblocks, snapshots, rbsize, grid, product)[source]¶ Bases:
object
-
class
pymordemos.thermalblock_gui.
SimPanel
(parent, sim)[source]¶ Bases:
QWidget
Methods
Attributes
staticMetaObject
customContextMenuRequested
,DrawChildren
,DrawWindowBackground
,IgnoreMask
,RenderFlag
,RenderFlags
,windowIconChanged
,windowIconTextChanged
,windowTitleChanged
destroyed
,objectNameChanged
PaintDeviceMetric
,painters
,PdmDepth
,PdmDevicePixelRatio
,PdmDevicePixelRatioScaled
,PdmDpiX
,PdmDpiY
,PdmHeight
,PdmHeightMM
,PdmNumColors
,PdmPhysicalDpiX
,PdmPhysicalDpiY
,PdmWidth
,PdmWidthMM
-
pymordemos.thermalblock_gui.
main
(xblocks: int = <typer.models.ArgumentInfo object>, yblocks: int = <typer.models.ArgumentInfo object>, snapshots: int = <typer.models.ArgumentInfo object>, rbsize: int = <typer.models.ArgumentInfo object>, grid: int = <typer.models.OptionInfo object>, product: pymor.tools.typer.Choices = <typer.models.OptionInfo object>, testing: bool = <typer.models.OptionInfo object>)[source]¶ Thermalblock demo with GUI.
thermalblock_simple module¶
Simplified version of the thermalblock demo.
- Usage:
thermalblock_simple.py MODEL ALG SNAPSHOTS RBSIZE TEST
Arguments:
-
pymordemos.thermalblock_simple.
main
(model: pymor.tools.typer.Choices = <typer.models.ArgumentInfo object>, alg: pymor.tools.typer.Choices = <typer.models.ArgumentInfo object>, snapshots: int = <typer.models.ArgumentInfo object>, rbsize: int = <typer.models.ArgumentInfo object>, test: int = <typer.models.ArgumentInfo object>)[source]¶
-
pymordemos.thermalblock_simple.
reduce_adaptive_greedy
(fom, reductor, parameter_space, validation_mus, basis_size)[source]¶
-
pymordemos.thermalblock_simple.
reduce_greedy
(fom, reductor, parameter_space, snapshots, basis_size)[source]¶