To get a "tight" comparison, set t.max to 305 seconds,
and t.delta = 0.001 for both models.
BTEX_Pipe: Shows the conservation of volume of volume
(top Figure, green line), conservation of mass (middle
Figure, green line) and the concentrations in the two compartments
and average concentration in the pipe (bottom Figure) as functions
of time for BTEX10_OscillatingFlow model.
Comp_Pipe: Similar to plots for Comp1_OscillatingFlow model
where the BTEX10 pipe has been replace by a one compartment pipe.
Comparison: The concentrations for both models are plotted
with the BTEX10_OscillatingFlow results plotted as dashed red
lines.
// MODEL FOR VALIDATING BTEX10_OscillatingFlow
import nsrunit;
unit conversion on;
math Comp1_OscillatingFlow {
// INDEPENDENT VARIABLE
realDomain t sec; t.min=0; t.max=100; t.delta=0.01;
// PARAMETERS
real A = .1 ml/sec, // Amplitude of flow
k = 1 sec^(-1), // Frequency of Flow
F(t) = A*sin(k*t), // Reversing Flow
FluxVolume= 2*A/k, // Net volume flow for half
// of reversing cycle, F>0.
a1 = 5 dimensionless, // Scales V1, must be >1
a2 = 2 dimensionless, // Scales V2, must be >1
V10 = (if(a1>1) a1 else 2)*FluxVolume, // Initial volume for V1
V20 = (if(a2>1) a2 else 2)*FluxVolume, // Initial volume for V2
Vm = 0.1 ml, // Pipe Volume
Am0 = 0 mmol, // Initial Amount in Pipe
A10 = 1 mmol, // Initial Amount in V1
A20 = 0 mmol; // Initial Amount in V2
// DEPENDENT VARIABLES
real A1(t) mmol, // Amount in V1
A2(t) mmol, // Amount in V2
Am(t) mmol, // Amount in pipe
V1(t) ml, // Volume V1
V2(t) ml; // Volume V2
// INITIAL CONDITIONS
when(t=t.min) {A1=A10; V1=V10;
A2=A20; V2=V20;
Am=Am0; }
// ORDINARY DIFFERENTIAL EQUATIONS
V1:t = -F;
V2:t = F;
A1:t = if(F>0) -F*(A1/V1) else -F*(Am/Vm);
A2:t = if(F>0) F*(Am/Vm) else F*(A2/V2);
Am:t/Vm = if(F>0) F/Vm*(A1/V1-Am/Vm) else -F/Vm*(A2/V2-Am/Vm);
// CALCULATE CONCENTRATIONS
real C1(t) M, C2(t) M, Cm(t) M;
C1=A1/V1;
C2=A2/V2;
Cm=Am/Vm;
}
/*
DIAGRAM:
Variable Fixed Pipe Variable
Volume V1(t) Volume Vm Volume V2(t)
---------- ----------
( ) _____________________ ( )
( C1(t) <----> COMPARTMENT PIPE <---> C2(t) )
( ) ______________________( )
---------- ----------
Flow = A*sin(k*t),
This model consists of a stirred tank with variable volume,
a stirred tank with fixed volume, and a third stirred tank with
variable volume. Material sloshes back and forth between the
two stirred tanks with variable volumes through the middle
stirred tank (compartment model of pipe).
*/
To get a "tight" comparison, set t.max to 305 seconds,
and t.delta = 0.001 for both models.
BTEX_Pipe: Shows the conservation of volume of volume
(top Figure, green line), conservation of mass (middle
Figure, green line) and the concentrations in the two compartments
and average concentration in the pipe (bottom Figure) as functions
of time for BTEX10_OscillatingFlow model.
Comp_Pipe: Similar to plots for Comp1_OscillatingFlow model
where the BTEX10 pipe has been replace by a one compartment pipe.
Comparison: The concentrations for both models are plotted
with the BTEX10_OscillatingFlow results plotted as dashed red
lines.
/* MODEL NUMBER: 0308
MODEL NAME: BTEX10_OscillatingFlow
SHORT DESCRIPTION: Two single compartments use an oscillating flow
through a pipe (BTEX10) to exchange material and volume.
*/
import nsrunit; unit conversion on;
math BTEX10_OscillatingFlow {
// INDEPENDENT VARIABLES
realDomain t sec; t.min=0; t.max=100; t.delta=0.01;
real L = 0.1 cm, Ndiv=7;
realDomain x cm; x.min=0; x.max=L; x.ct=Ndiv;
// PARAMETERS
real A = .1 ml/sec, // Amplitude of flow
k = 1 sec^(-1), // Frequency of Flow
F(t) = A*sin(k*t), // Reversing Flow
FluxVolume= 2*A/k, // Net volume flow for half
// of reversing cycle, F>0.
a1 = 5 dimensionless, // Scales V1, must be >1
a2 = 2 dimensionless, // Scales V2, must be >1
V10 = (if(a1>1) a1 else 2)*FluxVolume, // Initial volume for V1
V20 = (if(a2>1) a2 else 2)*FluxVolume, // Initial volume for V2
Vm = 0.1 ml, // Pipe Volume
Cm0 = 0 M, // Initial Pipe Concentration
A10 = 1 mmol, // Initial Amount in V1
A20 = 0 mmol, // Initial Amount in V2
D = 0.1 cm^2/sec; // Diffusion coefficient in pipe
// DEPENDENT VARIABLES
real A1(t) mmol, // Amount in V1
A2(t) mmol, // Amount in V2
Am(t) mmol, // Amount in pipe
Cm(t,x) M, // Concentration in pipe
CoutL(t) M, // Concentration at outflow
// at left when F<0
CoutR(t) M, // Concentration at outflow
// at right when F>=0
V1(t) ml, // Volume V1
V2(t) ml; // Volume V2
real FlowFromLeft(t) = if(F>=0) F else 0;
real FlowFromRight(t) = if(F<=0) F else 0;
// INITIAL CONDITIONS
when(t=t.min) {A1=A10; V1=V10;
A2=A20; V2=V20;
Cm=Cm0; }
// BOUNDARY CONDITIONS
when(x=x.min) {-FlowFromLeft*L/Vm*(Cm-A1/V1) + D*Cm:x=0; CoutR=Cm;}
when(x=x.max) {-FlowFromRight*L/Vm*(Cm-A2/V2) + D*Cm:x=0; CoutL=Cm;}
// ORDINARY DIFFERENTIAL EQUATIONS
V1:t = -F;
V2:t = F;
A1:t = if(F>0) -F*(A1/V1) else -F*(CoutR);
A2:t = if(F>0) F*(CoutL) else F*(A2/V2);
// PARTIAL DIFFERENTIAL EQUATION FOR PIPE
Cm:t = -F*L/Vm*Cm:x + D*Cm:x:x;
// CALCULATE AMOUNT IN PIPE AND CONCENTRATIONS IN V1 and V2
Am = Vm*sum(Cm@x)/Ndiv;
real C1(t) M, C2(t) M;
C1=A1/V1;
C2=A2/V2;
}
/*
DIAGRAM:
Variable Fixed Pipe Variable
Volume V1(t) Volume Vm Volume V2(t)
---------- ----------
( ) _________________ ( )
( C1(t) <----> BTEX10 PIPE <---> C2(t) )
( ) _________________ ( )
---------- ----------
Flow = A*sin(k*t),
D = 0.1 cm^2/sec is large diffusion coefficient for comparison
with a compartmental pipe.
DETAILED DESCRIPTION:
This model consists of two well-stirred (instantaneously mixed)
compartments connected by a pipe (BTEX10) through which they exchange
material and volume by an oscillating flow. The solutions from
BTEX10_OscillatingFlow are compared with Comp1_OscillatingFlow
(2nd model in this project, where the BTEX10 pipe is replace by
a one compartment pipe) by setting the diffusion cofficient to
a large value (D=0.1 cm^2/sec).
KEY WORDS:
BTEX10, Oscillating flow, reversing flow, PDE, advection, diffusion
REFERENCES:
W.C. Sangren and C.W. Sheppard. A mathematical derivation of the
exchange of a labelled substance between a liquid flowing in a
vessel and an external compartment. Bull Math BioPhys, 15, 387-394,
1953.
C.A. Goresky, W.H. Ziegler, and G.G. Bach. Capillary exchange modeling:
Barrier-limited and flow-limited distribution. Circ Res 27: 739-764, 1970.
J.B. Bassingthwaighte. A concurrent flow model for extraction
during transcapillary passage. Circ Res 35:483-503, 1974.
B. Guller, T. Yipintsoi, A.L. Orvis, and J.B. Bassingthwaighte. Myocardial
sodium extraction at varied coronary flows in the dog: Estimation of
capillary permeability by residue and outflow detection. Circ Res 37: 359-378, 1975.
C.P. Rose, C.A. Goresky, and G.G. Bach. The capillary and
sarcolemmal barriers in the heart--an exploration of labelled water
permeability. Circ Res 41: 515, 1977.
J.B. Bassingthwaighte, F.P. Chinard, C. Crone, C.A. Goresky,
N.A. Lassen, R.S. Reneman, and K.L. Zierler. Terminology for
mass transport and exchange. Am. J. Physiol. 250 (Heart. Circ.
Physiol. 19): H539-H545, 1986.
J.B. Bassingthwaighte, C.Y. Wang, and I.S. Chan. Blood-tissue
exchange via transport and transformation by endothelial cells.
Circ. Res. 65:997-1020, 1989.
Poulain CA, Finlayson BA, Bassingthwaighte JB.,Efficient numerical methods
for nonlinear-facilitated transport and exchange in a blood-tissue exchange
unit, Ann Biomed Eng. 1997 May-Jun;25(3):547-64.
REVISION HISTORY:
Written 09/08/10 Gary M. Raymond
JSim SOFTWARE COPYRIGHT AND REQUEST FOR ACKNOWLEDGMENT OF USE:
JSim software was developed with support from NIH grants HL088516,
and HL073598. Please cite these grants in any publication for which
this software is used and send one reprint of published abstracts or
articles to the address given below. Academic use is unrestricted.
Software may be copied so long as this copyright notice is included.
Copyright (C) 1999-2009 University of Washington.
Contact Information:
The National Simulation Resource,
Director J. B. Bassingthwaighte,
Department of Bioengineering,
University of Washington, Seattle, WA
98195-5061
*/