Medicine & Health
OOP & C++
Sony PCM-R500 DAT
PhD work at UC Berkeley and IMMA description of the TRACMIX++ code
This page provides a summary of the work completed in the Nuclear Engineering Department at the University of California, Berkeley and the Informatics and Mathematical Modeling Department at the Technical University of Denmark. As a result of completing this work, the author was awarded the PhD degree in Nuclear Engineering at UC Berkeley. The main product of the PhD project is the TRACMIX++ code which can simulate the time-wise evolution of the fluid state in a stably stratified enclosure mixed by buoyant jets (anything from plumes to jets).
This work includes both modeling of the physics of the processes in the enclosure, numerical analysis, and object-oriented analysis, design and programming. TRACMIX++ has been implemented in C++.
Mixing processes in large enclosures under stably stratified conditions are important in many applications. From smaller rooms in houses and high-rises experiencing heating and natural ventilation to mixing processes in the ocean due to discharge of both natural and man-made sources, mixing under stratified conditions can be the primary mechanism by which the time-wise evolution of the fluid state is controlled. In between these two length-scale extremes of the ``enclosure'' size other important applications are found, such as multi-compartment modeling of fires in complex building structures, mixing in the gas space of waste tanks containing liquid high-level radioactive waste, and modeling the long term response of the reactor containment and suppression pool of a nuclear power station under accident conditions.
When modeling fire propagation in building structures, 2-zone models have been used extensively. These 2-zone models utilize one warm zone placed at the top of the enclosure and a lower unaltered zone. The top zone holds all the smoke and pollutants generated by the fire.
As goes for ventilation of rooms it can be argued that a stable stratification needs to be maintained as too much mixing due to forced circulation will make the room unsuited for people due to the drafts produced.
In the past, stratification in large volumes has been modeled by either lumped or 2-zone models. Both models, and the lumped model in particular, fail to model the more detailed physics of the mixing processes. In the lumped model the fundamental assumption is that the volume is homogeneously mixed. This assumption can introduce substantial error when large gradients exist in the stratified ambient. Introducing several artificial control volumes within the large lumped volume has been attempted, but this introduces flows between control volumes which are non-physical.
Somewhat better agreement can be attained by the 2-zone models (using codes like CFAST), however, they also fail to model the detailed physics of the mixing processes. In many situations, dependent on the complexity of buoyant jets and openings in the enclosure, the flow field is not well described as two distinct, uniformly mixed layers, but may instead only have a distinct non-uniform distribution of species and energy. This is typically seen in the long term behavior in stratification experiments.
The two-zone approach cannot be used for more complex scenarios, where, for instance, multiple buoyant jets are active at the same time. In two-zone fire modeling codes it is silently assumed that only one buoyant jet is present and hence only one front is generated.
An alternative approach to modeling of stably stratified enclosures is to use full 3-D CFD type calculations. However, it is very difficult at present times to resolve the buoyant jet structures within the flow with a reasonably low number of mesh elements. At this time, trying to model multiple interconnected enclosures using 3-D CFD type calculation is out of the question. Since the ability to model multiple enclosures in a timely way is very important both for applications in both nuclear reactor containment safety analysis and fire safety modeling, it was the goal for this project to provide a means of computing the flow solution for multiple connected enclosures.
In stably stratified volumes, the distribution of temperature, species concentration etc become essentially 1-D throughout most of the enclosure. When the fluid in an enclosure is stratified, wall boundary buoyant jets, forced buoyant jets (injection of fluid) and natural convection plumes become the primary sources of mixing. The time constants for the buoyant jets may be considered as much smaller than the time constant for the mixing of the stratified ambient fluid, provided the combined volume occupied by the buoyant jets is small compared to the volume of the enclosure. Therefore, fluid transport by the buoyant jets may be considered as occurring instantaneously.
Under stably stratified conditions the solution to the conservation equations can exhibit strong gradients (what are later described as ``fronts'') that have to be preserved when solving the discretized continuous conservation equations using a suitable numerical method. The Eulerian conservation equations consist of a set of convection-diffusion partial differential equations (PDEs), or in mathematical terms hyperbolic-parabolic PDEs. In many practical cases, the flow field is convectively dominated (strongly hyperbolic), but diffusion may become important for very weak buoyant jets. The term ``buoyant jet'' refers to everything between a ``jet'' which is a pure source of momentum (with neutral buoyancy) to a ``plume'' which is a pure source of buoyancy (with zero momentum).
This text discusses a way of obtaining the vertical 1-D flow solution when mixing in large stably stratified enclosures occurs primarily due to the effect of buoyant jets or diffusion related processes. The fundamental assumption is to use the approximation to the full Navier-Stokes equations presented by Prof. Peterson at UC Berkeley. The approximation presented by Prof. Peterson at UC Berkeley derived especially for stably stratified flows has not been used before in developing a numerical method for obtaining the flow field in stably stratified enclosures.
Using the approximate conservation equations it is possible to develop an efficient numerical tool, in this case the TRACMIX++ code, for modeling of these types of flows.
From the beginning of this project it was one of the final goals to couple this new nuclear reactor containment accident modeling approach with one of the popular nuclear reactor systems codes, like TRAC or RELAP. For this reason, the guarantee of high computational efficiency was a major requirement for the TRACMIX++ code from the very start of this project.
The major contribution of this work is, therefore, the creation of this new numerical tool, the TRACMIX++ code to better understand the mixing problems in stably stratified large enclosures at a 1-D level.
The 1-D fluid conservation equations present several challenges when trying to decide on ways to solve those numerically. Especially the source and sink terms in the equations, signified by line type sinks generated by buoyant jet entrainment and the discharge source delta function terms, are challenging because 1) the line sinks are discontinuous as the line sink flow rate per unit length decreases to zero abruptly at the discharge elevation and 2) the source terms originating from discharging buoyant jets are modeled using Dirac delta functions in space.
In addition to the peculiarities in space, the numerical method which is to be used to solve these equations also has to handle discontinuities in time to allow for, for instance, an abrupt change in the injected flow rate generating a buoyant jet. This abrupt change will change the buoyant jet discontinuously, and hence generate a discontinuity in time.
Broadly available computer codes used to solve general conservation equations do not have a built-in capability to handle these peculiarities. For instance, the CLAWPACK code is able to solve general 1-, 2-, and 3-dimensional conservation equations. However, the problem arises in how the CLAWPACK code is to deal with the discontinuities occurring in the source terms both in time and space. Furthermore, adding the modeling of aerosol transport to a code like CLAWPACK is difficult. TRACMIX++ on the other hand was constructed with the goal that aerosol modeling could be easily added. In addition, in TRACMIX++ it is completely straightforward to set up modeling of multiple enclosures.
Since the generally available computer codes used to solve conservation equation type equations fail to address the peculiarities of the problem at hand, it was identified early on in this research project that a new numerical tool would have to be constructed.
One of the main contributions of this work is to apply a phenomenological approach to model the stably stratified enclosure mixing problem. In fact, in a mathematical analog, one could say the TRACMIX++ code is constructed using a truncation in the phenomenological space, only including phenomena which are important for a particular stably stratified flow. Using the phenomenological approach, the solution strategy employed in the numerical tool, the TRACMIX++ code, described in this text maps the physics of the mixing problem closely. This is one of the main strengths of the numerical model as it is clearly identified which physical phenomena is modeled and to what level of detail they are described. This leaves the user with a much better understanding of the dynamics of the mixing processes in the enclosure compared to using a more black-box mathematical solution methodology. The dynamic interaction of, for instance, point sinks and buoyant jets can much better be illustrated using a phenomenological description. If, for instance, the discharge elevation of a buoyant jet is within the region of influence of a sink, the complexity of the computation rises considerably, especially for multi-enclosure simulations because of coupling effects.
The individual phenomena, in addition to the core conservation equations, are discretized in the simplest ways in TRACMIX++ Version 1.0. Increasing the detailedness of the computation is easily achieved by improving the modeling of particular phenomena.
It is, however, demonstrated in this text that even with the simplest discretization, the TRACMIX++ code is able to cheaply and accurately compute the solution of the conservation equations.
One of the main solution strategies of TRACMIX++ is to use a Lagrangian discretization and divide the computation into a convective step and a diffusive step. Operator splitting is not something new in itself as many researchers have indicated the advantages of using this two step approach (see, for instance, the work by Prof. Chorin at UC Berkeley). In this way the numerical solver used for either of the two numerical sub-problems can be optimized separately. In addition to the separate convective and diffusive steps, the pressure distribution in the enclosure is computed in a quasi-steady way in a separate correction step.
While the individual ideas which lay the foundation of the new TRACMIX++ code are not inherently new, using the wide conglomerate of ideas taken broadly both from fluid mechanics, numerical analysis, and object-oriented software engineering has not been used for stably stratified flows before. This is one of the main contributions of this work.
Despite the approximation inherently present in the mathematical model, it is demonstrated in this text that the TRACMIX++ code can capture experimental data showing the time wise evolution of the fluid state in stably stratified enclosures accurately and importantly with a small computational expense.
This text only considers the simplest stably stratified enclosure mixing problems. If more complex models of the buoyant jets are incorporated in the code, more complex mixing scenarios can be modeled with adequate accuracy as it has been demonstrated using the BMIX version of the TRACMIX++ code. In the PhD dissertation of Dr. HaiHua of UC Berkeley, additional modeling of wall and ceiling buoyant jets have been added which has made it possible for Dr. HaiHua to model a large enclosure experiment using a vertical cooling plate and hot air fluid injection.
Naturally, if it would be possible to quantify all parameters theoretically, a 3-D CFD type modeling approach would be preferable. Unfortunately, closing the very complicated set of 3-D fluid conservation equations is difficult and computationally expensive. Furthermore, in a 3-D approach the major problems is how to adequately resolve the buoyant jet structures within the enclosure. For this reason, modeling of multiple interconnected enclosures using 3-D CFD is currently impossible given the current stage of high performance computing.
Buoyant jet modeling is still a heavily researched area of fluid mechanics and the current state-of-the-art leaves much to be desired. Ultimately, the goal of these models is to estimate the entrainment of ambient stratified fluid into the buoyant jet. As entrainment is in many cases the primary way of mixing in stably stratified enclosures, being able to accurately predict entrainment rates is vital.
With the current state of buoyant jet modeling it becomes somewhat questionable, in the author's opinion, to use 3-D modeling approaches.
The modeling provided by TRACMIX++ seeks to fill the gap between on one hand the zeroth dimensional approach with a homogeneous enclosure and the full 3-D CFD type approach on the other hand.
Furthermore, it should be noted that the 1-D approach used for TRACMIX++ is not a cross-sectional average of the standard 3-D CFD type conservation equations. Because gas dynamics effects are not important for the flows of interest in this text, these effects are not present in the resulting set of conservation equations. This implies that a much simpler numerical algorithm can be used which in turn greatly enhances the computational efficiency of the computation. Since the time scales of gas dynamics effects are very small compared to the residence time of the stratified enclosure ambient fluid, retaining these terms in the mathematical model would severely impair computational efficiency without any meaningful increase in solution accuracy.
Using the simplified 1-D description, relatively simple numerical methods are fully adequate to solve the conservation equations. Although the numerical methods used in TRACMIX++ are simple, the logistics of the 1-D description presented in this text becomes the most difficult problem to solve.
Since it was initially decided that a phenomenological approach to the development process was to be adopted, it was natural to utilize object-orientation for the final code implementation.
In addition to providing excellent fundamental programming constructs suitable for mathematical and numerical modeling, the object-oriented (OO) techniques used to implement TRACMIX++ is also excellent given the phenomenological approach used to derive the numerical model of TRACMIX++. Using OO techniques, the individual phenomena map closely onto a set of well defined objects or object hierarchies.
This implies a natural way of implementing the TRACMIX++ code and ensures the long term flexibility and reuseability of the code. For instance, the integral models used to describe the buoyant jets can be changed on the fly and additional buoyant jet models can be added effortlessly because the OOD (OO design) clearly specifies how to add additional models. Furthermore, as the correctness of the extensions are checked by the compiler many potential sources of errors in the source code can be eliminated.
In TRACMIX++ the unique choice of numerical algorithms coupled with strong insights into the mixing problem has created a unique numerical tool which is both very accurate and computationally efficient while at the same time relatively simple (given the level of complexity of the problem) and immensely flexible. The flexibility of the TRACMIX++ solution methodology assures the long term success of this project. No one else has so far tried to model the stably stratified enclosure mixing problem in this eyeopening way.
One could say the numerical tool, the TRACMIX++ code, and the underlying intellectual property is the main contribution of this work. The author remains sure, given the level of detailedness of this text, that researchers in the field of stably stratified mixing processes will find useful considerations throughout the text.
Using a more physical approach to the solution of the mixing problem, the way the entrainment is calculated, the way the equivalent sink entrainment is calculated, the introduction of the sink ROI (Region of Influence), the potential complex coupling effects of sinks and buoyant jets, the potential complex coupling effects for multiple enclosure are all areas where this work adds original contribution. Because no one else has tried to solve the stably stratified enclosure in a way similar to what is used in TRACMIX++, the modeling efforts described in this text gives a completely new way of looking at the stratified enclosure mixing problem, and thereby provides very useful insights into the dynamics of this mixing problem. Furthermore, the ability of TRACMIX++ to track the fronts and flag the generation of discontinuities in the general case (for enclosure fires, CFAST, for instance, tracks only a single smoke front) has not been done before for stably stratified enclosures.
The primary factors limiting the accuracy of TRACMIX++ do not concern the discretization error but rather the model assumptions.
One limitation is that the horizontal transit time has been completely neglected (as it should in a fully 1-D description). The horizontal transit time is also somewhat connected to the generation of waves especially at front locations. For certain problem geometries the horizontal transit time may be of importance.
Also the effect of turbulent mixing in the stably stratified ambient has been neglected. When a buoyant jet, for instance, hits an enclosure wall, turbulent mixing occurs and this effect may also in some cases be of some importance.
In this work the I fluid species move at the same Lagrangian velocity, in the absence of molecular mass diffusion. When density differences between the fluid components are relatively modest, this assumption is adequate. When a high density fluid is mixed into a low density fluid, a so-called slip can exist between to two fluids, ie the fluid velocities tend to differ in a more substantial way. This is, for instance, a well known phenomenon of flow with two-phase water-steam fluid mixtures. Examples of high and low density mixtures occurring in typical TRACMIX++ cases would include 1) the modeling of aerosols (fission products for reactor safety analysis) within a gaseous (low density) fluid and 2) a fully separated flow, for instance, steam condensation along containment walls or a water pool at the bottom of the reactor containment.
In the case with aerosols, the fluid velocity difference between the carrying gaseous mixture and the aerosols can be modeled by additional flux type contributions along control surfaces of the computational grid. Particles can be binned by size and tracked, including modeling of agglomeration source and sink terms in bins.
In the case of wall condensation the containment volume taken up by the wall condensate on the wall can be neglected, and hence the properties, including the velocity of the water flowing downward on a containment wall can be modeled using a separate wall model.
The simplest numerical methods which can be used to solve the simplified 1-D set of conservation equations derived by Prof. Peterson have great difficulty preserving the strong gradients which can be present in hyperbolically dominated flows. The traditional discretization procedures inherently introduce extra (``false'') diffusion terms which do not exist in the original differential equation. Typically these extra diffusion terms put severe limitations on the maximal size of the computational cell for the computed solution to be reasonably accurate, or require higher-order differencing methods that can exhibit stability problems.
The numerical model presented in this text provides an alternative to the traditional simplistic numerical methods which
A Lagrangian approach was adopted to eliminate numerical diffusion. The Lagrangian formulation tracks the position of constant mass fluid ``layers''. In practice, the enclosure is divided into a user-specified number of horizontal control volumes and the conservation equations, without the diffusion terms, are then used to calculate the new positions, compositions and enthalpies of the control volumes for each time step. This step is referred to as the pure Lagrangian step. Next the composition and energy are corrected for each CV to account for the presence of the diffusive fluxes of mass and heat occurring in the conservation equations. Finally, compressibility effects are taken into account by updating the enclosure pressure level and pressure distribution.
Choosing a Lagrangian method also has its costs, mostly due to a more complicated implementation, because the position of every control volume has to be tracked. If higher order accuracy is desired, it is necessary to track the control volume positions even within a time step. In general, having a moving computational grid implies more bookkeeping and makes the implementation of virtually all aspects of the code less automatic compared to a standard finite difference method (FDM).
One example of the complication is the necessity of grid management. At each time step a set of new control volumes (corresponding to the number of buoyant jets present in the enclosure) are created and so both the number of control volumes and the computational cost increase linearly with time. For a production type of code this is clearly not feasible and some kind of truncation error based intelligent grid management is necessary.
This section lists summaries of the two computer codes, BMIX (Matlab version) and TRACMIX++, developed during this PhD research.
BMIX (Matlab version):
The BMIX (Matlab version) code was the first try at implementing a code which was able to solve the 1-D unsteady fluid conservation equations for relatively simple configurations.
The BMIX (Matlab version) code was simplistic in several ways. First, the choice of implementational language, Matlab, severely limited the versatility and flexibility both from the implementer's side but even more so from the user's point of view.
However, the BMIX (Matlab version) code served its purpose to quickly generate the first insights into the mathematical and numerical properties of the system of PDEs representing the fluid conservation equations. Implementing this first primitive code had numerous beneficial impacts on the development of the production type TRACMIX++ V1.0 code.
Furthermore, even though the mathematical model had its limitations the BMIX (Matlab version) code still produced reasonable results.
The main assumption in the BMIX (Matlab version) code is that the mixture density is constant throughout the enclosure. While this assumption greatly simplifies the mathematical model, the model errors introduced are not generally acceptable and great care need to be applied before using this simplified model.
TRACMIX++ V1.0 summary:
Whereas the BMIX (Matlab version) code exclusively is a research type code not suitable for production type of simulations, the TRACMIX++ V1.0 code has been implemented with the aim that production (or real life) simulations are to be carried out.
TRACMIX++ has been implemented in C++ using almost all of the sophisticated programming paradigms available in this programming environment (using, for instance, class inheritance, templates and several design patterns). Version 1.0 of TRACMIX++ contains more than 50,000 lines of well commented C++ source code.
Conservation equations are implemented in a conservative way at the macro level.
A conservative formulation is important because this is what physical laws state (conserved quantities should (not surprisingly) be conserved); this feature can also be used as a first crude test for correctness because the integral of a conserved quantity in the enclosure should be constant (taking into account exchanges with the surroundings).
Formulating the conservation equations at the macro level assures that additional conserved quantities can be added with minimal effort.
Some main features of the TRACMIX++ code:
The extensibility and adaptability of the TRACMIX++ code can first really be appreciated by looking ``under the hood'', viewing the source code.
For a detailed description of the mathematical models, numerical methods applied and the details of the TRACMIX++ implementation, the author's PhD dissertation should be consulted.
Interested in taking a peek in my PhD dissertation, proceed along to the download page.
Revision 2.0, Copyright © 1999-2004 Jakob Christensen