This page is designed to align with Chapter 4 of the text book which can be accessed here:
Datta, A.K. and V. Rakesh. 2010. An Introduction to Modeling of Transport Processes: Applications to Biomedical Systems. Cambridge University Press.
Contents
Introduction
In the previous two chapters, the mathematical model consisting of the governing equations and boundary conditions were implemented in a software, together with instructing the software how to solve the equations. These steps together are called preprocessing as discussed earlier. After these steps, the computer simply solves the equations— a step called processing that is completely automated. Once a “solution” is available, we can visualize and analyze it to make sense of it. Remember, computational results are not a solution to our problem until we have validated the results. This chapter simply presents ways of visualizing and manipulating the results of computation using a software, and its relation to other chapters is shown in Figure 4.1. This stage is also called post-processing. Post processing is the further processing of the raw data produced by the computation. A simple post-processing step could be the display as a graph of the data produced by computations, for example, a plot of concentration calculated at a point as a function of time.
Standard quantities to be displayed or standard computations to be made are built into a typical software. If this is all that is needed, one simply learns the respective commands from the software interface. Sometimes and especially for a newcomer to modeling, it may not be obvious as to which raw or derived information is most relevant in relating back to the physical problem. Thus, in this chapter, we first give examples of the different types of information that are useful in various biomedical situations. The rest of the chapter simply shows how to obtain the information in one particular software, namely COMSOL. We skip details when the software makes it quite obvious to get a particular parameter.
4.1 Useful Information in Biomedical Context
Information at a location Temperature or concentration at a location, at any time or as a function of time, is the simplest type of information that may be necessary.
Spatial average Sometimes detailed variation is not that important and an average value over a region is all that is needed. For example, in therapeutic heating, average temperature for a region may be of interest. In drug delivery, average concentration over a region may be the quantity we are interested in.
Spatial variation The simplest information on spatial variation is to locate the point or region for maximum or minimum values. For example, in cryosurgery, we may be interested in the boundary of the region over which the temperature is less than −45 ◦C, which would be the region where tissue destruction by freezing occurs.
A more comprehensive way to provide spatial variation over a region for a continuous variable such as temperature or concentration is to have contours. For a quantitative representation of variations or uniformity in a region, a statistical measure such as standard deviation can be used.
Time variation Time variation for a single location can be provided as a function of time as a line graph. Time variation for an entire region as a function of time can be provided as a series of contour plots or, more effectively, as a movie. Although mostly qualitative, a movie is very effective in obtaining a visual picture of how the quantities change with time. One may be interested in how much drug has entered through a particular boundary as a function of time. This means the time-varying flux has to be integrated over time.
Secondary quantities Examples of a secondary quantity are heat or mass flux at a location on a surface. This is useful, for example, when a certain amount of drug per unit area and per unit time has to enter a surface. Time variation of flux is also important in drug delivery as, in many cases, an attempt is made to obtain a more or less constant rate of release over time. Another example of a secondary quantity is mass balance at a location. For example, often in drug delivery we would like to know how much drug has left the drug capsule. This can be found by knowing how much drug is remaining in the capsule and subtracting that from the initial amount of drug in the capsule.
Arbitrary functions We often require customized information which depends on the variables calculated. For example, thermal conductivity may be some function of temperature (e.g., k = 0.4692 + 0.001 161T) and we would like to plot the variation of thermal conductivity in the domain. We can define functions of concentration or temperature according to our needs.
Examples of various postprocessing options (computation and display of the above quantities) from the Case studies in Chapter 6 are listed in Table 4.1. The reader is referred to the appropriate pages of these Case studies. We will now look at the detailed steps of how to obtain the plots of these quantities in COMSOL. Table 4.2 lists the most commonly used variables in COMSOL. The symbols shown in the table can be used to access the solution variables in order to define expressions and functions during postprocessing (as well as preprocessing).
Table 4.1 Postprocessing used in the different Case studies. The reader is referred to Section 6.1 for more details of these Case studies.
Table 4.2 Commonly used variables in COMSOL.
4.2 Obtaining data at a particular location
The value of a computed variable at any particular location in the
domain may be needed during post processing. The point of interest
may either be a vertex that was created during the geometry
creation process or any other arbitrary location inside the
geometry.
4.3 Plotting transient data at one or more points, line or surface as a function of time
In addition to obtaining data about a specific point at a specific time, cutpoints can be used to plot the data at that point versus time.
Cut lines can be used to obtain data along a user defined line, as shown below. Note that this video is from an older version of COMSOL, so the implementation process may not be identical to COMSOL 5.3. However, the concepts and names should be similar i.e. “Cut Line 2D”.
4.4 Obtaining surface/contour plots (in 2D problems) for observing variation within a region
To plot a variable over a subdomain (in 2D problems) in order to look at the spatial variation, use the Contour or Surface plot option in the Plot Parameters dialog box. Contour plots in COMSOL are plots that show the variation of a particular variable in a subdomain by lines of constant magnitude. Surface plots(in COMSOL) are color-filled plots that show the variation using a continuous color display, instead of discrete lines representing specific values. Both types of plot (contour and surface) display essentially the same information and should be used as needed. As a result, in some places in the text, contour plots have been used interchangeably with surface plots. Both types of plot are described here.
The following video demonstrates how to create a contour plot in 3D, 2D contour plots can be created in a similar manner using 2D plot groups.
The following video demonstrates how to create a surface plot in 3D, 2D surface plots can be created in a similar manner using 2D plot groups.
4.5 Obtaining a surface plot in a 3D problem
In 3D problems, spatial variations can be plotted using a surface plot for the entire geometry (or a part of it), or taking cross-sections at different parts of the geometry and obtaining surface plots at those sections.
Surface plots:
Slice Plots:
4.6 Obtaining average values at a particular time or as a function of time
The average value of a variable in the entire region or a part of it and its variation with time (for a time-dependent problem) can be obtained in COMSOL. However, there is no direct method to obtain average values in COMSOL and hence, we must use the integration tool in the software to determine the average values, as described below.
4.7 Arbitrary functions
Arbitrary functions involving computed variables can be obtained by specifying the expression in the Expression field (instead of choosing the variable in the Predefined quantities menu) in all the postprocessing methods discussed above. For example, as in Section 4.2, a function of T such as 0.4692 + 0.001 161T can be plotted by setting 0.4692 + 0.001 161 ∗ T in the Expression field in any postprocessing dialog box to look at the variation of the function of T instead of T (temperature).
4.8 Creating Animations
Animations/movies provide an excellent way of demonstrating results during a presentation. They can be created in COMSOL using the Animate tab in the Plot Parameters dialog box:
4.9 Dedicated plotting and post processing software
Software such as Microsoft Excel, MATLAB, Tecplot and Ensight can be used for additional postprocessing of the data obtained from the analysis in COMSOL. For example, transient data at a point can be exported from COMSOL, as shown in the Case study X (Chapter 6). Once exported it can be used to do calculations inside another software program such as a spreadsheet application (e.g., Excel) or MATLAB.
The most common need for exporting data is for a transient plot at a point or for a plot along any line. Details of postprocessing by exporting data can be seen in Case study X. Tecplot and Ensight are two of the advanced tools that offer 2D/3D visualization, analysis and plotting capabilities. To use these software packages, the data must, however, be converted to a format suitable for import into them. More details about these packages can be found from their own individual websites.
4.10 Relating to the goals of the simulation: guidelines for postprocessing
The postprocessing techniques discussed earlier can create a set of beautiful plots of the problem. However, the whole point of doing a simulation is not to get a large collection of plots, rather it is to get concise and meaningful answers relevant to the goal of solving the problem. It is, therefore, essential to create and analyze only those plots that are relevant to your problem. Before choosing any type of plot for postprocessing, you should consider the following questions and the associated guidelines:
- When is a transient line plot for a point important? A transient plot for a point may be necessary if the point is a location of interest, that is, it represents a location where you want to know how the variable varies as time progresses. For example, in the case study “Radiofrequency cardiac ablation” we want to heat the tissue using an electrode to a particular temperature, but not beyond a certain other temperature. In this case, we know that the highest temperatures will be at places where the electrode touches the tissue. We therefore obtain a line plot representing temperatures at a point on the surface of the tissue as a function of heating time, to make sure that the temperatures are in the acceptable range. It would, however, not be that important to show a transient temperature plot for a point far away from the electrode as we almost expect that the temperatures would not vary significantly in those regions.
- When do you need to show spatial variation? A surface/contour plot may be important for problems where one wants to observe how the variable of interest varies in the domain at any given time. For example, in Case study II, we want to determine if the wart region reaches the desired low temperature for destruction after the cryosurgery procedure, and at the same time that the normal tissue is not cooled to very low temperatures. Calculation of average temperatures (discussed next) may also be useful in some cases. However, when it is critical that some solution variable does not fall below a minimum limit or exceed a maximum limit, then the spatial variation plot is critical.
- Would an average be useful for a particular analysis? Averages are useful if we are more interested in things happening in the overall domain rather than the spatial variation. For example, in a drug diffusion problem (similar to Case study II), we are interested in determining the total amount of drug delivered to the blood stream or the average concentration of the drug delivered as a function of time. A spatial variation in such cases may not provide critical information.
- Would calculation of fluxes be useful? Would a flux plot be more relevant than the primary variable (i.e., temperature or concentration)? Sometimes calculation of fluxes may be more important than the primary variable. For example, if we want to calculate the heat or mass transfer coefficient at a particular boundary using the computed solution, we need to determine the heat or mass flux at that boundary. 1
- When do you present the data in tables instead of figures (plots)? Results may sometimes be needed to be presented in tabular form. This is generally the case when we want to report discrete values such as data at different locations or at different times and average values of different subdomains, or after particular time intervals. Plots in such cases may not be very specific and useful information may become hidden.
4.11 Analysis of data obtained from postprocessing
Interpretation of results is as important as the actual analysis itself. First and foremost the computed data should be validated. This is discussed in detail in Chapter 5. Once the results are validated, we should try to reason out scientifically why the data is behaving the way it is. We should try to answer questions such as:
- Why do the temperature/concentration/pressure vary with time the way they do? Specifically look at the material properties, boundary conditions and source terms (their values and dependence on time) being used in the problem to figure out the behavior of the results.
- Why do the temperature/concentration/pressure vary with space the way they do? Again look at the input parameters to answer this question. Check if they are varying with the solution variable. Look at their values in different regions of the geometry in trying to determine the reason for the observed results. Look at the geometry and determine if the shape of the geometry is leading to the observed results.
- How do we interpret the surface/contour plots? The first thing that we use these plots for is to visually check that the problem we have solved is indeed the problem we are trying to solve. For example, we can visually check whether a no-flux condition is being satisfied at a particular boundary. This process is known as qualitative check and is discussed in detail in Chapter 5. We can also visually check if the material properties, initial conditions, other boundary conditions and time stepping are being properly implemented as desired. Once we confirm that the problem is correctly implemented in the software, we can try to learn from the solution.
4.13 Presenting the simulation results to others
A written report provides a formal way for the modeler to describe what has been accomplished and to offer an analysis or interpretation of what it means. Within an organization, reports are often the primary way to let colleagues know what one has been doing. Supervisors may judge the work based on the quality of one’s reports. An example of detailed instructions for reporting projects performed in an undergraduate class can be seen in the Appendix to this chapter.



