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
ThinTendon.m
Go to the documentation of this file.
1 namespace models{
2 namespace muscle{
3 namespace examples{
4 
5 
6 /* (Autoinserted by mtoc++)
7  * This source code has been filtered by the mtoc++ executable,
8  * which generates code that can be processed by the doxygen documentation tool.
9  *
10  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
11  * Except for the comments, the function bodies of your M-file functions are untouched.
12  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
13  * attached source files that are highly readable by humans.
14  *
15  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
16  * the correct locations in the source code browser.
17  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
18  */
19 
33  public:
34 
35  ylen = 200;
36 
37  movetime = 80;
38 
40 
41 
42  public:
43 
45  this = this@models.muscle.AExperimentModelConfig(varargin[:]);
46  this.addOption(" BC ",1);
47  this.init;
48  this.VelocityBCTimeFun= general.functions.ConstantUntil(this.movetime);
49  this.configs= (-.9:.1:.2)*this.ylen/this.movetime;
50  this.NumConfigurations= length(this.configs);
51  this.NumOutputs= 1;
52  }
53 
54 
55  function configureModel(m) {
56  configureModel@models.muscle.AMuscleConfig(this, m);
57  m.T= this.movetime+20;
58  m.dt= m.T/200;
59 
60  mu = m.DefaultMu;
61  /* Small viscosity */
62  mu(3) = 0;
63  m.DefaultMu= mu;
64  }
65 
66 
67  function tmr = getTendonMuscleRatio(points) {
68  tmr = ones(1,size(points,2));
69  }
78  function u = getInputs() {
79  u = [];
80  if this.Options.BC == 2
81  u = [this.getAlphaRamp(this.movetime,1)];
82  end
83  }
103  function P = getBoundaryPressure(elemidx,faceidx) {
104  P = [];
105  if this.Options.BC == 2 && any(elemidx == 21:24) && faceidx == 4
106  P = 1;
107  end
108  }
122  function o = getOutputOfInterest(double t,matrix<double> y) {
123  m = this.Model;
124  /* Get the residual dirichlet forces at end time */
125  df = m.getResidualForces(t(end),y(:,end));
126  idx = m.getPositionDirichletBCFaceIdx(1:4,3);
127  o(1) = sum(df(idx));
128  /* o(2) = sum(df(idx,passive_pos)); */
129  }
130 
131 
132  protected:
133 
134 
135  function geo = getGeometry() {
136  geo = fem.geometry.Belly(6,this.ylen," Radius ",0," InnerRadius ",2," Gamma ",2);
137  n = geo.Nodes;
138  /* Slightly deviate a node in the center */
139  n(1,137) = n(1,137)*1.1;
140  geo = fem.geometry.Cube27Node(n,geo.Elements);
141  /* geo = belly.scale(20); */
142  }
143 
144 
145  function displ_dir = setPositionDirichletBC(displ_dir) {
146  geo = this.FEM.Geometry;
147  /* Fix ends in xz direction */
148  displ_dir(:,geo.Elements(1:4,geo.MasterFaces(3,:))) = true;
149  displ_dir([1 3],geo.Elements(21:24,geo.MasterFaces(4,:))) = true;
150  }
159  function [velo_dir , velo_dir_val ] = setVelocityDirichletBC(velo_dir,velo_dir_val) {
160  if this.Options.BC == 1
161  geo = this.FEM.Geometry;
162  /* Fix ends in xz direction */
163  velo_dir(2,geo.Elements(21:24,geo.MasterFaces(4,:))) = true;
164  velo_dir_val(velo_dir) = this.configs(this.CurrentConfigNr);
165  end
166  }
175  public: /* ( Static ) */
176 
177  static function test_ThinTendon() {
178  c = models.muscle.examples.ThinTendon;
179  m = c.createModel;
180  c.CurrentConfigNr= 4;
181  m.simulateAndPlot;
182  }
183 
184 
185  static function runExperiment() {
186  c = models.muscle.examples.ThinTendon;
187  m = c.createModel;
188  e = models.muscle.ExperimentRunner(m);
189  d = e.runExperimentsCached;
190  semilogy(d.o);
191  title(" Forces at fixed nodes at end time ");
192  }
193 
194 
195 
196 };
197 }
198 }
199 }
200 
201 
202 
static function test_ThinTendon()
Definition: ThinTendon.m:177
function addOption(name, default, varargin)
Definition: AFEMConfig.m:219
function alpha = getAlphaRamp(ramptime,double alphamax,double starttime)
Creates a linearly increasing scalar function starting at starttime milliseconds ranging from zero to...
static function runExperiment()
Definition: ThinTendon.m:185
function P = getBoundaryPressure(elemidx, faceidx)
Determines the neumann forces on the boundary.
Definition: ThinTendon.m:103
function [ velo_dir , velo_dir_val ] = setVelocityDirichletBC(velo_dir, velo_dir_val)
% Dirichlet conditions: Position (fix one side)
Definition: ThinTendon.m:159
A variable number of input arguments.
function displ_dir = setPositionDirichletBC(displ_dir)
% Dirichlet conditions: Position (fix one side)
Definition: ThinTendon.m:145
Thin tendon experiment for parameter fitting of tendon params.
Definition: ThinTendon.m:20
function o = getOutputOfInterest(double t,matrix< double > y)
Definition: ThinTendon.m:122
VelocityBCTimeFun
Velocity conditions application function.
Definition: AFEMConfig.m:65
function geo = getGeometry()
Returns the intended geometry for this model config.
Definition: ThinTendon.m:135
function tmr = getTendonMuscleRatio(points)
Pure tendon material!
Definition: ThinTendon.m:67
CurrentConfigNr
Sets the configuration number.
function u = getInputs()
Returns the inputs of the model.
Definition: ThinTendon.m:78