Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Lecture 12: Multiscale Bio-Modeling and Visualization
Organ Models II: Heart, Cardiovascular Circulation and Reactive Fluid Transport
Chandrajit Bajaj
http://www.cs.utexas.edu/~bajaj
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Blood Circulation
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Heart Organ System
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Active Transport
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Transport of Reactive Substances through Fluids
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Transport of Reactive Substances through Fluids
• To extend the model of fluid hydrodynamics with chemical kinetics to handle flow of reactive substances through fluids.
• To establish a particle-mesh simulation technique for reactive flow transport.
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Basic Fluid Dynamics Equations in [Stam99]
• The incompressible Navier-Stokes equations for inviscid fluids
For the velocity u = (u, v, w), – Conservation of mass
– Conservation of momentum
advection diffusion pressure external force
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Fluids (contd)
• Helmholtz-Hodge decomposition
– “Any vector field is the sum of a mass conserving field and a gradient field.”
• Projection operator P
• The combined Navier-Stokes equations– Using the fact that and , the following equation is obtained:
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Updating the Velocity Field
• The general procedure
w0(x) w1(x) w2(x) w3(x) w4(x)add force advect diffuse project
u(x, t) u(x, t + t )
1. The add force step: f Update the velocity field for the effect of external forces.
Implementation: – Simple.
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Advect Step
2.The advect step: Use the method of characteristics for
the effect of advection: a semi-Lagrangian scheme
– Implementation: • Build a particle tracer and linear (or cubic) interpolator.
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Diffuse step
3.The diffuse step: – Use an implicit method for the effect of viscosity.
– Implementation: • Use the linear solver POIS3D from FISHPAK after discretization.
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Project step
4.The project step: P(w3)• Apply the projection operator to make the velocity field divergent-free.
– Implementation: • Use the linear solver POIS3D form FISHPAK after discretization.
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Moving Substances through the Fluid
• A non-reactive substance is advected by the fluid while diffusing at the same time.
• The following equation can be used to evolve density, temperature, etc.
– Dissipation term
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Introduction to Chemical Kinetics
• What is chemical kinetics?A branch of kinetics that studies the rates and mechanisms of chemical reactions.
• Stoichiometric equation
– A, B, E, F : chemical species (reactants & products)
– a, b, e, f : stoichiometric coefficients
fFeEbBaA
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Reaction
• Reaction rate (a.k.a. rate law)
– Describes the rate r of change of the concentrations, denoted by [*], of reactants and products.
dt
Fd
fdt
Ed
edt
Bd
bdt
Ad
ar
][1][1][1][1
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Reaction Rate• How to decide the reaction rate r :
– r : a function of the concentrations of species present at time t,
– For a large class of chemical reactions, it is proportional to the concentration of each reactant/product raised to some power.
• When, for example, only a forward reaction occurs,
– Once the rate is determined, [A], [B], [C] and [D] are updated by integrating the rate law over time interval.
][][])[],[],[],([ BAkFEBAfr r
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Rate Coefficient Dependence
• Rate coefficient k
– Is a function of both temperature and pressure.
– Usually, the pressure dependence is ignored.
– For many homogeneous reactions,
RT
Ea
Aek
Arrhenius equation
A = const. Ea = activation energy
R = universal gas constant 8.314x10^-3 kJ/(mol. K)
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Extension to Reactive Fluids
Update of velocity field
Evolution of density and temperature
Application of chemical reaction
Update of reaction- related parameters
[Step1] [Step3][Step2] [Step4]
The simulation technique by [Sta99] and [FSJ01] comprises [Step1] and [Step2] and [IKC04] for [Step3] and [Step 4]
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Grid values used in this method
discretized grid
Velocity
Molar concentration
Pressure
Temperature
Reaction rate
• Several values are defined at the center of the grid cell
grid cell defined values
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Added control factors
Control parameter Description
the chemical reaction type
the stoichiometric coefficients
the molar masses
the reaction rate law
the reaction rate constant
the heat source term
the vorticity coefficient
the divergence control factor
fFeEbBaA
FEBA ,,,
FEBA MMMM ,,,
])[],[],[],([ FEBAfr r
),( Tfk k
),( rfTT
),()( rfdt
dor
),( rf
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Computation Flow
u
fpuvuut
u
1
)()(
ddut
dd
2)(
TT TTut
T 2)( rf
dt
Fdre
dt
Edrb
dt
Bdra
dt
Ad
][ ,
][ ,
][ ,
][
fFeEbBaA
),( rfTT
confbuoyuser ffff
),( rf zz )( ambbuoy TTdf
Computation of the fluid’s velocity field
Evolution of the density & temperature Application of chemical reaction
Update of reaction-related parameters
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
[Step1] Update of velocity field
• Uses a modified mass conservation equation, as in [FOA03], to control the expansion/contraction of reactive gases:
• The divergence constraint is determined for each cell according to the reaction process that occurs in the region.– Determined in [Step4] after the application of chemical kinetics.
• The pressure is computed through the modified Poisson equation:
u
)(2
u
tp
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
[Step2] Evolution of density and temperature
• Density field– Similarly as in [Sta99] and [FSJ01] except that multiple substances in the gas mixture are handled:
ddut
dd
2)(
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Reactive Fluids– Each substance is evolved separately.
•Molar concentrations and densities are related by molar masses .
])[],[],[],([ DCBAc
])[],[],[],[(),,,( FMEMBMAMdddd FEBAFEBA d
),,,(F
F
E
E
B
B
A
A
M
d
M
d
M
d
M
dc
FEBA dddd ,,,Evolve .
FEBA MMMM ,,,
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Temperature Fields
• Temperature field
– Similarly as in [Sta99] and [FSJ01] except that a heat source term is added.
– The heat source term is updated for each cell in [Step4] to reflect the occurring chemical reaction in the region.
TT TTut
T 2)(
T
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
[Step3] Application of chemical reaction
• The reaction process is applied for each cell in the reaction system.
① Determine the reaction rate
② Then, the new concentration vector c is updated by integrating the differential equations over t:
])[],[],[],([ FEBAfr r
rfdt
Fdre
dt
Edrb
dt
Bdra
dt
Ad
][ ,
][ ,
][ ,
][
fFeEbBaA
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
[Step4] Update of reaction-related parameters
• The updated density d, temperature T, and reaction rate r influence the velocity through the heat source term external force f and the value.
– The temperature update is completed by taking care of the heat source term defined by
– The buoyancy force, as proposed in
[FSJ01], is updated:
),( rfTT T
zzf )( ambbuoy TTd
T
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Velocity confinement
③ The vorticity confinement force, as proposed in [FSJ01], is updated according to or
④ The resulting external force is applied to the momentum conservation
equation in each time frame.
⑤ The value, determined by or ,is applied to the modified mass conservation equation in the next time frame.
confbuoyuser ffff
),( rf
)( Nhconff
),( rf
),( rfdt
d
),( rfdt
d
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Vorticity confinement•fconf : vorticity confinement force
–Use a vorticity confinement method by Steinhoff and Underhill.
–Inject the energy lost due to numerical dissipation back into the fluid using a forcing term.
–Reduce the numerical dissipation inherent in semi-Lagrangian schemes.
– Implementation: straightforward
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Computation Flow
u
fpuvuut
u
1
)()(
ddut
dd
2)(
TT TTut
T 2)( rf
dt
Fdre
dt
Edrb
dt
Bdra
dt
Ad
][ ,
][ ,
][ ,
][
fFeEbBaA
),( rfTT
confbuoyuser ffff
),( rf zz )( ambbuoy TTdf
Computation of the fluid’s velocity field
Evolution of the density & temperature Application of chemical reaction
Update of reaction-related parameters
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Animation Results – Reactive substance in a gaseous flow
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Additional Reading
1. J. Stam “Stable Fluids”, SIGGRAPH 1999, 121-128.2. N. Foster, D. Metaxas, “Modeling the motion of a hot
turbulent gas”, SIGGRAPH 1997, 181-1883. G. Yngve, J. O’Brien, J. Hodgins. Animating explosions.
SIGGRAPH 2000. 29-364. R. Fedkiw, J. Stam, H. Jensen. “Visual simulation of
smoke”. SIGGRAPH 2001, 23-30.5. W. Gates “Animation of Reactive Fluids”, Ph.D. Thesis,
UBC, 20026. B. Feldman, J. O’Brien, O. Arikan. Animating suspended
particle explosions. TOG, 22(3):23-40. 2003.7. I. Ihm, B. Kang, D. Cha “Animation of Reactive Gaseous
Fluids through Chemical Kinetics”, ACM/Siggraph Symp. on Computer Animation (2004)
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Heart Organ System I
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Heart Disorders I
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Heart Disorder II
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Heart Disorder III
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Heart Disorder IV
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Summary of [Stam99]
• Based on the full Navier-Stokes equations• Based on an ‘unconditionally’ stable computational model– Semi-Lagrangian integration scheme
• Easy to implement• Appropriate for gas and smoke • Suffers from ‘numerical dissipation’
– The flow tends to dampen rapidly.– [Fedkiw01] attempts to solve this problem.
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Basic Equations in [Fedkiw01]
• The incompressible Euler equations “Gases are modeled as inviscid, incompressible, constant density fluids.”
• The equations for the evolution of the temperature T and the smoke’s density
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Updating the Velocity Field
1.The add force step: f– Update the velocity field for the effect of forces.
• fuser : user-defined force (for any purpose)
• fbuoy : gravity and buoyancy forces
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Advection
2.The advect step: - (u • ) u
– Use the method of characteristics for the effect of advection: a semi-Lagrangian scheme
– Implementation: • Build a particle tracer and linear interpolator.
• Same as [Stam99]
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Project step3.The project step: P(w3)
• Apply the projection operator to make the velocity field divergent-free.
• Same as [Stam99]
– Implementation: • Impose free Neumann boundary conditions at the occupied voxels.
• Use the conjugate gradient method with an incomplete Choleski pre-conditioner.
: Poisson equation
Center for Computational VisualizationInstitute of Computational and Engineering SciencesDepartment of Computer Sciences University of Texas at Austin November 2005
Moving Substances through the Fluid
• Use the semi-Lagrangian scheme.