Next Article in Journal
In-Vitro Validation of Self-Powered Fontan Circulation for Treatment of Single Ventricle Anomaly
Next Article in Special Issue
Proposal of a Mask and Its Performance Analysis with CFD for an Enhanced Aerodynamic Geometry That Facilitates Filtering and Breathing against COVID-19
Previous Article in Journal
Dynamics of Shock Structure and Frontal Drag Force in a Supersonic Flow Past a Blunt Cone under the Action of Plasma Formation
Previous Article in Special Issue
Fluid Dynamics in Curvilinear Coordinates without Fictitious Forces
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Tutorial

A CFD Tutorial in Julia: Introduction to Compressible Laminar Boundary-Layer Flows

School of Mechanical and Aerospace Engineering, Oklahoma State University, Stillwater, OK 74078, USA
*
Author to whom correspondence should be addressed.
Fluids 2021, 6(11), 400; https://doi.org/10.3390/fluids6110400
Submission received: 13 October 2021 / Revised: 30 October 2021 / Accepted: 2 November 2021 / Published: 5 November 2021
(This article belongs to the Collection Feature Paper for Mathematical and Computational Fluid Mechanics)

Abstract

:
A boundary-layer is a thin fluid layer near a solid surface, and viscous effects dominate it. The laminar boundary-layer calculations appear in many aerodynamics problems, including skin friction drag, flow separation, and aerodynamic heating. A student must understand the flow physics and the numerical implementation to conduct successful simulations in advanced undergraduate- and graduate-level fluid dynamics/aerodynamics courses. Numerical simulations require writing computer codes. Therefore, choosing a fast and user-friendly programming language is essential to reduce code development and simulation times. Julia is a new programming language that combines performance and productivity. The present study derived the compressible Blasius equations from Navier–Stokes equations and numerically solved the resulting equations using the Julia programming language. The fourth-order Runge–Kutta method is used for the numerical discretization, and Newton’s iteration method is employed to calculate the missing boundary condition. In addition, Burgers’, heat, and compressible Blasius equations are solved both in Julia and MATLAB. The runtime comparison showed that Julia with f o r loops is 2.5 to 120 times faster than MATLAB. We also released the Julia codes on our GitHub page to shorten the learning curve for interested readers.

Graphical Abstract

1. Introduction

Until the 19th century, scientists neglected the effects of viscosity in their hydrodynamic and aerodynamic calculations using potential flow theory. However, this assumption led to a contradiction between theoretical predictions and experimental measurements of drag force acting on a moving body, now known as the d’Alembert paradox [1]. Later, a revolutionary boundary-layer concept is introduced [2,3]. In this concept, the fluid flow over a surface is divided into two regions by the boundary-layer edge: an area between the surface and the boundary-layer edge dominated by the viscous effects and a region outside the boundary-layer edge where the viscous effects can be neglected. It enables a significant simplification of full Navier–Stokes equations.
The boundary-layer theory was first presented by Prandtl [4] in 1904, and it provides the solutions of velocity and temperature profiles within the boundary-layer by using approximations. One can obtain Blasius [5,6], Falkner–Skan [7], and compressible Falkner–Skan [2,8] solutions by using this approach. Researchers extensively use these solutions to validate the computational fluid dynamics (CFD) simulations. Moreover, in a CFD simulation, one can calculate the boundary-layer thickness in advance to estimate the required grid parameters to resolve the boundary-layer region. Understanding the fundamentals of boundary-layer theory is critical for engineers to solve today’s aerodynamic design challenges.
It may be challenging to fully understand the fundamentals of the boundary-layer theory in undergraduate- and graduate-level boundary-layer courses. Most of the time, books skip or briefly mention some steps in the derivation of a system of equations. Additionally, instructors are forced to leave the details of derivations to students due to the limited lecture time. The steps that are skipped may become a challenge for students. Moreover, the derived equations usually do not have an analytical solution; therefore, they must be solved using numerical methods. Students or engineers who do not have adequate experience in the subject may struggle to understand the details of the topics because of the blanks in the process. A tutorial of step-by-step derivation and implementation in the computer environment may help students to fill the blanks. Moreover, researchers from another field may utilize the code and/or the simple explanation of the topic in their research. For the coding part, there are several available coding languages extensively used in scientific community, such as Fortran [9], Python [10], C/C++ [11], and MATLAB [12]. However, Julia [13] may be another alternative for students to write high-level, generic code that resembles mathematical formulas. It is a relatively new, fast, and dynamic coding language that focuses on productivity. It is trying to fill the gap between high-performance languages, such as Fortran and C/C++, and user-friendly languages, such as Python and MATLAB. Students tend to use user-friendly languages for their coursework and simple problems; however, in the industry, it is crucial to have a fast solver. In this gap, Julia provides easy syntax, as Python and MATLAB, and a fast performance, as Fortran and C/C++. This makes Julia a great choice for researchers due to the ability to combine high-performance with productivity. Although there are some tutorial papers and modules developed in other languages [14,15,16,17], the current number of publications is not enough to gain a thorough understanding of the Julia language in CFD [18,19].
In this tutorial paper, compressible Blasius equation and energy equation are derived from scratch and implemented in the Julia environment. The fourth-order Runge–Kutta method is employed to solve the final differential equations and Newton’s iteration method is used for the missing boundary condition. Solutions obtained by the code are validated with Iyer’s [20] BL2D boundary-layer solver which is used in NASA’s well-known compressible boundary-layer stability solver Langley Stability and Transition Analysis Code (LASTRAC) [21]. The derivation details with the numerical implementation will guide students to understand the compressible laminar boundary-layer concept better. It will be easier for them to solve more complex problems with their own codes. Figure 1 illustrates the visual abstract of the paper, which gives the main ideas of the present paper. Additionally, Burger’s, heat, and compressible Blasius equations solution times obtained by Julia and MATLAB solvers are compared with each other. We make all these codes available on GitHub to shorten the learning curve. We provide the GitHub link of the codes, installation instructions, and required packages in Appendix A. Advanced boundary-layer topics are beyond the scope of this paper, interested readers are referred to additional references [22,23,24,25] for subsonic boundary-layer transition, references [26,27,28,29,30,31,32,33,34] for supersonic/hypersonic boundary-layer transition, and references [35,36,37] for flow separation. The other research studies where boundary-layer flow is involved are presented in the references [38,39,40,41,42,43].

2. Compressible Laminar Boundary-Layer

