Geometry Modeling in Simulation Apps
COMSOL applications created with the new Application Builder will make sophisticated simulations based on parameterized CAD models more accessible than ever before. A COMSOL application allows easy access to not only parameterized models but also completely different geometry configurations, such as a mixer with a variable number of impeller blades or a variable number of impellers. To make this easy for the application developer, we have made available cumulative selections and geometry parts. See how these tools work.
When we create a simulation app based on a parameterized geometry model, we probably don’t want the users of our application to have to manually update all the materials, physics, and mesh settings for each new parameter value they enter. Instead, we need tools that automatically update these operations behind the scenes. Cumulative selections will help us with this — they are used to group geometric entities such as domains, boundaries, edges, and points.
For example, when a parameter value is changed, the geometry model may change in such a way that splits a boundary. What was once a single boundary may now be split in two or more parts. The application now “needs to know” what boundary conditions to apply to these newly created boundaries. If the boundary condition is tied to a cumulative selection, then this tells the application what new boundary condition to apply to the newly created boundaries.
Cumulative selections are also used to update material properties, other physics settings (e.g., source terms), mesh settings, and results. For example, different domains created in different geometry operations can be gathered in the geometry sequence according to the material of the domains. That way, all domains with the same material are available in a single cumulative selection. The assignment of a material to such a selection can be updated automatically when domains are added or removed in the geometry sequence during a parameterization.
The Geometry node in the model tree of the COMSOL Multiphysics simulation software contains an ordered sequence of geometry operations. These include the creation of a block or spheres, Boolean unions, intersections, or more high-level operations, such as fillet and loft. This sequence of operations is referred to as the geometry sequence.
Cumulative selections can also be used within the geometry sequence for pure geometry modeling tasks. For instance, a cumulative selection can gather objects to be added or subtracted in a Boolean difference operation, see the figure below. The difference operation is then automatically updated even in the case where the number of objects to be subtracted changes.
Editor’s note: The following sections were updated on 7/1/2015 to be consistent with COMSOL Multiphysics version 5.1, which was released after this post was originally published.
Geometry parts can be viewed as custom composite geometry objects. They can be used in a geometry sequence in the same way as primitive objects like blocks and spheres.
Geometry parts are defined globally for a model and can be added to the geometry sequence of any model component as part instances. The user can select the desired part from a Part Library or from his/her own list of geometry parts available in the model.
A geometry part can receive model parameters as input. The output is one or several geometry objects and one or several selections that can be used as input selections by geometry operations and the material, physics, mesh, and results settings. Geometry parts can use cumulative selections internally within the geometry sequence that builds the part, but they can also contribute with their output selections to cumulative selections in the main geometry sequence when a part instance is added.
Cumulative selections and geometry parts are important concepts in the ability to create applications that use parameterized geometries. In fact, the geometry parts and the cumulative selections were both built with the Application Builder and the creation of apps in mind.
Using Cumulative Selections
The geometry sequence, represented in the geometry branch in the model tree, is based on primitive objects — such as cylinders and blocks — and composite objects — such as objects that are a result of a Boolean operation or a sweep of a cross-sectional profile. Operations that create composite objects may require selections as input.
For example, the difference operation between two groups of objects requires that the two object groups in question are specified in a selection list. In the figure below, the Tank selection includes one object created by part instance 1 (pi1). In this case, we want to subtract the impeller shaft and the different impellers from the tank to create the remaining object that corresponds to the fluid domain in the tank. Three impellers (imp1 to imp3) and one shaft (pi2) are the objects in the Impeller input selection.
The Boolean operation “Difference” requires at least two objects, one to add and one to subtract. Also, selections and cumulative selections may be used as input to populate the list of objects.
Cumulative selections make it possible to organize this process and to automatically update geometry operations that require input selections created in previous operations.
We can exemplify the use of cumulative selections in the geometry sequence that creates a Rushton impeller. A Rushton impeller consists of a number of impeller blades attached to a disk with an impeller hub that can be attached to the impeller shaft.
Geometry of a Rushton impeller.
The first step in the geometry sequence is to create the impeller disk with a parameter that controls the diameter of the disk. For this step, a work plane is used with a series of geometry operations defined with respect to this work plane. The second step is to create the first impeller blade, which is created in a work plane positioned perpendicular to the disk. The third step is to use a rotate operation in order to rotate the blade and create the desired number of blades.
The first step, with geometry operations in Work Plane 1, creates the impeller disk and an “impeller_disk” selection. The second step creates an impeller blade and a cumulative selection that we can name “impeller_blades”, as shown in the figure below.
The “impeller_blades” selection is used as input to the rotate operation. This automates the creation of the impeller blades and does not require manual input from the graphics window.
The output from the rotate operation, which creates the other impeller blades in the Rushton turbine, can also contribute to the “impeller_blades” cumulative selection. We can specify the number of blades by updating a parameter for the number of blades. The rotation angle, “angle_ib”, is then created by dividing 360° with the number of blades. The selection “impeller_blades” is then automatically updated. The figure below shows the settings window for the corresponding rotate operation.
Cumulative selections also allow for the automatic update of input selections in the materials, mesh, physics, and results settings, once the geometry sequence is finalized.
Let’s assume that we want to set the same material or the same boundary conditions on the impeller disk and the impeller blades. We can then use the output selection of the rotate operation and the disk in a pure selection operation. Doing so will make the impeller disk and the impeller blades available in the same cumulative selection. For this purpose, we can add a union selection that unites the selections “impeller_disk” and “impeller_blades”.
Note that the union selection operation is different from the geometric union operation — it makes it possible to refer to the blades and the disk with a single selection.
When the geometry sequence is finalized, the “rotating_internal_walls” selection will be automatically updated for the materials, physics, mesh, and results settings that use this selection as input.
For example, if we are modeling turbulent flow in a mixer with a rotating impeller, the input selection to the rotating interior wall boundary condition can be automatically updated by the “rotating_internal_wall” selection created in the geometry sequence. This can be done for different choices in the number of impeller blades and for different dimensions.
Using Geometry Parts
It is easy to imagine that we would like to have the possibility to change the type of impeller completely, depending on the type of fluid that the impeller stirs. If we are building a mixer application, we would like to provide different alternative impeller designs that the users can choose from and dimensions for their specific processes and conditions. In addition, we may also want the ability to create several impellers along the length of the impeller shaft. To make this easy, we can use geometry parts. They allow us to build a geometry object library that can be accessed from the geometry sequence.
In a way, the geometry parts can work like our own custom-created objects, which we can use in a similar fashion to the primitive objects like blocks and cylinders. However, in addition to the input dimensions and the output geometry objects, the geometry parts can also output selections.
The geometry parts are created in the Global node or imported from a Part Library. The reason for having them in the Global node is that they can be called from several geometry sequences in different components. The figure below shows fifteen different geometry parts for eleven different impellers, one impeller shaft, and three different tank types. All parts except the Rushton Impeller have been downloaded from the Mixer Module Part Library. The Rushton Impeller is built directly in the Parts branch in Global Definitions. This shows that it is possible to combine downloaded parts with parts that were constructed for use in one specific model, but is then used several times in the same model.
The geometry part that defines the Rushton impeller can receive a number of input parameters that control the geometry object parameterization. Additionally, the geometry part can also include a number of local parameters, which are only defined in the part’s geometry sequence. For example, the number of impeller blades is received as an input parameter, denoted “n_ib”. The angle between the blades — which is obtained by dividing 360° with the number of blades — is a local parameter, since it is enough to receive the number of blades to calculate the angle.
The settings in the part instance contain a reference to the selected part — in this example, the Rushton Impeller part (see the figure below). The input parameter expressions in the settings window now refer to global parameters in the Global Parameters node in the model tree. In this case, most of these input parameters have similar names as the arguments in the geometry part, with the addition of “_i” for “instance”. However, note that the input parameter expressions can have any parameter name or number as input.
The selections created in the part can be mapped to cumulative selections in the part instance in the main geometry sequence. For example, the “impeller_blades” selection now contributes to the “rotating_internal_wall” cumulative selection defined in the main geometry sequence. The “impeller_hub” selection contributes to the “rotating_wall” selection in the main geometry sequence. The cumulative selections created in the main geometry sequence can then be used as input in other geometry operations, such as the union or difference Boolean operations. They can also be used in the materials, physics, mesh, and results settings.
Also, note that the part instance further allows for the positioning and orientation of the created geometry objects. Two different part instances referring to the same part can in this way get different positions and orientations in the main geometry sequence.
The figure below shows the unlikely case where seven different impeller types are positioned along a single impeller shaft. This, perhaps a bit unusual, example shows that the output selections from the parts and the cumulative selections in the main geometry sequence can group geometric entities that are completely different in configuration. The cumulative selections can then automatically update the materials, physics, mesh, and results settings.
For example, the cumulative selection “rotating_internal_wall” automatically selects all of the impeller blades and impeller disks for all different impellers in the rotating interior wall boundary condition for turbulent flow. The same functionality also groups the hub and the shaft surfaces in the “rotating_wall” cumulative selection, which is used in the rotating wall boundary condition.
Using Cumulative Selections and Parts in Simulation Apps
The parts and the cumulative selections allow us to create libraries of complex and parameterized geometry objects. In addition, the ability to create cumulative selections allows us to build applications that are very user-friendly. The user of the application does not need to be bothered with irrelevant technicalities in the design of a process or a device.
As a final example, we can look at a mixer application that could be a result of the operations exemplified above.
In this app, the mixer designer can select impeller type and dimensions, vessel type and dimensions, and operating conditions for the mixer. The output of the simulations is the mixing efficiency in the process. The user of this application can focus on changing different model parameters to increase mixing efficiency using available components, with only minimal knowledge of the technicalities involved in CFD simulations. The user can focus on the physics involved instead of these technicalities.
- COMSOL Now
- Today in Science
- COMSOL Now
- Today in Science