In The Name of Absolute Power & Absolute Knowledge Department of Mechanical Engineering University of Western Macedonia COMSOL Multiphisics Prof. Sofoklis Makridis Assistant Professor of Materials and Energy Applications 2015 COMSOL Multiphysics COMSOL Multiphysics is a powerful interactive environment for modeling and solving all kinds of scientific and engineering problems based on partial differential equations (PDEs). With this software you can easily extend conventional models for one type of physics into multiphysics models that solve coupled physics phenomena - and do so simultaneously. 3 COMSOL Multiphysics It is possible to build models by defining the physical quantities - such as material properties, loads, constraints, sources, and fluxes - rather than by defining the underlying equations. You can always apply these variables, expressions, or numbers directly to solid domains, boundaries, edges, and points independently of the computational mesh. COMSOL then internally compiles a set of PDEs representing the entire model. You access the power of COMSOL through a flexible graphical user interface, or by script programming in the COMSOL Script language. 4 COMSOL Multiphysics PDEs form the basis for the laws of science and provide the foundation for modeling a wide range of scientific and engineering phenomena. When solving the PDEs, COMSOL Multiphysics uses the finite element method (FEM). The software runs the finite element analysis together with adaptive meshing and error control using a variety of numerical solvers. 5 COMSOL Application You can use COMSOL Multiphysics in many application areas, just a few examples being: Chemical reactions Diffusion Fluid dynamics Fuel cells and electrochemistry Bioscience Acoustics Electromagnetics Geophysics 6 COMSOL Application Heat transfer Microelectromechanical systems (MEMS) Microwave engineering Optics Photonics Porous media flow Quantum mechanics Radio-frequency components Semiconductor devices Structural mechanics Transport phenomena Wave propagation 7 COMSOL M-file You can build models of all types in the COMSOL user interface. For additional flexibility, COMSOL also provides its own scripting language, COMSOL Script, where you can access the model as a Model M-file or a data structure. COMSOL Multiphysics also provides a seamless interface to MATLAB. This gives you the freedom to combine PDE-based modeling, simulation, and analysis with other modeling techniques. For instance, it is possible to create a model in COMSOL and then export it to Simulink as part of a controlsystem design. 8 COMSOL Multiphysics Many real-world applications involve simultaneous couplings in a system of PDEs - multiphysics. COMSOL Multiphysics offers modeling and analysis power for many application areas. For several of the key application areas optional modules are provided. These applicationspecific modules use terminology and solution methods specific to the particular discipline, which simplifies creating and analyzing models. The COMSOL 3.4 product family includes the following modules: 9 The COMSOL Modules 1. 2. 3. 4. 5. 6. 7. 8. AC/DC Module Acoustics Module Chemical Engineering Module Earth Science Module Heat Transfer Module MEMS Module RF Module Structural Mechanics Module The optional modules are optimized for specific application areas. They offer discipline standard terminology and interfaces, materials libraries, specialized solvers, elements, and visualization tools. 10 The AC/DC Module The AC/DC Module provides a unique environment for simulation of AC/DC electromagnetics in 2D and 3D. The AC/DC Module is a powerful tool for detailed analysis of coils, capacitors, and electrical machinery. With this module you can run static, quasi-static, transient, and time-harmonic simulations in an easy-to-use graphical user interface. 11 The AC/DC Module The available application modes cover the following types of Electromagnetics field simulations: Electrostatics Conductive media DC Magnetostatics Low-frequency electromagnetics 12 The Acoustics Module The Acoustics Module provides an environment for modeling of acoustics in fluids and solids. The module supports timeharmonic, modal, and transient analyses for fluid pressure as well as static, transient, eigenfrequency, and frequency-response analyses for structures. The available application modes include: Pressure acoustics Aeroacoustics (acoustics in an ideal gas with an irrotational mean flow) Compressible irrotational flow Plane strain, axisymmetric stress/strain, and 3D stress/strain 13 The Acoustics Module Typical application areas for the Acoustics Module include: Modeling of loudspeakers and microphones Aeroacoustics Underwater acoustics Automotive applications such as mufflers and car interiors 14 The Chemical Engineering Module The Chemical Engineering Module presents a powerful way of modeling equipment and processes in chemical engineering. It provides customized interfaces and formulations for momentum, mass, and heat transport coupled with chemical reactions for applications such as: Reaction engineering and design Heterogeneous catalysis Separation processes Fuel cells and industrial electrolysis Process control together with Simulink 15 The Chemical Engineering Module … COMSOL Multiphysics excels in solving systems of coupled nonlinear PDEs that can include: Heat transfer Mass transfer through diffusion and convection Fluid dynamics Chemical reaction kinetics Varying material properties The multiphysics capabilities of COMSOL can fully couple and simultaneously model fluid flow, mass and heat transport, and chemical reactions. 16 The Chemical Engineering Module … In fluid dynamics you can model fluid flow through porous media or characterize flow with the Navier-Stokes equations. It is easy to represent chemical reactions by source or sink terms in mass and heat balances. All formulations exist for both Cartesian and Cylindrical coordinates (for axisymmetric models) as well as for stationary and time-dependent cases. 17 The Chemical Engineering Module … The available application modes are: 1. Momentum balances Incompressible Navier-Stokes equations Darcy’s law Brinkman equations Non-Newtonian flow Nonisothermal and weakly compressible flow Turbulent flow, k-ε turbulence model Turbulent flow, k-ω turbulence model Multiphase flow 18 The Chemical Engineering Module … 2. Energy balances Heat conduction Heat convection and conduction 3. Mass balances Diffusion Convection and diffusion Electrokinetic flow Maxwell-Stefan diffusion and convection Nernst-Planck transport equations 19 The Earth Science Module The Earth Science Module combines application modes for fundamental processes and structural mechanics and electromagnetics analyses. Available application modes are: Darcy’s law for hydraulic head, pressure head, and pressure Solute transport in saturated and variably saturated porous media Richards’ equation including nonlinear material properties. Heat transfer by conduction and convection in porous media with one mobile fluid, one immobile fluid, and up to five solids Brinkman equations Incompressible Navier-Stokes equations 20 The Heat Transfer Module The Heat Transfer Module supports all fundamental mechanisms of heat transfer. Available application modes are: General heat transfer, including conduction, convection, and surface-to-surface radiation Bioheat equation for heat transfer in biomedical systems Highly conductive layer for modeling of heat transfer in thin structures. Nonisothermal flow appliction mode . Turbulent flow, k-ε turbulence model applications in electronics and power systems, process 21 industries, and manufacturing industries. The MEMS Module One of the most exciting areas of technology to emerge in recent years is MEMS (microelectromechanical systems), where engineers design and build systems with physical dimensions of micrometers. These miniature devices require multiphysics design and simulation tools because virtually all MEMS devices involve combinations of electrical, mechanical, and fluidflow phenomena. 22 The MEMS Module Available application modes are: Plane stress Plane strain Electrokinetic flow Axisymmetry, stress-strain Piezoelectric modeling in 2D plane stress and plane strain, axisymmetry, and 3D solids. 3D solids General laminar flow 23 The RF Module The RF Module provides a unique environment for the simulation of electromagnetic waves in 2D and 3D. The RF Module is useful for component design in virtually all areas where you find electromagnetic waves, such as: Optical fibers Antennas Waveguides and cavity resonators in microwave engineering Photonic waveguides Photonic crystals Active devices in photonics 24 The RF Module The available application modes cover the following types of electromagnetics field simulations: In-plane wave propagation Axisymmetric wave propagation Full 3D vector wave propagation Full vector mode analysis in 2D and 3D 25 The Structural Mechanics Module The Structural Mechanics Module solves problems in structural and solid mechanics, adding special element types—beam, plate, and shell elements—for engineering simplifications. Available application modes are: Plane stress/ strain Axisymmetry, stress-strain Piezoelectric modeling 2D beams, Euler theory 3D beams, Euler theory 3D solids Shells 26 The Modeling Process The modeling process in COMSOL consists of six main steps: 1. Selecting the appropriate application mode in the Model Navigator. 2. Drawing or importing the model geometry in the Draw Mode. 3. Setting up the subdomain equations and boundary conditions in the Physics Mode. 4. Meshing in the Mesh Mode. 5. Solving in the Solve Mode. 6. Postprocessing in the Postprocessing Mode. 27 1. The Model Navigator When starting COMSOL Multiphysics, you are greeted by the Model Navigator. Here you begin the modeling process and control all program settings. It lets you select space dimension and application modes to begin working on a new model, open an existing model you have already created, or open an entry in the Model Library. COMSOL Multiphysics provides an integrated graphical user interface where you can build and solve models by using predefined physics modes 28 2. Creating Geometry An important part of the modeling process is creating the geometry. The COMSOL Multiphysics user interface contains a set of CAD tools for geometry modeling in 1D, 2D, and 3D. The CAD Import Module provides an interface for import of Parasolid, SAT (ACIS), STEP, and IGES formats. In combination with the programming tools, you can even use images and magnetic resonance imaging (MRI) data to create a geometry. 29 Axes and Grid In the COMSOL Multiphysics user interface you can set limits for the model axes and adjust the grid lines. The grid and axis settings help you get just the right view to produce a model geometry. To change these settings, use the Axes/Grid Settings dialog box that you open from the Options menu. You can also set the axis limits with the zoom functions. 30 Axes and Grid The default names for coordinate systems vary with the space dimension: Models that you open using the space dimensions 1D, 2D, and 3D use the Cartesian coordinates x, y, and z. In 1D axisymmetric geometries the default coordinate is r, the radial direction. The x-axis represents r. In 2D axisymmetric geometries the x-axis represents r, the radial direction, and the y-axis represents z, the height coordinate. 31 3. Modeling Physics and Equations From the Physics menu you can specify all the physics and equations that define a model including: Boundary and interface conditions Domain equations Material properties Initial conditions 32 4. Creating Mesh When the geometry is complete and the parameters are defined, COMSOL Multiphysics automatically meshes the geometry. However, you can take charge of the mesh-generation process through a set of control parameters. For a 2D geometry the mesh generator partitions the subdomains into triangular or quadrilateral mesh elements. Similarly, in 3D the mesh generator partitions the subdomains into tetrahedral, hexahedral, or prism mesh elements. 33 5. Solution Next comes the solution stage. Here COMSOL Multiphysics comes with a suite of solvers for stationary, eigenvalue, and time-dependent problems. For solving linear systems, the software features both direct and iterative solvers. A range of preconditioners are available for the iterative solvers. COMSOL sets up solver defaults appropriate for the chosen application mode and automatically detects linearity and symmetry in the model. A segregated solver provides efficient solution schemes for large multiphysics models, turbulence modeling, and other 34 challenging applications. 6. Postprocessing For postprocessing, COMSOL provides tools for plotting and postprocessing any model quantity or parameter: Surface plots Slice plots Isosurfaces Contour plots Arrow plots Streamline plots and particle tracing Cross-sectional plots Animations Data display and interpolation Integration on boundaries and subdomains 35 Report Generator To document your models, the COMSOL Report Generator provides a comprehensive report of the entire model, including graphics of the geometry, mesh, and postprocessing quantities. You can print the report directly or save it as an HTML file for viewing through a web browser and further editing. 36 Expression Variables Add symbolic expression variables or expressions using the dialog boxes that you open from the Expressions submenu on the Options menu. Global expressions are available globally in the model, and scalar expressions are defined the same anywhere in the current geometry. With boundary expressions, subdomain expressions, point expressions, and interior mesh boundary expressions you can also create expressions that have different meanings in different parts of the model. 37 Expression Variables Expression variables can make a model easier to understand by introducing short names for complicated expressions. Another use for expression variables is during postprocessing. If you need to view a field variable throughout the model, but it has different names in different domains, create an expression variable made up of the different domains and then plot that variable. 38 Example 1: fluid flow between two parallel plates This example models the developing flow between two parallel plates. The purpose is to study the inlet effects in laminar flow at moderate Reynolds numbers, in this case around 40. The model’s input data are tabulated below. 39 Step 1: The Model Navigator Selecting the appropriate application mode in the Model Navigator. In the Model Navigator, click the New page. Select: Chemical Engineering Module>Momentum Transport> Laminar Flow>Incompressible Navier-Stokes. 40 Step 2: Creating Geometry Drawing or importing the model geometry in the Draw Mode. Simultaneously press the Shift key and click the Rectangle/Square button. Type the values below in the respective edit fields for the rectangle dimensions. Use the Draw Point button to place two points by clicking at (−0.01, 0.01) and (0.01, 0.01). 41 Step 3: Modeling Physics and Equations The first step of the modeling process is to create a temporary data base for the input data. Define the constants in the Constants dialog box in the Option menu. Setting up the subdomain equations and boundary conditions in the Physics Mode. Select Subdomain Settings, select Subdomain 1, Define the physical properties of the fluid. 42 Boundary Conditions From the Physics menu, select Boundary Settings. Enter boundary conditions according to the following table. 43 Step 4: Mesh Generation In this case you want to customize some settings for the initial mesh. 1. From the Mesh menu, select Free Mesh Parameters. 2. On the Boundary page, select Boundaries 3 and 6 from the Boundary Selection list. 3. In the Maximum element size edit field, type 1e-3. This creates elements with a maximum edge length of 10-3 m for Edges 3 and 6. 4. Click the Remesh button. 44 Step 5 : Solve Computing the solution, Click the Solve button on the Main toolbar. Step 6 : Postprocessing The resulting plots show how the velocity profile develops along the flow direction. At the outlet, the flow is almost a fully developed parabolic velocity profile. 45 Velocity Field Surface Plot 46 Example 2: Coupled Free and Porous Media Flow This is a model of the coupling between flow of a gas in an open channel and in a porous catalyst attached to one of the channel walls. The flow is described by the Navier-Stokes equation in the free region and the Brinkman equations in the porous region. 47 Step 1: The Model Navigator Selecting the appropriate application mode in the Model Navigator. In the Model Navigator, click the New page. Select: Chemical Engineering Module>Momentum Transport> Laminar Flow>Incompressible Navier-Stokes. 48 Step 2: Creating Geometry Drawing or importing the model geometry in the Draw Mode. Simultaneously press the Shift key and click the Rectangle/Square button. Type the values below in the respective edit fields for the rectangle dimensions. 49 Step 3: Modeling Physics and Equations Define the constants in the Constants dialog box in the Option menu. Setting up the subdomain equations and boundary conditions in the Physics Mode. Select Subdomain Settings, select Subdomain 1, Set ρ to rho and η to eta. Select Subdomain 2, select the Flow in porous media (Brinkman equations) check box. Set ρ to rho, η to eta, εp to epsilon, and k to k. 50 Boundary Conditions From the Physics menu, select Boundary Settings. Enter boundary conditions according to the following table. 51 Step 4: Mesh Generation In order to resolve the velocity profile close to the interface between the open channel and the porous domain, a finer mesh is required at this boundary. 1. From the Mesh menu, select Free Mesh Parameters. 2. Click the Custom mesh size option button. 3. In the Maximum element size edit field, type 2e-4. 4. In the Boundary tab, Select Edge 5, then type 1e-4 in the Maximum element size edit field. 5. Click the Remesh button. 52 Step 5 : Solve Click the Solve button on the Main toolbar. Step 6 : Postprocessing To visualize the velocity in a horizontal cross-section across the channel and the porous domain, follow these steps: 1. From the Postprocessing menu, select Cross-Section Plot Parameters. 2. Specify the following Cross-section line data: 53 Cross Section Plot of Velocity Field 54