Compressibility effect in the boundary-layer requires additional calculations. Constant density assumption in incompressible speeds is no longer valid for the compressible boundary-layer. In compressible speeds, temperature and density change within the boundary-layer. It is crucial to capture the velocity, temperature and density variations in the boundary-layer to obtain accurate simulation results. One can estimate the number of element required to resolve the boundary-layer in the CFD simulation by using the boundary-layer theory. Compressible Blasius is also widely used for CFD validations in high-speed flows. In this section, compressible Blasius equations will be derived from scratch and implemented in the Julia environment. The contribution of this paper is employing the Julia language. The equations used in this paper are already in the literature [2,44]. The manuscript may enable students to adopt the programming language with easily and available GitHub codes, which may shorten the learning curve.

2.1. Compressible Blasius Equations

Incompressible Blasius solution is a similarity solution for a flat plate. The assumptions for the incompressible Blasius equations are given in our previous work [19]; interested readers can check the details from there. In the compressible region, the temperature effects must be taken into account for an accurate solution. In the incompressible region, the temperature and density changes are small enough to be neglected. In the compressible region, the temperature can increase drastically as a result; density decreases within the boundary-layer. For example, the temperature on the solid wall can reach 7 times the freestream temperature in Mach 6 flow over a wedge. If the freestream temperature is 300 K, the wall temperature will be around 2100 K. In order to compare the quantity, the melting point of titanium is around 1941 K [45]. This problem is still a challenge for aerospace applications in which high Mach numbers are involved.
The compressible Blasius equations can be derived from the compressible Navier–Stokes equations, which can be expressed in two spatial dimensions as:
ρ t + ( ρ u ) x + ( ρ v ) y = 0
ρ u t + u u x + v u y = p x + x 2 μ u x + λ u x + v y + y μ u y + v x
ρ v t + u v x + v v y = p y + x μ v x + u y + y 2 μ v y + λ u x + v y
ρ c p T t + u T x + v T y = u p x v p y + x k T x + y k T y + Φ ,
where ρ is the density, u and v are the velocities in x- and y- directions, p is the pressure, μ is the dynamic viscosity, λ is the second viscosity coefficient, k is the thermal conductivity, T is the temperature, c p is the specific heat at constant pressure, and Φ is the dissipation function, which can be written as:
Φ = μ 2 u x 2 + 2 v y 2 + u x + v y 2 + λ u x + v y 2 .
In order to obtain the boundary-layer equations, dimensional analysis is required to neglect the variables that have smaller orders than others. The flat plate boundary-layer development is illustrated in Figure 2. In this flow, u velocity is related to freestream velocity and the order of magnitude is one. The x is related to plate length, so its order of magnitude is also one. The y distance is related to boundary-layer thickness, so it is in the order of δ which is the boundary-layer thickness. The density, ρ , is related to freestream density so its order of magnitude is also one. The magnitude of the v velocity can be calculated from the continuity equation, Equation (1). In order to get zero from this equation, all variables must be in the same order so v is in the order of δ as a result of this, ( ρ v ) y = O ( 1 ) . When the magnitude analysis is completed in the same manner, the boundary-layer equations can be obtained. It has to be noted that dynamic viscosity is in the order of δ 2 , pressure and temperature are in the order of one. The specific heat at constant pressure is in the order of one. The second viscosity coefficient, λ , can be taken as 2 / 3 μ because of Stokes’ hypothesis. Once the order of magnitude is obtained for each of the terms, some of the terms can be neglected because δ 1 . The final system of equations in steady-state condition ( t = 0 ) will be:
( ρ u ) x + ( ρ v ) y = 0
ρ u u x + v u y = p x + y μ u y
p y = 0
ρ c p u T x + v T y = u p x + y k T y + μ u y 2 .
Equation (7) can be expressed at the boundary-layer edge as:
ρ u e u e x = p e x .
The variables are changing from the solid surface up to the boundary-layer edge. At the boundary-layer edge, they reach to freestream value for the corresponding variable and remain constant. The velocity change in the y-direction at the boundary-layer edge is zero ( u y | y = δ = 0 ), because it is constant at boundary-layer edge. Equation (8) indicates that the pressure gradient in the y-direction is zero, so pressure at the boundary-layer edge equals the pressure within the boundary-layer ( p e = p ). Equation (10) becomes:
ρ u e u e x = p x .
The velocity at the boundary-layer edge is equal to freestream velocity, which is constant in x-direction for a flat plate. In other words, edge velocity gradient in x-direction is zero ( u e x = 0 ). If the equation of state is used to obtain the ratio of density and temperature as:
p = ρ R T
p e = ρ e R T e ,
where R is the gas constant. It is known that p = p e , so ρ T = ρ e T e . The final system of equations is:
( ρ u ) x + ( ρ v ) y = 0
ρ u u x + v u y = y μ u y
p y = 0
ρ c p u T x + v T y = y k T y + μ u y 2 ,
where T e T = ρ ρ e . At this point, a similarity parameter can be introduced to the system to obtain a similarity solution [46]. The similarity parameter, η , can be defined as:
η = u e ρ e 2 s 0 y T e T d y ,
where s = μ e ρ e u e x . Let’s assume that the stream function is
ψ = 2 s f ( η ) .
The u and v velocities can be calculated from the stream function as:
u = 1 ρ ψ y , v = 1 ρ ψ x
In this step, the variables in Equation (15), u, v, u x , u y , and y μ u y can be calculated. The first derivative of η with respect to y and the first derivative of s with respect to x will be required for the chain rule.
s = μ e ρ e u e x
d s d x = μ e ρ e u e
η = u e ρ e 2 s 0 y T e T d y
η y = u e ρ 2 s .
It is better to note that, in η y calculation, T e T = ρ ρ e relation is used. The u velocity can be calculated as:
u = 1 ρ ψ y
= 1 ρ ψ η η y
= 1 ρ 2 s d f d η u e ρ 2 s
= f u e
The same procedure can be applied for v velocity as:
v = 1 ρ ψ x
= 1 ρ ψ s s x + ψ η η x
= 1 ρ 1 2 2 s 2 f μ e ρ e u e + 2 s f η x
= 1 ρ 1 2 s f μ e ρ e u e + 2 s f η x .
Once u velocity is obtained, the derivatives with respect to x and y can be calculated as:
u y = u η η y
= u e 2 ρ 2 s f
y μ u y = η μ u y η y
= η μ u e 2 ρ 2 s f u e ρ 2 s
= η μ ρ f u e 3 ρ 2 s
u x = u η η x
= ( u e f ) η η x
= u e f η x .
All terms in Equation (15) are known. If the above terms are substituted into Equation (15) and the necessary simplifications are done, the final equation will be:
η f ρ ρ e μ μ e + f f = 0 .
It has to be noted that if ρ = ρ e and μ = μ e , in other words, if the flow is incompressible, Equation (41) becomes an incompressible Blasius equation ( f + f f = 0 ). Equation (41) can be further simplified as:
ρ ρ e μ μ e f + f η ρ ρ e μ μ e + f f = 0
f + ρ ¯ μ ¯ η μ ¯ ρ ¯ f + ρ ¯ μ ¯ f f = 0 ,
where μ ¯ = μ μ e and ρ ¯ = ρ e ρ = T T e . The momentum equation of the compressible Blasius equations is obtained in Equation (42). The energy equation of the compressible Blasius equations can be obtained with the same procedure. First of all, T x , T y , and y k T y have to be calculated. These terms can be calculated as:
T x = T η η x
= T e ρ ¯ η x
T x = T η η y
= T e ρ ¯ u e ρ 2 s
y k T y = η k T y η y
= η k T e ρ ¯ u e ρ 2 s u e ρ 2 s
= T e u e 2 ρ 2 s ( k ρ ρ ¯ ) η .
When these terms are substituted into Equation (17), the new equation will be:
ρ c p ( u e f ) T e ρ η x + ρ c p 1 ρ 1 2 s f μ e ρ e u e + 2 s f η x T e ρ ¯ u e ρ 2 s = T e u e 2 ρ 2 s ( k ρ ρ ¯ ) η + μ ρ u e 2 2 s f 2 .
Equation (51) can be simplified by dividing it with ρ μ c p , substituting Prandtl number into the equation where Prandtl number P r = c p μ k and multiplying with P r ρ ¯ μ ¯ . The final equation will be:
ρ ¯ + ρ ¯ μ ¯ ρ ¯ η μ ¯ ρ ¯ + P r μ ¯ ρ ¯ f ρ ¯ + ( γ 1 ) P r M e 2 f 2 = 0 ,
where c p = γ γ 1 R , M = u e a e , and a e = γ R T e . In the final system of equations, the μ ¯ can be calculated from Sutherland Viscosity Law [47]. The dimensional viscosity function is:
μ = c 1 T 3 / 2 T + c 2 ,
where c 1 = 1.458 × 10 6 k g m s K and c 2 = 110.4  K. The μ ¯ is:
μ ¯ = c 1 T 3 / 2 T + c 2 T e + c 2 c 1 T e 3 / 2
= T T e 3 / 2 1 + c 2 T e T T e + c 2 T e
= ρ ¯ 3 / 2 1 + c 2 T e ρ ¯ + c 2 T e .
The derivative of the viscosity is also required. The derivative terms can be calculated as:
η μ ¯ ρ ¯ = 1 + c 2 T e ρ ¯ 2 ρ ¯ 1 / 2 ρ ¯ + c 2 T e ρ ¯ ρ ¯ 3 / 2 ρ ¯ + c 2 T e 2 .
The final system of equations is:
f + ρ ¯ μ ¯ η μ ¯ ρ ¯ f + ρ ¯ μ ¯ f f = 0
ρ ¯ + ρ ¯ ρ ¯ μ ¯ η μ ¯ ρ ¯ + P r ρ ¯ μ ¯ f ρ ¯ + ( γ 1 ) P r M e 2 f 2 = 0 .
It has to be emphasized that ρ ¯ is a function of η and the final system of equations is coupled, so they have to be solved together. The boundary conditions of the system for an adiabatic system are:
η f = 1
η = 0 f = f = 0
η ρ ¯ = 1
η = 0 ρ ¯ = 0 .
The boundary condition for the isothermal wall depends on the wall temperature. For example, if the wall temperature equals the boundary-layer edge temperature, it will be ρ ¯ = 1 , and it will be replaced with the last boundary condition of the system. In the adiabatic boundary condition, the derivative of the temperature with respect to wall-normal direction will be 0. During the numerical procedures, the difference will be emphasized one more time.

