I love a good challenge, and as the newest member of AltaSim’s team, I am fortunate to have excellent mentors here who constantly challenge me to expand my knowledge. I have been teaching myself how to use COMSOL, and one of my most recent challenges from the team was to solve a turbulent flow problem, which I hoped to complete with minimal assistance. What follows are some insights into my approach to solving this model. From setup to dealing with convergence issues, I will walk you through how a seemingly daunting problem can be deconstructed into a simpler version of itself, gradually leading to the resolution of the complete problem.
Boundary Conditions for Gasses at Two Temperatures
In the model under discussion, gas enters at two distinct temperatures – the cold and the hot gas. We will refer to these as the ‘cold gas’ and the ‘hot gas.’ The cold gas is set to room temperature (293.15K), while the hot gas is set to 1000K. The significant temperature difference means the two gases will have very different densities, even in the same gas. The mixing of different densities can lead to difficulties in convergence. The cold gas flows in through relatively thin cylinders located on the sides of a larger cylinder near the top, and it does so at a high flow rate.
Conversely, the hot gas enters from the top. Determining the appropriate boundary conditions for these flows presented some challenges—one of the first major decisions I had to make concerned the inlet conditions. Although I was given flow rates for both gases, they had fully developed flow profiles.
Both fully developed and mass flow are challenging to get and difficult to converge, often proving more complex than simply specifying the velocities. To address this, I extended the length of the relatively thin cylinders, allowing the fully developed flow to result in a converged solution. An alternative approach involves solving a subproblem for the fully developed flow profile separately and then feeding this profile into the model as the inlet condition. In this case, I used mass flow for the hotter gas and fully developed flow for the colder gas.
A Lesson on Compressibility
My next decision involved selecting what kind of compressibility my flow should be. I opted for a weakly compressible flow. My esteemed colleague, Luke, influenced this choice and advised that selecting a compressible isn’t always the best decision, even when working with a compressible gas. He explained that this choice could lead to difficulties in convergence and is unnecessary if there is no influence from the pressure in the density. If you have, there are minimal fluctuations in pressure.
I was also taught that initial conditions are essential in a fluid flow problem but become even more significant when dealing with natural convection. Consequently, I decided to leave my initial conditions as they were. I assigned the necessary pressure (required to make the problem unique) at the bottom, far from the fluid flow inlets, and then proceeded to the heat transfer part of the problem. Although there were more settings to adjust for the fluid flow, I preferred setting up the simplest parts of each interface and then returning to the more complicated steps. For the heat transfer, we needed the inlets, which coincided with the fully developed flow for the cold gas and the mass flow rate for the hot gas. Additionally, there was an initial condition of 573K on the entire geometry, and the walls were kept at this temperature for the simulation.
After setting all the conditions of which I was confident, there were others I needed to consider more closely. For example, I anticipated convergence difficulties due to the large mass flow and fully developed flow numbers. Given the high velocities, the inertial term was much greater than the viscous term. Initially, I contemplated ramping the viscosity, which aids convergence in such scenarios. I chose isotropic diffusion despite its tendency to smooth out the solution. This approach allowed me to step down the amount of isotropic diffusion and use the final solution from each step as the initial solution for the subsequent step.
Next, meshing would be complex, and it would likely necessitate revisiting my geometry to incorporate some mesh-control domains. I’m gradually realizing that meshing and creating geometry for that mesh are a considerable part of CFD modeling. I knew that the fluid flow from the thin cylinders would have a boundary layer (or shear layer) inside the large cylinder, which I would need to resolve without resorting to a boundary layer mesh. I knew the fluid flow coming off the thin cylinders would have a boundary layer (or shear layer) inside the large cylinder, which I would need to resolve without resorting to a boundary layer mesh. First, I aimed to obtain an initial solution to understand the expected fluid flow, even if it had too much isotropic diffusion. In the first instance, I partitioned the large cylinder to form a smaller one, which had the same diameter as the large cylinder but was positioned between the inlets of the smaller cylinders. This allowed me to mesh the region with the shear layers finer than the rest of the domain and proved successful, but only with all the isotropic diffusion in the problem.
Consequently, I introduced another study where I would use this result as the initial values (the values not solved for in the wall initialization step) and apply a different geometry with a more interesting mesh for the remaining auxiliary steps, during which I progressively eliminated more isotropic diffusion. Although this step was unnecessary, I tried to get a quick visual.
The following geometry was more interesting. While maintaining the additional cylinder at the points where the inlets were located, I added annuli to allow me to mesh even finer near the inlets. These annuli artificially extended the geometry of the inlets into the larger cylinder, creating regions where I could mesh even more finely. Consequently, I had more mesh-control domains, precisely one for each thin cylinder serving as an inlet. I gradually ramped the isotropic diffusion down until it reached 0.01, which resulted in the final converged solution.
The next step involves determining what would happen if the inlet cylinders were allowed to tilt. This proved more challenging than it sounds, given the rapid inflow of the gas. As I had some luck with my previous convergence, it prompted me to revisit creating additional domains for meshing. First, I needed to figure out how to tilt all the cylinders, a task that was not as straightforward as it might seem since COMSOL doesn’t always work in the coordinate system you want it to. I then made the annuli, which I had previously created, thinner and longer. This time, I ensured they were perfectly aligned with the cylinder inlets, correcting my previous oversight; they also needed to rotate in sync with the cylinders! I ran a model with shorter annuli and even attached a cylinder at the end to capture more of the flow. This model, however, didn’t end up converging. Instead of hitting the cancel button, I pressed stop on the progress bar to examine the velocity profile, which allowed me to modify the profile derived from this non-converged result. Subsequently, I decided to eliminate these secondary cylinders and extend the annuli, making them wider and longer to capture the streaming flow of each inlet.
The subsequent phase was a lesson in patience, as illustrated in Fig 1. The total computation time was under twelve hours, reminding me that “a watched pot never boils.” Also, it’s essential to be aware that the segregated solver isn’t the only metric to monitor to determine if our model is going in the right direction. We must also keep an eye on our pseudo-time-stepping CFL ratio, which must reach 1 for a converged solution, and this can occur before your segregated solver has converged. This problem is a subset of a more significant, more complex issue. The most challenging aspects were undoubtedly setting up the inlet conditions for the two gases and the meshing. The more substantial problem was significantly more complicated due to the inlet condition of the hot gas. The temperature there wasn’t merely 1,000K as I had set it but had a radial dependence, and this initial dependence subsequently affected density and velocity. Going through the steps of this problem taught me how to dissect a complex problem into its components and ensure I understand each one before adding the next layer of complexity.