78 this =
this@models.BaseFirstOrderSystem(rmodel);
90 disp(
" Start building reduced system... ");
93 fullmodel = rmodel.FullModel;
94 fullsys = fullmodel.System;
98 if ~isempty(fullmodel.SpaceReducer) && isempty(V)
99 error([
" Model has a SpaceReducer but no projection "...
100 " matrix V is given. Forgot to call offlineGenerations? "]);
105 if ~isempty(V) && isempty(W)
117 s = fullmodel.System.StateScaling;
120 dim = fullsys.NumStateDofs;
125 SV = spdiags(s,0,dim,dim);
126 SW = spdiags(1./s,0,dim,dim);
137 this.
Params= fullsys.Params;
138 this.
Inputs= fullsys.Inputs;
150 if ~isempty(fullsys.x0)
155 this.
C= fullsys.
C.project(SR,SW);
157 if ~isempty(fullsys.x0)
161 this.
C= fullsys.
C.clone;
169 if ~isempty(fullsys.B)
173 if ~isempty(fullsys.A)
174 this.
A= fullsys.
A.project(V,W);
177 if ~isempty(fullmodel.Approx)
178 this.
f= fullmodel.Approx.
project(V,W);
179 elseif ~isempty(fullsys.f)
181 this.f= fullsys.f.project(this.R,W);
184 if ~isempty(fullsys.M)
190 if ~isempty(fullsys.g)
191 this.
g= fullsys.g.
project(this.R,1);
192 this.g.setSystem(
this);
196 if ~isempty(fullmodel.Approx)
197 this.f= fullmodel.Approx;
203 this.f.setSystem(
this);
207 this.plotPtr= @fullsys.plot;
240 this.plotPtr(model, t, y);
254 est = this.
Model.ErrorEstimator;
255 haveest = ~isempty(est) && est.Enabled;
258 x = x(1:end-est.ExtraODEDims,:);
261 dx =
ODEFun@models.BaseFirstOrderSystem(
this,t,x);
264 dx = [dx; est.evalODEPart(xall, t, this.
u(t))];
270 est = this.
Model.ErrorEstimator;
271 haveest = ~isempty(est) && est.Enabled;
273 xc = xc(1:end-est.ExtraODEDims,:);
275 J =
getJacobian@models.BaseFirstOrderSystem(
this, t, xc);
284 x0 =
getX0@models.BaseFirstOrderSystem(
this, mu);
286 if ~isempty(m.ErrorEstimator) && m.ErrorEstimator.Enabled
287 x0 = [
x0; m.ErrorEstimator.getE0(mu)];
325 if ~isa(model,
" models.ReducedModel ")
326 error(
" The Model property has to be a child of models.ReducedModel ");
function updateDimensions()
Params
The parameters usable for the dynamical system.
function plot(models.BaseFullModel model,double t,matrix< double > y)
Unless overridden for specific reduced system plots this method just calls the plot method of the ori...
The base class for any KerMor detailed model.
dscomponents.AInputConv B
The input conversion.
function R = compileReconstructionMatrix(V)
Model
The Model this System is attached to.
ReducedSystem: A KerMor reduced dynamical system.
function J = getJacobian(double t, xc)
ReducedSystem(rmodel)
Creates a new ReducedSystem instance.
dscomponents.AInitialValue x0
Function handle to initial state evaluation.
function build()
Creates a reduced system from BaseFullModel child system. As default, all system's components are cop...
function x0 = getX0(colvec< double > mu)
Gets the initial value of .
mu
The current parameter for simulations, [] is none used.
function dx = ODEFun(double t,colvec< double > x)
Inputs
The system's possible input functions. A cell array of function handles, each taking a time argument ...
colvec StateScaling
The scaling for the state vectors.
disp
Handle object disp method which is called by the display method. See the MATLAB disp function...
function handle target = project(matrix< double > V,matrix< double > W,handle target)
Returns a NEW INSTANCE of the projected object that does not rely on data of the old one via referenc...
function copy = clone(copy)
The interface method with returns a copy of the current class instance.
R
The reduced dof to full dof reconstruction matrix.
function validateModel(models.BaseFullModel model)
Overrides the validateModel function in BaseFirstOrderSystem.
A
The systems core function matrix.
dscomponents.LinearOutputConv C
The output conversion Defaults to an LinearOutputConv instance using a 1-matrix, which just forwards ...
dscomponents.ACoreFun f
The core f function from the dynamical system.
dscomponents.ACoreFun g
The system's algebraic constraints function.
SparsityPattern
The global sparsity pattern for the entire RHS.
dscomponents.AMassMatrix M
The system's mass matrix.
u
The current input function as function handle, [] if none used.
double MaxTimestep
The maximum timestep allowed for any ODE solvers.
Base class for all KerMor first-order dynamical systems.
function updateSparsityPattern()
Reduced systems are not sparse anymore.
function target = project(V, W, target)
Sets the protected matrices that can be utilized on core function evaluations after projection...
dscomponents.LinearCoreFun A
Represents a linear or affine-linear component of the dynamical system.