2.2. Numerical Procedure

In this section, the compressible Blasius equation will be solved with the fourth-order Runge–Kutta method [48] and Newton’s iteration method [49]. Different methods can be used for this problem; however, we used Runge–Kutta and Newton’s method because of their extensive usage in the literature and accuracy. To start the numerical procedure, high-order differential equations can be reduced to the first-order differential equations as:
f = y 1
f = y 2
f = y 3
ρ ¯ = y 4
ρ ¯ = y 5
if Equations (64)–(68) are substituted into Equations (58) and (59), the final version of these equations can be written as:
f = y 3 y 5 2 y 4 y 5 y 4 + c 2 T e y 1 y 3 y 4 + c 2 T e y 4 ( 1 + c 2 T e )
ρ ¯ = y 5 2 1 2 y 4 1 y 4 + c 2 T e P r y 1 y 5 y 4 y 4 + c 2 T e 1 + c 2 T e ( γ 1 ) P r M e 2 y 3 2 .
The final system of equations can be written in the matrix form as:
y 1 y 2 y 3 y 4 y 5 = y 2 y 3 y 3 y 5 2 y 4 y 5 y 4 + c 2 T e y 1 y 3 y 4 + c 2 T e y 4 ( 1 + c 2 T e ) y 5 y 5 2 1 2 y 4 1 y 4 + c 2 T e P r y 1 y 5 y 4 y 4 + c 2 T e 1 + c 2 T e ( γ 1 ) P r M e 2 y 3 2 .
The adiabatic boundary conditions for the system are:
f ( η = 0 ) = 0 y 1 ( η = 0 ) = 0
f ( η = 0 ) = 0 y 2 ( η = 0 ) = 0
ρ ¯ ( η = 0 ) = 0 y 5 ( η = 0 ) = 0
f ( η ) = 1 y 2 ( η ) = 1
ρ ¯ ( η ) = 1 y 4 ( η ) = 1 .
The isothermal boundary conditions for the system are:
f ( η = 0 ) = 0 y 1 ( η = 0 ) = 0
f ( η = 0 ) = 0 y 2 ( η = 0 ) = 0
ρ ¯ ( η = 0 ) = T w / T y 4 ( η = 0 ) = T w / T
f ( η ) = 1 y 2 ( η ) = 1
ρ ¯ ( η ) = 1 y 4 ( η ) = 1 .
The functions can be introduced in Julia as shown in Listing 1, where c μ is the second coefficient of the Sutherland Viscosity Law, T is the temperature at the boundary-layer edge, M is the Mach number at the boundary-layer edge, γ is the specific heat ratio, P r is the Prandtl number and y 1 , y 2 , y 3 , y 4 , and y 5 are the terms given in Equations (64)–(66), Equation (67), and Equation (68). In the functions given in Listing 1, only 2 parameters are dimensional, which are c μ and T . In this tutorial paper, Kelvin is the unit of both parameters. If the temperature unit is required to be different, such as Fahrenheit or Rankine, the units of c μ and T must be transformed into the new unit accordingly.
Listing 1. Implementation of system of equations in Julia environment. There are five functions which correspond to five first-order ordinary differential equations.
Listing 1. Implementation of system of equations in Julia environment. There are five functions which correspond to five first-order ordinary differential equations.
Fluids 06 00400 i001
In this paper, implementation of the Runge–Kutta method will be provided. The derivation of the Runge–Kutta method and how it calculates the function value at the next step can be checked from Reference [49]. The implementation of the Runge–Kutta method for the compressible Blasius problem can be seen in Listing 2, where N is the number of elements. It has to be emphasized that the number of node points is N + 1 , which means that terms must be calculated until ( N + 1 ) t h node. The first point is the boundary condition, so there will be N number of calculations.
The initialization and the boundary conditions can be introduced as shown in Listing 3, where a d i is a flag for the adiabatic or isothermal condition selection and T w is the dimensionless wall temperature. It is nondimensionalized with T e , so if the temperature at the boundary-layer edge, T e , is 300 K and the wall temperature is required to be 150 K, T w must be entered as 0.5 . Another important point about Listing 3 is the indices. In the derived formulations, indices start from 0. However, in both Julia and MATLAB, indices start from 1. This is the reason why indices are starting from 1 in Listing 3 boundary conditions part.
Listing 2. Implementation of Runge-Kutta method in Julia environment. It requires four slope calculation to estimate the function value in the next node value.
Listing 2. Implementation of Runge-Kutta method in Julia environment. It requires four slope calculation to estimate the function value in the next node value.
Fluids 06 00400 i002
In the system of equations, there are five equations and five boundary conditions; however, two boundary conditions are located at the end of the domain. In order to start the calculation, all values at the η = 0 should be given. α 0 and β 0 in the Listing 3 are the initial guesses for the missing boundary conditions. They can be any value. Once they are introduced to the system, compressible Blasius equations can be solved. When the equations are solved with guessed initial conditions, the solution vector must satisfy the boundary conditions at the end of the domain. However, it will not converge at the first try because the guessed boundary conditions are not correct. To overcome this problem, different methods can be used, such as the shooting method, bisection method, or Newton’s iteration method. In this paper, Newton’s iteration method will be used because it is fast and it is not hard to implement. In order to use it, the algorithm needs to run with the initial guesses one time. Once the y 2 (corresponds to u) and y 4 (corresponds to T) at the end of the domain are obtained, an arbitrary small number can be added to one of the initial guesses. The algorithm can be run one more time with the new boundary condition guesses. After that, the same small number can be added to the other initial guess and the algorithm can be run one more time. After running the algorithm 3 times, there will be 3 different y 2 y 4 pairs. It has to be noted that when the small number is added to the second boundary condition (in the third run), other boundary conditions should be equal to the value in the first run. In other words, after adding a small value in the second run, it should be subtracted in the third run. The main purpose of running three times is to determine the more accurate boundary condition guess. The new boundary conditions can be calculated with:
α = α + d α
β = β + d β ,
where α and β are the initially guessed boundary conditions. d α and d β are required for the new boundary conditions. These values can be approximated from the Taylor series expansion of the y 2 and y 4 , which can be shown as:
y 2 , n e w = y 2 , o l d + y 2 α d α + y 2 β d β + O ( d α 2 , d β 2 )
y 4 , n e w = y 4 , o l d + y 4 α d α + y 4 β d β + O ( d α 2 , d β 2 ) .
y 2 , n e w and y 4 , n e w must be 1 due to the boundary conditions. The new system of equations for the d α and d β will be:
y 2 α y 2 β y 4 α y 4 β d α d β = 1 y 2 , o l d 1 y 4 , o l d .
The partial differentials can be approximated with the finite difference as:
y 2 α = y 2 ( α + Δ ) y 2 ( α ) Δ = y 2 , n e w , 1 y 2 , o l d Δ
y 4 α = y 4 ( α + Δ ) y 4 ( α ) Δ = y 4 , n e w , 1 y 4 , o l d Δ
y 2 β = y 2 ( β + Δ ) y 2 ( β ) Δ = y 2 , n e w , 2 y 2 , o l d Δ
y 4 β = y 4 ( β + Δ ) y 4 ( β ) Δ = y 4 , n e w , 2 y 4 , o l d Δ ,
where y 2 , o l d and y 4 , o l d are the values obtained from the first run, y 2 , n e w , 1 and y 4 , n e w , 1 are the values obtained from the second run, and y 2 , n e w , 2 and y 4 , n e w , 2 are the values obtained from the third run. Once everything is calculated, the system of equations in Equation (86) can be used to calculate d α and d β . The implementation of the explained method in Julia can be seen in Listing 4.
Listing 3. Initialization of the variables and implementation of boundary conditions in Julia environment. The boundary conditions for adiabatic and isothermal conditions are different than each other.
Listing 3. Initialization of the variables and implementation of boundary conditions in Julia environment. The boundary conditions for adiabatic and isothermal conditions are different than each other.
Fluids 06 00400 i003
The same procedure will run until y 2 , and y 4 at the end of the domain will be 1. It is important to decide the upper limit of the domain. If it is small, it will force the value at that point to be 1 where it should not be. It is also important to choose the small number, Δ , smaller than convergence criteria which will finalize the simulation. If Δ is higher than the convergence criteria, the simulation might run until it reaches the maximum iteration number. In the code provided in GitHub, convergence criteria is taken as 1 × 10 9 and the small number is taken as 1 × 10 10 . The results of the code for M = 4.5 and M = 2.8 are illustrated in Figure 3, where total temperatures are 311 K for both. The freestream temperature is calculated from isentropic relation and it is 61.584  K for M = 4.5 and 121.11  K for M = 2.8 . The results are compared with the Iyer’s [20] BL2D boundary-layer solver, which is used in NASA’s well-known compressible boundary-layer stability solver LASTRAC [21].
Listing 4. Implementation of Newton’s Iteration Method in Julia environment. It requires three function calls to estimate the missing boundary condition value. Each estimation will lead to closer boundary condition guess.
Listing 4. Implementation of Newton’s Iteration Method in Julia environment. It requires three function calls to estimate the missing boundary condition value. Each estimation will lead to closer boundary condition guess.
Fluids 06 00400 i004

