/* MODEL NUMBER: 0236
MODEL NAME: Comp1FlowReactions2
SHORT DESCRIPTION: Single Compartment with flow and
irreversible conversion of C to D and D to E.
*/
import nsrunit; unit conversion on;
math Comp1FlowReactions2 {
// INDEPENDENT VARIABLE
realDomain t sec; t.min=0; t.max=60; t.delta=0.1;
// PARAMETERS
real F = 0.01 ml/sec, // Flow
V = 0.05 ml, // Volume
Gc2d = 0.03 ml/sec, // Clearance rate C->D
Gd2e = 0.015 ml/sec, // Clearance rate D->E
C0 = 0 mM, // Initial concentration of C
D0 = 0.0 mM, // Initial concentration of D
E0 = 0.0 mM; // Initial concentration of E
extern real Cin(t) mM; // Inflow Concentration
// VARIABLES
real C(t) mM, // Concentration of C
D(t) mM, // Concentration of D
E(t) mM, // Concentration of E
Cout(t) mM, // Outflow concentration of C, Cout=C
Dout(t) mM, // Outflow concentration of D, Dout=D
Eout(t) mM; // Outflow concentration of E, Eout=E
// INITIAL CONDITIONS
when(t=t.min) { C = C0; D = D0; E = E0; }
// ORDINARY DIFFERENTIAL EQUATIONS
C:t = F/V*(Cin-C) -Gc2d/V*C;
D:t = F/V*( -D) +Gc2d/V*C-Gd2e/V*D;
E:t = F/V*( -E) +Gd2e/V*D;
/* Outflow concentration equals compartment concentration
because compartments are instantaneously well mixed. */
Cout=C;
Dout=D;
Eout=E;
//ADDITIONAL CALCULATIONS
real Qint(t) mmol,
Q(t) mmol;
when(t=t.min) {Qint=V*(C+D+E);}
Qint:t=F*(Cin-Cout-Dout-Eout);
Q=V*(C+D+E);
// AREA AND TRANSIT TIME OF INFLOW AND OUTFLOW CONCENTRATIONS
real Tout(t) mM;
Tout = Cout+Dout+Eout;
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 = Tout;
S2_in:t = Cin*t;
S2_out:t = Tout*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;
real Area_outC(t) mM*sec,
Area_outD(t) mM*sec,
Area_outE(t) mM*sec;
when(t=t.min) { Area_outC=0; Area_outD=0; Area_outE=0;}
Area_outC:t=Cout;
Area_outD:t=Dout;
Area_outE:t=Eout;
}
/*
DIAGRAM:
F(flow) +-------------------------------+
Cin(t) ----> | F(flow)
| Gc2d Gd2e -->Cout(t)=C1(t)
| C(t)----->D(t)----->E(t) -->Dout(t)=D1(t)
| -->Eout(t)=E1(t)
| V (volume) |
| Gc2d, Gd2E (conversion rates) |
| instantaneously well mixed |
+-------------------------------+
DETAILED DESCRIPTION:
This is a one compartment model. F is flow, Cin is inflow
concentration, Cout, Dout, and Eout are outflow concentrations, V
is volume, Gc2d is the rate at which substance C is converted
to substance D, andGd2e is the rate at which substance D is
converted to substance E. The reactions are irreversible.
C0, D0, and E0 are the initial concentrations of
C, D, and E respectively. The amount of material in the compartment
is calculated by multiplying the volume by the sum of the
concentrations and also by integrating the flow multiplying the
difference of what flows in minus what flows out.
SHORTCOMINGS/GENERAL COMMENTS:
KEY WORDS: Compartmental, one compartment, single compartment,
flow, reactions, conversion, irreversible, Tutorial
REFERENCES:
Jacquez JA. Compartmental Analysis in Biology
and Medicine. Ann Arbor: University of Michigan Press, 1996.
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
*/