Suite-CFD: An Array of Fluid Solvers Written in MATLAB and Python
Abstract
:1. Introduction
2. Brief Overview of the Three Fluid Solvers
2.1. Projection Method
- Cavity Flow
- Circular Flow in a Square Domain
2.2. Spectral Method (FFT)
- Side-by-Side Vorticity-Region Interactions
- Evolution of Vorticity from an Initial Velocity Field
2.3. Lattice Boltzmann Method
- Flow past one or more cylinders
- Flow past porous cylinder
3. How to Run the Simulations, Visualize, and Analyze
- Running a Simulation
- Visualizing the Data in VisIt
- Guide: Running the Spectral (FFT) Method’s ‘bubble3’ Example
- Guide: Visualizing the Spectral (FFT) Method’s ‘bubble3’ Data
- Guide: Analyzing the Spectral (FFT) Method’s ‘bubble3’ Data
3.1. Running a Simulation
- Either clone the Holy_Grail repository or download the Holy_Grail zip file at https://github.com/nickabattista/Holy_Grail/ to your local machine. Note you can download or clone this repository to any directory on your local machine.
- Open MATLAB and go to the appropriate sub-directory for the particular fluid solver example you wish to run, e.g.,
- Projection_Method: for the projection method solver and its examples
- FFT_NS_Solver: for the spectral (FFT) method solver and its examples
- Lets_Do_LBM: for the Lattice Boltzmann method solver and its examples
and go into the MATLAB subfolder. (If you wanted to run an example in Python, you would change directories until you are in the complementary Python subfolder.) - The main script name for each fluid solver is named accordingly, e.g.,
- Projection_Method.m - main script for the projection method
- FFT_NS_Solver.m - main script for the spectral (FFT) solver
- lets_do_LBM.m - main script for the Lattice Boltzmann solver
Each of these scripts contains all the functions and modules necessary to run each example. The file print_vtk_files.m produces the data files during each simulation. The user should not have to change this file, unless they do not wish to save some of the data for storage reasons. If this is the case, this can be accomplished by commenting out the lines corresponding to whichever data is not to be saved. - Depending on the subfolder that you are in, to run an example, you would type its main script name into the MATLAB command window and click enter.
- The simulations are not instantaneous; they may take a few minutes. Upon starting the simulation, a folder named vtk_data is produced, which will be used for storing the simulation data files in format. As the simulation runs, it will dump more data into this folder. Note that depending on the simulation you choose and the grid resolution, the simulations may take from a few minutes to ∼30 min. Moreover, if you wish to run multiple simulations, note that the default folder name is set to vtk_data, and so running additional simulations will overwrite any previously saved data in the previous vtk_data folder. Please manually change the name of the folder after each simulation to avoid this.
- If one desires to change parameters for a particular simulation, e.g., grid resolution, viscosity (either (Projection) or (FFT) or (LBM), etc.), options are available to the user without digging deep into any of the sub-functions or individual modules beyond the main function itself, see Figure 3.
- Figure 3 highlights the main choices the user can make for each of the three fluid solvers (a) Projection, (b) Spectral (FFT), and (c) Lattice Boltzmann. The user can identify which of the built-in examples they wish to run by changing the appropriate string flag labeled choice.
- Note that each example will run as described in Section 4 if all the parameters are selected to be those in the parameter Table that provided within each example’s section. Caution: numerical stability conditions may be violated by choice of other parameters. To test other parameter values, we suggest making incremental variations, e.g., try doubling or halving viscosity, rather than testing values orders of magnitude apart. Numerical instability will appear if solvers cannot converge or begin dumping NaNs (not-a-number), which represent unrepresentable numbers to computers, due to their inherent floating-point arithmetic.
- As the entire fluid-solver is contained within each script, the user can go deeper into the code to modify examples or create their own. This can be done in the following sub-functions:
- Projection Method: please_Give_Me_BCs (choice)
- Spectral (FFT) Solver: please_Give_Initial_Vorticity_State (choice, NX, NY)
- Lattice Boltzmann Solver: give_Me_Problem_Geometry (choice, Nx, Ny, percentPorosity)
3.2. Visualizing the Data in VisIt
- Open VisIt [41]
- Open the desired Eulerian data (magnitude of velocity, vorticity, velocity vector field, etc.) from the vtk_data folder.
- A table of the possible data stored and their corresponding name when saved is found below in Table 1.
- To Visualize Geometry (LBM only):
- (a)
- Click Open
- (b)
- Go to the vtk_data data folder that the simulation produced
- (c)
- Click on the grouping of Bounds, click OK
- (d)
- In VisIt, click on Add then Mesh→mesh.
- (e)
- Then click Draw
- (f)
- You can elect to change the color of boundary or size by double clicking on the Mesh in the VisIt database listing window.
- To Visualize Velocity Vectors:
- (a)
- Click Open
- (b)
- Go to the vtk_data data folder that the simulation produced
- (c)
- Click on the grouping of u, click OK
- (d)
- In VisIt, click on Add then Vector→u
- (e)
- Then click Draw. An error message might pop up during at time-step zero (first data point) if velocity is identically zero
- (f)
- You can elect to change the color, size, scaling, and number of velocity vectors by double-clicking on u in the VisIt database listing window
- (g)
- To add streamlines of the velocity field, first make sure that your Active Source is set to u (see Figure 4a), then click Add→Pseudocolor→operators→IntegralCurve→u (see Figure 4b). Note you have the option to put numerous seed points for streamlines to stem in the domain. Here we have chosen to use a line of points, sampled it at 4 evenly spaced locations within that line, and specified particular integration tolerances, and a maximum number of steps (see Figure 4c). Click Draw. You can also adjust the streamline aesthetics to how you desire, e.g., color, thickness, etc.
- To Visualize the Eulerian scalar data (e.g., Vorticity, Magnitude of Velocity, etc.):
- (a)
- Click Open
- (b)
- Go to the vtk_data data folder that the simulation produced
- (c)
- Click on the grouping of the desired Eulerian scalar data, for example, Omega (for Vorticity), click OK
- (d)
- In VisIt, click on Add then Pseudocolor→Omega.
- (e)
- Then click Draw
- (f)
- You can elect to change the colormap and/or colormap scaling by double clicking on Omega in the VisIt database listing window. The following table (Table 2) details the specific colormap used for each scalar variable in the manuscript,
- (g)
- To visualize the finite-time Lyapunov exponent (FTLE), your Active Source in Visit (see Figure 5a) must be on the velocity vectors, u. Then click Add→Pseudocolor→operators→LCS→u (see Figure 5b). We used the attributes in Figure 5c for computing the FTLE. In particular, we limited the maximum advection time to 0.05 and maximum number of steps to 10. Once those are changed, click Draw.
- (h)
- To add contours of the desired scalar variable, first make sure that your Active Source (see Figure 5a) is set to the correct variable, then click Add→Contour→<desired variable name>. Note that you have the option to scale the contours separate from the colormap of the variable itself. Moreover, for FTLE your active source must be u and you can modify how FTLE are computed, e.g., Figure 5c; however, we used consistent values for both FTLE computations.
3.3. Guide: Running the Spectral (FFT) Method’s ‘bubble3’ Example
- First we must make sure that we are inside of MATLAB the corresponding directory for the MATLAB version of the spectral-based solver. To do this click through: Holy_Grail→FFT_NS_Solver→MATLAB, see Figure 6. Note that I have downloaded (or cloned) the software into my Documents folder.
- To run this simulation, type FFT_NS_Solver into MATLAB’s command window and click enter. See Figure 7 for what should print to the command window shortly thereafter. Note that the bubble3 example is the default built-in example upon downloading the software (see Figure 3b).Upon starting the simulation, information regarding the simulation solver and simulation is printed to the screen. Moreover, the current_time within the simulation gets printed to the screen at the time-points in which the data is stored. The data is stored in the vtk_data folder, which is made upon starting the simulation.
- Once the simulation has finished running, we will change the vtk_folder’s name to Simulation_1_Data. This folder contains all of the data that was stored during the simulation, i.e., the vorticity, fluid velocity field, magnitude of velocity, etc. It is imperative to change this folder name after each simulation if more simulations are to be run, or else the new data will printed over the previous simulation’s data.
- Once the folder’s name has been changed, we will open the FFT_NS_Solver.m script to change one (or more) of the parameters. Here we will only change the fluid’s kinematic viscosity, ; however, there are other options in which you could change, such as the computational domain size and/or grid resolution, see Figure 3b. As an example change from , see Figure 8. Once you have changed , you can close the script.Note that if you chose to change the grid resolution and domain size, make sure that the resolution in x and y are equal, i.e., . Moreover if you increase the resolution (increase ) the simulations will take longer to run and the resulting data will require more storage.
- Finally, run this new simulation case by typing FFT_NS_Solver into the command window and pressing enter. Once that simulation has finished running, change its folder name to Simulation_2_Data. Now that we have a couple of simulations run, and have their corresponding data saved, we will next focus on visualizing each simulation’s dynamics using the open-source software VisIt [41].
3.4. Guide: Visualizing the Spectral (FFT) Method’s ‘bubble3’ Data
- First we must open the desired magnitude of velocity data. Recall that the fluid’s magnitude of velocity data was saved under the name uMag. Click open in the VisIt toolbar and in the dialog box that pops up, locate the desired data directory, here it is Simulation_Data_1 from earlier, and select the uMag group. Figure 9 is provided as a visual aid for these steps.
- Although we have opened the data, nothing will appear visualized, yet. However, now uMag is the Active Source in the window, see Figure 10. We must now tell VisIt how to visualize the data. We will visualize magnitude of velocity as a background colormap, as it is a scalar quantity. To do this click ‘Add’ and then select Pseudocolor from the menu that appears, followed by uMag, i.e., Add→Pseudocolor→uMag.
- To finally visualize the data, click Draw. Window 1 will then show the fluid’s magnitude of velocity data at time-point 0, i.e., the initial magnitude of velocity, see Figure 11.
- Furthermore, we note that certain choices of colormaps are better for both conveying the data, but also for people who are colorblind. Generally, the default colormap, which was used in Figure 11, is a bad choice, as it is impossible for people who are red-green colorblind to interpret the field [57]. Thus, we will change the colormap to another, e.g., the RdYlBu (red-yellow-blue) colormap, by double-clicking on the uMag.*.vtk database:Pseudocolor uMag in the database list and appropriately selecting the desired colormap. Other properties may also be changed in this box, such as the colormap’s scaling.Also, you can visualize the magnitude of velocity at the different time-points that were saved during the simulation by moving the time-slider. Figure 12 shows the data at time-point 30. Moreover, the colormap and its properties may be modified by double-clicking on uMag.*.vtk database:Pseudocolor uMag in the database list.
- Note that the time in the simulation does not generally correspond to the time-point stored. For example, in this case the simulation modeled 30 s of time and 60 total data time-points were stored. Thus, data was saved every 0.5 s of simulation time. Furthermore, you could repeat Steps 1–4 for data in Simulation_2_Data from the second simulation you ran. Instead of comparing the 30th time-point’s data, we will compare the 60th, i.e., the last time-point. Repeating this entire process for the other simulation’s data yields the comparison as shown in Figure 13, below.However, we cannot qualitatively compare the magnitude of velocity between each of these simulations as they are in Figure 13. Each simulation’s colormap has a different scale. In order to compare, we must make both scales equivalent.
- To change the scale, double-click on each of the databases. This will bring up a dialog window (as described earlier) where you can change the scaling, e.g., minimum and maximum, as well as the colormap itself. Change the minimum and maximum values to 0.0 and 0.2, respectively. Figure 14 illustrates where to change the minimum and maximum for the colormap’s scale. Once those values are changed, click Apply. Note that you must do this for both of the databases individually.
- After changing the scale, the comparison is significantly different than when first visualized, see Figure 15.Furthermore, we also provide visualizations of other time-points and/or scalar data in Appendix C.
3.5. Guide: Analyzing the Spectral (FFT) Method’s ‘bubble3’ Data
- Make sure that Active source is the uMag data corresponding to the data from Simulation_1_Data in VisIt, see Figure 16.Once the Active Source has been appropriately selected, in the command bar, in the VisIt menu go to Controls→Query (see Figure 16).
- Next select Lineout under Queries and then under Variables select Scalars and then uMag, i.e., Variables→Scalars→uMag, see Figure 17.
- Next we will define the line segment in which we intend to measure the data across. To do this the user gets to choose the starting point and ending point of the line segment, see Figure 17b. We will measure across a vertical line through the center of the domain, hence we choose and as the starting and ending point, respectively. We also will measure the value of uMag at 250 sampled points. Thus, change Sample Points to 250, see Figure 17b and select Use sampling. VisIt will automatically interpolate the data so that it is measured at number of equally-spaced sample points that is designated by the user.
- Once you click Query a plot should pop up in a new Active Window in Visit, i.e., Active window 2, see Figure 18. If you double-click on the Lineout(uMag) bar in the VisIt database listing window, you can change various attributes about the line, such as its thickness or color among others. Moreover, you can use the time-slider to observe how the magnitude of velocity across the chosen line varies from time-point to time-points.
- To get back to the colormap window, select Active Window 1, rather than 2.
- You can repeat this procedure and overlay multiple uMag measured data on the same plot, each corresponding to a different simulation, e.g., repeat this process for Simulation_2_Data. Be sure to choose the correct data for the Active source.
- If you repeat this entire process for the Simulation_2_Data and move the time-slider such that the data being shown in Active window 2 corresponds to the last time-point stored (the 60th), you should see what is give in Figure 19. Also, note that we have changed each line’s thickness individually.
4. Built-in Examples (for Each Fluid Solver)
- Lid-Driven Cavity Flow via the Projection Method
- Circular Flow in a Square Domain via the Projection Method
- Side-by-side Vorticity Region Interactions via the Spectral (FFT) Method
- Evolution of Vorticity from an Initial Velocity Field via the Spectral (FFT) Method
- Flow Past One or More Cylinders via the Lattice Boltzmann Method
- Flow Past a Porous Cylinders via the Lattice Boltzmann Method
4.1. Cavity Flow (via Projection Method)
- Recreate the above results for cavity flow with the geometric and simulation parameters given in Table 3 for one or more .
- Change the domain width (cavity width) to observe differences as the cavity gets wider for a given .
- Vary the lid-velocity to observe differences (e.g., varying for different velocities as opposed to differing viscosities, ).
4.2. Circular Flow in a Square Domain (via Projection Method)
- Recreate the above results with the parameters listed in Table 4
- Change the computational geometry, e.g., rectangular instead of square
- Vary the input velocity along each side of the domain to make them non-uniform
- Vary the by changing dynamic viscosity for suggestion (2) or (3)
4.3. Side-by-Side Voritices (via Spectral Method)
- When same-spinning and size vorticity regions interact, more fluid mixing occurs directly between them (1st row)
- When oppositely-spinning and same size vortex regions interact, there is enhanced vertical fluid flow between the vorticity regions, but less mixing between them (2nd row)
- When oppositely-spinning vorticity regions of different strengths interact, the stronger region (whose magnitude of vorticity is greater), influences fluid flow to move in the same direction further away from it. There is still some enhanced vertical flow through the region between the regions (3rd row)
- If there are asymmetric region sizes and strengths, where the larger region is weaker (smaller magnitude of vorticity), the region with the larger vorticity magnitude may be able to keep the other region from influencing much of the flow around it, while imposing its flow direction on the weaker region (4th row)
- Two regions of vorticity with the same sign, but differing strengths, leads to enhanced fluid mixing between the vortices, while flow around the smaller region are significantly less than the other (5th row)
- If there are asymmetric region sizes but uniform strengths, enhanced vertical flow will be seen between the regions, although the larger vorticity region exerts more influence on flow patterns closer to the smaller region (6th row)
- If there are asymmetric region sizes and strengths, where the smaller region is weaker (smaller magnitude of vorticity), enhanced vertical flow will be seen between the regions, although the stronger vorticity region exerts more influence closer to the smaller region (7th row)
- Recreate the above results for interacting side-by-side vorticity regions with the geometric and simulation parameters given in Table 5 or for different or computational domains.
- Add more vorticity regions or make the case with four asymmetric in terms of placement and/or size.
- Change the distance between the vorticity regions to observe how magnitude of velocity or FTLE contours change.
4.4. Evolution of Vorticity from an Initial Velocity Field
- Recreate the above results with the parameters listed in Table 6 or for different .
- Take a velocity field from one of the Projection method examples, e.g., from Section 4.1 or Section 4.3, and use it to initialize the vorticity for a simulation using this spectral (FFT) method.
- Find how long it takes the simulation to reach a or of the original maximum magnitude of velocity.
- Discover how that time varies with changes in viscosity, .
4.5. Flow Past One or More Cylinders (via Lattice Boltzmann)
- Recreate the above results with the parameters listed in Table 7
- Using the radius for the larger geometry case, run a simulation with only one cylinder present in the middle and compare vorticity and FTLE evolution plots.
- Vary (relaxation parameter relate to viscosity) to test the system’s sensitivity to
- Change the number, placement, or size of each cylinder in the domain.
- Change the shape of the object in the channel, e.g., try an ellipse or airfoil-like shape
4.6. Flow Past a Porous Cylinder (via Lattice Boltzmann)
- Recreate the above results with the parameters listed in Table 7
- Create the accompanying FTLE plots and discuss how fluid mixing changes due to the porous cylinder
- Vary (relaxation parameter relate to viscosity) to test the system’s sensitivity to
- Increase the number of porous cylinder in the domain and vary their placement or size
- Change the shape of the porous object in the channel, e.g., try an ellipse or airfoil-like shape
- Create a specific porous network structure through the cylinder and test how flows directly through a porous cylinder may affect vortex shedding
5. Discussion
Supplementary Materials
Funding
Acknowledgments
Conflicts of Interest
Abbreviations
Computational Fluid Dynamics | |
Reynolds Number | |
Boundary Conditions | |
Lattice Boltzmann Method | |
Void Fraction (Porosity) | |
Graphics Processing Unit | |
Central Processing Unit |
Appendix A. Instructor Resources
- suiteCFD_Supplement.pptx/.pdf: presentations which may be used in class; slides that tell the story of the paper. Note that the file has embedded movies in format.
- Images: directory containing images (simulation snapshots, data) pertaining to each simulation shown in the manuscript.
- Movies: directory containing movies ( format) pertaining to each simulation shown in the manuscript.
- suite-CFD-Software-02-06-2019.zip: zip-file containing all fluid solver codes used in the manuscript (as of 6 February 2020).
- Note that all codes used in the manuscript can also be found at: https://github.com/nickabattista/Holy_Grail.
- Visualization software used: VisIt (https://visit.llnl.gov/) (v. 2.12.3).
Appendix B. Select CFD Algorithms
Appendix B.1. Projection Methods
Appendix B.2. Spectral Methods via Fast Fourier Transform (FFT)
- Taking the Discrete Fourier Transform (DFT) of a set of complex numbers produces another set of complex numbers. The notation denotes taking the Discrete Fourier Transform of a set of N-values, , e.g., for , we define
- Variables with a hat, such as , denote variables that have been transformed into frequency space via the Discrete Fourier Transform. Moreover, the indices k are known as the DFT’s wave-numbers.
- We can also take the Inverse Discrete Fourier Transform (IDFT) to return our quantities of interest from frequency space to real space. We denote the IDFT as
- Next we will define the discretized quantities in the algorithm. A quantity such as denotes that quantity’s value at the nth time-step at spatial location within the rectangular computational grid. Hence we have a set of numbers (or matrix that changes as ), and can transform it in analogous manner using a DFT.
- We define and to be matrices of the DFT’s wave-numbers, where . They are defined as:Note that each row of the matrix is a vector that we denote with components . Similarly each column of the matrix is a vector that we denote
- In order to benefit from the FFT we will assume our spatial grid has a resolution of , where both and are powers of 2 [89].
- Update the streamfunction to the current time-step, n:From the previous time-step’s vorticity, , we can solve the Poisson problem (Equation (A18)) for the streamfunction at the current time-step, , i.e.,
- Obtain the components of velocity and the gradient of vorticity:With the newly updated as well as from the previous time-step, we are able to compute the components of the velocity field at the current time-step, . To do this, we take derivatives of the streamfunction and vorticity in frequency space. This then gives us the components of velocity (see Equation (A17)) and the gradient of vorticity, in frequency space respectively. We can then use the IDFT to transform these quantities back into in real space, e.g.,
- Compute the advection term in frequency space from Equation (A15):.Once you have the velocity field and partial derivatives of vorticity and at the current time-step, it is now possible to compute the advection term from Equation (A15), i.e., . We define to be the above advection term, and hence get thatFurthermore, we can apply the DFT to Equation (A25) to transform it into frequency space, e.g.,This will allows us to update vorticity to the time-step using Equation (A15) in frequency space.
- Update the vorticity to next time-step:Finally we use the Crank-Nicholson scheme to update the vorticity to the next time-step, ,Note that this method is semi-implicit; we explicitly discretize the advection term, while we implicitly discretize the diffusion term. The Crank-Nicholson scheme is second order accurate in time and space [51], and is unconditionally stable for an array of parabolic problems of the type [52].Now that the vorticity has been updated, , you can repeat this process again.
Appendix B.3. Lattice Boltzmann Methods
- The first step is to stream the particle densities to propagate in each direction. Explicitly you calculate the following intermediate particle density, ,This idea of streaming is shown in Figure A2.
- The second step involves finding what is referred to as the equilibrium distribution. This step is a part of the collision step, where you want to relax the particle density distributions towards a local equilibrium. The local equilibrium is denoted First we must compute macroscopic the properties (density and velocity) from the intermediate particle distributions using (A29) and (A30).Once we have these quantities, we can now define the equilibrium distributions, We note that there are many equilibrium distributions one could use in practice; however, each depends on your specific model and its assumptions. The Lattice Boltzmann method implemented here uses what is called the Bhatnagar-Gross-Krook (BGK) collision mode [90]. The BGK collision model is useful for simulating single phase flows [12] and is most often the classic model to use for solving the incompressible, viscous Navier-Stokes equations, although it can also be useful for simulating compressible flows at low Mach numbers [11]. See [11] for a good review of the BGK model. The BGK model’s equilibrium distribution can be written as followsThe corresponding weights, are given as
- Finally we compute the collision step associated with the BGK model as follows
Appendix C. Extra Visualizations of Data from Section 3: Spectral (FFT) Method’s bubble3 Example
Parameter | Variable | Units | Value |
---|---|---|---|
Domain Size | m | ||
Spatial Grid Resolution | |||
Spatial Grid Size | m | ||
Time Step Size | s | ||
Total Simulation Time | T | s | 30 |
Fluid Kinematic Viscosity | m/s |
- Recreate the above results with the parameters listed in Table A1 or for different or computational domains.
- Change the initial vorticity in each ‘overlapping’ region.
- Change the placement of where each vorticity region is.
- Modify the example to have more/fewer overlapping regions of vorticity.
- Try initializing a completely random background vorticity without any other vorticity structures.
References
- Fefferman, C.L. Existence and Smoothness of the Navier-Stokes Equation. In The Millenium Prize Problems; Clay Mathematics Institute: Cambridge, MA, USA, 2006; pp. 57–67. [Google Scholar]
- Chorin, A.J. The numerical solution of the Navier-Stokes equations for an incompressible fluid. Bull. Am. Math. Soc. 1967, 73, 928–931. [Google Scholar] [CrossRef] [Green Version]
- Chorin, A.J. Numerical Solution of the Navier-Stokes Equations. Math. Comp. 1968, 22, 745–762. [Google Scholar] [CrossRef]
- Temam, R. Une méthode d’approximation de la solution des équations de Navier-Stokes. Bull. Soc. Math. Franc. 1968, 96, 115–152. [Google Scholar] [CrossRef] [Green Version]
- Brown, D.L.; Cortez, R.; Minion, M.L. Accurate Projection Methods for the Incompressible Navier-Stokes Equations. J. Comp. Phys. 2001, 168, 464–499. [Google Scholar] [CrossRef] [Green Version]
- Griffith, B.E. An accurate and efficient method for the incompressible Navier-Stokes equations using the projection method as a preconditioner. J. Comput. Phys. 2009, 228, 7565–7595. [Google Scholar] [CrossRef]
- Costa, B. Spectral Methods for Partial Differential Equations. CUBO Math. J. 2004, 6, 1–32. [Google Scholar]
- Uecker, H. A short ad hoc introduction to spectral methods for parabolic PDE and the Navier-Stokes equations, 2009. In Proceedings of the Lecture given at International Summer School Modern Computational Science, Oldenburg, Germany, 16–28 August 2009. [Google Scholar]
- Suzuki, M. Fourier-Spectal Methods For Navier-Stokes Equations in 2D. 2014. Available online: http://www.math.mcgill.ca/gantumur/math595f14/NSMashbat.pdf (accessed on 29 June 2019).
- Hardy, J.; Pomeau, Y.; de Pazzis, O. Time evolution of a two-dimensional classical lattice system. Phys. Rev. Lett. 1973, 31, 276–279. [Google Scholar] [CrossRef]
- Chen, S.; Doolen, G.D. Lattice Boltzmann method for fluid flows. Annu. Rev. Fluid Mech. 1998, 30, 282–300. [Google Scholar] [CrossRef] [Green Version]
- Succi, S. The Lattice Boltzmann Equation for Fluid Dynamics and Beyond; Oxford University Press: Oxford, UK, 2001. [Google Scholar]
- Stern, F.; Xing, T.; Yarbrough, D.B.; Rothmayer, A.; Rajagopalan, G.; Prakashotta, S.; Caughey, D.; Bhaskaran, R.; Smith, S.; Hutchings, B.; et al. Hands-On CFD Educational Interface for Engineering Courses and Laboratories. J. Eng. Edu. 2006, 95, 63–83. [Google Scholar] [CrossRef]
- Cummings, R.; Morton, S. Computational Aerodynamics Goes to School: A Course in CFD for Undergraduate Students. In Proceedings of the 43rd AIAA Aerospace Sciences Meeting and Exhibit, Reno, NV, USA, 10–13 January 2005; AIAA: Reston, VA, USA, 2005. [Google Scholar] [CrossRef] [Green Version]
- Ormiston, S.J. Incorporating CFD into the undergraduate Mechanical Engineering Programme at the University of Manitoba. In Proceedings of the Ninth Annual Conference of the CFD Society of Canada: CFD2001, Waterloo, ON, Canada, 27–29 May 2001; Schneider, G., Ed.; CFD Society of Canada: Waterloo, ON, Canada, 2001; pp. 333–337. [Google Scholar]
- Aung, K. Design and Implementation of an Undergraduate Computational Fluid Dynamics (Cfd) Course, 2003. In Proceedings of the 2003 American Society for Engineering Education Annual Conference, Nashville, TN, USA, 22–25 June 2003; Available online: https://peer.asee.org/design-and-implementation-of-an-undergraduate-computational-fluid-dynamics-cfd-course.pdf (accessed on 9 September 2019).
- Stern, F.; Xing, T.; Yarbrough, D.; Rothmayer, A.; Rajagopalan, G.; Otta, S.P.; Caughey, D.; Bhaskaran, R.; Smith, S.; Hutchings, B.; et al. Development of hands-on CFD educational interface for undergraduate engineering courses and laboratories. In Proceedings of the 2004 American Society for Engineering Education Annual Conference & Exposition, Salt Lake City, UT, USA, 20–23 June 2004; American Society for Engineering Education: Washington, DC, USA, 2004; pp. 1526–1555. [Google Scholar]
- Adair, D. Incorporation of Computational Fluid Dynamics into a Fluid Mechanics Curriculum. In Advances in Modeling of Fluid Dynamics; Liu, C., Ed.; IntechOpen: London, UK, 2012; Chapter 5; pp. 97–122. [Google Scholar]
- Stern, F.; Yoon, H.; Yarbrough, D.; Okcay, M.; Oztekin, B.U.; Roszelle, B. Hands-on integrated CFD educational interface for introductory fluids mechanics. Int. J. Aerodyn. 2012, 2, 339–371. [Google Scholar] [CrossRef] [Green Version]
- Ray, B.; Bhaskaran, R. Integrating Simulation into the Engineering Curriculum: A Case Study. Int. J. Mech. Eng. Edu. 2013, 41, 269–280. [Google Scholar] [CrossRef]
- Eldredge, J.D.; Senocak, I.; Dawson, P.; Canino, J.; Liou, W.; LeBeau, R.; Hitt, D.; Rumpfkeil, M.; Cummings, R. A Best Practices Guide to CFD Education in the Undergraduate Curriculum. Int. J. Aerodyn. 2014, 4, 200–236. [Google Scholar] [CrossRef]
- Heron, P.; McNeill, L. Phys21: Preparing Physics Students for 21st-Century Careers (A Report by the Joint Task Force on Undergraduate Physics Programs). 2016. American Physical Society and the American Association of Physics Teachers. Available online: https://www.compadre.org/JTUPP/report.cfm (accessed on 7 January 2020).
- Heron, P.; McNeill, L. Preparing Physics Students for 21st-Century Careers. Phys. Today 2017, 70, 38. [Google Scholar]
- Fefferman, C.L. A Comparison of C, MATLAB, and Python as Teaching Languages in Engineering. In Computational Science—ICCS 2004; Bubak, M., van Albada, G.D., Sloot, P.M., Dongarra, J., Eds.; Springer: Berlin/Heidelberg, Germany, 2004; pp. 1210–1217. [Google Scholar]
- Spencer, R.L. Teaching computational physics as a laboratory sequence. Am. J. Phys. 2005, 73, 151–153. [Google Scholar] [CrossRef]
- Peng, L.; Bao, L.; Huang, M. Application of Matlab/Simulink Software in Physics. In High Performance Networking, Computing, and Communication Systems; Wu, Y., Ed.; Springer: Berlin/Heidelberg, Germany, 2011; Chapter 21; pp. 140–146. [Google Scholar]
- Sangwin, C.J.; O’Toole, C. Computer programming in the UK undergraduate mathematics curriculum. Int. J. Math. Edu. Sci. Technol. 2017, 48, 1133–1152. [Google Scholar] [CrossRef] [Green Version]
- Wang, Y.; Hill, K.J.; Foley, E.C. Computer programming with Python for industrial and systems engineers: Perspectives from an instructor and students. Comput. Appl. Eng. Educ. 2017, 25, 800–811. [Google Scholar] [CrossRef]
- MATLAB. Version 8.5.0 (R2015a); The MathWorks Inc.: Natick, MA, USA, 2015. [Google Scholar]
- Van Rossum, G. Python, version 3.5; 2015. Available online: https://www.python.org (accessed on 31 August 2019).
- Carey, M.A.; Papin, J.A. Ten simple rules for biologists learning to program. PLoS Comput. Biol. 2018, 14, e1005871. [Google Scholar] [CrossRef] [Green Version]
- Battista, N.A.; Strickland, W.C.; Miller, L.A. IB2d: A Python and MATLAB implementation of the immersed boundary method. Bioinspir. Biomim. 2017, 12, 036003. [Google Scholar] [CrossRef] [Green Version]
- Barba, L.A.; Forsyth, G. CFD Python: The 12 steps to Navier-Stokes equations. J. Open Source Edu. 2018, 1, 21. [Google Scholar] [CrossRef]
- Barba, L.A.; Mesnard, O. Aero Python: Classical aerodynamics of potential flow using Python. J. Open Source Edu. 2019, 2, 45. [Google Scholar] [CrossRef]
- Battista, N.A.; Mizuhara, M.S. Fluid-Structure Interaction for the Classroom: Speed, Accuracy, Convergence, and Jellyfish! arXiv 2019, arXiv:1902.07615. [Google Scholar]
- Battista, N. Fluid-structure Interaction for the Classroom: Interpolation, Hearts, and Swimming! SIAM Rev. 2018, in press. [Google Scholar]
- Battista, N.A.; Strickland, W.C.; Barrett, A.; Miller, L.A. IB2d Reloaded: A more powerful Python and MATLAB implementation of the immersed boundary method. Math. Methods Appl. Sci. 2018, 41, 8455–8480. [Google Scholar] [CrossRef] [Green Version]
- Kluyver, T.; Ragan-Kelley, B.; Pérez, F.; Granger, B.; Bussonnier, M.; Frederic, J.; Kelley, K.; Hamrick, J.; Grout, J.; Corlay, S.; et al. Jupyter Notebooks—A publishing format for reproducible computational workflows. In Positioning and Power in Academic Publishing: Players, Agents and Agendas; Loizides, F., Schmidt, B., Eds.; IOS Press: Amsterdam, The Netherlands, 2016; pp. 87–90. [Google Scholar]
- Pawar, S.; San, O. CFD Julia: A Learning Module Structuring an Introductory Course on Computational Fluid Dynamics. Fluids 2019, 4, 159. [Google Scholar] [CrossRef] [Green Version]
- Bezanson, J.; Edelman, A.; Karpinski, S.; Shah, V.B. Julia: A fresh approach to numerical computing. SIAM Rev. 2017, 59, 65–98. [Google Scholar] [CrossRef] [Green Version]
- Childs, H.; Brugger, E.; Whitlock, B.; Meredith, J.; Ahern, S.; Pugmire, D.; Biagas, K.; Miller, M.; Harrison, C.; Weber, G.H.; et al. VisIt: An End-User Tool For Visualizing and Analyzing Very Large Data. In High Performance Visualization–Enabling Extreme-Scale Scientific Insight; Bethel, E.W., Childs, H., Hansen, C., Eds.; Chapman and Hall/CRC: Boca Raton, FL USA, 2012; pp. 357–372. [Google Scholar]
- Ahrens, J.; Gerveci, B.; Law, C. ParaView: An End-User Tool for Large Data Visualizations; Elsevier: Atlanta, GA, USA, 2005. [Google Scholar]
- Burden, R.L.; Faires, J.D. Numerical Analysis, 5th ed.; Prindle, Weber and Schmidt: Boston, MA USA, 1993. [Google Scholar]
- Minion, M.L. Higher-Order Semi-Implicit Projection Methods. In Numerical Simulations of Incompressible Flows; Hafez, M.M., Ed.; World Scientific Publishing Company: Waterloo, ON, Canada, 2003; pp. 126–140. [Google Scholar]
- Guermond, J.L.; Minev, P.; Shen, J. An overview of projection methods for incompressible flows. Comp. Methods Appl. Mech. Eng. 2006, 195, 6011–6045. [Google Scholar] [CrossRef] [Green Version]
- Almgren, A.S.; Aspden, A.J.; Bell, J.B.; Minion, M.L. On the Use of Higher-Order Projection Methods for Incompressible Turbulent Flow. SIAM J. Sci. Comput. 2013, 35, B25–B42. [Google Scholar] [CrossRef] [Green Version]
- Bell, J.B.; Colella, P.; Glaz, H.M. A second order projection method for the incompressible Navier-Stokes equations. J. Comput. Phys. 1989, 85, 257–283. [Google Scholar] [CrossRef] [Green Version]
- Atkinson, K.E. An Introduction to Numerical Analysis, 2nd ed.; John Wiley & Sons: Hoboken, NJ, USA, 1989. [Google Scholar]
- Trefethen, L.N. Spectral Methods in MATLAB; SIAM: Philadelphia, PA, USA, 2001. [Google Scholar]
- Battista, N.A. Spectrally Accurate Initial Data in Numerical Relativity. Master’s Thesis, Rochester Institute of Technology, Rochester, NY, USA, 2010. [Google Scholar]
- Crank, J.; Nicholson, P. A practical method for numerical evaluation of solutions of partial differential equations of the heat conduction type. Proc. Camb. Phil. Soc. 1947, 43, 50–67. [Google Scholar] [CrossRef]
- Thomas, J.W. Numerical Partial Differential Equations: Finite Difference Methods; Springer: New York, NY, USA, 1995. [Google Scholar]
- Battista, N.A.; Baird, A.J.; Miller, L.A. A Mathematical Model and MATLAB Code for Muscle-Fluid-Structure Simulations. Integr. Comp. Biol. 2015, 55, 901–911. [Google Scholar] [CrossRef] [Green Version]
- Zhang, J. Lattice Boltzmann method for microfluidics: Models and applications. Microfluid. Nanofluidics 2011, 10, 1–28. [Google Scholar] [CrossRef]
- Bao, Y.B.; Meskas, J. Lattice Boltzmann Method for Fluid Simulations. 2011. Available online: http://www.cims.nyu.edu/~billbao/report930.pdf (accessed on 19 September 2019).
- Tu, J.; Yeoh, G.H.; Liu, C. Computational Fluid Dynamics, 3rd ed.; Butterworth-Heinemann: Oxford, UK, 2018. [Google Scholar]
- Ishihara, I. Tests for color blindness. Am. J. Ophthal. 1918, 1, 457. [Google Scholar] [CrossRef]
- Shadden, S.C.; Lekien, F.; Marsden, J.E. Definition and properties of Lagrangian coherent structures from finite-time Lyapunov exponents in two-dimensional aperiodic flows. Physica D 2005, 212, 271–304. [Google Scholar] [CrossRef]
- Shadden, S.C. Lagrangian Coherent Structures: Analysis of Time Dependent Dynamical Systems Using Finite-Time Lyapunov Exponent. 2005. Available online: https://shaddenlab.berkeley.edu/uploads/LCS-tutorial/index.html (accessed on 19 September 2019).
- Shadden, S.C.; Katija, K.; Rosenfeld, M.; Marsden, J.E.; Dabiri, J.O. Transport and stirring induced by vortex formation. J. Fluid Mech. 2007, 593, 315–331. [Google Scholar] [CrossRef] [Green Version]
- Haller, G.; Sapsis, T. Lagrangian coherent structures and the smallest finite-time Lyapunov exponent. Chaos 2011, 21, 023115. [Google Scholar] [CrossRef] [Green Version]
- Shadden, S.C.; Dabiri, J.O.; Marsden, J.E. Lagrangian analysis of fluid transport in empirical vortex ring flows. Phys. Fluids 2006, 18, 047105. [Google Scholar] [CrossRef] [Green Version]
- Lukens, S.; Yang, X.; Fauci, L. Using Lagrangian coherent structures to analyze fluid mixing by cilia. Chaos 2010, 20, 017511. [Google Scholar] [CrossRef]
- Cheryl, S.; Glatzmaier, G.A. Lagrangian coherent structures in the California Current System—Sensitivities and limitations. Geophys. Astrophys. Fluid Dyn. 2012, 106, 22–44. [Google Scholar]
- Haller, G. Finding finite-time invariant manifolds in two-dimensional velocity fields. Chaos 2000, 10, 99–108. [Google Scholar] [CrossRef]
- Haller, G. Lagrangian Coherent Structures. Annu. Rev. Fluid Mech. 2015, 47, 137–162. [Google Scholar] [CrossRef] [Green Version]
- Truskey, G.A.; Yuan, F.; Katz, D.F. Transport Phenomena in Biological Systems; Pearson Prentice Hall Bioengineering: Upper Saddle River, NJ, USA, 2004. [Google Scholar]
- Rayleigh, L. On the flow of compressible fluid past an obstacle. Lond. Edinb. Dublin Philos. Mag. J. Sci. 1916, 32, 1–6. [Google Scholar] [CrossRef]
- Acheson, D.J. Elementary Fluid Dynamics; Oxford University Press: Oxford, UK, 1990. [Google Scholar]
- Batchelor, G.K. An Introduction to Fluid Dynamics; Cambridge University Press: Cambridge, UK, 2000. [Google Scholar]
- Morton, C.; Yarusevych, S. Vortex shedding in the wake of a step cylinder. Phys. Fluids 2010, 22, 083602. [Google Scholar] [CrossRef]
- Bao, Y.; Wu, Q.; Zhou, D. Numerical investigation of flow around an inline square cylinder array with different spacing ratios. Comput. Fluids 2012, 55, 118–131. [Google Scholar] [CrossRef]
- Carini, M.; Gianetti, F.; Auteri, F. On the origin of the flip-flop instability of two side-by-side cylinder wakes. J. Fluid Mech. 2014, 742, 552–576. [Google Scholar] [CrossRef] [Green Version]
- Younis, M.Y.; Alam, M.M.; Zhou, Y. Flow around two non-parallel tandem cylinders. Phys. Fluids 2016, 28, 125106. [Google Scholar] [CrossRef]
- Gao, Y.; Chen, W.; Wang, B.; Wang, L. Numerical simulation of the flow past six-circular cylinders in rectangular configurations. J. Mar. Sci. Technol. 2019, 1–25. [Google Scholar] [CrossRef]
- Ji, C.; Cui, Y.; Xu, D.; Yang, X.; Srinil, N. Vortex-induced vibrations of dual-step cylinders with different diameter ratios in laminar flows. Phys. Fluids 2019, 31, 073602. [Google Scholar]
- Ji, C.; Yang, X.; Yu, Y.; Cui, Y.; Srinil, N. Numerical simulations of flows around a dual step cylinder with different diameter ratios at low Reynolds number. Eur. J. Mech. B/Fluids 2019, in press. [Google Scholar] [CrossRef]
- Fransson, J.H.; Konieczny, P.; Alfredsson, P.H. Flow around a porous cylinder subject to continuous suction or blowing. J. Fluids Stuct. 2004, 19, 1031–1048. [Google Scholar] [CrossRef]
- Chen, X.; Yu, P.; Winoto, S.; Low, H. Numerical analysis for the flow past a porous square cylinder based on the stress-jump interfacial-conditions. Int. J. Num. Meth. Heat Fluid Flow 2008, 18, 635–655. [Google Scholar] [CrossRef]
- Naito, H.; Fukagata, K. Numerical simulation of flow around a circular cylinder having porous surface. Phys. Fluids 2012, 24, 117102. [Google Scholar] [CrossRef]
- Shahsavari, S.; Wardle, B.L.; McKinley, G.H. Interception efficiency in two-dimensional flow past confined porous cylinders. Chem. Eng. Sci. 2014, 116, 752–762. [Google Scholar] [CrossRef]
- Ledda, P.G.; Siconolfi, L.; Viola, F.; Gallaire, F.; Camarri, S. Suppression of von Kármán vortex streets past porous rectangular cylinders. Phys. Rev. Fluids 2007, 3, 103901. [Google Scholar] [CrossRef] [Green Version]
- Gupta, G.K. Computer literacy: Essential in today’s computer-centric world. ACM SIGCSE Bull. 2005, 38, 115–119. [Google Scholar] [CrossRef]
- Shein, E. Should everybody learn to code? Commun. ACM 2014, 57, 16–18. [Google Scholar]
- Sterling, L. Coding in the curriculum: Fad or foundational? ACER Res. Conf. 2016, 4, 72–84. [Google Scholar]
- Baker, M. Scientific computing: Code alert. Nature 2017, 541, 563–565. [Google Scholar] [CrossRef] [Green Version]
- Helmholtz, H. Uber Integrale der hydrodynamischen Gleichungen, welcher der Wirbelbewegungen entsprechen. J. Reine Angew. Math. 1858, 55, 25–50. [Google Scholar]
- Bladel, J. On Helmholtz’s Theorem in Finite Regions; Midwestern Universities Research Association: Madison, WI, USA, 1958. [Google Scholar]
- Cooley, J.W.; Tukey, J.W. An algorithm for the machine calculation of complex Fourier series. Math. Comput. 1965, 19, 297–301. [Google Scholar] [CrossRef]
- Bhatnagar, P.L.; Gross, E.P.; Krook, M. A Model for Collision Processes in Gases. I. Small Amplitude Processes in Charged and Neutral One-Component Systems. Phys. Rev. 1954, 94, 511–525. [Google Scholar] [CrossRef]
- Asinari, P. Multi-Scale Analysis of Heat and Mass Transfer in Mini/Micro Structures. Ph.D. Thesis, Energy Engineering, Politecnico di Torino, Turin, Italy, 2005. [Google Scholar]
Parameter | Type | ‘.vtk’ Name |
---|---|---|
Magnitude of Velocity | Scalar | |
Velocity Vectors | Vector | u |
Horizontal Velocity | Scalar | |
Vertical Velocity | Scalar | |
Pressure (projection only) | Scalar | P |
Vorticity | Scalar | |
Geometry (LBM only) | Mesh |
Parameter | Colormap |
---|---|
Magnitude of Velocity | RdYlBu or BrBG (Section 4.1 only) |
Horizontal Velocity | RdYlBu |
Vertical Velocity | RdYlBu |
Pressure | orangehot (Section 4.1 only) |
Vorticity | hot_desaturated |
FTLE | PuRd |
Parameter | Variable | Units | Value |
---|---|---|---|
Domain Size | m | ||
Spatial Grid Resolution | |||
Spatial Grid Size | m | ||
Time Step Size | s | ||
Total Simulation Time | T | s | 6 |
Fluid Density | 1000 | ||
Fluid Dynamic Viscosity | 1 |
Parameter | Variable | Units | Value |
---|---|---|---|
Domain Size | m | ||
Spatial Grid Resolution | |||
Spatial Grid Size | m | ||
Time Step Size | s | ||
Total Simulation Time | T | s | 24 |
Fluid Density | 1000 | ||
Fluid Dynamic Viscosity |
Parameter | Variable | Units | Value |
---|---|---|---|
Domain Size (4 case) | m | ||
Spatial Grid Resolution (4 case) | |||
Spatial Grid Size | m | ||
Domain Size (2 case) | m | ||
Spatial Grid Resolution (4 case) | |||
Spatial Grid Size | m | ||
Time Step Size | s | ||
Total Simulation Time | T | s | 5 |
Fluid Kinematic Viscosity |
Parameter | Variable | Units | Value |
---|---|---|---|
Domain Size | m | ||
Spatial Grid Resolution | |||
Spatial Grid Size | m | ||
Time Step Size | s | ||
Total Simulation Time | T | s | 50 |
Fluid Kinematic Viscosity | m/s |
Parameter | Variable | Units | Value |
---|---|---|---|
Domain Size | m | ||
Spatial Grid Resolution (1 Cylinder) | |||
Spatial Grid Resolution (Multiple Cylinders) | |||
Spatial Grid Size | m | ||
‘Density’ Initialization | |||
Relaxation Parameter | |||
Total Simulation Steps (1 Cylinder) | N | 56000 | |
Total Simulation Steps (Multiple Cylinders) | N | 5500 | |
Incremental inflow velocity increase (1 cylinder) | |||
Incremental inflow velocity increase (Multiple Cylinders) | |||
Radii (1 Cylinder) | r | ||
Radii (Multiple Cylinders) | r |
© 2020 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
Share and Cite
Battista, N.A. Suite-CFD: An Array of Fluid Solvers Written in MATLAB and Python. Fluids 2020, 5, 28. https://doi.org/10.3390/fluids5010028
Battista NA. Suite-CFD: An Array of Fluid Solvers Written in MATLAB and Python. Fluids. 2020; 5(1):28. https://doi.org/10.3390/fluids5010028
Chicago/Turabian StyleBattista, Nicholas A. 2020. "Suite-CFD: An Array of Fluid Solvers Written in MATLAB and Python" Fluids 5, no. 1: 28. https://doi.org/10.3390/fluids5010028
APA StyleBattista, N. A. (2020). Suite-CFD: An Array of Fluid Solvers Written in MATLAB and Python. Fluids, 5(1), 28. https://doi.org/10.3390/fluids5010028