147 this =
this@models.BaseModel;
168 disp(
" Building reduced model... ");
171 if isempty(fullmodel.Approx) && isempty(fullmodel.SpaceReducer)
172 error(
" No reduction methods found on full model. No use in building a reduced model from it. ");
177 this.
Name= [
" Reduced: " fullmodel.Name];
181 this.
dt= fullmodel.dt;
182 this.
tau= fullmodel.tau;
189 [this.
V, this.
W] = fullmodel.assembleProjectionMatrices(varargin[:]);
193 fsys = fullmodel.System;
198 fms = fullmodel.ODESolver;
199 if isa(fms,
" solvers.SemiImplicitEuler ")
200 this.
ODESolver= solvers.SemiImplicitEuler(
this);
201 elseif isa(fms,
" solvers.FullyImplEuler ")
202 this.
ODESolver= solvers.FullyImplEuler(
this);
209 if ~isempty(fullmodel.ErrorEstimator)
262 ctime = ctime + cpre + cpost;
263 fprintf(
" Finished after %gs\n ",ctime);
291 save(filename,
" this ");
314 est = this.fErrorEstimator;
318 edims = est.ExtraODEDims;
321 JacFun_ = @(
t, x)sys.A.getStateJacobian(x(1:end-edims),
t) + sys.f.getStateJacobian(x(1:end-edims),
t);
323 JacFun_ = @(
t, x)sys.A.getStateJacobian(x(1:end-edims),
t);
325 JacFun_ = @(
t, x)sys.f.getStateJacobian(x(1:end-edims),
t);
329 pad = zeros(edims,edims);
330 JacFun = @(
t, x)blkdiag(JacFun_(
t,x),pad);
359 text(-6,5,1.05,n,
" FontSize ",14,
" FontWeight ",
" bold ");
361 file =
" modelimage ";
363 file = [file
" .png "];
378 #if 0 //mtoc++: 'get.ErrorEstimator'
380 e = this.fErrorEstimator;
387 #if 0 //mtoc++: 'set.ErrorEstimator'
390 if ~isa(value," error.BaseEstimator ")
391 error(" The
ErrorEstimator property must be a subclass of the error.BaseEstimator class. ");
393 msg = value.validModelForEstimator(this.
FullModel);
398 this.fErrorEstimator= value;
405 #if 0 //mtoc++: 'set.FullModel'
407 if ~isempty(value) && ~isa(value,
" models.BaseFullModel ")
410 this.FullModel= value;
417 methods(Static,Access=
protected)
419 * % Creates a
new reduced model instance and loads its properties
420 * % from the given
struct.
422 * % This method is only implemented as the
property assignment
423 * % order is important
for a reduced model (example: cannot set
424 * % an error estimator before having set the models system)
425 * obj = models.ReducedModel;
428 * obj = loadobj@models.BaseModel(s, obj);
430 * % Load local properties
431 * di = ALoadable.getObjectDict;
432 * ex = di(s.FullModel.ID);
434 * obj.FullModel = ex;
436 * obj.FullModel = s.FullModel;
438 * obj.V = s.V; obj.W = s.W;
439 * obj.ParamSamples = s.ParamSamples;
440 * obj.ErrorEstimator = s.ErrorEstimator;
char Name
The name of the Model.
Collection of generally useful functions.
**Load BaseModel s properties * obj
BaseModel: Base class for both full and reduced models.
logical isStatic
Determines if the model is time dependent or static.
The base class for any KerMor detailed model.
models.BaseFullModel FullModel
The full model this reduced model was created from.
double dt
The desired time-stepsize for simulations.
function [ f , ax ] = plotState(double t,matrix< double > y, varargin)
*if ~isempty(ex)*obj.FullModel
models.BaseFirstOrderSystem System
The actual dynamical system used in the model.
methods(Static, Access=protected)*function obj
matrix< double > ParamSamples
The originally used parameter samples.
function build(varargin)
Creates a new reduced model instance from a full model.
function rsys = getReducedSystemInstance(models.ReducedModel rmodel)
Creates a reduced system given the current system and the reduced model.
matrix< double > G
The custom scalar product matrix .
The KerMor reduced model class.
matrix< double > V
The matrix that has been used for projection.
matrix< double > W
The biorthogonal matrix for V, i.e. .
Base class for all error estimators.
Enabled
Flag that indicates whether error estimation is used or not.
A variable number of input arguments.
error.BaseEstimator ErrorEstimator
The error estimator for the reduced model.
double tau
Time scaling factor .
solvers.BaseSolver ODESolver
The solver to use for the ODE. Must be an instance of any solvers.BaseSolver subclass.
function double ct = postProcess(unused1,rowvec t, unused2)
Post-processes the error estimator ODE part after reduced simulation computation. ...
static function saveFigure(fig, filename, ext)
Opens a matlab save dialog and saves the given figure to the file selected.
function [ f , ax ] = plotSingle(double t,colvec< double > y, varargin)
Plots a single solution. Override in subclasses for specific plot behaviour.
integer DefaultInput
The default input to use if none is given.
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...
function prepared = prepareForReducedModel(models.ReducedModel rmodel)
Default implementation which simply clones this (subclass!)instance and returns the copy to use in re...
approx.BaseApprox Approx
The approximation method for the CoreFunction.
disp
Handle object disp method which is called by the display method. See the MATLAB disp function...
double T
The final timestep up to which to simulate.
data.ModelData Data
The full model's data container. Defaults to an empty container.
function [ file , folder ] = createImage()
This method can be invoked to obtain an image for the current model.
function ct = prepareConstants(colvec< double > mu, unused1)
function [ f , ax ] = plotSingle(double t,matrix< double > y, varargin)
colvec< double > DefaultMu
The default parameter value if none is given.
function saveFinal(filename)
Saves this reduced model for final use.
static function this = loadobj(this, s)
function [ f , ax ] = plot(double t,matrix< double > y, varargin)
function clear()
Clears the last error set by the estimator.
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...
Global configuration class for all KerMor run-time settings.
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...
static function KerMor theinstance = App()
The singleton KerMor instance.
ExtraODEDims
The dimensions added to the ODE function by the estimator.
function [ JacFun , JPattern ] = getJacobianInfo()