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
PCDSystem1D.m
Go to the documentation of this file.
1 namespace models{
2 namespace pcd{
3 
4 
5 /* (Autoinserted by mtoc++)
6  * This source code has been filtered by the mtoc++ executable,
7  * which generates code that can be processed by the doxygen documentation tool.
8  *
9  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
10  * Except for the comments, the function bodies of your M-file functions are untouched.
11  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
12  * attached source files that are highly readable by humans.
13  *
14  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
15  * the correct locations in the source code browser.
16  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
17  */
18 
20  :public models.pcd.BasePCDSystem {
36  public:
37 
39  this = this@models.pcd.BasePCDSystem(model);
40 
41  /* Set core function */
42  this.f= models.pcd.CoreFun1D(this);
43 
44  /* Spatial resolution (in real sizes) */
45  this.Omega= [0 1] * this.Model.L;
46  this.h= this.Model.L/24;
47 
48  /* Remove params set in BasePCDSystem (simpler for 1D) */
49  this.Params= data.ModelParam.empty;
50 
51  /* Add input param (is getting inserted after the BasePCDSystem
52  * constructor params, so number 9!) */
53  this.addParam(" U ", 1e-3, " Range ", [1e-5, 1e-2], " Desired ", 50);
54  }
55 
56 
57  function plot(models.BaseFullModel model,double t,matrix<double> y) {
58 
59  if length(t) > 700
60  idx = round(linspace(1,length(t),700));
61  t = t(idx);
62  y = y(:,idx);
63  end
64  states = [" alive "," unstable "," dead "];
65 
66  figure;
67  X = t;
68  Y = this.Omega(1):this.h:this.Omega(2);
69  m = model.System.Dims(1);
70  doplot(y(1:m,:)," Caspase-8 (x_a) ",1);
71  doplot(y(m+1:2*m,:)," Caspase-3 (y_a) ",2);
72  doplot(y(2*m+1:3*m,:)," Pro-Caspase-8 (x_i) ",3);
73  doplot(y(3*m+1:end,:)," Pro-Caspase-3 (y_i) ",4);
74 
75  function doplot(y,thetitle,pnr)
76  subplot(2,2,pnr);
77  mesh(X,Y,y);
78  /* surf(X,Y,y,'EdgeColor','none'); */
79  xlabel(" Time [s] ");
80  ylabel(sprintf(" %.2e to %.2e: Cell core to hull [m] ",this.Omega(1),this.Omega(2)));
81  grid off;
82  mi = min(y(:));
83  Ma = max(y(:));
84  if abs((mi-Ma) / mi) < 1e-14
85  mi = .999*mi; Ma=1.001*Ma;
86  end
87  axis([0 max(t) this.Omega mi Ma]);
88  di = abs(this.Model.SteadyStates(:,pnr)-y(end));
89  reldi = di ./ (this.Model.SteadyStates(:,pnr)+eps);
90  reldistr = Utils.implode(reldi," , "," %2.3e ");
91  if any(reldi > .1) || any(reldi < 10)
92  [~, id] = min(di);
93  title(sprintf(" Model '%s', %s concentrations\nCell state at T=%d: %s\n%s ", model.Name, thetitle,...
94  max(t),states[id],reldistr));
95  else
96  title(sprintf(" Model '%s', %s concentrations\n%s ", model.Name, thetitle,reldistr));
97  end
98  end
99  }
112  protected:
113 
114  function newSysDimension() {
115  m = prod(this.Dims);
116 
117  x0 = zeros(4*m,1);
118  x0(1:2*m) = 1e-16;
119  x0(2*m+1:end) = 1e-9;
120  this.x0= dscomponents.ConstInitialValue(x0);
121 
122  e = ones(m,1);
123  A = spdiags([e -2*e e],-1:1,m,m)/this.hs^2;
124  A(1) = -1/this.hs^2;
125  A(end) = -1/this.hs^2;
126  A = blkdiag(A,this.Diff(1)*A,this.Diff(2)*A,this.Diff(3)*A);
127  this.A= dscomponents.LinearCoreFun(A);
128 
129  /* Extracts the caspase-3 concentrations from the result
130  * C = zeros(m,4*m);
131  * C(:,m+1:2*m) = diag(ones(m,1));
132  *this.C = dscomponents.LinearInputConv(sparse(C)); */
133  }
140 };
141 }
142 }
143 
144 
145 
char Name
The name of the Model.
Definition: BaseModel.m:117
Collection of generally useful functions.
Definition: Utils.m:17
PCDSYSTEM1D Summary of this class goes here Detailed explanation goes here.
Definition: PCDSystem1D.m:19
function newSysDimension()
Assign fitting initial value.
Definition: PCDSystem1D.m:114
Params
The parameters usable for the dynamical system.
h
Spatial stepwidth (in unscaled size units!) is set in subclasses.
Definition: BasePCDSystem.m:62
PCDSystem1D(models.BaseFullModel model)
Definition: PCDSystem1D.m:38
The base class for any KerMor detailed model.
Definition: BaseFullModel.m:18
models.BaseFirstOrderSystem System
The actual dynamical system used in the model.
Definition: BaseModel.m:102
Model
The Model this System is attached to.
hs
scaled spatial stepwidth
Dims
The system's dimensions.
LinearCoreFun(A)
No system reference needed for constant linear core fun.
Definition: LinearCoreFun.m:43
dscomponents.AInitialValue x0
Function handle to initial state evaluation.
#define X(i, j)
dscomponents.ACoreFun f
The core f function from the dynamical system.
static function char str = implode(char|rowvec data,char glue,char format)
Implodes the elements of data using glue.
Definition: Utils.m:208
#define Y(i, j)
Omega
The spatial width/area/region (in unscaled size units!)
Definition: BasePCDSystem.m:78
function ModelParam p = addParam(char name, default, varargin)
Adds a parameter with the given values to the parameter collection of the current dynamical system...
PCDSYSTEM The 2D dynamical system of the Programmed Cell Death Model by Markus Daub.
Definition: BasePCDSystem.m:19
function plot(models.BaseFullModel model,double t,matrix< double > y)
Performs a plot for this model's results.
Definition: PCDSystem1D.m:57
dscomponents.LinearCoreFun A
Represents a linear or affine-linear component of the dynamical system.
Diff
Relative diffusion coefficients ([d2/d1, d3/d1, d4/d1])