3. Comparison of Julia and MATLAB

The design process requires lots of simulations in order to obtain the final and optimized design. It is highly beneficial to have a fast CFD solver. One of the crucial factors that affects the speed of the solver is the language. The same script may lead to different central processing unit (CPU) times with different coding languages. Additionally, similar simulations will be required multiple times. Eventually, the total time spent on simulations might be drastic with a slow solver.
MATLAB is one of the languages that is widely used. It is one of the favorite coding language for most of the students because of its user-friendly syntax, easy debugging feature, and built-in functions. One of the most important drawbacks of this language is that it is not free. It is also slower than high-performance languages, such as Fortran and C/C++. Julia is a user-friendly, open-source language that can increase productivity drastically [13]. Another great feature of Julia is that it is completely free. Julia can call C, Fortran, and Python libraries. It is great for experienced engineers who think that their previous code in other coding languages will be useless.
One of the great concerns about language selection is the speed of the code. For large-scaled projects, most of the time, a fast solver is the most important point. In this section, the same problem will be solved with Julia and MATLAB codes. The solution times will be compared with each other. The purpose of this comparison is to provide a rough estimation about code execution speeds. Three different test cases will be applied for both languages. The cases are unsteady inviscid Burgers’ equation with the first-order backward finite difference scheme, heat equation with second-order central finite difference scheme, and compressible Blasius equation with fourth-order Runge–Kutta and Newton’s iteration method. Burgers’ and heat equations will be tested with f o r loops with file operations, vectorized operations with file operations, f o r loops without file operations, and vectorized operations without file operations. For the compressible Blasius equation solver, the code developed for this paper will be used. The test cases will simulate real-life problems by solving the problem and exporting the solution vector to a text file when the file operations are included. In real-life problems, most of the time, post-processing is required after the simulation. In order to do that, saving data into a file is required. If it is a steady problem, exporting can be done at the end of the simulation, if there are not any other limitations or additional requirements. On the other hand, if the problem is unsteady, exporting the data in different time steps during the simulations is required. This is the reason why there will be two different simulations where data will be exported and will not be exported.
The first case is unsteady, inviscid, Burgers’ equation in one dimension, which can be represented in the conservative form:
u t = x u 2 2 .
The equation is solved with a first-order backward finite difference scheme. The details of the scheme will not be provided because the purpose of the test case is to measure the speed difference of two similarly developed codes. However, codes that are used in this paper are available on GitHub. Interested readers can check the implementation details from the codes. The number of elements in the problem is taken as 2500, 5000, and 10,000. The same simulation will be run with an increasing number of elements to show the solution time change trend. The execution time will be calculated by BenchmarkTools in Julia and tic/toc functions in MATLAB. The standard deviation will be calculated manually by using 10 data points obtained from the runs. The time step is taken as half of the grid spacing. The domain is limited with [0, π ] and the initial conditions for velocity, u ( x i , t ) , are taken as:
u ( x i , 0 ) = s i n ( x i ) .
The solution vector is written to a “ . t x t ” file for every hundredth iteration. The mean execution times with the standard deviation of the data obtained by Julia and MATLAB solvers are given in Table 1 and Table 2. Table 1 provides the execution times with file operations, and Table 2 excludes file operations in the calculations. The results show that MATLAB is slow with file operations. There is approximately 15 times’ difference between Julia and MATLAB mean execution times with file operations and f o r loops, but the speed-up difference is decreasing to 8 with vectorization. Without file operations, Julia is 3 times faster than MATLAB with f o r loops. However, MATLAB vectorization is faster than Julia. One interesting point of this test case is that MATLAB execution times are reduced by vectorization, except for the N = 10,000 case with file operations excluded. Detailed investigations about this trend indicate that there is a relation between the L1, L2, L3 cache size of the CPU and the vectorization performance. Tests are completed in 3 different computers with varying cache sizes. After a certain number of elements, vectorization starts to increase the mean execution time. The limiting number of elements is related to cache size. In computers with higher cache sizes, the negative effect of vectorization started after N = 5000 . In computers with lower cache sizes, the negative effect started after N = 2500 . This trend is not observed in Julia language. In Julia, f o r loops are highly optimized and manual vectorization leads to an increase in the mean execution times because manual vectorization creates temporary arrays during the calculations. Creating and deleting these temporary arrays require more time than calculation with f o r loops. In MATLAB, results indicate that temporary array usage is faster than f o r loops up to certain array size.
In the previous test case, the one-dimensional Burgers’ equation is solved. For the second test case, the two-dimensional heat equation is solved. The two-dimensional heat equation can be shown as:
T t = α 2 T x 2 + 2 T y 2 ,
where α is a constant which is taken as 0.25 Δ x . The time step is taken as Δ x . This assures that the coefficient of the second derivative will satisfy the stability condition. The boundary conditions of the system are 1 for each side and the initial conditions for the remaining nodes are 0. The heat equation is solved with the second-order central finite difference with 250 × 250 , 500 × 500 , and 1000 × 1000 elements. The domain is limited with [0, π ] 2 . The execution times of the two codes are given in Table 3 with file operations and in Table 4 without file operations. For this problem, the results indicate that Julia file operations are faster as it is observed in Burgers’ equation solver. Vectorization has a negative effect for all cases in this problem. For Julia, vectorization increases solution time approximately 8 times without file operations, and 4 times with file operations. On the other hand, MATLAB vectorization increases the solution time approximately twice without file operations and 1.2 times with file operations. Julia with f o r loops has the fastest solution time for all cases. It is approximately 2.5 times faster than MATLAB without file operations and approximately 8 times faster with file operations.
Lastly, the derived compressible Blasius equations for the present study will be solved in both MATLAB and Julia. The difference of that case is to test the function calls because sometimes dividing the solver into smaller functions may lead to longer solution times. The problem will be solved with 50,000, 100,000, and 200,000 elements. Table 5 gives the solution times of two codes developed in MATLAB and Julia. In this problem, Julia is drastically faster than MATLAB, and the time differences are increasing with the problem size. With 50,000 elements, Julia is approximately 15 times faster than MATLAB, with 100,000 elements, it is 32 times faster, and with 200,000 elements, it is 120 times faster.
Although time differences are varying with problems, Julia with f o r loops exhibited better performance than MATLAB in every problem. On the other hand, MATLAB showed better performance when both of the codes are developed in vectorized form. In general, MATLAB file operations are slower than Julia. It has to be noted that MATLAB has special data exporting options which might be faster, such as . m a t extensions. In order to conduct an exact comparison, regular . t x t extension with conventional exporting commands are used. The main purpose of these time comparisons is to provide an approximate performance differences between Julia and MATLAB under different conditions. In this paper, Julia is compared with MATLAB. Interested readers can check Lubin and Dunning’s paper [50] for other coding language comparisons.

