KerMor
0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
|
Model: Model for a FEM-discretized muscle model. More...
Model: Model for a FEM-discretized muscle model.
The global time unit for this model is milliseconds [ms] and the spatial quantities are in [mm]. Weight is in [g]. This results in pressure values of [MPa] and the forces K(u,v,w) are measured in [N] (Newton).
Public Member Functions | |
Model (conf, basedir) | |
function [ double t , matrix< double > y ] = | simulateAndPlot (withResForce, varargin) |
function [
double t ,
colvec< double > x , time , cache ] = | computeTrajectory (colvec< double > mu,integer inputidx) |
Allows to also call prepareSimulation for any quantities set by the AMuscleConfig class. More... | |
function double t = | getConfigTable (colvec< double > mu) |
function | plotForceLengthCurve (colvec< double > mu, pm) |
function | plotAnisotropicPressure (colvec< double > mu) |
function | plotActivation () |
function
varargout = | plotGeometrySetup (varargin) |
function | plotGeometryInfo (varargin) |
function [
residuals_dirichlet , residuals_neumann ] = | getResidualForces (double t, uvw) |
function colvec < integer > idx = | getFaceDofsGlobal (integer elem,rowvec< integer > faces,rowvec< integer > dim) |
Returns the indices in the global uvw vector (including dirichlet values) of the given faces in the given element. More... | |
function idx = | getPositionDirichletBCFaceIdx (integer elem,integer face,rowvec< integer > dim) |
Returns the positions of dofs of a specified face within the boundary conditions residual vector. Applies to dirichlet boundary conditions of POSITION (u) More... | |
function idx = | getVelocityDirichletBCFaceIdx (integer elem,integer face,rowvec< integer > dim) |
Returns the positions of dofs of a specified face within the boundary conditions residual vector. Applies to dirichlet boundary conditions of VELOCITY (v) More... | |
function | setConfig (value) |
function | setGaussIntegrationRule (value) |
Sets the gauss integration rule for the model. More... | |
function
varargout = | plot (varargin) |
Public Member Functions inherited from models.BaseFullModel | |
BaseFullModel (char name) | |
Creates a new instance of a full model. More... | |
function | delete () |
function | off1_createParamSamples () |
Offline phase 1: Sample generation. More... | |
function | off2_genTrainingData () |
Offline phase 2: Snapshot generation for subspace computation. More... | |
function | off3_computeReducedSpace () |
Offline phase 3: Generate state space reduction. More... | |
function | off4_genApproximationTrainData () |
Generates the training data \(x_i\) for the \(\hat{f}\)-approximation and precomputes \(f(x_i)\) values. More... | |
function | off5_computeApproximation () |
Offline phase 5: Core function approximation. More... | |
function | off6_prepareErrorEstimator () |
Prepares offline data for a possible error estimator. More... | |
function | offlineGenerations () |
Performs all large offline computations for model reduction. More... | |
function [
models.ReducedModel reduced , double time ] = | buildReducedModel (varargin) |
Builds a reduced model from a full model. More... | |
function [
t , x , time , cache ] = | computeTrajectory (colvec< double > mu, inputidx) |
Computes a solution/trajectory for the given mu and inputidx in the SCALED state space. More... | |
function [
double t ,
matrix< double > y , colvec < double > mu , in , ct ] = | getSimCacheTrajectory (nr) |
function | plotTrajectoryNr (nr) |
function [
V , W ] = | assembleProjectionMatrices (target_dim) |
function file = | save (char directory,char filename) |
Saves this instance inside the data.ModelData.DataDirectory folder using the model's SaveTag if set or "model.mat". More... | |
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 () | |
Static Public Member Functions | |
static function res = | test_ModelVersions () |
static function res = | test_JacobianApproxGaussRules () |
Tests the precision of the analytical jacobian computation using different gauss integration rules. More... | |
Static Public Member Functions inherited from models.BaseFullModel | |
static function | test_BaseModels () |
static function res = | test_BareModel () |
static function | test_LinearModel () |
static function | test_LinearModelNoProj () |
static function | test_LinearModelNoApprox () |
static function | test_LinearModelParams () |
static function | test_LinearModelInputs () |
static function | test_LinearModelParamsInput () |
static function | test_NonlinearModel () |
static function | test_NonlinearModelParams () |
static function | test_NonlinearModelInputs () |
static function | test_NonlinearModelParamsInput () |
static function | test_TimeDependentOutput () |
static function res = | test_FileSystemTidyness () |
Plain small model. More... | |
Public Attributes | |
MuscleDensity = 1.1e-3 | |
g/mm³ More... | |
Plotter | |
The plotter class for visualization. More... | |
int | RandSeed = 1 |
Seed that can be used by random number generator instances in order to enable result reproduction. More... | |
Config | |
Gravity = 9.80665e-3 | |
[mm/ms²] More... | |
Geo | |
Public Attributes inherited from models.BaseFullModel | |
data.ModelData | Data |
The full model's data container. Defaults to an empty container. More... | |
export.JKerMorExport | JKerMorExport |
Export instance for possible export of this model to JKerMor. More... | |
sampling.BaseSampler | Sampler |
The sampling strategy the Model uses. More... | |
spacereduction.BaseSpaceReducer | SpaceReducer |
The reduction algorithm for subspaces. More... | |
approx.BaseApprox | Approx = "[]" |
The approximation method for the CoreFunction. More... | |
function_handle | preApproximationTrainingCallback |
Advanced property. Must be a function handle taking the current model instance. More... | |
function_handle | postApproximationTrainingCallback |
Advanced property. Must be a function handle taking the current model instance. More... | |
logical | EnableTrajectoryCaching = false |
Flag that enables caching of computed trajectories in a simulation cache stored in KerMor's TempDirectory folder. More... | |
error.BaseEstimator | ErrorEstimator = "[]" |
The associated error estimator for this model. More... | |
logical | ComputeTrajectoryFxiData = false |
Flag that determines whether fxi data should be computed along with the trajectories or not. More... | |
logical | ProjectApproxTrainingData = false |
Flag to determine if the data collected by the approx.Approx.TrainDataSelector should be projected into the previously computed projection space V (see offline phase 3). If so, the \(f(x_i)\) values are also re-computed for the updated \(x_i\) samples. More... | |
logical | AutoSave = false |
Flag to enable automatic saving of the model after each individual offline phase step and at other locations prone to data loss due to lengthy computations. More... | |
char | SaveTag = "" |
A custom tag that can be used as a prefix to files for corresponding model identification. More... | |
integer | TrainingInputs |
The indices of inputs to use for training data generation. Uses the DefaultInput if not set (and DefaultInput is not empty) More... | |
rowvec< integer > | TrainingParams |
The indices of the model parameters to use for training data generation. More... | |
integer | TrainingInputCount |
Gets the number of inputs used for training. More... | |
rowvec< double > | OfflinePhaseTimes = "[]" |
The computation times for all phases of the last offline generation. More... | |
TrajectoriesCompleted = "[]" | |
Contains a flag for each input/parameter combination which has been successfully computed completely during the offline phase. More... | |
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... | |
Public Attributes inherited from IParallelizable | |
ComputeParallel = false | |
Flag whether the code should be run in parallel or not. More... | |
Static Protected Member Functions | |
static function this = | loadobj () |
Static Protected Member Functions inherited from models.BaseFullModel | |
static function this = | loadobj (this, sobj) |
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) |
Additional Inherited Members | |
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) |
models.muscle.Model.Model | ( | conf, | |
basedir | |||
) |
Definition at line 89 of file Model.m.
References KerMor.App(), models.BaseFullModel.Data, models.BaseModel.DefaultInput, models.BaseModel.DefaultMu, models.BaseModel.dt, models.BaseModel.initDefaultParameter(), models.BaseFirstOrderSystem.MaxTimestep, data.ModelData.ModelData(), models.BaseModel.ODESolver, models.muscle.System.prepareSimulation(), models.BaseFullModel.SaveTag, setConfig(), models.BaseFullModel.SpaceReducer, models.muscle.System.System(), models.BaseModel.T, and models.BaseFullModel.TrainingParams.
function [ double t , colvec< double > x , time , cache ] = models.muscle.Model.computeTrajectory | ( | colvec< double > | mu, |
integer | inputidx | ||
) |
Allows to also call prepareSimulation for any quantities set by the AMuscleConfig class.
mu | The currently used parameter \(\vmu\). Set to \([]\) if not used. |
inputidx | The index \(i\) of the currently used input function \(u_i(t)\). Set to \([]\) if not used. |
Definition at line 173 of file Model.m.
References Config, models.BaseFirstOrderSystem.f, and t.
Definition at line 190 of file Model.m.
References models.BaseModel.DefaultMu, models.BaseFirstOrderSystem.f, MuscleDensity, models.BaseModel.Name, and t.
function colvec< integer > idx = models.muscle.Model.getFaceDofsGlobal | ( | integer | elem, |
rowvec< integer > | faces, | ||
rowvec< integer > | dim | ||
) |
Returns the indices in the global uvw vector (including dirichlet values) of the given faces in the given element.
elem | The element index |
faces | The faces whose indices to return. May also only be one face. |
dim | The dimensions which to select. Default: [1 2 3] |
idx | The global indices of the face |
function idx = models.muscle.Model.getPositionDirichletBCFaceIdx | ( | integer | elem, |
integer | face, | ||
rowvec< integer > | dim | ||
) |
Returns the positions of dofs of a specified face within the boundary conditions residual vector. Applies to dirichlet boundary conditions of POSITION (u)
elem | The element the face belongs to |
face | The face number of that element |
dim | Optionally, specify a requested dimension to get the indices for. Defaults to return all x,y,z components on every node on the face. Default: 1:3 |
Definition at line 413 of file Model.m.
References models.muscle.System.bool_u_bc_nodes, Config, and models.muscle.System.idx_u_bc_glob.
function [residuals_dirichlet , residuals_neumann ] = models.muscle.Model.getResidualForces | ( | double | t, |
uvw | |||
) |
Definition at line 372 of file Model.m.
References k, models.BaseModel.System, and t.
Referenced by plotGeometrySetup(), and simulateAndPlot().
function idx = models.muscle.Model.getVelocityDirichletBCFaceIdx | ( | integer | elem, |
integer | face, | ||
rowvec< integer > | dim | ||
) |
Returns the positions of dofs of a specified face within the boundary conditions residual vector. Applies to dirichlet boundary conditions of VELOCITY (v)
elem | The element the face belongs to |
face | The face number of that element |
dim | Optionally, specify a requested dimension to get the indices for. Defaults to return all x,y,z components on every node on the face. Default: 1:3 |
Definition at line 438 of file Model.m.
References models.muscle.System.bool_expl_v_bc_nodes, models.muscle.System.bool_u_bc_nodes, Config, models.muscle.System.idx_v_bc_glob, and models.muscle.System.val_u_bc.
|
staticprotected |
function varargout = models.muscle.Model.plot | ( | varargin | ) |
Definition at line 504 of file Model.m.
References Plotter.
Referenced by plotActivation(), plotForceLengthCurve(), plotGeometrySetup(), and simulateAndPlot().
function models.muscle.Model.plotActivation | ( | ) |
Definition at line 334 of file Model.m.
References models.BaseFirstOrderSystem.f, PlotManager.LeaveOpen, models.BaseModel.Name, plot(), and models.BaseModel.Times.
Definition at line 306 of file Model.m.
References models.BaseModel.DefaultMu, models.BaseFirstOrderSystem.f, fl(), PlotManager.LeaveOpen, and models.BaseModel.Name.
Definition at line 203 of file Model.m.
References Config, models.BaseModel.DefaultInput, models.BaseModel.DefaultMu, models.BaseFirstOrderSystem.f, fl(), plot(), dscomponents.ACoreFun.prepareSimulation(), models.BaseModel.System, and t.
function models.muscle.Model.plotGeometryInfo | ( | varargin | ) |
function varargout = models.muscle.Model.plotGeometrySetup | ( | varargin | ) |
Definition at line 345 of file Model.m.
References models.BaseModel.DefaultInput, models.BaseModel.DefaultMu, getResidualForces(), models.BaseSecondOrderSystem.getX0(), models.BaseFirstOrderSystem.mu, plot(), Plotter, and models.muscle.System.prepareSimulation().
function models.muscle.Model.setConfig | ( | value | ) |
Definition at line 468 of file Model.m.
References Config, models.muscle.System.configUpdated(), and Plotter.
Referenced by Model(), and setGaussIntegrationRule().
function models.muscle.Model.setGaussIntegrationRule | ( | value | ) |
Sets the gauss integration rule for the model.
See fem.BaseFEM for possible values. Currently 3,4,5 are implemented.
Definition at line 478 of file Model.m.
References Config, models.BaseModel.DefaultInput, models.BaseModel.DefaultMu, models.BaseFirstOrderSystem.mu, setConfig(), and models.BaseModel.System.
function [doublet , matrix<double>y ] = models.muscle.Model.simulateAndPlot | ( | withResForce, | |
varargin | |||
) |
Definition at line 159 of file Model.m.
References getResidualForces(), plot(), models.BaseModel.simulate(), and t.
|
static |
|
static |
models.muscle.Model.Config |
Definition at line 68 of file Model.m.
Referenced by models.muscle.System.assembleB(), models.muscle.System.assembleDampingMatrix(), models.muscle.System.assembleMassMatrix(), models.muscle.System.assembleX0(), models.muscle.System.computeDirichletBC(), computeTrajectory(), models.muscle.System.configUpdated(), getFaceDofsGlobal(), getPositionDirichletBCFaceIdx(), getVelocityDirichletBCFaceIdx(), models.muscle.System.inita0(), models.muscle.System.initMuscleTendonRatios(), loadobj(), plotForceLengthCurve(), plotGeometryInfo(), models.muscle.System.prepareSimulation(), setConfig(), and setGaussIntegrationRule().
models.muscle.Model.Gravity = 9.80665e-3 |
[mm/ms²]
SetAccess = Private, GetAccess = Public
models.muscle.Model.MuscleDensity = 1.1e-3 |
Default: 1.1e-3
Definition at line 36 of file Model.m.
Referenced by models.muscle.System.assembleMassMatrix(), and getConfigTable().
models.muscle.Model.Plotter |
The plotter class for visualization.
Definition at line 44 of file Model.m.
Referenced by plot(), plotGeometrySetup(), and setConfig().
models.muscle.Model.RandSeed = 1 |
Seed that can be used by random number generator instances in order to enable result reproduction.
SetAccess = Private, GetAccess = Public
Definition at line 54 of file Model.m.
Referenced by loadobj().