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
Shear.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 
20 class Shear
28  public:
29 
31  this = this@models.muscle.AMuscleConfig(varargin[:]);
32  this.addOption(" BC ",1);
33  this.init;
34  }
35 
36 
37  function configureModel(m) {
38  configureModel@models.muscle.AMuscleConfig(this, m);
39  m.T= 50;
40  m.dt= 1;
41  m.ODESolver.RelTol= 1e-6;
42  m.ODESolver.AbsTol= 1e-6;
43  if this.Options.BC == 2
44  m.DefaultInput= 1;
45  m.DefaultMu(3) = 1;
46  end
47  }
48 
49 
50  function P = getBoundaryPressure(elemidx,faceidx) {
51  P = [];
52  o = this.Options;
53  if o.BC == 2
54  if faceidx == 2 && ((o.GeoNr == 1 && elemidx == 1) || ...
55  (o.GeoNr == 2 && any(elemidx == 5:8)))
56  P = zeros(3,3);
57  P(3,1) = 1;
58  end
59  end
60  }
74  function u = getInputs() {
75  u = [];
76  if this.Options.BC == 2
77  u = [this.getAlphaRamp(this.Model.T/2,.1)];
78  end
79  }
80 
81 
82  protected:
83 
84 
85  function geo = getGeometry() {
86  if this.Options.GeoNr == 1
87  geo = fem.geometry.RegularHex8Grid([0 1],[0 1],[0 1]);
88  else
89  geo = fem.geometry.RegularHex8Grid(0:2,0:2,0:2);
90  end
91  geo = geo.toCube27Node;
92  }
100  function displ_dir = setPositionDirichletBC(displ_dir) {
101  geo = this.FEM.Geometry;
102  o = this.Options;
103  if o.GeoNr == 1
104  displ_dir(:,geo.Elements(1,geo.MasterFaces(1,:))) = true;
105  if o.BC == 1
106  displ_dir(1:2,geo.Elements(1,geo.MasterFaces(2,:))) = true;
107  end
108  else
109  displ_dir(:,geo.Elements(1:4,geo.MasterFaces(1,:))) = true;
110  if o.BC == 1
111  displ_dir(1:2,geo.Elements(5:8,geo.MasterFaces(2,:))) = true;
112  end
113  end
114  }
115 
116 
117  function [velo_dir , velo_dir_val ] = setVelocityDirichletBC(velo_dir,velo_dir_val) {
118  geo = this.FEM.Geometry;
119  o = this.Options;
120  if o.BC == 1
121  if o.GeoNr == 1
122  velo_dir(3,geo.Elements(1,geo.MasterFaces(2,:))) = true;
123  else
124  velo_dir(3,geo.Elements(5:8,geo.MasterFaces(2,:))) = true;
125  end
126  velo_dir_val(velo_dir) = .1;
127  end
128  }
139  function anull = seta0(anull) {
140  anull(3,:,:) = 1;
141  }
142 
143 
144  public: /* ( Static ) */
145 
146  static function test_Shear() {
147  for g = 1:2
148  for b = 1:2
149  f = models.muscle.examples.Shear(" GeoNr ",g," BC ",b);
150  m = f.createModel;
151  m.plotGeometrySetup;
152  [t,y] = m.simulate;
153  m.plot(t,y," Lambdas ",true);
154  end
155  end
156  }
157 
158 
159 
160 };
161 }
162 }
163 }
164 
165 
166 
static function test_Shear()
Definition: Shear.m:146
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...
function anull = seta0(anull)
Definition: Shear.m:139
function [ velo_dir , velo_dir_val ] = setVelocityDirichletBC(velo_dir, velo_dir_val)
Determines the dirichlet velocities.
Definition: Shear.m:117
A variable number of input arguments.
function P = getBoundaryPressure(elemidx, faceidx)
Determines the neumann forces on the boundary.
Definition: Shear.m:50
double T
The final timestep up to which to simulate.
Definition: BaseModel.m:271
function geo = getGeometry()
Single cube with same config as reference element.
Definition: Shear.m:85
function u = getInputs()
Definition: Shear.m:74
function configureModel(m)
Definition: Shear.m:37
An example illustrating shear forces.
Definition: Shear.m:20
function displ_dir = setPositionDirichletBC(displ_dir)
Definition: Shear.m:100
Model: Model for a FEM-discretized muscle model.
Definition: Model.m:19