4. Conclusions

Compressible Blasius equation, which comes from boundary-layer theory, is extensively used by researchers to validate the CFD simulation results. One can estimate the number of elements required to capture the boundary-layer by using the solution of the compressible Blasius equation. Although it is crucial to understand the boundary-layer theory, undergraduate- or graduate-level boundary-layer classes may not be adequate for a student to fully understand it due to time limitations. A step-by-step tutorial may help students to understand the theory better. Both compressible and incompressible boundary-layer problems require numerical solution. Deriving the equations from scratch and implementing the numerical methods may shorten the learning curve for a student or an engineer.
In this paper, compressible Blasius equation and energy equation are derived from scratch. The final system of equations is solved in the Julia environment. For the numerical implementation, the fourth-order Runge–Kutta and Newton’s iteration methods are employed. It has to be noted that other methods such as Runge–Kutta–Fehlberg, compact finite difference, a high-order finite-difference can also be used to solve the final system of equations. However, authors preferred the Runge–Kutta and Newton’s iteration method due to their accuracy and wide usage in the literature. Moreover, the authors compared the Julia and MATLAB solver speed to give an initial impression about performance of Julia. The results showed that MATLAB is slower than Julia in file operations. Additionally, Julia is faster than MATLAB with f o r loops. On the other hand, Julia vectorization affects the solution times negatively. However, MATLAB vectorization decreases the solution time for small-sized problems. When the problem size increases, MATLAB vectorization also has a negative effect on the solution time. It has to be noted that these test cases are relatively less demanding cases. In real-life problems, simulations require longer codes with more complex operations. In longer runs, the time difference in between these two languages may increase.

