Filters and queries in STAR-CCM+
In this article I will go over filters and queries. Filters and queries can be used to automate your simulations which can save you a lot of time. As an example, if you create a simulation file template that contains filters and queries, they can be defined to automatically assign boundary conditions to surfaces with certain names. This means that the template later can be used for future simulations on similar geometries, to decrease the amount of manual work. The article will contain a general description and one part where a small template is created to show the streamline ability provided by the filter tool.
General
In the simulation tree of Simcenter STAR-CCM+, under tools, you can find Filters. A filter uses queries to define groups of objects in Simcenter STAR-CCM+. A query is made up one or more conditional statements, called predicates. They are used to search among the objects in the simulation.
Filters and queries can be used to find objects in the tree, selection in mesh operations, derived parts, and scene displayers. You can use filters to create custom trees and to create nested queries where two or more predicates should be fulfilled.
Using filters and queries can take you a long way in creating your own templates in Simcenter STAR-CCM+. Allowing you set up your own simulation files for similar types of simulations where you can by using filters and queries, interchange your geometry of interest. We will look at an example below, where the use of filters should allow us to go from importing a surface mesh directly to being ready for meshing and simulation.
First, we look at where filter can be found in the simulation tree. Once you edit a filter you can select several predicates to include in your filter. You can filter by names, type, relationships in the tree and you can also refer to other filters. This creates nested filters. You can use the operators AND, requiring that all the predicates should be fulfilled, and OR, allowing to any one of the predicated to fulfil the filter requirement, as shown in the right in the figure below.
To assign a query to a selection you click the funnel (shown in red circles in the picture below) that can be found everywhere you usually make a geometry selection. You can then add the filters and predicates you want to the queries.
Create a template
In the example I will use four bodies, shown in the figure below in two different scenes. I will set up several filters and queries that allow us to select either combination of a large domain (large cylinder or large box) and a smaller obstacle geometry (small cylinder or small box) to import as a surface mesh. Once they are imported as a surface mesh into geometry/parts, they will be instantly ready for meshing and simulation. The large bodies have inlets and outlets together with a set of walls. The surfaces need to have a name since a lot of the queries point to name containing a certain text-string.
Let us create a full template that can run any combinations of our large bodies and small geometries (obstacles). With any geometric shape inside any other. Since there are two geometries in each possible combination of surface meshes, and since we only want one fluid domain, we start by creating a subtract-operation. In the below picture is the description of the selection of filters and queries for the Initial subtract operation that creates a simulation domain, that subtracts the small obstacle geometry from the large body.
In the picture below we define the initial subtract operation to create the simulation domain. Here we use a selection of filters and queries. The input parts shall be a Geometry Part and their name shall not contain “Subtract”. To the left you can see the result of your query: Block_domain and Cylinder_obstacle.
In the bottom filter is a selection that makes sure the part containing the name domain is selected (that is our target part). In the top selection the filter selects all parts that we have imported. Note however that it excludes the newly created part associated with the subtract-operation.
The next step is to create a region that can always be used and used with some name queries that allows for a fool-proof selection of the names. This is of course related to the naming of your specific geometry.
Once we have created a region that is based on the subtract part created from our subtract operation (after “assign parts to regions”) operation, we simply rename all the boundaries (and the region itself) to something generic. This is not necessary but makes it easier to keep track of the different boundaries. We can then use name queries on both the region and the region boundaries. You might need to exclude certain parts from being selected at some boundaries. Because once a part has been selected in a query, it can not be assigned again (the same principle as the possibility of assigning only one part surface to a boundary).
The picture below shows how the queries looks for the Fluid-Region and a couple of the boundaries. The region needs only to match to subtract-operation since that will always exist in the sim-file. It is only the surface meshes that are supposed to be replaced. The boundary named Floor also only needs to match to its name. However for the wall-boundary, we will need to exclude the inherited part-surface wall related to the part that has obstacle in its name. This is because we intend to have all part-surfaces related to the obstacle in its own boundary.
The next step is to create a mesh operation. Once that is done we again refer to the subtract-part. A surface refinement is included that corresponds to the name obstacle (resolving the obstacle a little better). A wake refinement with a 10-degree spread is used to resolve the wake.
A scene is setup also using queries to always show a derived part (only one in the simulation). Meaning that type is set to derived part in the query, showing the scenes we see below. Regardless of combination used for domain and obstacles you simply import the surface mesh you wish to include in your simulation, run all the operations and run. You could also set up your post-processing using queries and filter. That will not be shown here, but it follows the same principle.
I hope this has helped you understand the automatization possibilities within Simcenter STAR-CCM+. If you have any questions, do not hesitate to send me an email at robin.victor@volupe.com
Read also:
Templating, an internal flow example