Skip to content
Snippets Groups Projects
Commit 77fddf7e authored by Dilawar Singh's avatar Dilawar Singh
Browse files

Squashed 'moose-core/' changes from 052318cb4..ba97d4cc0

ba97d4cc0 Merge commit '0014d826'
6aac85bad Follow up fixes to calcium-hsolve  (#221)

git-subtree-dir: moose-core
git-subtree-split: ba97d4cc05425dc8b8b42ee6f8976989e229a144
parent 0014d826
No related branches found
No related tags found
No related merge requests found
......@@ -111,6 +111,7 @@ void ChanCommon::sendProcessMsgs( const Eref& e, const ProcPtr info )
void ChanCommon::sendReinitMsgs( const Eref& e, const ProcPtr info )
{
ChanBase::channelOut()->send( e, Gk_, Ek_ );
ChanBase::IkOut()->send( e, Ik_ );
// Needed by GHK-type objects
ChanBase::permeability()->send( e, Gk_ );
}
......
......@@ -235,6 +235,7 @@ void DifBuffer::vSetShapeMode(const Eref& e, unsigned int shapeMode )
return;
}
shapeMode_ = shapeMode;
calculateVolumeArea(e);
}
unsigned int DifBuffer::vGetShapeMode(const Eref& e) const
......@@ -250,6 +251,7 @@ void DifBuffer::vSetLength(const Eref& e, double length )
}
length_ = length;
calculateVolumeArea(e);
}
double DifBuffer::vGetLength(const Eref& e ) const
......@@ -265,6 +267,7 @@ void DifBuffer::vSetDiameter(const Eref& e, double diameter )
}
diameter_ = diameter;
calculateVolumeArea(e);
}
double DifBuffer::vGetDiameter(const Eref& e ) const
......@@ -280,6 +283,7 @@ void DifBuffer::vSetThickness( const Eref& e, double thickness )
}
thickness_ = thickness;
calculateVolumeArea(e);
}
double DifBuffer::vGetThickness(const Eref& e) const
......@@ -360,7 +364,54 @@ double DifBuffer::integrate( double state, double dt, double A, double B )
}
return state + A * dt ;
}
void DifBuffer::calculateVolumeArea(const Eref& e)
{
double rOut = diameter_/2.;
double rIn = rOut - thickness_;
if (rIn <0)
rIn = 0.;
switch ( shapeMode_ )
{
/*
* Onion Shell
*/
case 0:
if ( length_ == 0.0 ) { // Spherical shell
volume_ = 4./3.* M_PI * ( rOut * rOut * rOut - rIn * rIn * rIn );
outerArea_ = 4*M_PI * rOut * rOut;
innerArea_ = 4*M_PI * rIn * rIn;
} else { // Cylindrical shell
volume_ = ( M_PI * length_ ) * ( rOut * rOut - rIn * rIn );
outerArea_ = 2*M_PI * rOut * length_;
innerArea_ = 2*M_PI * rIn * length_;
}
break;
/*
* Cylindrical Slice
*/
case 1:
volume_ = M_PI * diameter_ * diameter_ * thickness_ / 4.0;
outerArea_ = M_PI * diameter_ * diameter_ / 4.0;
innerArea_ = outerArea_;
break;
/*
* User defined
*/
case 3:
// Nothing to be done here. Volume and inner-, outer areas specified by
// user.
break;
default:
assert( 0 );
}
}
void DifBuffer::vProcess( const Eref & e, ProcPtr p )
{
......
......@@ -61,7 +61,8 @@ class DifBuffer: public DifBufferBase{
void vSetInnerArea(const Eref& e, double innerArea );
double vGetInnerArea(const Eref& e) const;
void calculateVolumeArea(const Eref& e);
static const Cinfo * initCinfo();
private:
......
......@@ -100,6 +100,8 @@ void DifShell::vSetCeq( const Eref& e, double Ceq )
}
Ceq_ = Ceq;
prevC_ = Ceq;
C_ = Ceq;
}
double DifShell::vGetCeq(const Eref& e ) const
......@@ -155,6 +157,7 @@ void DifShell::vSetShapeMode(const Eref& e, unsigned int shapeMode )
return;
}
shapeMode_ = shapeMode;
calculateVolumeArea(e);
}
unsigned int DifShell::vGetShapeMode(const Eref& e) const
......@@ -170,6 +173,7 @@ void DifShell::vSetLength(const Eref& e, double length )
}
length_ = length;
calculateVolumeArea(e);
}
double DifShell::vGetLength(const Eref& e ) const
......@@ -185,6 +189,7 @@ void DifShell::vSetDiameter(const Eref& e, double diameter )
}
diameter_ = diameter;
calculateVolumeArea(e);
}
double DifShell::vGetDiameter(const Eref& e ) const
......@@ -200,6 +205,7 @@ void DifShell::vSetThickness( const Eref& e, double thickness )
}
thickness_ = thickness;
calculateVolumeArea(e);
}
double DifShell::vGetThickness(const Eref& e) const
......@@ -276,12 +282,9 @@ double DifShell::integrate( double state, double dt, double A, double B )
return state + A * dt ;
}
void DifShell::vReinit( const Eref& e, ProcPtr p )
void DifShell::calculateVolumeArea(const Eref& e)
{
dCbyDt_ = leak_;
Cmultiplier_ = 0;
double rOut = diameter_/2.;
double rOut = diameter_/2.;
double rIn = rOut - thickness_;
......@@ -326,11 +329,20 @@ void DifShell::vReinit( const Eref& e, ProcPtr p )
default:
assert( 0 );
}
}
void DifShell::vReinit( const Eref& e, ProcPtr p )
{
dCbyDt_ = leak_;
Cmultiplier_ = 0;
calculateVolumeArea(e);
C_= Ceq_;
prevC_ = Ceq_;
concentrationOut()->send( e, C_ );
innerDifSourceOut()->send( e, prevC_, thickness_ );
outerDifSourceOut()->send( e, prevC_, thickness_ );
}
void DifShell::vProcess( const Eref & e, ProcPtr p )
......@@ -342,22 +354,24 @@ void DifShell::vProcess( const Eref & e, ProcPtr p )
C_ = integrate(C_,p->dt,dCbyDt_,Cmultiplier_);
/**
* Send ion concentration to ion buffers. They will send back information on
* the reaction (forward / backward rates ; free / bound buffer concentration)
* immediately, which this DifShell will use to find amount of ion captured
* or released in the current time-step.
*/
prevC_ = C_;
//cout<<"Shell "<< C_<<" ";
dCbyDt_ = leak_;
Cmultiplier_ = 0;
prevC_ = C_;
innerDifSourceOut()->send( e, prevC_, thickness_ );
outerDifSourceOut()->send( e, prevC_, thickness_ );
concentrationOut()->send( e, C_ );
concentrationOut()->send( e, C_ );
}
void DifShell::vBuffer(const Eref& e,
double kf,
......@@ -380,6 +394,7 @@ void DifShell::vFluxFromOut(const Eref& e, double outerC, double outerThickness
dCbyDt_ += diff * outerC;
Cmultiplier_ += diff ;
}
void DifShell::vFluxFromIn(const Eref& e, double innerC, double innerThickness )
......@@ -387,6 +402,7 @@ void DifShell::vFluxFromIn(const Eref& e, double innerC, double innerThickness )
//influx from inner shell
//double dx = ( innerThickness + thickness_ ) / 2.0;
double diff = 2.* D_/volume_ * innerArea_ / (innerThickness + thickness_);
dCbyDt_ += diff * innerC ;
Cmultiplier_ += diff ;
}
......@@ -399,6 +415,7 @@ void DifShell::vInflux(const Eref& e, double I )
* valence_: charge on ion: dimensionless
*/
dCbyDt_ += I / ( F * valence_ * volume_ );
}
/**
......@@ -448,6 +465,7 @@ void DifShell::vEqTauPump(const Eref& e, double kP )
void DifShell::vMMPump(const Eref& e, double vMax, double Kd )
{
Cmultiplier_ += ( vMax / volume_ ) / ( C_ + Kd ) ;
}
void DifShell::vHillPump(const Eref& e, double vMax, double Kd, unsigned int hill )
......
......@@ -73,6 +73,9 @@ class DifShell: public DifShellBase{
void vSetInnerArea(const Eref& e, double innerArea );
double vGetInnerArea(const Eref& e) const;
void calculateVolumeArea(const Eref& e);
static const Cinfo * initCinfo();
......
......@@ -322,12 +322,12 @@ void HHChannel::vProcess( const Eref& e, ProcPtr info )
}
ChanCommon::vSetGk( e, g_ * HHChannelBase::modulation_ );
this->updateIk();
ChanCommon::updateIk();
// Gk_ = g_;
// Ik_ = ( Ek_ - Vm_ ) * g_;
// Send out the relevant channel messages.
sendProcessMsgs( e, info );
ChanCommon::sendProcessMsgs( e, info );
g_ = 0.0;
}
......@@ -386,13 +386,13 @@ void HHChannel::vReinit( const Eref& er, ProcPtr info )
}
ChanCommon::vSetGk( er, g_ * HHChannelBase::modulation_ );
updateIk();
ChanCommon::updateIk();
// Gk_ = g_;
// Ik_ = ( Ek_ - Vm_ ) * g_;
// Send out the relevant channel messages.
// Same for reinit as for process.
sendReinitMsgs( er, info );
ChanCommon::sendReinitMsgs( er, info );
g_ = 0.0;
}
......
......@@ -246,7 +246,8 @@ void HSolve::addGkEk( Id id, double Gk, double Ek )
void HSolve::addConc( Id id, double conc )
{
unsigned int index = localIndex( id );
assert( index + 1 < externalCalcium_.size() );
assert( index < externalCalcium_.size() );
externalCalcium_[ index ] = conc;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment