With today’s technology, we have turned into a “right now” society where we have a hard time waiting for anything. As an engineer, you have probably encountered times when you wish you could speed up your simulation time.
In our latest Tips & Tricks video, I demonstrate how to speed up the simulation time of Acoustic Shock Wave by locating the minimum mesh element using surface plot and a predefined variable for the element size. And, how to use virtual operation to remove small geometrical features to speed up time-explicit solver.
To help you follow along, we have included the video transcription below.
There’s no reason to learn software programs through trial and error, so in addition to our tips and tricks, our upcoming training classes will support you, the COMSOL user, in utilizing best practices with many of the COMSOL modules. Please visit our training calendar and find the course that is best for you.
“Acoustic Shock Wave: How to Speed Up Solution” Transcription:
Welcome to this Tips and Tricks video. In this video, we will demonstrate how to speed up the simulation time of acoustic shockwave. First, let’s take a look at the animation of acoustic shockwave. At time T equal to 0 there is small overpressure region of 50 kilopascal. Everywhere else the initial pressure is zero.
There are two symmetry planes so only quarter of geometry is shown. As simulation starts, the overpressure region is spreading out and wave propagating along the X axis. Sharp pressure front indicates that the propagating wave is shockwave. To handle this type of nonlinearity, special physics interface is used. The interface is nonlinear pressure acoustics time explicit. The interface is based on the Discontinuous Galerkin method so-called DG method. The DG method is especially good for solving wave-type problems of high-pressure amplitude. The interface is computationally efficient in terms of the speed and memory consumption. The solver in this interface is Time-Explicit solver. It means that the time steps taken by solver are constant and directly proportional to the smaller size of the mesh element. For simple geometries, the smallest element size is defined by requirement to resolve acoustic wave in space and in time. For more complicated geometries the minimum size of the mesh element might be controlled by small geometrical features such as fillets, sliver faces, small edges, or small overlappings. These features have nothing to do with physics, however they will result in creating small mesh elements reducing steps taken by solver and increasing computational time. Most often, such situation arises when we use ‘Get file’ to import geometry.
Let’s start analysis. Go to ‘Study’ click ‘Compute’ and analysis is run running now. It’s quite slow so we stop analysis and go to the log tab and here is we can see time steps taking by solver. Let’s copy this time step and go to the parameters list and create special parameter step one and then paste. We will use this parameter later on for comparison purposes. Let us look at the geometry to see if we can identify any small geometrical feature limiting time step. Go to the geometry and nothing obvious is seen. So you can use predefined variable H for element size to locate the mesh smallest element. To do that you go to the results and right click and add 2D Plot Group, then add Surface sub note, and go to the replace expression go to the mesh and here you can see parameter for the element size H. Then we add another sub note, more plots surface minimum, maximum and then we plot H. And, what we can see this is the location of the minimum element size and the size of the element is roughly 10 microns. Probably this is the element controlling time stepping. To see why we have so small element size we go to the geometry and zoom in area where you have very small element size. Zoom even more and what we see, there are two points located very close to each other. This is the reason why we have very small element size. To fix the issue we go to the geometry and select virtual operation vertices and then select point you want to remove. Now, to update mesh plot we go to the results, go to study and select get initial value. Go to the surface plot for the mesh element size and what we see now that the minimum element size is roughly .2 millimeters which is 20 times larger than we had before.
We expect solar speed up roughly by 20 times. So let’s go to the study and compute and what we see that the solver is running is much faster. So, let’s stop analysis and copy time step. Then go to the parameters and create another parameter Step 2 and paste the current time stepping and then form the ratio. Ratio is step two over step one and what we see that the ratio of the two steps is roughly 20 times. So before the analysis was running roughly 40 minutes now it should run roughly for two minutes. So this was demonstration on how to locate minimum mesh element using surface plot and predefined variable H for the element size and then how to use virtual operation to remove small geometrical features to speed up time-explicit solver. Hope this was helpful and thank you so much.