/* MODEL NUMBER: 0248
MODEL NAME: Comp2FlowExchangeReaction
SHORT DESCRIPTION: Model with two species A and B, with flow in
a plasma compartment and exchange with an interstitial fluid
compartment with A converting to B reversibly.
*/
import nsrunit; unit conversion on;
math Comp2FlowExchangeReaction {
// INDEPENDENT VARIABLE
realDomain t sec; t.min=0.0; t.max=60; t.delta = 0.1;
// PARAMETERS
real Fp = 1 ml/(g*min), // Plasma flow per gram of tissue
Vp = 0.05 ml/g, // Volume of plasma compartment
Visf = 0.15 ml/g, // Volume of compartment 2
PSa = 3.0 ml/(g*min), // Permeability Surface area product
// for exchange of A between plasma and isf
PSb = 3.0 ml/(g*min), // Permeability Surface area product
// for exchange of A between plasma and isf
Ga2b = 1.0 ml/(g*min), // Conversion rate of A to B in isf compartment
Gb2a = 0.0 ml/(g*min), // Conversion rate of A to B in isf compartment
Ap0 = 0 mM, // Initial concentration of A in plasma compartment
Aisf0 = 0 mM, // Initial concentration of A in isf compartment
Bp0 = 0 mM, // Initial concentration of B in plasma compartment
Bisf0 = 0 mM; // Initial concentration of B in isf compartment
extern real Ain(t) mM; // Inflow Concentration
// VARIABLES
real Ap(t) mM, // Concentration of A in plasma compartment
Aisf(t) mM, // concentration of A in isf compartment
Aout(t) = Ap, // Plasma outflow concentration of A
Bp(t) mM, // Concentration of B in plasma compartment
Bisf(t) mM, // Concentration of B in isf compartment
Bout(t) = Bp; // Plasma outflow concentration of B
// INITIAL CONDITIONS
when (t=t.min) {Ap = Ap0; Aisf = Aisf0; Bp = Bp0; Bisf = Bisf0; }
//ORDINARY DIFFERENTIAL EQUATIONS
Ap:t = (Fp/Vp)*(Ain-Ap)+(PSa/Vp)*(Aisf-Ap);
Bp:t = (Fp/Vp)*( -Bp)+(PSb/Vp)*(Bisf-Bp);
Aisf:t = (PSa/Visf)*(Ap-Aisf)-(Ga2b/Visf)*Aisf+(Gb2a/Visf)*Bisf;
Bisf:t = (PSb/Visf)*(Bp-Bisf)+(Ga2b/Visf)*Aisf-(Gb2a/Visf)*Bisf;
// ADDITIONAL CALCULATIONS
// QUANTITIES OF MATERIAL IN SYSTEM in nanomoles/gram of tissue
real Qa(t) nmol/g, // Amount of A in system by direct calculation
Qb(t) nmol/g, // Amount of B in system by direct calculation
Qtotal(t) nmol/g, // Amount of A and B in system by direction
Qintegral(t) nmol/g; // Amount of A and B in system by integration
when(t=t.min) {Qintegral=Vp*(Ap0+Bp0) + Visf*(Aisf0+Bisf0);}
Qa = Vp*Ap+Visf*Aisf;
Qb = Vp*Bp+Visf*Bisf;
Qtotal = Vp*(Ap+Bp)+Visf*(Aisf+Bisf);
Qintegral:t = Fp*(Ain-Aout-Bout);
// 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 = Ain;
Area_out:t = Aout+Bout;
S2_in:t = Ain*t;
S2_out:t = (Aout+Bout)*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;
// SOLVE FOR STEADY STATE CONCENTRATIONS GIVEN IMPLICIT EQUATIONS
// (See Notes for Figure 4.)
real ssAp mM, ssBp mM, ssAisf mM, ssBisf mM;
0 = (Fp/Vp)*(Ain(t.max)-ssAp)+(PSa/Vp)*(ssAisf-ssAp);
0 = (Fp/Vp)*( -ssBp)+(PSb/Vp)*(ssBisf-ssBp);
0 = (PSa/Visf)*(ssAp-ssAisf)-(Ga2b/Visf)*ssAisf+(Gb2a/Visf)*ssBisf;
0 = (PSb/Visf)*(ssBp-ssBisf)+(Ga2b/Visf)*ssAisf-(Gb2a/Visf)*ssBisf;
} // END OF MODEL
/*
DIAGRAM:
+-----------------+
Fp*Ain ---> ---> Fp*Aout, Aout=Ap
| ---> Fp*Bout, Bout=Bp
| |
| A1 B1 |
| ^ ^ Vp |
+---|--------|----+
| PSa |PSb
+---|--------|----+
| v v |
| A2<----->B2 |
| Ga2b-> |
| <-Gb2a |
| Visf |
+-----------------+
DETAILED DESCRIPTION:
This is a two compartment model (plasma and isf) exchange
model with flow in the plasma compartment. Both spaces are
instantaneously well mixed. A and B reversibly convert to
each other in the isf space. The isf space can also be used
as a cell space. Flow, Fp, and exchange rates, PSa and PSb,
have the same units, ml/(g*min) (milliliters per minute per
gram of tissue). These units are used in the physiological
terminology to relate them to fluxes per gram of tissue.
The conversion rates have the same units, ml/(g*min).
Ga2b is the conversion rate of A going to B, and Gb2a is the
conversion rate of B becoming A.
The steady state solutions for constant inflow of A are
solved implicitly, using the final value of the input concentration
(assumed to have been constant).
KEY WORDS:
Course, compartment, compartmental, tutorial, exchange,
multiple compartments, flux, steady state, reaction,
conversion, flow, implicit equations
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
*/