Author Contributions

Code generation, F.O. and K.K.; validation, F.O. and K.K.; writing—original draft preparation, F.O.; writing—review and editing, F.O. and K.K.; visualization, F.O. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

All the data used and generated in this study are available in the GitHub link provided in Appendix A.

Conflicts of Interest

The authors declare no conflict of interest.

Appendix A

Julia setup files can be downloaded from their website (https://julialang.org/downloads/ (accessed on 4 November 2021)). The website also includes instructions on how to install Julia on Windows, Linux, and MAC operating systems. Some of the useful resources for learning Julia are listed below:
It is common to use external packages for Julia. In order to do that, Pkg, which is Julia’s built-in package manager, can be used. Once Julia is opened, Pkg can be activated with the “]” button in Windows. In Linux, calling “julia” in the terminal will open it. After that, “Pkg.add(“Pluto”)” will trigger the setup process for that package. In here, we used Pluto as an example because, in GitHub, our codes are developed in the Pluto environment. After Pluto is installed, Pluto can be run with “Pluto.run()”. This command will open a new tab in the browser which you can run your Julia codes. After that, the “using Pluto” line must be placed to the top of the file. For “Plots” package, the commands will be “Pkg.add(“Plots”)” and “using Plots”. Since the Plots package does not have a GUI, there is not a command called “Plots.run()”.
Other than Pluto, JuliaPro, which includes Julia and the Juno IDE (https://juliacomputing.com/products/juliapro/ (accessed on 4 November 2021)), can be used as an editor and compiler. This software contains a set of packages for plotting, optimization, machine learning, database, and much more. Pluto is appropriate for small scripts, while JuliaPro is better for more complex codes. The GitHub link of the codes used in this paper is:

References

  1. Anderson, J.D. Fundamentals of Aerodynamics; McGraw-Hill Education: New York, NY, USA, 2010. [Google Scholar]
  2. Schlichting, H.; Gersten, K. Boundary-Layer Theory; Springer: Berlin/Heidelberg, Germany, 2016. [Google Scholar]
  3. Anderson, J.D. Ludwig Prandtl’s Boundary Layer. Phys. Today 2005, 58, 42–48. [Google Scholar] [CrossRef]
  4. Prandtl, L. Über Flüssigkeitsbewegung bei sehr kleiner Reibung, Verh 3 int. Math-Kongr, Heidelberg, English Translation. 1904. Available online: http://homepage.ntu.edu.tw/~wttsai/Adv_Fluid/NACA_TM-452.pdf (accessed on 4 November 2021).
  5. Blasius, H. Grenzschichten in Flüssigkeiten mit Kleiner Reibung. Z. Math. Phys. 1908, 60, 397–398. [Google Scholar]
  6. Hager, W.H. Blasius: A life in research and education. Exp. Fluids 2003, 34, 566–571. [Google Scholar] [CrossRef] [Green Version]
  7. Cousteix, T.; Cebeci, J. Modeling and Computation of Boundary-Layer Flows; Springer: Berlin/Heidelberg, Germany, 2005. [Google Scholar]
  8. White, F.M.; Corfield, I. Viscous Fluid Flow; McGraw-Hill: New York, NY, USA, 2006; Volume 3. [Google Scholar]
  9. Metcalf, M.; Reid, J.K. Fortran 90/95 Explained; Oxford University Press, Inc.: Oxford, UK, 1999. [Google Scholar]
  10. Sanner, M.F. Python: A programming language for software integration and development. J. Mol. Graph. Model. 1999, 17, 57–61. [Google Scholar] [PubMed]
  11. Stroustrup, B. The C++ Programming Language; Pearson Education: London, UK, 2000. [Google Scholar]
  12. MATLAB. Version 7.10. 0 (R2010a); The MathWorks Inc.: Natick, MA, USA, 2010. [Google Scholar]
  13. 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]
  14. Barba, L.; Forsyth, G. CFD Python: The 12 steps to Navier-Stokes equations. J. Open Source Educ. 2018, 2, 21. [Google Scholar] [CrossRef]
  15. Oliphant, T.E. A Guide to NumPy; Trelgol Publishing USA: Natick, MA, USA, 2006; Volume 1. [Google Scholar]
  16. Ketcheson, D.I. Teaching numerical methods with IPython notebooks and inquiry-based learning. In Proceedings of the 13th Python in Science Conference, Austin, TX, USA, 6–12 July 2014; pp. 19–24. [Google Scholar]
  17. Ketcheson, D.I.; Mandli, K.; Ahmadia, A.J.; Alghamdi, A.; de Luna, M.Q.; Parsani, M.; Knepley, M.G.; Emmett, M. PyClaw: Accessible, extensible, scalable tools for wave propagation problems. SIAM J. Sci. Comput. 2012, 34, 210–231. [Google Scholar] [CrossRef] [Green Version]
  18. 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]
  19. Oz, F.; Kara, K. A CFD Tutorial in Julia: Introduction to Laminar Boundary-Layer Theory. Fluids 2021, 6, 207. [Google Scholar] [CrossRef]
  20. Iyer, V. Computer Program BL2D for Solving Two-Dimensional and Axisymmetric Boundary Layers; NASA NASA-CR-4668; NASA: Washington, DC, USA, 1995.
  21. Chang, C.L. Langley Stability and Transition Analysis Code (LASTRAC) Version 1.2 User Manual; NASA TM-2004-213233; NASA: Washington, DC, USA, June 2004.
  22. Brennan, G.; Gajjar, J.; Hewitt, R. Tollmien–Schlichting wave cancellation via localised heating elements in boundary layers. J. Fluid Mech. 2021, 909. [Google Scholar] [CrossRef]
  23. Brennan, G.S.; Gajjar, J.S.; Hewitt, R.E. Cancellation of Tollmien–Schlichting waves with surface heating. J. Eng. Math. 2021, 128, 1–23. [Google Scholar] [CrossRef]
  24. Corelli Grappadelli, M.; Sattler, S.; Scholz, P.; Radespiel, R.; Badrya, C. Experimental investigations of boundary layer transition on a flat plate with suction. In Proceedings of the AIAA Scitech 2021 Forum, Virtual Event, 11–15 and 19–21 January 2021; p. 1452. [Google Scholar]
  25. Rigas, G.; Sipp, D.; Colonius, T. Nonlinear input/output analysis: Application to boundary layer transition. J. Fluid Mech. 2021, 911. [Google Scholar] [CrossRef]
  26. Haley, C.; Zhong, X. Supersonic mode in a low-enthalpy hypersonic flow over a cone and wave packet interference. Phys. Fluids 2021, 33, 054104. [Google Scholar] [CrossRef]
  27. Malik, M.R. Numerical methods for hypersonic boundary layer stability. J. Comput. Phys. 1990, 86, 376–413. [Google Scholar] [CrossRef]
  28. Fedorov, A. Transition and stability of high-speed boundary layers. Annu. Rev. Fluid Mech. 2011, 43, 79–95. [Google Scholar] [CrossRef]
  29. Long, T.; Dong, Y.; Zhao, R.; Wen, C. Mechanism of stabilization of porous coatings on unstable supersonic mode in hypersonic boundary layers. Phys. Fluids 2021, 33, 054105. [Google Scholar] [CrossRef]
  30. Fong, K.D.; Wang, X.; Zhong, X. Numerical simulation of roughness effect on the stability of a hypersonic boundary layer. Comput. Fluids 2014, 96, 350–367. [Google Scholar] [CrossRef]
  31. Kara, K.; Balakumar, P.; Kandil, O. Receptivity of hypersonic boundary layers due to acoustic disturbances over blunt cone. In Proceedings of the 45th AIAA Aerospace Sciences Meeting and Exhibit, Reno, Nevada, 8–11 January 2007; p. 945. [Google Scholar]
  32. Kara, K.; Balakumar, P.; Kandil, O. Effects of wall cooling on hypersonic boundary layer receptivity over a cone. In Proceedings of the 38th Fluid Dynamics Conference and Exhibit, Seattle, WA, USA, 23–26 June 2008; p. 3734. [Google Scholar]
  33. Kara, K.; Balakumar, P.; Kandil, O.A. Effects of nose bluntness on hypersonic boundary-layer receptivity and stability over cones. AIAA J. 2011, 49, 2593–2606. [Google Scholar] [CrossRef] [Green Version]
  34. Oz, F.; Kara, K. Effects of Local Cooling on Hypersonic Boundary-Layer Stability. In AIAA Scitech 2021 Forum; AIAA: Reston, VA, USA, 2021; p. 0940. [Google Scholar]
  35. Drozdz, A.; Niegodajew, P.; Romanczyk, M.; Sokolenko, V.; Elsner, W. Effective use of the streamwise waviness in the control of turbulent separation. Exp. Therm. Fluid Sci. 2021, 121. [Google Scholar] [CrossRef]
  36. Iyer, P.S.; Malik, M.R. Wall-modeled LES of flow over a Gaussian bump. In AIAA Scitech 2021 Forum; AIAA: Reston, VA, USA, 2021; p. 1438. [Google Scholar]
  37. Mohammed-Taifour, A.; Weiss, J. Periodic forcing of a large turbulent separation bubble. J. Fluid Mech. 2021, 915. [Google Scholar] [CrossRef]
  38. Hady, F.; Ibrahim, F.; Abdel-Gaied, S.; Eid, M. Effect of heat generation/absorption on natural convective boundary-layer flow from a vertical cone embedded in a porous medium filled with a non-Newtonian nanofluid. Int. Commun. Heat Mass Transf. 2011, 38, 1414–1420. [Google Scholar] [CrossRef]
  39. Hady, F.M.; Ibrahim, F.S.; Abdel-Gaied, S.M.; Eid, M.R. Radiation effect on viscous flow of a nanofluid and heat transfer over a nonlinearly stretching sheet. Nanoscale Res. Lett. 2012, 7, 1–13. [Google Scholar] [CrossRef] [Green Version]
  40. Hady, F.; Ibrahim, F.; Abdel-Gaied, S.; Eid, M.R. Boundary-layer non-Newtonian flow over vertical plate in porous medium saturated with nanofluid. Appl. Math. Mech. 2011, 32, 1577–1586. [Google Scholar] [CrossRef]
  41. Hady, F.; Ibrahim, F.; Abdel-Gaied, S.; Eid, M. Boundary-layer flow in a porous medium of a nanofluid past a vertical cone. In An Overview of Heat Transfer Phenomena; Kazi, S.N., Ed.; IntechOpen: London, UK, 2012; pp. 91–104. [Google Scholar]
  42. Sohail, M.; Naz, R.; Abdelsalam, S.I. Application of non-Fourier double diffusions theories to the boundary-layer flow of a yield stress exhibiting fluid model. Phys. Stat. Mech. Appl. 2020, 537, 122753. [Google Scholar] [CrossRef]
  43. Bhatti, M.; Alamri, S.Z.; Ellahi, R.; Abdelsalam, S.I. Intra-uterine particle–fluid motion through a compliant asymmetric tapered channel with heat transfer. J. Therm. Anal. Calorim. 2020, 144, 2259–2267. [Google Scholar] [CrossRef]
  44. Tannehill, J.C.; Pletcher, R.H.; Anderson, D.A. Computational Fluid Mechanics and Heat Transfer; Taylor & Francis: Bristol, PA, USA, 1997. [Google Scholar]
  45. National Center for Biotechnology Information. PubChem Periodic Table of Elements. 2021. Available online: https://pubchem.ncbi.nlm.nih.gov/element/Titanium (accessed on 12 October 2021).
  46. Howarth, L. Concerning the effect of compressibility on lam inar boundary layers and their separation. Proc. R. Soc. London. Ser. Math. Phys. Sci. 1948, 194, 16–42. [Google Scholar]
  47. LII, W.S. The viscosity of gases and molecular force. Lond. Edinb. Dublin Philos. Mag. J. Sci. 1893, 36, 507–531. [Google Scholar]
  48. Moin, P. Fundamentals of Engineering Numerical Analysis; Cambridge University Press: Cambridge, UK, 2010. [Google Scholar]
  49. Anderson, J.D.; Degrez, G.; Dick, E.; Grundmann, R. Computational Fluid Dynamics: An Introduction; Springer Science & Business Media: Berlin, Germany, 2013. [Google Scholar]
  50. Lubin, M.; Dunning, I. Computing in operations research using Julia. INFORMS J. Comput. 2015, 27, 238–248. [Google Scholar] [CrossRef] [Green Version]
