Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moose
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sahil Moza
moose
Commits
5d2cb8a8
Commit
5d2cb8a8
authored
Jan 20, 2017
by
Asia Jędrzejewska-Szmek
Browse files
Options
Downloads
Patches
Plain Diff
Move source messages to class. Correctly initialize Faraday's constant
parent
41b15f25
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!205
DifShell and DifBuffer implementation
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
moose-core/biophysics/DifShell.cpp
+38
-18
38 additions, 18 deletions
moose-core/biophysics/DifShell.cpp
with
38 additions
and
18 deletions
moose-core/biophysics/DifShell.cpp
+
38
−
18
View file @
5d2cb8a8
...
@@ -13,7 +13,8 @@
...
@@ -13,7 +13,8 @@
#include
"ElementValueFinfo.h"
#include
"ElementValueFinfo.h"
#include
"../utility/numutil.h"
#include
"../utility/numutil.h"
#include
<cmath>
#include
<cmath>
#include
<boost/numeric/odeint.hpp>
using
namespace
boost
::
numeric
;
SrcFinfo1
<
double
>*
DifShell
::
concentrationOut
()
SrcFinfo1
<
double
>*
DifShell
::
concentrationOut
()
{
{
static
SrcFinfo1
<
double
>
concentrationOut
(
"concentrationOut"
,
static
SrcFinfo1
<
double
>
concentrationOut
(
"concentrationOut"
,
...
@@ -83,7 +84,7 @@ const Cinfo* DifShell::initCinfo()
...
@@ -83,7 +84,7 @@ const Cinfo* DifShell::initCinfo()
new
EpFunc4
<
DifShell
,
double
,
double
,
double
,
double
>
(
&
DifShell
::
buffer
));
new
EpFunc4
<
DifShell
,
double
,
double
,
double
,
double
>
(
&
DifShell
::
buffer
));
static
Finfo
*
bufferShared
[]
=
{
static
Finfo
*
bufferShared
[]
=
{
concentrationOut
(),
&
reaction
DifShell
::
concentrationOut
(),
&
reaction
};
};
static
SharedFinfo
buffer
(
"buffer"
,
static
SharedFinfo
buffer
(
"buffer"
,
"This is a shared message from a DifShell to a Buffer (FixBuffer or DifBuffer). "
"This is a shared message from a DifShell to a Buffer (FixBuffer or DifBuffer). "
...
@@ -105,8 +106,9 @@ const Cinfo* DifShell::initCinfo()
...
@@ -105,8 +106,9 @@ const Cinfo* DifShell::initCinfo()
new
EpFunc2
<
DifShell
,
double
,
double
>
(
&
DifShell
::
fluxFromOut
));
new
EpFunc2
<
DifShell
,
double
,
double
>
(
&
DifShell
::
fluxFromOut
));
static
Finfo
*
innerDifShared
[]
=
{
static
Finfo
*
innerDifShared
[]
=
{
innerDifSourceOut
(),
&
fluxFromOut
,
&
fluxFromOut
DifShell
::
innerDifSourceOut
(),
};
};
static
SharedFinfo
innerDif
(
"innerDif"
,
static
SharedFinfo
innerDif
(
"innerDif"
,
"This shared message (and the next) is between DifShells: adjoining shells exchange information to "
"This shared message (and the next) is between DifShells: adjoining shells exchange information to "
...
@@ -120,7 +122,7 @@ const Cinfo* DifShell::initCinfo()
...
@@ -120,7 +122,7 @@ const Cinfo* DifShell::initCinfo()
static
Finfo
*
outerDifShared
[]
=
{
static
Finfo
*
outerDifShared
[]
=
{
&
fluxFromIn
,
&
fluxFromIn
,
outerDifSourceOut
(),
DifShell
::
outerDifSourceOut
(),
};
};
static
SharedFinfo
outerDif
(
"outerDif"
,
static
SharedFinfo
outerDif
(
"outerDif"
,
...
@@ -128,8 +130,12 @@ const Cinfo* DifShell::initCinfo()
...
@@ -128,8 +130,12 @@ const Cinfo* DifShell::initCinfo()
outerDifShared
,
outerDifShared
,
sizeof
(
outerDifShared
)
/
sizeof
(
Finfo
*
));
sizeof
(
outerDifShared
)
/
sizeof
(
Finfo
*
));
static
ReadOnlyElementValueFinfo
<
DifShell
,
double
>
C
(
"C"
,
//Should be changed it to ElementValueFinfo, to correctly set initial
"Concentration C is computed by the DifShell and is read-only"
,
//conditions (AJS)
static
ElementValueFinfo
<
DifShell
,
double
>
C
(
"C"
,
"Concentration C"
,
// is computed by the DifShell",
&
DifShell
::
setC
,
&
DifShell
::
getC
);
&
DifShell
::
getC
);
static
ElementValueFinfo
<
DifShell
,
double
>
Ceq
(
"Ceq"
,
""
,
static
ElementValueFinfo
<
DifShell
,
double
>
Ceq
(
"Ceq"
,
""
,
&
DifShell
::
setCeq
,
&
DifShell
::
setCeq
,
...
@@ -211,9 +217,9 @@ const Cinfo* DifShell::initCinfo()
...
@@ -211,9 +217,9 @@ const Cinfo* DifShell::initCinfo()
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
&
proc
,
&
proc
,
&
buffer
,
&
buffer
,
concentrationOut
(),
//
concentrationOut(),
innerDifSourceOut
(),
//
innerDifSourceOut(),
outerDifSourceOut
(),
//
outerDifSourceOut(),
&
innerDif
,
&
innerDif
,
&
outerDif
,
&
outerDif
,
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
...
@@ -262,7 +268,7 @@ static const Cinfo* difShellCinfo = DifShell::initCinfo();
...
@@ -262,7 +268,7 @@ static const Cinfo* difShellCinfo = DifShell::initCinfo();
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// Faraday's constant (Coulomb / Mole)
/// Faraday's constant (Coulomb / Mole)
const
double
DifShell
::
F_
=
0.0
;
const
double
DifShell
::
F_
=
96485.3415
;
/* C / mol like in genesis */
DifShell
::
DifShell
()
:
DifShell
::
DifShell
()
:
dCbyDt_
(
0.0
),
dCbyDt_
(
0.0
),
...
@@ -284,6 +290,17 @@ DifShell::DifShell() :
...
@@ -284,6 +290,17 @@ DifShell::DifShell() :
// Field access functions
// Field access functions
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// C is a read-only field
/// C is a read-only field
void
DifShell
::
setC
(
const
Eref
&
e
,
double
C
)
{
if
(
C
<
0.0
)
{
cerr
<<
"Error: DifShell: C cannot be negative!
\n
"
;
return
;
}
C_
=
C
;
}
double
DifShell
::
getC
(
const
Eref
&
e
)
const
double
DifShell
::
getC
(
const
Eref
&
e
)
const
{
{
return
C_
;
return
C_
;
...
@@ -579,7 +596,7 @@ void DifShell::hillPump(const Eref& e,
...
@@ -579,7 +596,7 @@ void DifShell::hillPump(const Eref& e,
void
DifShell
::
localReinit_0
(
const
Eref
&
e
,
ProcPtr
p
)
void
DifShell
::
localReinit_0
(
const
Eref
&
e
,
ProcPtr
p
)
{
{
dCbyDt_
=
leak_
;
dCbyDt_
=
leak_
;
C_
=
Ceq_
;
const
double
dOut
=
diameter_
;
const
double
dOut
=
diameter_
;
const
double
dIn
=
diameter_
-
thickness_
;
const
double
dIn
=
diameter_
-
thickness_
;
...
@@ -629,10 +646,11 @@ void DifShell::localProcess_0( const Eref & e, ProcPtr p )
...
@@ -629,10 +646,11 @@ void DifShell::localProcess_0( const Eref & e, ProcPtr p )
* Send ion concentration and thickness to adjacent DifShells. They will
* Send ion concentration and thickness to adjacent DifShells. They will
* then compute their incoming fluxes.
* then compute their incoming fluxes.
*/
*/
innerDifSourceOut
()
->
send
(
e
,
C_
,
thickness_
);
innerDifSourceOut
()
->
send
(
e
,
C_
,
thickness_
);
outerDifSourceOut
()
->
send
(
e
,
C_
,
thickness_
);
outerDifSourceOut
()
->
send
(
e
,
C_
,
thickness_
);
C_
+=
dCbyDt_
*
p
->
dt
;
C_
+=
dCbyDt_
*
p
->
dt
;
dCbyDt_
=
leak_
;
/**
/**
* Send ion concentration to ion buffers. They will send back information on
* Send ion concentration to ion buffers. They will send back information on
* the reaction (forward / backward rates ; free / bound buffer concentration)
* the reaction (forward / backward rates ; free / bound buffer concentration)
...
@@ -640,6 +658,7 @@ void DifShell::localProcess_0( const Eref & e, ProcPtr p )
...
@@ -640,6 +658,7 @@ void DifShell::localProcess_0( const Eref & e, ProcPtr p )
* or released in the current time-step.
* or released in the current time-step.
*/
*/
concentrationOut
()
->
send
(
e
,
C_
);
concentrationOut
()
->
send
(
e
,
C_
);
dCbyDt_
=
leak_
;
}
}
/*
/*
void DifShell::localProcess_1( const Eref& e, ProcPtr p )
void DifShell::localProcess_1( const Eref& e, ProcPtr p )
...
@@ -660,7 +679,7 @@ void DifShell::localBuffer(const Eref& e,
...
@@ -660,7 +679,7 @@ void DifShell::localBuffer(const Eref& e,
void
DifShell
::
localFluxFromOut
(
const
Eref
&
e
,
double
outerC
,
double
outerThickness
)
void
DifShell
::
localFluxFromOut
(
const
Eref
&
e
,
double
outerC
,
double
outerThickness
)
{
{
double
dx
=
(
outerThickness
+
thickness_
)
/
2.0
;
double
dx
=
(
outerThickness
+
thickness_
)
/
2.0
;
//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
* for the solver.
* for the solver.
...
@@ -670,6 +689,7 @@ void DifShell::localFluxFromOut(const Eref& e, double outerC, double outerThickn
...
@@ -670,6 +689,7 @@ void DifShell::localFluxFromOut(const Eref& e, double outerC, double outerThickn
void
DifShell
::
localFluxFromIn
(
const
Eref
&
e
,
double
innerC
,
double
innerThickness
)
void
DifShell
::
localFluxFromIn
(
const
Eref
&
e
,
double
innerC
,
double
innerThickness
)
{
{
//influx from inner shell
double
dx
=
(
innerThickness
+
thickness_
)
/
2.0
;
double
dx
=
(
innerThickness
+
thickness_
)
/
2.0
;
dCbyDt_
+=
(
D_
/
volume_
)
*
(
innerArea_
/
dx
)
*
(
innerC
-
C_
);
dCbyDt_
+=
(
D_
/
volume_
)
*
(
innerArea_
/
dx
)
*
(
innerC
-
C_
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment