Table Of ContentModelling Anaerobic Digesters in Three Dimensions:
Integration of Biochemistry with Computational Fluid Dynamics
by
David L. F. Gaden
A Thesis submitted to the Faculty of Graduate Studies of
The University of Manitoba
in partial fulfilment of the requirements of the degree of
DOCTOR OF PHILOSOPHY
Department of Mechanical and Manufacturing Engineering
University of Manitoba
Winnipeg
Copyright © 2013 by David L. F. Gaden
Microsoft Office 2007 is copyright Microsoft Corporation 2007
Excel, Word and Visual Basic are registered trademarks of Microsoft Corporation
MATLAB is copyright The Math Works, Inc. 1994-2011
CFX is copyright ANSYS, Inc. 2011
Fluent is copyright ANSYS, Inc. 2011
OpenFOAM is a registered trademark of ESI Group
i
Abstract
Anaerobic digestion is a process that simultaneously treats waste and produces renewable energy in the
form of biogas. Applications include swine and cattle waste management, which is still dominated by
aerobic digestion, a less environmental alternative. The low adoption rates of anaerobic digestion is
partly caused by the lack of modelling basis for the technology. This is due to the complexity of the
process, as it involves dozens of interrelated biochemical reactions driven by hundreds of species of
micro-organisms, immersed in a three-phase, non-Newtonian fluid. As a consequence, no practical
computer models exist, and therefore, unlike most other engineering fields, the design process for
anaerobic digesters still relies heavily on traditional methods such as trial and error. The current state-
of-the-art model is Anaerobic Digestion Model No. 1 (ADM1), published by the International Water
Association in 2001. ADM1 is a bulk model, therefore it does not account for the effects of
concentration gradients, stagnation regions, and particle settling. To address this, this thesis works
toward the creation of the first three-dimensional spatially resolved anaerobic digestion model, called
Anaerobic Digestion Model with Multi-Dimensional Architecture (ADM-MDA), by developing a
framework. The framework, called Coupled Reaction-Advection Flow Transient Solver (CRAFTS), is a
general reaction solver for single-phase, incompressible fluid flows. It is a novel partial differential and
algebraic equation (PDAE) solver that also employs a novel programmable logic controller (PLC)
emulator, allowing users to define their own control logic. All aspects of the framework are verified for
proper function, but still need validation against experimental results. The biochemistry from ADM1 is
input into CRAFTS, resulting in a manifestation of ADM-MDA; however the numerical stiffness of ADM1
is found to conflict with the second order accuracy of CRAFTS, and the resulting model can only operate
under restricted conditions. Preliminary results show spatial effects predicted by the CRAFTS model,
and non-observable in the bulk model, impact the digester in a non-trivial manner and lead to
ii
measurable differences in their respective outputs. A detailed discussion of suggested work to arrive at
a practical spatially resolved anaerobic digestion model is also provided.
iii
Acknowledgments
I would like to acknowledge the generous funding provided by Manitoba Hydro and NSERC. I would like
to thank the members of the grad committee, Dr. D. Bagley, Dr. N. Cicek and Dr. H. Soliman for their
patience and their guidance. Dr. D. Batstone from the University of Queensland provided me with the
code and assistance for ADM1, and our discussions were insightful into the model development. I
shared an office and several courses with Amir Birjandi, and he made coming into work fun and
enjoyable. Amir and Jonathon Serhal helped me perform my early experimental work with the stirplate,
and I am greatly appreciative of those long hours they laboured with me. Dr. S. Ormiston was neither a
member of the grad committee, nor an advisor, but his contributions were significant: his technical help
in designing the algorithm was invaluable in achieving a working solver, as I implemented everything he
suggested; and he even let me deliver a couple of lectures in his Heat Transfer class for my professional
development. I would like to thank my advisor, Dr. E. Bibeau, for his trust, patience, and frequent
injections of perspective. When he suggested I study manure for my PhD, I thought he was kidding.
I would like to acknowledge the assistance I received from the OpenFOAM community. Whenever an
OpenFOAM problem refused to give way, Dr. H. Jasak always took time out of his busy schedule to send
me simple three-line emails that lead me straight to the solution. Late in the model development, I
encountered a show-stopping bug, but I was not alone in trying to fix it, with thanks to Ivor Clifford for
his collaboration.
Finally, I would like to thank my wife, Ashley. Without her, this PhD thesis would never have been
written. She worked a job so I could work on the thesis. She supported me in every way imaginable. It
is as much her accomplishment as it is mine. Thank-you.
iv
Table of Contents
Abstract ....................................................................................................................................... ii
Acknowledgments ............................................................................................................................. iv
List of Figures .................................................................................................................................. xiv
List of Tables ................................................................................................................................... xix
Abbreviations ................................................................................................................................... xx
Nomenclature .................................................................................................................................xxii
Chapter 1 Introduction.....................................................................................................................1
1.1 Purpose and objective ..........................................................................................................1
1.2 Overview .............................................................................................................................2
1.3 Proposed research limitations...............................................................................................4
1.4 Livestock industry waste management ..................................................................................4
1.4.1 Characterizing manure ..................................................................................................5
1.4.2 Waste management strategies ......................................................................................6
1.4.2.1 Aerobic digestion versus anaerobic digestion..............................................................7
1.5 Introduction to anaerobic digestion ......................................................................................8
1.5.1 History of anaerobic digesters .......................................................................................9
1.5.2 Types of anaerobic digesters .........................................................................................9
1.5.2.1 Configuration..........................................................................................................10
1.5.2.2 Microorganism growth strategy ...............................................................................11
1.5.2.3 Temperature operating range ..................................................................................12
1.5.3 Inputs and outputs .....................................................................................................13
1.5.4 Biochemistry ..............................................................................................................13
1.5.4.1 Disintegration .........................................................................................................14
1.5.4.2 Hydrolysis ...............................................................................................................14
1.5.4.3 Acidogenesis...........................................................................................................14
1.5.4.4 Acetogenesis ..........................................................................................................15
1.5.4.5 Methanogenesis .....................................................................................................15
1.6 Literature review ...............................................................................................................15
1.6.1 Experimental ..............................................................................................................15
1.6.1.1 Studies focusing on the overall process ....................................................................16
1.6.1.2 Studies focusing on the effluent ...............................................................................16
1.6.1.3 Studies focusing on fluid flow ..................................................................................17
1.6.1.4 Studies focusing on design.......................................................................................17
1.6.1.5 Studies focusing on control systems .........................................................................17
1.6.1.6 Studies focusing on microbiology .............................................................................17
1.6.2 Numerical ..................................................................................................................18
1.6.2.1 Modelling fluid flow ................................................................................................18
1.6.2.2 Modelling biochemistry ...........................................................................................19
1.6.2.3 Modelling fluid flow and biochemistry together ........................................................22
Chapter 2 Theory and method ........................................................................................................24
v
2.1 Numerical analysis theory...................................................................................................24
2.1.1 Root finding ...............................................................................................................24
2.1.2 Ordinary differential equations....................................................................................25
2.1.3 Adaptive timestep control ...........................................................................................26
2.1.4 Timescales and stiffness ..............................................................................................29
2.1.5 Differential algebraic equations ...................................................................................29
2.1.6 Partial differential equations .......................................................................................32
2.1.7 Partial differential algebraic equations .........................................................................34
2.1.8 Equation coupling .......................................................................................................35
2.1.8.1 Coupled solvers ......................................................................................................36
2.1.8.2 Segregated solvers ..................................................................................................38
2.1.9 Stabilisation coupling ..................................................................................................40
2.1.9.1 Point stabilisation coupling ......................................................................................41
2.1.9.2 Curve stabilisation coupling .....................................................................................42
2.1.9.3 Source term stabilisation coupling ...........................................................................43
2.2 ADM1 theory .....................................................................................................................44
2.2.1 Overview ...................................................................................................................44
2.2.2 Kinetic model .............................................................................................................45
2.2.3 Inhibition ...................................................................................................................48
2.2.4 Ion model...................................................................................................................48
2.2.5 Dissolved hydrogen gas concentration .........................................................................50
2.2.6 Gas model ..................................................................................................................51
2.3 CFD theory ........................................................................................................................52
2.3.1 Transport equations – general form.............................................................................52
2.3.2 Viscosity models .........................................................................................................53
2.3.3 Incompressible buoyancy model..................................................................................54
2.3.4 Transport equations – simplified form .........................................................................56
2.4 CRAFTS and ADM-MDA theory............................................................................................57
2.4.1 Process control ...........................................................................................................57
2.4.2 Algorithm-switching....................................................................................................58
2.4.3 Flow solution..............................................................................................................58
2.4.4 Coupled reaction model ..............................................................................................59
2.4.5 Algebraic routines.......................................................................................................59
2.4.6 Gas model ..................................................................................................................60
2.4.7 Energy equation .........................................................................................................60
2.4.8 Turbulence .................................................................................................................61
Chapter 3 Model development .......................................................................................................62
3.1 Project size ........................................................................................................................62
3.2 Programming environment.................................................................................................63
3.2.1 Bulk model programming environment ........................................................................63
3.2.2 CRAFTS programming environment .............................................................................63
3.3 Design philosophy ..............................................................................................................64
3.3.1 Flexibility ...................................................................................................................64
3.3.2 User-friendliness ........................................................................................................65
3.3.3 Extensibility................................................................................................................67
3.4 Process control and algorithm-switching .............................................................................68
3.5 Reaction library..................................................................................................................68
vi
3.5.1 Components...............................................................................................................69
3.5.2 Manager classes and the model class ...........................................................................69
3.5.3 Interfaces ...................................................................................................................70
3.5.4 Variable classes ..........................................................................................................72
3.5.4.1 Standard and implicit variables ................................................................................73
3.5.4.2 Derived variables ....................................................................................................73
3.5.5 Coefficient classes ......................................................................................................74
3.5.6 Reaction class .............................................................................................................75
3.5.6.1 Reaction rates.........................................................................................................75
3.5.6.2 Reaction rate inhibitions..........................................................................................76
3.5.7 Build dependencies ....................................................................................................77
3.6 Solver structures ................................................................................................................77
3.6.1 Components...............................................................................................................77
3.6.2 Solver application .......................................................................................................78
3.6.3 Flow solver .................................................................................................................78
3.6.3.1 Sub-stepping...........................................................................................................78
3.6.4 Coupled reaction model ..............................................................................................79
3.6.4.1 Coupled reaction model solver algorithms ................................................................80
3.6.4.2 Coupled reaction model class ..................................................................................81
3.6.4.3 Block matrix construction ........................................................................................81
3.6.5 Adaptive timestepping ................................................................................................84
3.6.6 State control ..............................................................................................................87
3.6.7 User-defined functions ...............................................................................................88
3.6.7.1 Function hooks .......................................................................................................89
3.6.7.2 Customizing input files ............................................................................................90
3.6.7.3 Standard variables ..................................................................................................91
3.6.7.4 Implicit variables .....................................................................................................91
3.6.7.5 Derived variables ....................................................................................................91
3.6.7.6 Coupling within UDFs ..............................................................................................92
3.6.7.7 Return values..........................................................................................................92
3.6.7.8 State control ...........................................................................................................94
3.6.7.9 Iterations................................................................................................................94
3.6.7.10 Ion model ...............................................................................................................95
3.6.8 Static equilibrium .......................................................................................................95
3.6.9 Gas model ..................................................................................................................96
3.6.9.1 Gas transfer boundary condition ..............................................................................97
3.6.9.2 Gas transfer algebraic routine ..................................................................................99
3.6.9.3 Gas flow rate ........................................................................................................ 100
3.6.9.4 Bubble model ....................................................................................................... 102
3.6.9.5 Gas model coupling ............................................................................................... 103
3.6.9.6 Pseudo Gas Model ................................................................................................ 103
3.7 Supporting structures....................................................................................................... 104
3.7.1 Dependencies........................................................................................................... 105
3.7.2 Bulk model ............................................................................................................... 105
3.7.3 equationReader........................................................................................................ 106
3.7.4 multiSolver............................................................................................................... 107
3.7.5 plcEmulator.............................................................................................................. 108
3.7.5.1 Outputs ................................................................................................................ 109
vii
3.7.5.2 Inputs................................................................................................................... 109
3.7.5.3 Logic .................................................................................................................... 110
3.7.5.4 Sequence of events ............................................................................................... 111
3.7.6 VectorN library ......................................................................................................... 112
3.7.7 Block matrix tools ..................................................................................................... 114
3.8 Code optimisation ............................................................................................................ 114
3.8.1 Indexing arrays ......................................................................................................... 114
3.8.2 Lazy-evaluation ........................................................................................................ 115
3.8.3 Pointer loops ............................................................................................................ 117
3.8.4 Jump tables .............................................................................................................. 118
3.8.4.1 Jump tables in equationReader .............................................................................. 118
3.8.4.2 Jump tables for derivative calculations ................................................................... 119
Chapter 4 Model verification and use ........................................................................................... 121
4.1 Verification and validation ................................................................................................ 121
4.2 Verification method ......................................................................................................... 121
4.3 Direct verification ............................................................................................................ 123
4.3.1 equationReader verification ...................................................................................... 124
4.3.2 multiSolver and plcEmulator verification .................................................................... 124
4.3.3 Reaction library verification....................................................................................... 124
4.3.4 Flow solver verification ............................................................................................. 124
4.3.5 Scalar transport verification ...................................................................................... 125
4.4 Indirect verification .......................................................................................................... 125
4.4.1 Bulk model verification ............................................................................................. 126
4.4.2 Biochemical reaction solver verification ..................................................................... 127
4.4.3 Gas model verification .............................................................................................. 131
4.4.4 Coupled reaction model verification .......................................................................... 133
4.5 Using the model............................................................................................................... 136
4.5.1 Convergence criteria ................................................................................................. 136
4.5.1.1 Matrix solver tolerances ........................................................................................ 137
4.5.1.2 Timestep doubling convergence criteria ................................................................. 137
4.5.1.3 implicitAutoSolve convergence criteria................................................................... 138
4.5.1.4 Gas model convergence criteria ............................................................................. 138
4.5.2 Transport error......................................................................................................... 139
4.5.3 Variable limiters ....................................................................................................... 141
Chapter 5 Results and discussion .................................................................................................. 143
5.1 Numerical stiffness........................................................................................................... 143
5.1.1 Gas model ................................................................................................................ 145
5.1.2 Buoyancy ................................................................................................................. 145
5.1.3 Temperature Inhibition ............................................................................................. 146
5.2 Full model simulation ....................................................................................................... 147
5.2.1 Case setup ............................................................................................................... 147
5.2.2 Runtime information ................................................................................................ 149
5.2.3 Time-resolved data ................................................................................................... 149
5.2.3.1 Disintegration stage .............................................................................................. 150
5.2.3.2 Hydrolysis stage .................................................................................................... 151
5.2.3.3 Acidogenesis, acetogenesis and methanogenesis .................................................... 152
5.2.3.4 Carbon and nitrogen balances ............................................................................... 153
viii
5.2.3.5 Ion model ............................................................................................................. 154
5.2.3.6 Gas model ............................................................................................................ 157
5.2.3.7 Microbial populations ........................................................................................... 159
5.2.3.8 Discussion ............................................................................................................ 160
5.2.4 Spatially resolved data .............................................................................................. 165
5.2.5 Animations............................................................................................................... 168
Chapter 6 Conclusion ................................................................................................................... 169
Chapter 7 Contribution ................................................................................................................ 171
7.1 Source term stabilisation coupling .................................................................................... 171
7.2 PDAE solver ..................................................................................................................... 172
7.3 Integrated PLC emulation and algorithm-switching ............................................................ 173
7.4 General coupled liquid reacting solver............................................................................... 173
7.5 General three-dimensional implementation of ADM1 ........................................................ 175
Chapter 8 Suggested future work ................................................................................................. 176
8.1 General model improvements .......................................................................................... 176
8.1.1 Parallelisation........................................................................................................... 176
8.1.1.1 Parallelisation of the solver application .................................................................. 177
8.1.1.2 Parallelisation of the coupled reaction model ......................................................... 177
8.1.1.3 Parallelisation of multiSolver ................................................................................. 177
8.1.1.4 Parallelisation of the plcEmulator........................................................................... 178
8.1.1.5 Parallelisation of the gas model ............................................................................. 178
8.1.2 Mesh Motion ........................................................................................................... 178
8.1.3 Lagrange particle tracking ......................................................................................... 179
8.1.4 Non-Newtonian model.............................................................................................. 179
8.2 ADM1-specific improvements ........................................................................................... 179
8.2.1 Addressing the stiffness of ADM1 .............................................................................. 179
8.2.2 Coefficient and sensitivity analysis ............................................................................. 181
8.2.3 Mass-conserving model ............................................................................................ 181
8.2.4 Shear-induced decay model ...................................................................................... 182
Bibliography ................................................................................................................................... 183
Appendix A Additional literature review ......................................................................................... 202
A.1 Studies that focus on the overall process ........................................................................... 202
A.2 Studies focusing on the effluent ........................................................................................ 203
A.3 Studies focusing on fluid flow ........................................................................................... 204
A.4 Studies focusing on design................................................................................................ 204
A.5 Studies focusing on control systems .................................................................................. 205
A.6 Studies focusing on microbiology ...................................................................................... 205
Appendix B ODE theory ................................................................................................................. 207
B.1 ODE theory ...................................................................................................................... 207
B.1.1 Euler’s method ............................................................................................................... 207
B.1.2 Fourth-order Runge-Kutta method .................................................................................. 208
B.1.3 Semi-implicit Bulirsch-Stoer method (SIBS) ....................................................................... 208
Appendix C Source term stabilisation coupling................................................................................ 210
ix
Description:shared an office and several courses with Amir Birjandi, and he made Amir and Jonathon Serhal helped me perform my early experimental work