Figure 1. The visual abstract of the present paper which is mainly designed around 3 major points. Major points are further divided into smaller points which correspond to purposes/ideas of the particular major point. Each major point is connected to one another, which makes them complete.
Figure 1. The visual abstract of the present paper which is mainly designed around 3 major points. Major points are further divided into smaller points which correspond to purposes/ideas of the particular major point. Each major point is connected to one another, which makes them complete.
Fluids 06 00400 g001
Figure 2. Schematic description of the flow over a flat plate. The red dashed line corresponds to boundary-layer edge. The boundary-layer velocity profile is illustrated with a blue line. The black dot corresponds to the boundary-layer edge at that station. The density, temperature, and velocity at the boundary-layer edge are ρ e , T e , and u e , respectively. The boundary-layer thickness is defined with δ ( x ) , which is the function of x.
Figure 2. Schematic description of the flow over a flat plate. The red dashed line corresponds to boundary-layer edge. The boundary-layer velocity profile is illustrated with a blue line. The black dot corresponds to the boundary-layer edge at that station. The density, temperature, and velocity at the boundary-layer edge are ρ e , T e , and u e , respectively. The boundary-layer thickness is defined with δ ( x ) , which is the function of x.
Fluids 06 00400 g002
Figure 3. The distribution of the (a) velocity and (b) temperature of the compressible Blasius equation obtained by the given code and BL2D boundary-layer solver [20] for freestream Mach number 2.8 and 4.5 where freestream temperatures are 121.11 K and 61.584 K, respectively.
Figure 3. The distribution of the (a) velocity and (b) temperature of the compressible Blasius equation obtained by the given code and BL2D boundary-layer solver [20] for freestream Mach number 2.8 and 4.5 where freestream temperatures are 121.11 K and 61.584 K, respectively.
Fluids 06 00400 g003
Table 1. Mean execution times and standard deviations of the Burgers’ equation solver written in MATLAB and Julia by including file operations. The mean execution times are given in second. Ten data points are used in the calculation of the mean and the standard deviation.
Table 1. Mean execution times and standard deviations of the Burgers’ equation solver written in MATLAB and Julia by including file operations. The mean execution times are given in second. Ten data points are used in the calculation of the mean and the standard deviation.
File Op. N = 2500 N = 5000 N =  10,000
Included JuliaMATLABJuliaMATLABJuliaMATLAB
f o r LoopMean0.03600.52140.13941.98170.55927.8060
STD0.00100.01370.00170.02100.00620.0522
VectorizedMean0.06430.51450.26781.94711.00427.7527
STD0.01390.01370.02870.01070.03480.0402
Table 2. Mean execution times and standard deviations of the Burgers’ equation solver written in MATLAB and Julia by excluding file operations. The mean execution times are given in second. Ten data points are used in the calculation of the mean and the standard deviation.
Table 2. Mean execution times and standard deviations of the Burgers’ equation solver written in MATLAB and Julia by excluding file operations. The mean execution times are given in second. Ten data points are used in the calculation of the mean and the standard deviation.
File Op. N = 2500 N = 5000 N =  10,000
Excluded JuliaMATLABJuliaMATLABJuliaMATLAB
f o r LoopMean0.00590.01770.02330.06510.09300.2562
STD0.00010.00310.00110.00240.00050.0138
VectorizedMean0.04370.01660.08660.05640.45420.3091
STD0.01170.00210.02150.00400.05840.0138
Table 3. Mean execution times and standard deviations of the heat equation solver written in MATLAB and Julia by including file operations. The mean execution times are given in second. Ten data points are used in the calculation of the mean and the standard deviation.
Table 3. Mean execution times and standard deviations of the heat equation solver written in MATLAB and Julia by including file operations. The mean execution times are given in second. Ten data points are used in the calculation of the mean and the standard deviation.
File Op. N = 250 × 250 N = 500 × 500 N = 1000 × 1000
Included JuliaMATLABJuliaMATLABJuliaMATLAB
f o r LoopMean0.46043.19213.385222.847225.1985151.5271
STD0.01600.41490.01320.43560.04700.5615
VectorizedMean1.45243.296410.028328.406381.2305188.5569
STD0.16220.15310.43561.02690.49250.9425
Table 4. Mean execution times and standard deviations of the heat equation solver written in MATLAB and Julia by excluding file operations. The mean execution times are given in second. Ten data points are used in the calculation of the mean and the standard deviation.
Table 4. Mean execution times and standard deviations of the heat equation solver written in MATLAB and Julia by excluding file operations. The mean execution times are given in second. Ten data points are used in the calculation of the mean and the standard deviation.
File Op. N = 250 × 250 N = 500 × 500 N = 1000 × 1000
Excluded JuliaMATLABJuliaMATLABJuliaMATLAB
f o r LoopMean0.15380.32681.19643.757410.599328.5775
STD0.00380.01870.00770.32740.16670.1065
VectorizedMean0.80560.50878.58739.363471.956067.5810
STD0.07060.02570.06870.98800.43090.8318
Table 5. Mean execution times and standard deviations of the compressible Blasius equations solver written in MATLAB and Julia. The mean execution times are given in second. Ten data points are used in the calculation of the mean and the standard deviation.
Table 5. Mean execution times and standard deviations of the compressible Blasius equations solver written in MATLAB and Julia. The mean execution times are given in second. Ten data points are used in the calculation of the mean and the standard deviation.
File Op. N =  50,000 N =  100,000 N =  200,000
Excluded JuliaMATLABJuliaMATLABJuliaMATLAB
f o r LoopMean0.08311.24680.16315.10700.329839.4378
STD0.00540.03100.00570.30060.00980.8308
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Oz, F.; Kara, K. A CFD Tutorial in Julia: Introduction to Compressible Laminar Boundary-Layer Flows. Fluids 2021, 6, 400. https://doi.org/10.3390/fluids6110400

AMA Style

Oz F, Kara K. A CFD Tutorial in Julia: Introduction to Compressible Laminar Boundary-Layer Flows. Fluids. 2021; 6(11):400. https://doi.org/10.3390/fluids6110400

Chicago/Turabian Style

Oz, Furkan, and Kursat Kara. 2021. "A CFD Tutorial in Julia: Introduction to Compressible Laminar Boundary-Layer Flows" Fluids 6, no. 11: 400. https://doi.org/10.3390/fluids6110400

Article Metrics

Back to TopTop