Skip to content
Snippets Groups Projects
Commit 6aa27cac authored by Asia Jędrzejewska-Szmek's avatar Asia Jędrzejewska-Szmek
Browse files

Change order of operations to slightly improve accuracy

parent bc28246b
No related branches found
No related tags found
1 merge request!205DifShell and DifBuffer implementation
...@@ -454,14 +454,14 @@ void DifBuffer::vReinit( const Eref& e, ProcPtr p ) ...@@ -454,14 +454,14 @@ void DifBuffer::vReinit( const Eref& e, ProcPtr p )
void DifBuffer::vFluxFromIn(const Eref& e,double innerC, double innerThickness) void DifBuffer::vFluxFromIn(const Eref& e,double innerC, double innerThickness)
{ {
double dif = 2 * D_ * innerArea_ / (thickness_ + innerThickness)/ volume_; double dif = 2 * D_ / volume_* innerArea_ / (thickness_ + innerThickness);
Af_ += dif * innerC; Af_ += dif * innerC;
Bf_ += dif; Bf_ += dif;
} }
void DifBuffer::vFluxFromOut(const Eref& e,double outerC, double outerThickness) void DifBuffer::vFluxFromOut(const Eref& e,double outerC, double outerThickness)
{ {
double dif = 2 * D_ * outerArea_ / (thickness_ + outerThickness) / volume_; double dif = 2 * D_ / volume_* outerArea_ / (thickness_ + outerThickness);
Af_ += dif * outerC; Af_ += dif * outerC;
Bf_ += dif; Bf_ += dif;
} }
...@@ -371,7 +371,7 @@ void DifShell::vBuffer(const Eref& e, ...@@ -371,7 +371,7 @@ void DifShell::vBuffer(const Eref& e,
void DifShell::vFluxFromOut(const Eref& e, double outerC, double outerThickness ) void DifShell::vFluxFromOut(const Eref& e, double outerC, double outerThickness )
{ {
double diff =2.* D_ * outerArea_ / (outerThickness + thickness_) /volume_; double diff =2.* D_ /volume_ * outerArea_ / (outerThickness + thickness_) ;
//influx from outer shell //influx from outer shell
/** /**
* We could pre-compute ( D / Volume ), but let us leave the optimizations * We could pre-compute ( D / Volume ), but let us leave the optimizations
...@@ -386,8 +386,7 @@ void DifShell::vFluxFromIn(const Eref& e, double innerC, double innerThickness ) ...@@ -386,8 +386,7 @@ void DifShell::vFluxFromIn(const Eref& e, double innerC, double innerThickness )
{ {
//influx from inner shell //influx from inner shell
//double dx = ( innerThickness + thickness_ ) / 2.0; //double dx = ( innerThickness + thickness_ ) / 2.0;
double diff = 2.* D_ * innerArea_ / (innerThickness + thickness_) /volume_; double diff = 2.* D_/volume_ * innerArea_ / (innerThickness + thickness_);
//cout << "FluxFromIn "<<innerC<<" "<<innerThickness;
dCbyDt_ += diff * innerC ; dCbyDt_ += diff * innerC ;
Cmultiplier_ += diff ; Cmultiplier_ += diff ;
} }
......
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