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
BasePCDISystem.m
Go to the documentation of this file.
1 namespace models{
2 namespace pcdi{
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 
39  public: /* ( Dependent, setObservable ) */
40 
41  h;
73  private:
74 
75  fh = "[]";
76 
77  fOmega = "[]";
78 
79 
80  public:
81 
93  hs;
126  Labels = {"'Caspase-8','Caspase-3','Pro-Caspase-8','Pro-Caspase-3', \
127  'IAP (iap)','BAR (bar)','Caspase-3+IAP (yb)','Caspase-8+BAR (xb)'"};
140  Tags = {"'c8','c3','pc8','pc3','iap','bar','yb','xb'"};
152  public:
153 
155  this = this@models.BaseFirstOrderSystem(model);
156 
157  /* Scale diffusion coefficients */
158  m = this.Model;
159  this.Diff= [m.d2/m.d1 m.d3/m.d1 m.d4/m.d1...
160  m.d5/m.d1 m.d6/m.d1 m.d7/m.d1 m.d8/m.d1];
161 
162  this.registerProps(" h "," Omega ");
163 
164  this.ReacCoeff= [m.K1 m.K2 m.K3 m.K4 m.K5 m.K6 m.K7...
165  m.K8 m.K9 m.K10 m.K11 m.K12 m.K13...
166  m.Km3 m.Km8 m.Km9 m.Km10 m.Km11...
167  m.Km12]^t * m.tau;
168 
169  /* Set state scaling */
170  this.StateScaling= this.Model.tc;
171 
172  /* Add parameters
173  * Activation area */
174  p = this.addParam(" area ", .1, " Range ", [.01, 1], " Desired ", 10);
175  p.Spacing= " lin ";
176 
177  /* Activation rate */
178  p = this.addParam(" rate ", .001, " Range ", [0.0005, 1], " Desired ", 15);
179  p.Spacing= " log ";
180 
181  /* Activation time */
182  p = this.addParam(" atime ", .5, " Range ", [0, 1], " Desired ", 5);
183  p.Spacing= " lin ";
184 
185  /* Exponent */
186  p = this.addParam(" exponent ", 2, " Range ", [1, 4], " Desired ", 5);
187  p.Spacing= " lin ";
188 
189  /* Diffusion density */
190  p = this.addParam(" diffusionstrength ", .5, " Range ", [0, 1], " Desired ", 5);
191  p.Spacing= " lin ";
192  }
193 
194 
196  setConfig@models.BaseFirstOrderSystem(this, mu, inputidx)
197  }
198 
199 
200 
201 #if 0 //mtoc++: 'get.h'
202 function h = h() {
203  h = this.fh;
204  }
205 
206 #endif
207 
208 
209 
210 #if 0 //mtoc++: 'set.h'
211 function h(value) {
212  if any(value >= this.fOmega(:,2))
213  error(" Cannot choose a step size h=%e value larger or equal to the geometry [%s]. ",...
214  value,Utils.implode(this.fOmega(:)," , "," %g "));
215  end
216  this.fh= value;
217  this.hs= value / this.Model.L;
218  this.updateDimensions;
219 
220  m = this.Model;
221  this.MaxTimestep= [];
222  if ~isa(m.ODESolver," solvers.IImplSolver ") && ~isa(m.ODESolver," solvers.SemiImplicitEuler ")
223  maxdt = .95*(value^2/max([m.d1 m.d2 m.d3 m.d4 m.d5 m.d6 m.d7 m.d8]));
224  maxdtsc = .95*(this.hs^2/max([1 this.Diff]));
225 
226  if (maxdtsc - maxdt/this.Model.tau) / maxdtsc > 1e-15
227  error(" Inconsistent scaling. Please check. ");
228  end
229  /* Set max timestep value (scaled!) */
230  this.MaxTimestep= maxdtsc;
231 
232  if maxdt < m.dt
233  warning(" models:pcd:CFL "," CFL condition violated with h=%e and current dt=%e.\nSetting System.MaxTimestep=%e (scaled, effective value %e)\n ", value, m.dt, maxdtsc, maxdt);
234  end
235  end
236  }
237 
238 #endif
239 
240 
241 
242 #if 0 //mtoc++: 'get.Omega'
243 function v = Omega() {
244  v = this.fOmega;
245  }
246 
247 #endif
248 
249 
250 
251 #if 0 //mtoc++: 'set.Omega'
252 function Omega(value) {
253  if size(value,2) ~= 2
254  error(" Omega needs to be a dim x 2 matrix with the spatial extend for each dimension in a row. ");
255  end
256  this.fOmega= value;
257 
258  /* Update the dimensions */
259  this.updateDimensions;
260  }
261 
262 #endif
263 
264 
265  protected:
266 
267 
268  function updateDimensions() {
269  if ~isempty(this.fh) && ~isempty(this.fOmega)
270  nd = size(this.fOmega,1);
271  this.Dims= zeros(1,nd);
272  for d=1:nd
273  this.Dims(d) = length(this.fOmega(d,1):this.h:this.fOmega(d,2));
274  end
275  m = prod(this.Dims);
276  if this.Model.WithInhibitors
277  this.NumStateDofs= 8*m;
278  else
279  this.NumStateDofs= 4*m;
280  end
281  updateDimensions@models.BaseFirstOrderSystem(this);
282 
283  /* Set new initial values and output in 1D-3D systems */
284  this.newSysDimension;
285 
286  /* Call template method for custom actions in the core
287  * functions (diffusion matrix comp) */
288  this.f.newSysDimension;
289  end
290  }
291 
292 
293  protected: /* ( Abstract ) */
294 
295  virtual function newSysDimension() = 0;
311 };
312 }
313 }
314 
315 
316 
317 
318 
Dims
The system's dimensions.
Collection of generally useful functions.
Definition: Utils.m:17
Labels
The concentration labels.
Tags
The concentration image tags.
BasePCDISystem(models.BaseFullModel model)
hs
scaled spatial stepwidth
The base class for any KerMor detailed model.
Definition: BaseFullModel.m:18
Model
The Model this System is attached to.
h
Spatial stepwidth (in unscaled size units!) is set in subclasses.
function registerProps(varargin)
Call this method at any class that defines DPCM observed properties.
Definition: DPCMObject.m:125
An integer value.
function setConfig(colvec< double > mu,integer inputidx)
inputidx
The current inputindex of the function .
Omega
The spatial width/area/region (in unscaled size units!)
mu
The current parameter for simulations, [] is none used.
BasePCDISystem The base dynamical system class for the the Programmed Cell Death Model by Markus Daub...
colvec StateScaling
The scaling for the state vectors.
virtual function newSysDimension()
Custom updates for new system dimension.
dscomponents.ACoreFun f
The core f function from the dynamical system.
dscomponents.ACoreFun g
The system's algebraic constraints function.
ReacCoeff
The reaction coefficients.
Diff
Relative diffusion coefficients ([d2/d1, d3/d1, d4/d1])
double MaxTimestep
The maximum timestep allowed for any ODE solvers.
function ModelParam p = addParam(char name, default, varargin)
Adds a parameter with the given values to the parameter collection of the current dynamical system...
Base class for all KerMor first-order dynamical systems.