Building 2D Geometry
Geometry models can be created within the COMSOL Multiphysics®software environment using the built-in geometry modeling features and functionality. In this article, we will begin by focusing on sketching in 2D directly in theGraphicswindow. We will then show how to edit withSketchmode and how you can addObject Primitivesdirectly to your geometry. After you have learned the basics of building 2D geometries, we will show the process using an example model. The end of this article includes modeling exercises for practicing what you will learn here.
Adding Components for Sketch Mode
One way for you to draw and edit geometry is by usingSketchmode. Drawing can be done right in theGraphicswindow with this feature. This is primarily how we will be building geometries in this article. To begin sketching, you will need to add a 2D component or a work plane to your model. There are several methods for adding components to your models. If you are starting a new model, you may want to use the Model Wizard to add the type of component, physics, and study you want to begin with.
While you are building your model, components can be added from theHometoolbar or the context menu. You can add multiple and different types of components to the Model Builder this way.
The COMSOL Multiphysics UI with the Add Component button selected in the Home toolbar, and then 2D selected from there.A 2D component is selected in theHometoolbar and will be added to the Model Builder.
Note that 3D geometries often use work planes, which follow the same principles as shown here in 2D. Work planes can be added from theGeometrytoolbar, and then thePlane Geometrycan be sketched.
Drawing with Sketch Mode
To begin sketching the geometry for your first component:
- Select theSketchtoolbar
- Select the type of shape you want to draw
- Click and drag in theGraphicswindow as necessary to create the shape
You can also right click in theGraphicswindow, whileSketchmode is on, to show the context menu and select the type of shape you want to draw.Sketchmode can be toggled on or off using the respective button in theSketchtoolbar. If your version of COMSOL Multiphysics®does not includeSketchmode, you may need to upgrade to a more recent version of COMSOL Multiphysics®.
TheSketchtoolbar withSketchmode on. The toolbar is available under theGeometryorSketchribbon tabs for 2D or 3D model components.
To create a new 2D sketch, you can simply interactively draw a wireframe rendering of your geometry. Once you leaveSketchmode, by turning it off or leaving theGeometrynode in the Model Builder, your sketch will become a 2D object. By default, a closed geometry will become a solid object, whereas an open geometry will become a curve object.
An example of theGraphicswindow whenSketchmode is on (left) and off (right).
Composite Curves
In COMSOL Multiphysics®, you can create objects with multiple types of edges by forming acomposite curve. TheComposite Curvefeature is automatically added to your geometry sequence when you draw a series of connected edges. Connected polygons, curves, and arcs can be manually selected and organized within new or existingComposite Curvefeatures. The selections can be made by holding Ctrl and clicking the edges in theGraphicswindow or the Model Builder window via their nodes. When they are selected, you can chooseComposite Curveby right-clicking or from theOperationssection of theSketchtoolbar. The connected yet standalone curve objects that were selected are then assembled into a single object.
Correcting Sketches
If you make a mistake while sketching, it is simple to make the correction. There are multiple ways to fix a sketch. If you catch a mistake while sketching an object, you can click the drawing tool you are using to stop where you are. A standalone object will be canceled and a composite curve will be finished. Sections of a composite curve can be deleted by clicking to select them in theGraphicswindow and using the Delete button. Two or more connected composite curves can be also be combined in the model tree to help keep your model organized.
Editing with Sketch Mode
Once you have sketched an object there are different options you can use to edit it. Sketched objects can be edited in theSettingswindow or theGraphicswindow. Values for various properties of the object can be entered in theSettingswindow, such as the dimensions or position. Alternatively, by clicking and dragging on the object, its edges, or vertices in theGraphicswindow, the size, shape, or position of your object can be adjusted. You can hold the Ctrl and/or Shift key while dragging your mouse to change how other geometric entities move in your sketch.
It may be necessary to modify objects manually in theSettingswindow to edit your geometry. Editing in theSettingswindow enables you to exactly specify the dimensions required. When objects are selected in the model tree in the Model Builder window, theSettingswindow will show information for that object, such as the coordinates, dimensions, and rotation angle, among other properties. Objects can also be selected by double-clicking the object in theGraphicswindow — with this, the associated node andSettingswindow will open. The approach utilizing theGraphicswindow can help you find the correct node for an object when you are working with a complex model geometry.
Guidelines and Indicators
There are many visual indicators in theGraphicswindow while inSketchmode. For instance, bold grid are visible by default at thex– andy-intercepts, providing a quick reference to grid origin.
The Graphics window with bold grid lines.TheGraphicswindow, displaying bold grid lines at the origin upon enablingSketchmode in the geometry.
Green grid lines will appear when any vertex is moved in your model geometry to align with other points in your geometry. These same type of lines appear while sketching new objects and are useful while sketching or editing because they make it simple for your objects to reference their relative position to each other.
When editing the point coordinates in theSettingswindow for certain geometric primitive features, such as polygons or interpolation curves, a red circle will identify the corresponding point in theGraphicswindow. This helps to confirm which points you are editing.
2D Object Primitives
Various built-in geometric shapes can be selected and added to your geometry sequence from theGeometrytoolbar. The properties for these 2D geometric primitives can then be edited through theSettingswindow, and then be built. You can also still interactively edit these shapes through theGraphicswindow. These objects can be then be combined with other geometry operations to form your final geometry.
Tutorial of 2D Sketching
Now that we have gone over the basics of building 2D geometry withSketchmode in COMSOL Multiphysics®, we will go through an example model step by step. The model we will be building is a cross section of a light bulb, which we can model in 2D even though the object is 3D. In the case of a lightbulb, we should have axial symmetry, and the results of a 2D simulation can be revolved to show results in 3D. This will take less time to model and compute a solution. You can follow along with the video below and refer to the written step-by-step instructions included with theLight Bulb Geometrytutorial model in the Application Gallery. There, you can also find the MPH-file for the model.
Modeling Exercises
In order to put into practice what you have learned through this article, we have provided several self-guided modeling exercises. Use the images and MPH-files included as a reference while you sketch the geometry yourself to test your knowledge. When needed, you can check the solution files attached to this article to see how you did. TheComparetoolin the software can be used to identify the differences between the solution and your sketch. It is important to note that there are multiple ways to create the geometries, so your geometry could be correct but simply created in a different manner.
Circulator
Open thecirculator geometryfile in COMSOL Multiphysics®. Then, use the features shown in this article to sketch over the imported geometry. You will have been successful in this exercise if you were able to use the tools to copy the imported geometry by hand. You can check how the original geometry was created with the solution file attached to this article.
A sketch of the circulator geometry.Landing Gear
Observe the shape of the model, made to look like landing gear, in the image below, and determine how you may most efficiently sketch it. The wheels should be 0.3 m in diameter, and the structure should have a uniform thickness of 0.1 m. Focus on making the shape of the model and remember that the dimensions can be adjusted afterward. There are two solution MPH-files attached that outline just a couple of the ways the geometry for this model could have been sketched. You can refer to the Application Gallery entry for thelanding gearmodel to learn more.
A sketch of the landing gear model.Abstract Geometry
Model this abstract geometry using the images below of the dimensioned sketch and the built geometry. The abstract geometry exists only to practice what you have learned in this article. If you need a hint, reference thegeometry sequenceto see what features were used to create the geometry originally. You can also compare your result with the attached solution to see how the features were used.
An abstract geometry shown inSketchmode, with the dimensions displayed. Right: The geometry with the objects built outside ofSketchmode.
The Design Module
Additional functionality for building geometry in COMSOL Multiphysics®is included with the Design Module. If you would like to learn more about the features included in the Design Module, such as constraints, dimensions, CAD import functionality, or standard and Boolean CAD operations, we recommend that you check out theDesign Modulein our product suite and read our blog post "How to Use the Sketch Tools in COMSOL®to Draw 2D Geometry".
An example geometry in the Graphics window showing the dimensions. A well-defined example geometry using constraints and dimensions.Further Learning
If you are looking for more materials to help hone your 2D-geometry-building skills in COMSOL Multiphysics®, there are a few resources we recommend:
- TheEffective Diffusivity in Porous Materialstutorial model
- TheAxisymmetric Twist and Bendingtutorial model
- OurUtilizing Geometric Measurements in COMSOL Multiphysics®video to learn about theMeasuretool, which can be used to measure geometric quantities in your model
Note that the PDF files for the tutorial models often include content beyond instructions for building the geometry. For the models listed here, we recommend referring to the instructions specific to building the geometry and practicing them using the capabilities discussed here.
请提交与此页面相关的反馈,或点击此处联系技术支持。