Changeset - c131f8cd4b54
[Not reviewed]
default
0 1 0
Roeland Merks - 15 years ago 2010-06-23 17:15:12
merks@cwi.nl
Changed auxin_growth example
1 file changed with 1 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/build_models/auxingrowthplugin.cpp
Show inline comments
 
/*
 
 *
 
 *  This file is part of the Virtual Leaf.
 
 *
 
 *  The Virtual Leaf is free software: you can redistribute it and/or modify
 
 *  it under the terms of the GNU General Public License as published by
 
 *  the Free Software Foundation, either version 3 of the License, or
 
 *  (at your option) any later version.
 
 *
 
 *  The Virtual Leaf is distributed in the hope that it will be useful,
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 *  GNU General Public License for more details.
 
 *
 
 *  You should have received a copy of the GNU General Public License
 
 *  along with the Virtual Leaf.  If not, see <http://www.gnu.org/licenses/>.
 
 *
 
 *  Copyright 2010 Roeland Merks.
 
 *
 
 */
 

	
 
#include <QObject>
 
#include <QtGui>
 
#include "../simplugin.h"
 

	
 
#include "parameter.h"
 

	
 
#include "wallbase.h"
 
#include "cellbase.h"
 
#include "auxingrowthplugin.h"
 

	
 
#include "far_mem_5.h"
 

	
 
static const std::string _module_id("$Id$");
 

	
 
bool batch = false;
 

	
 

	
 
// To be executed after cell division
 
void AuxinGrowthPlugin::OnDivide(ParentInfo *parent_info, CellBase *daughter1, CellBase *daughter2)
 
{
 

	
 
  // Auxin distributes between parent and daughter according to area
 
  double area1 = daughter1->Area(), area2 = daughter2->Area();
 
  double tot_area = area1 + area2;
 
	
 
  daughter1->SetChemical(0,daughter1->Chemical(0)*(area1/tot_area));
 
  daughter2->SetChemical(0,daughter2->Chemical(0)*(area2/tot_area));
 
	
 
  // After divisions, parent and daughter cells get a standard stock of PINs.
 
  daughter1->SetChemical(1, par->initval[1]);
 
  daughter2->SetChemical(1, par->initval[1]);
 
	
 
	
 
  // Reset transporter values of parent and daughter
 
  QList<WallBase *> walls;
 
  foreach(WallBase *w, walls) { 
 
    w->setTransporter(daughter1, 1, 0.);
 
  }
 
}
 

	
 
void AuxinGrowthPlugin::SetCellColor(CellBase *c, QColor *color)
 
{ 
 

	
 
  // Red: PIN1
 
  // Green: Auxin
 
  if (c->CellType()==1)
 
    color->setNamedColor("Blue"); 
 
  else 
 
    color->setRgb(c->Chemical(1)/(1+c->Chemical(1)) * 255.,(c->Chemical(0)/(1+c->Chemical(0)) * 255.), 0);
 
  color->setRgb(c->Chemical(1)/(1+c->Chemical(1)) * 255.,(c->Chemical(0)/(1+c->Chemical(0)) * 255.), 0);
 
}
 

	
 

	
 

	
 
void AuxinGrowthPlugin::CellHouseKeeping(CellBase *c)
 
{
 
  if (c->Boundary()==CellBase::None) {
 
    if (c->Area() > par->rel_cell_div_threshold * c->BaseArea() ) {
 
      c->SetChemical(0,0);
 
      c->Divide();
 
    }		
 
    if (c->Chemical(0)>0.6) {
 
      c->SetCellType(1);
 
    } 
 
    // expand according to auxin concentration
 
    c->EnlargeTargetArea(par->auxin_dependent_growth?(c->Chemical(0)/(1.+c->Chemical(0)))*par->cell_expansion_rate:par->cell_expansion_rate);
 
  }  
 
}
 

	
 
void AuxinGrowthPlugin::CelltoCellTransport(Wall *w, double *dchem_c1, double *dchem_c2)
 
{
 

	
 
  // leaf edge is const source of auxin
 
  // (Neumann boundary condition: we specify the influx)
 
  if (w->C2()->BoundaryPolP()) {
 
    if (w->AuxinSource()) {
 
      double aux_flux = par->leaf_tip_source * w->Length();
 
      dchem_c1[0]+= aux_flux;
 
      return;
 
    } else {
 
      return;
 
    }
 
  }
 
	
 
  if (w->C1()->BoundaryPolP()) {
 
		
 
    if (w->AuxinSource()) {
 
      double aux_flux = par->leaf_tip_source * w->Length();
 
      dchem_c2[0] += aux_flux;
 
      return;
 
    } else {
 
			
 
      if (w->AuxinSink()) {
 
				
 
	// efflux into Shoot Apical meristem
 
	// we assume all PINs are directed towards shoot apical meristem
 
	dchem_c2[0] -= par->sam_efflux * w->C2()->Chemical(0) / (par->ka + w->C2()->Chemical(0));
 
				
 
	return;
 
      } else 
 
	return;
 
    }
 
  }
 
	
 
    
 
  // Passive fluxes (Fick's law)
 
  // only auxin flux now
 
  // flux depends on edge length and concentration difference
 
  int c=0;
 
  double phi = w->Length() * ( par->D[c] ) * ( w->C2()->Chemical(c) - w->C1()->Chemical(c) );
 
  dchem_c1[c] += phi; 
 
  dchem_c2[c] -= phi;
0 comments (0 inline, 0 general)