Page MenuHomec4science

deltaNotchCell.cpp
No OneTemporary

File Metadata

Created
Tue, Sep 10, 12:31

deltaNotchCell.cpp

#include "deltaNotchCell.hpp"
void DeltaNotchCell::operator() (const state_type &y , state_type &dydt , const double t)
{
uint nbcells = lattice-> getNbCells();
double a = 0.1; // diffusion length scale
for (uint c=0;c<nbcells;c++){
Cell& ce = lattice->getCell(c);
uint sind = ce.stateVectorIndex();
double no = y[sind];
double del = y[sind+1];
BoundaryIterator it(&ce);
double dout = 0;
double totper = 0;
for(Boundary *b=it.first();!it.isLast();b=it.next()){
if(b->opposite()!=NULL){
uint ind = b->neighbor()->stateVectorIndex(); // index for cell state
// double len = b->length();
double len = b->scaledLength(lattice->getScale());
// len = max(len,0.1);
if(len>0.000001){len=a/(1-exp(-a/len));}else{len=a;}
dout += len*y[ind+1];
totper += len;
}
}
// if(dout>0.0000001){dout = 1+1/(1-exp(-1/dout));}else{dout=1;};
double bn = notchProduction(dout);
double bd = getDeltaProduction(no);
double dn = bn-gn*no;
double dd = bd-gd*del;//-kcm*si
// cout<<del<<": "<<bd<<" "<<gd<<" "<<endl;
double fac = 1e13; //=exp(30)
dydt[sind] = dn;
dydt[sind+1] = dd;//*fac/(exp(del)+fac);
}
}
void DeltaNotchCell::initState(double *s){
int n= lattice->getNbCells();
for (int c=0;c<n;c++){
uint idx = lattice->getCell(c).stateVectorIndex();
state[idx] = s[c*2+1];
state[idx+1] = s[c*2];
}
}
// void DeltaNotchCell::writeState(){//const state_type y,const double t){
// cout<<"state "<<state_dim<<": ";
// for(uint i=0;i<state_dim;i++){
// cout<<i<<": "<<state[i]<<"; ";
// }
// cout<<endl;
// }
// void DeltaNotchCell::initState(){
// void *pt = (void *)&state;
// lattice->forAllCellsAndBoundaries(DeltaNotchCell::initCellState,pt,NULL,NULL);
// }
// uint DeltaNotchCell::setStateVectorIndex(){
// uint cnt=0;
// visitorParams vp(&cnt, this);
// lattice->forAllCellsAndBoundaries(DeltaNotchCell::setCellIndex,
// (void *)&vp,NULL,NULL);
// return cnt;
// }
// void DeltaNotchCell::initCellState(Cell *ce, void *pt){
// state_type *y= (state_type*)pt;
// uint ind = ce->stateVectorIndex();
// (*y)[ind]=0.9+0.2*(rand()/(double)RAND_MAX);
// (*y)[ind+1]=0.9+0.2*(rand()/(double)RAND_MAX);;
// }
// void DeltaNotchCell::setCellIndex(Cell *ce, void *pt){
// visitorParams *vp = (visitorParams *) pt;
// uint *idx = vp->cnt;
// ce->setStateVectorIndex(*idx);
// *idx += vp->dn->cellStateDim();
// }

Event Timeline