This page will look better in a graphical browser that supports web standards, but is accessible to any browser or internet device.

Served by Samwise.


Models two compartments, fluid and air, for a soluble gas passively exchanging between the volumes, V1 liquid, V2 air, forming a closed system. Assumes constant volumes, dry air. Simple model of alveolar-capillary gas exchange.

Model number: 0429

Run Model: 
    Help running a JSim model.
Java runtime required. (JSim model may take 10-20 seconds to load.)
MacOS: Adjust "System Preferences" -> "Security & Privacy" to allow Java JSim jnlp app to execute.
More info here.


 Simple two compartment model of gas exchange between fluid and gas compartments. Emphasis 
 is on mass exchange as the mass flux of gas across a phase boundary can be confusing. 
 For this model the compartment volumes and temperature are held constant and the system is 
 closed so that the total mass in the system is constant.

 Amount of CO2 in water compartment = QCO2cap (mol) = CCO2 (mmoles/ml) * VolWater (ml)
 Amount of CO2 in air compartment   = QCO2air (mol) = pCO2 (mmHg) * VolAir (ml) 
                                                       *(pCO2/760)/(((37+273)/273)*22400 ml/mol) 
     Example for water with pCO2 of 50 mmHg: Amount Q for CO2 in H2O at 37C (or 310K) = 
                      = AlphaCO2w37 (ml/ml)* (50/760) / (((37+273)/273)*22400) 

 STP O2 and CO2 Solubility Equations from Christmas 2017 Eq 4a and 4b:
 Christmas KM and Bassingthwaighte JB. Equations for O2 and CO2 solubilities
   in saline and plasma: Combining temperature and density dependences. 
   J Appl Physiol 122: 1313-1320, 2017.

More information: Alveolar capillary exchange notes (pdf)

Figure: Upper panel: Partial pressure of CO2 (pCO2) drives the exchange between the two compartments. Black line is pCO2 in the water (pCO2w) compartment and the dashed red line is the pCO2 in the alveolar gas compartment (pCO2alv). Lower panel: the amount of CO2 gas, in moles, in each compartment and total (Qtot). Initially, the water compartment has the larger quantity of CO2 (QCO2molV1), but as the partial pressures equilibrate, CO2 moves into the alveolar gas compartment until, at equilbrium, the majority of CO2 is in it. Note that the total amount of CO2 in the system remains unchanged (green line).


The equations for this model may be viewed by running the JSim model applet and clicking on the Source tab at the bottom left of JSim's Run Time graphical user interface. The equations are written in JSim's Mathematical Modeling Language (MML). See the Introduction to MML and the MML Reference Manual. Additional documentation for MML can be found by using the search option at the Physiome home page.

Download JSim model project file

Model Feedback

We welcome comments and feedback for this model. Please use the button below to send comments:


 Christmas KM and Bassingthwaighte JB. Equations for O2 and CO2 solubilities in saline and plasma: 
 Combining temperature and density dependences. J Appl Physiol 122: 1313-1320, 2017.

 Dash RK and Bassingthwaighte JB. Erratum to: Blood HbO2 and HbCO2 dissociation curves at varied O2, CO2, pH, 
 2,3-DPG and Temperature Levels. Ann Biomed Eng 38(4): 1683-1701, DOI: 10.1007/s10439-010-9948-y PMC2862600, 2010

 Hills BA, Gas Transfer in the Lung (Book), Cambridge University Press, London, 1974

 Comroe J, Lung (Book), YEAR BOOK MEDICAL, Second Edition edition (1965)

Related Models

Key Terms

gas exchange, Compartment model, ODE, carbon dioxide, oxygen, gas solubilty, mass balance, alveolus, lung, Cardiac grid, tutorial

Model History

Get Model history in CVS.

Posted by: Name


Please cite in any publication for which this software is used and send an email with the citation and, if possible, a PDF file of the paper to:
Or send a copy to:
The National Simulation Resource, Director J. B. Bassingthwaighte, Department of Bioengineering, University of Washington, Seattle WA 98195-5061.

[This page was last modified 29Jan20, 1:02 pm.]

Model development and archiving support at provided by the following grants: NIH U01HL122199 Analyzing the Cardiac Power Grid, 09/15/2015 - 05/31/2020, NIH/NIBIB BE08407 Software Integration, JSim and SBW 6/1/09-5/31/13; NIH/NHLBI T15 HL88516-01 Modeling for Heart, Lung and Blood: From Cell to Organ, 4/1/07-3/31/11; NSF BES-0506477 Adaptive Multi-Scale Model Simulation, 8/15/05-7/31/08; NIH/NHLBI R01 HL073598 Core 3: 3D Imaging and Computer Modeling of the Respiratory Tract, 9/1/04-8/31/09; as well as prior support from NIH/NCRR P41 RR01243 Simulation Resource in Circulatory Mass Transport and Exchange, 12/1/1980-11/30/01 and NIH/NIBIB R01 EB001973 JSim: A Simulation Analysis Platform, 3/1/02-2/28/07.