Figure 1a: Concentration: Default parameter set
A washout curve is plotted for the case when Cin, the
inflowing concentration is always zero. C, the
concentration in the compartment has the same shape
as the first order decay process.
Figure 1b: Residual Quantity: Default parameter set
The residual quantities, Q and Qint are calculated by
two different methods and give the same result:
Q(t) = Volume*C(t)
/ t
Qint(t) = | Flow*(Cin(t')-C(t'))dt'
/ t.min
CHANGE TO PARSET ExternCin
Figure 1a: Concentration: ExternCin parameter set
The input concentration, Cin, is given by a Lagged
Normal function from the function generator, fgen_1.
Cout, the outflow, equals C, the concentration in
the compartment, because the compartment is
instantaneously well-mixed. The outflow has a lower
peak and a broader distribution caused by the
instantaneous mixing.
Figure 1b: Residual Quantity: ExternCin parameter set
See above discussion for Figure 1b using default parameter
set.
Figure 2A: Area of Cin and Cout: Default Parameter set
The running integral of Cin and Cout with respect to time is
plotted. Eventually the areas are equal after a "long" time,
in this case 40 seconds.
Figure 2B: Transit Time: Default parameter set
The running calculation of Tbar_in, Tbar_out, and Tbar_sys
is plotted along with the calculation of Tbar_sys equal to
Volume/Flow (green dashed line). It is seen that after 40
seconds when the area of the output concentration curve
matches the area of the input concentration curve, Tbar_sys
(orange line) approaches the value given by the system
transit time (green dashed line).
// MODEL NUMBER: 0241
// MODEL NAME: Comp1Flow
// SHORT DESCRIPTION: Models single compartment with inflowing and outflowing
// concentration of a single substance.
import nsrunit; unit conversion on;
math Comp1Flow {
// INDEPENDENT VARIABLE
realDomain t sec; t.min=0; t.max=40; t.delta=0.1;
// PARAMETERS
real C0 = 0 mM, // Initial Concentration
Volume = 0.06 ml, // Volume of compartment
Flow = 0.01 ml/sec; // Flow rate (volume per second)
extern real Cin(t) mM; // Inflowing concentration (defined with
// function generator)
// VARIABLES
real C(t) mM, // Concentration in compartment
Cout(t) mM; // Outflowing concentration NOTE that Cout=C because
// the compartment is instantaneously well mixed.
// INITIAL CONDITION
when(t = t.min) C=C0;
// ORDINARY DIFFERENTIAL EQUATION
C:t = (Flow/Volume)*(Cin-Cout);
Cout = C;
//ADDITIONAL CALCULATIONS
real Canalytic(t) mM;
Canalytic= Cin+(C0-Cin)*exp(-Flow*t/Volume);
// QUANTITY OF SUBSTANCE FROM TWO DIFFERENT CALCULATIONS
real Q(t) nmol, // Quantity = Volume* Concentration
Qint(t) nmol; // Quantity = integral of Flow multiplying inflow
// concentration minus outflow concentration
Q = Volume*C;when (t=t.min) Qint=Volume*C0;
Qint:t = Flow*(Cin-Cout);
// AREA AND TRANSIT TIME OF INFLOW AND OUTFLOW CONCENTRATIONS
private real S2_in(t) mM*sec^2, S2_out(t) mM*sec^2; // First moments
real Area_in(t) mM*sec, Area_out(t) mM*sec, // Areas
Tbar_in(t) sec, Tbar_out(t) sec, Tbar_sys(t) sec; // Transit times
when(t=t.min) {Area_in = 0; S2_in = 0;
Area_out = 0; S2_out = 0; }
Area_in:t = Cin;
Area_out:t = Cout;
S2_in:t = Cin*t;
S2_out:t = Cout*t;
Tbar_in = if(Area_in>0) S2_in /Area_in else 0;
Tbar_out = if(Area_out>0) S2_out/Area_out else 0;
Tbar_sys = Tbar_out-Tbar_in;
}
/* DIAGRAM
+-----------------------------+
Flow*Cin ---> C ---> Flow*Cout
| Volume | Cout = C
| instantaneously well mixed |
+-----------------------------+
DETAILED DESCRIPTION:
In a single compartment with flow, there is a source
term, (Flow/Volume)*Cin, which adds material to the
compartment, and a sink term, -(Flow/Volume)*C, the washout
term, which removes material from the compartment. These
two terms are usually combined as a single term in the
mass balance ordinary differential equation after dividing
left and right hand sides by the volume:
dC/dt = (Flow/Volume)*(Cin-C).
The compartment is instantaneously well mixed.
Various methods for checking the
calculations in a model are illustrated: (1) two methods of
calculating the amount of material in a compartment with
flow, (2) comparison of the running integrals of inflow and
outflow concentrations, and (3) calculation of the system
transit time of a compartment model with flow by
two different methods.
SHORTCOMINGS/GENERAL COMMENTS:
- None.
KEY WORDS:
compartment, compartmental, flow, first order process, Tutorial
REFERENCES: None.
REVISION HISTORY:
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
*/