KerMor
0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
|
The KerMor reduced model class. More...
The KerMor reduced model class.
In difference to the BaseModels this class cannot be extended. All needed functionality for reduced models is included here (simulation, error computation etc) and no specific subclasses for other models need to be implemented. One can obtain a reduced model from a full model by calling the full model's
function. Dont forget to call
at least once before reduction.
This class is part of the framework
Homepage
http://www.morepas.org/software/index.htmlDocumentation
http://www.morepas.org/software/kermor/index.htmlLicense
KerMor license conditions Definition at line 18 of file ReducedModel.m.
Public Member Functions | |
ReducedModel (fullmodel) | |
function | delete () |
function | build (varargin) |
Creates a new reduced model instance from a full model. More... | |
function [
rowvec< double > t , matrix < double > x , double ctime ] = | computeTrajectory (colvec mu,integer inputidx) |
Computes an approximated solution/trajectory for the given mu and inputidx in the coefficient space. More... | |
function | saveFinal (filename) |
Saves this reduced model for final use. More... | |
function [
f , ax ] = | plot (double t,matrix< double > y, varargin) |
function [
f , ax ] = | plotState (double t,matrix< double > y, varargin) |
function [
f , ax ] = | plotSingle (double t,matrix< double > y, varargin) |
function [
file , folder ] = | createImage () |
This method can be invoked to obtain an image for the current model. More... | |
methods (Static, Access=protected)*function obj | |
*if | ~isempty (ex)*obj.FullModel |
Public Member Functions inherited from models.BaseModel | |
BaseModel () | |
function | delete () |
function | initDefaultParameter () |
Reads the default values of the System's ModelParam list and initializes the BaseModel.DefaultMu with it. More... | |
function [
rowvec< double > t , matrix < double > y , double sec , x ] = | simulate (colvec< double > mu,integer inputidx) |
Simulates the system and produces the system's output. More... | |
function [ handle f , handle ax ] = | plot (rowvec< double > t,matrix< double > y, varargin) |
Plots the results of the simulation. Override in subclasses for a more specific plot if desired. More... | |
function [ handle f , handle ax ] = | plotState (rowvec t,matrix< double > x, varargin) |
Plots the results of the simulation. Override in subclasses for a more specific plot if desired. More... | |
function [
f , ax ] = | plotSingle (double t,colvec< double > y, varargin) |
Plots a single solution. Override in subclasses for specific plot behaviour. More... | |
function | plotInputs (pm) |
function [
double t ,
colvec< double > x , double ctime ] = | solveStatic (colvec< double > mu,integer inputidx) |
Solves the linear system \(A(t,\mu)*x + f(t,\mu) + B(t,\mu)*u(t) = 0\). Spatial dependence of f is neglected in the current implementation (since this would require solving a nonlinear system). More... | |
function [
rowvec< double > t , matrix < double > x , double ctime ] = | computeTrajectory (colvec< double > mu,integer inputidx) |
Computes a solution/trajectory for the given mu and inputidx in the SCALED state space. More... | |
function matrix < double > mu = | getRandomParam (integer num,integer seed) |
Gets a random parameter sample from the system's parameter domain P. More... | |
Public Member Functions inherited from KerMorObject | |
KerMorObject () | |
Constructs a new KerMor object. More... | |
function | display () |
disp(object2str(this)); More... | |
function bool = | eq (B) |
Checks equality of two KerMor objects. More... | |
function bool = | ne (B) |
Checks if two KerMorObjects are different. More... | |
function cn = | getClassName () |
Returns the simple class name of this object without packages. More... | |
Public Member Functions inherited from DPCMObject | |
DPCMObject () | |
Creates a new DPCM object. More... | |
DPCMObject () | |
Public Attributes | |
models.BaseFullModel | FullModel |
The full model this reduced model was created from. More... | |
matrix< double > | V |
The matrix that has been used for projection. More... | |
matrix< double > | W |
The biorthogonal matrix for V, i.e. \(W^tV = I_d\). More... | |
matrix< double > | ParamSamples |
The originally used parameter samples. More... | |
error.BaseEstimator | ErrorEstimator |
The error estimator for the reduced model. More... | |
**Load BaseModel s properties * | obj = loadobj@models.BaseModel(s, obj) |
**Load local properties * | di = ALoadable.getObjectDict |
* | ex = di(s.FullModel.ID) |
*else *obj | FullModel = s.FullModel |
*end *obj | V = s.V |
obj | W = s.W |
*obj | ParamSamples = s.ParamSamples |
*obj | ErrorEstimator = s.ErrorEstimator |
Public Attributes inherited from models.BaseModel | |
models.BaseFirstOrderSystem | System = "[]" |
The actual dynamical system used in the model. More... | |
char | Name = "" |
The name of the Model. More... | |
matrix< double > | G = 1 |
The custom scalar product matrix \(\vG\). More... | |
double | RealTimePlottingMinPause = .1 |
Minimum pause between successive steps when RealTimePlotting is enabled. More... | |
logical | isStatic = false |
Determines if the model is time dependent or static. More... | |
integer | DefaultInput = "[]" |
The default input to use if none is given. More... | |
Times | |
Evaluation points \(\{0=t_0,\ldots,t_n=T\}\) of the model. More... | |
rowvec< double > | scaledTimes |
The time steps Times in scaled time units \(\tilde{t_i} = \frac{t_i}{\tau}\). More... | |
double | Tscaled |
The scaled end time \(\tilde{T} = \frac{T}{\tau}\). More... | |
double | tau |
Time scaling factor \(\tau\). More... | |
double | T |
The final timestep \(T\) up to which to simulate. More... | |
double | dt |
The desired time-stepsize \(\Delta t\) for simulations. More... | |
solvers.BaseSolver | ODESolver |
The solver to use for the ODE. Must be an instance of any solvers.BaseSolver subclass. More... | |
logical | RealTimePlotting |
Determines if the simulation should plot intermediate steps during computation. More... | |
colvec< double > | DefaultMu = "[]" |
The default parameter value if none is given. More... | |
dtscaled = .1 | |
The scaled timestep \(\tilde{\Delta t} = \frac{\Delta t}{\tau}\). More... | |
char | gitRefOnSave = "" |
Contains the GIT revision of this model when it was last saved. More... | |
Public Attributes inherited from DPCMObject | |
WorkspaceVariableName = "" | |
The workspace variable name of this class. Optional. More... | |
ID = "[]" | |
An ID that allows to uniquely identify this DPCMObject (at least within the current MatLab session/context). More... | |
PropertiesChanged = "[]" | |
The Dictionary containing all the property settings as key/value pairs. More... | |
Public Attributes inherited from handle | |
addlistener | |
Creates a listener for the specified event and assigns a callback function to execute when the event occurs. More... | |
notify | |
Broadcast a notice that a specific event is occurring on a specified handle object or array of handle objects. More... | |
delete | |
Handle object destructor method that is called when the object's lifecycle ends. More... | |
disp | |
Handle object disp method which is called by the display method. See the MATLAB disp function. More... | |
display | |
Handle object display method called when MATLAB software interprets an expression returning a handle object that is not terminated by a semicolon. See the MATLAB display function. More... | |
findobj | |
Finds objects matching the specified conditions from the input array of handle objects. More... | |
findprop | |
Returns a meta.property objects associated with the specified property name. More... | |
fields | |
Returns a cell array of string containing the names of public properties. More... | |
fieldnames | |
Returns a cell array of string containing the names of public properties. See the MATLAB fieldnames function. More... | |
isvalid | |
Returns a logical array in which elements are true if the corresponding elements in the input array are valid handles. This method is Sealed so you cannot override it in a handle subclass. More... | |
eq | |
Relational functions example. See details for more information. More... | |
transpose | |
Transposes the elements of the handle object array. More... | |
permute | |
Rearranges the dimensions of the handle object array. See the MATLAB permute function. More... | |
reshape | |
hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape function. More... | |
sort | |
ort the handle objects in any array in ascending or descending order. More... | |
Protected Member Functions | |
function [
JacFun , JPattern ] = | getJacobianInfo () |
Protected Member Functions inherited from models.BaseModel | |
function this = | saveobj () |
Store the current GIT branch in the object. More... | |
function | plotstep (src, ed) |
Callback for the ODE solvers StepPerformed event that enables during-simulation-plotting. More... | |
Protected Member Functions inherited from KerMorObject | |
function | checkType (obj, type) |
Object typechecker. More... | |
Protected Member Functions inherited from DPCMObject | |
function | registerProps (varargin) |
Call this method at any class that defines DPCM observed properties. More... | |
function | registerProps (varargin) |
Additional Inherited Members | |
Static Protected Member Functions inherited from models.BaseModel | |
static function this = | loadobj (this, s) |
Static Protected Member Functions inherited from DPCMObject | |
static function obj = | loadobj (obj, from) |
Re-register any registered change listeners! More... | |
static function obj = | loadobj (obj, from) |
models.ReducedModel.ReducedModel | ( | fullmodel | ) |
Definition at line 146 of file ReducedModel.m.
References FullModel.
* if models.ReducedModel::~isempty | ( | ex | ) |
Referenced by build(), computeTrajectory(), and getJacobianInfo().
function models.ReducedModel.build | ( | varargin | ) |
Creates a new reduced model instance from a full model.
Ensure that offlineGenerations have been called on the full model to provide any necessary reduction data.
varargin | code build ( fullmodel, target_dim ) Required Parameters for varargin:
|
Sealed
set to true. It cannot be overwritten. Definition at line 166 of file ReducedModel.m.
References models.BaseFullModel.Data, models.BaseModel.DefaultInput, models.BaseModel.DefaultMu, handle.disp, models.BaseModel.dt, ErrorEstimator, FullModel, models.BaseModel.G, models.BaseFirstOrderSystem.getReducedSystemInstance(), models.BaseModel.isStatic, models.BaseModel.Name, models.BaseModel.ODESolver, ParamSamples, error.BaseEstimator.prepareForReducedModel(), models.BaseModel.System, models.BaseModel.T, models.BaseModel.tau, V, W, and ~isempty().
function [ rowvec< double > t , matrix< double > x , double ctime ] = models.ReducedModel.computeTrajectory | ( | colvec | mu, |
integer | inputidx | ||
) |
Computes an approximated solution/trajectory for the given mu and inputidx in the coefficient space.
mu | The parameter \(\mu\) for the simulation |
inputidx | The integer index of the input function to use. If more than one inputs are specified this is a necessary argument. |
t | The times at which the model was evaluated. Will equal the property Times |
x | The state variables at the corresponding times t. |
ctime | The time needed for computation. |
Sealed
set to true. It cannot be overwritten. Definition at line 239 of file ReducedModel.m.
References error.BaseEstimator.clear(), error.BaseEstimator.Enabled, ErrorEstimator, error.BaseEstimator.ExtraODEDims, error.BaseEstimator.postProcess(), error.BaseEstimator.prepareConstants(), t, and ~isempty().
function [ file , folder ] = models.ReducedModel.createImage | ( | ) |
This method can be invoked to obtain an image for the current model.
If not overridden in subclasses, this method creates an png image using the KerMor logo and the model's name as text in it.
Definition at line 355 of file ReducedModel.m.
References KerMor.App(), models.BaseModel.Name, and Utils.saveFigure().
function models.ReducedModel.delete | ( | ) |
Definition at line 152 of file ReducedModel.m.
References ErrorEstimator, FullModel, V, and W.
|
protected |
Definition at line 313 of file ReducedModel.m.
References models.BaseModel.System, t, and ~isempty().
models.ReducedModel.methods | ( | Static | , |
Access | = protected |
||
) |
Definition at line 337 of file ReducedModel.m.
References FullModel, and models.BaseModel.plot().
Definition at line 347 of file ReducedModel.m.
References FullModel, and models.BaseModel.plotSingle().
Definition at line 342 of file ReducedModel.m.
References FullModel, and models.BaseModel.plotState().
function models.ReducedModel.saveFinal | ( | filename | ) |
Saves this reduced model for final use.
Using this method produces a small-sized file only suitable for online simulations. Most other functionalities or analysis will not work anymore as all large data has been discarded during the saving process.
Sealed
set to true. It cannot be overwritten. Definition at line 284 of file ReducedModel.m.
References models.BaseFullModel.Approx, models.BaseFullModel.Data, and FullModel.
* * Load local properties* models.ReducedModel.di = ALoadable.getObjectDict |
Definition at line 431 of file ReducedModel.m.
models.ReducedModel.ErrorEstimator |
The error estimator for the reduced model.
Default: []
Dependent
set to true. Definition at line 118 of file ReducedModel.m.
Referenced by build(), computeTrajectory(), delete(), testing.DEIM.effectivityAnalysis(), testing.DEIM.getDEIMEstimators_ErrOrders(), testing.DEIM.getDEIMEstimators_MDEIM_ST(), testing.DEIM.getDEIMReducedModelErrors(), EstimatorAnalyzer.getErrorEstimates(), and EstimatorAnalyzer.setModel().
* obj models.ReducedModel.ErrorEstimator = s.ErrorEstimator |
Definition at line 440 of file ReducedModel.m.
* models.ReducedModel.ex = di(s.FullModel.ID) |
Definition at line 432 of file ReducedModel.m.
models.ReducedModel.FullModel |
The full model this reduced model was created from.
Once an instance of a reduced model gets saved to disk, the FullModels .Data and .Approx properties get set to [] for disk space reduction since these properties are not necessarily used by the reduced system. So far, only error computations will take longer since the initial snapshots are not available anymore.
SetAccess = Private, GetAccess = Public
Definition at line 53 of file ReducedModel.m.
Referenced by error.alpha.Base.Base(), build(), error.DefaultEstimator.DefaultEstimator(), delete(), testing.DEIM.effectivityAnalysis(), error.DEIMEstimator.getAlpha(), error.DEIMEstimator.getBeta(), EstimatorAnalyzer.getDefaultEstStruct(), testing.DEIM.getDEIMReducedModelErrors(), testing.DEIM.getTrajApproxErrorDEIMEstimates(), error.alpha.Constant.inputOfflineComputations(), error.alpha.AffineParametric.inputOfflineComputations(), plot(), plotSingle(), plotState(), error.DefaultEstimator.postProcess(), error.BaseEstimator.postProcess(), error.TPWLLocalLipEstimator.postProcess(), error.GLEstimator.prepareConstants(), error.initial.Constant.prepareForReducedModel(), error.initial.AffineParametric.prepareForReducedModel(), error.TPWLLocalLipEstimator.prepareForReducedModel(), error.BaseCompLemmaEstimator.prepareForReducedModel(), error.IterationCompLemmaEstimator.prepareForReducedModel(), error.DEIMEstimator.prepareForReducedModel(), ReducedModel(), saveFinal(), and error.TPWLLocalLipEstimator.validModelForEstimator().
* else* obj models.ReducedModel.FullModel = s.FullModel |
Definition at line 436 of file ReducedModel.m.
* * Load BaseModel s properties* models.ReducedModel.obj = loadobj@models.BaseModel(s, obj) |
Definition at line 428 of file ReducedModel.m.
models.ReducedModel.ParamSamples |
The originally used parameter samples.
The parameter samples that have been used for computation of the reduced model.
SetAccess = Private, GetAccess = Public
Definition at line 100 of file ReducedModel.m.
Referenced by build().
* obj models.ReducedModel.ParamSamples = s.ParamSamples |
Definition at line 439 of file ReducedModel.m.
models.ReducedModel.V |
The matrix that has been used for projection.
Default: []
SetAccess = Private, GetAccess = Public
Definition at line 72 of file ReducedModel.m.
Referenced by error.alpha.Base.Base(), build(), delete(), error.TPWLLocalLipEstimator.evalODEPart(), error.IterationCompLemmaEstimator.getBeta(), error.alpha.Constant.inputOfflineComputations(), error.alpha.AffineParametric.inputOfflineComputations(), error.DefaultEstimator.postProcess(), error.BaseEstimator.postProcess(), error.initial.Constant.prepareForReducedModel(), error.initial.AffineParametric.prepareForReducedModel(), error.TPWLLocalLipEstimator.prepareForReducedModel(), error.IterationCompLemmaEstimator.prepareForReducedModel(), and error.DEIMEstimator.prepareForReducedModel().
* end* obj models.ReducedModel.V = s.V |
Definition at line 438 of file ReducedModel.m.
models.ReducedModel.W |
The biorthogonal matrix for V, i.e. \(W^tV = I_d\).
If empty, and \(V\) is set, \(W=V\) is assumed.
Default: []
SetAccess = Private, GetAccess = Public
Definition at line 85 of file ReducedModel.m.
Referenced by error.alpha.Base.Base(), build(), delete(), error.alpha.Constant.inputOfflineComputations(), error.alpha.AffineParametric.inputOfflineComputations(), error.initial.Constant.prepareForReducedModel(), error.initial.AffineParametric.prepareForReducedModel(), error.TPWLLocalLipEstimator.prepareForReducedModel(), error.IterationCompLemmaEstimator.prepareForReducedModel(), and error.DEIMEstimator.prepareForReducedModel().
obj models.ReducedModel.W = s.W |
Definition at line 438 of file ReducedModel.m.