KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
models.ReducedModel Class Reference

The KerMor reduced model class. More...

Detailed Description

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

buildReducedModel

function. Dont forget to call

offlineGenerations

at least once before reduction.

See Also
BaseModel BaseFullModel
Author
Daniel Wirtz
Date
23.03.2010
New in 0.5:
(Daniel Wirtz, 2011-08-23) Added a createImage method that per default saves the KerMor Logo with the models name in the KerMor.TempDirectory. This is used for example in general.AppExport to create an representing image for a reduced model.
Todo:
maybe make W dependent and return V if W has not been explicitly set

This class is part of the framework

KerMor - Model Order Reduction using Kernels

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< doubleV
 The matrix that has been used for projection. More...
 
matrix< doubleW
 The biorthogonal matrix for V, i.e. \(W^tV = I_d\). More...
 
matrix< doubleParamSamples
 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< doubleG = 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< doublescaledTimes
 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< doubleDefaultMu = "[]"
 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)
 

Constructor & Destructor Documentation

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().

Here is the caller graph for this function:

Member Function Documentation

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.

See Also
models.BaseFullModel models.BaseFullModel.buildReducedModel models.BaseFullModel.offlineGenerations
Parameters
varargincode build ( fullmodel, target_dim ) Required Parameters for varargin:
  • fullmodel A full model where the reduced model shall be created from.
  • target_dim The target dimension \(d\) of the reduced model. Uses the first \(d\) columns of the projection matrices \(V\) (and \(W\) if set, respectively) to create a subspace-projected reduced model.
Note
This method has the MATLAB method attribute Sealed set to true. It cannot be overwritten.
matlab documentation of method attributes.

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().

Here is the call graph for this function:

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.

Parameters
muThe parameter \(\mu\) for the simulation
inputidxThe integer index of the input function to use. If more than one inputs are specified this is a necessary argument.
Return values
tThe times at which the model was evaluated. Will equal the property Times
xThe state variables at the corresponding times t.
ctimeThe time needed for computation.
Note
This method has the MATLAB method attribute Sealed set to true. It cannot be overwritten.
matlab documentation of method attributes.

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

function models.ReducedModel.delete ( )

Definition at line 152 of file ReducedModel.m.

References ErrorEstimator, FullModel, V, and W.

function [JacFun , JPattern ] = models.ReducedModel.getJacobianInfo ( )
protected

Definition at line 313 of file ReducedModel.m.

References models.BaseModel.System, t, and ~isempty().

Here is the call graph for this function:

models.ReducedModel.methods ( Static  ,
Access  = protected 
)
function [f , ax ] = models.ReducedModel.plot ( double  t,
matrix< double y,
  varargin 
)

Definition at line 337 of file ReducedModel.m.

References FullModel, and models.BaseModel.plot().

Here is the call graph for this function:

function [f , ax ] = models.ReducedModel.plotSingle ( double  t,
matrix< double y,
  varargin 
)

Definition at line 347 of file ReducedModel.m.

References FullModel, and models.BaseModel.plotSingle().

Here is the call graph for this function:

function [f , ax ] = models.ReducedModel.plotState ( double  t,
matrix< double y,
  varargin 
)

Definition at line 342 of file ReducedModel.m.

References FullModel, and models.BaseModel.plotState().

Here is the call graph for this function:

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.

Note
This method has the MATLAB method attribute Sealed set to true. It cannot be overwritten.
matlab documentation of method attributes.

Definition at line 284 of file ReducedModel.m.

References models.BaseFullModel.Approx, models.BaseFullModel.Data, and FullModel.

Member Data Documentation

* * Load local properties* models.ReducedModel.di = ALoadable.getObjectDict

Definition at line 431 of file ReducedModel.m.

models.ReducedModel.ErrorEstimator
* 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.

Note
This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public
Matlab documentation of property attributes.
This property has custom functionality when its value is changed.

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.

Note
This property has non-standard access specifiers: SetAccess = Private, GetAccess = Public
Matlab documentation of property attributes.

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.

* end* obj models.ReducedModel.V = s.V

Definition at line 438 of file ReducedModel.m.

obj models.ReducedModel.W = s.W

Definition at line 438 of file ReducedModel.m.


The documentation for this class was generated from the following file: