89
FEATool Version: . Quickstart Guide

FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

Embed Size (px)

Citation preview

Page 1: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

FEAToolVersion: 1.6

Quickstart Guide

Page 2: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

Precise Simulation Ltd.Unit 903-9059/F Kowloon Centre33 Ashley RoadTsimshatsui, KowloonHong Kong

Home page and [email protected]

(c) Copyright 2013-2017 by Precise Simulation Ltd. All rights reserved

The soware described in this document is furnished under a license agreement. The soware may be used, mod-ified, and copied only under the terms of the license agreement. No part of this manual may be photocopied orreproduced in any form without prior written consent from Precise Simulation Ltd.

FEATool is a trademark of Precise Simulation Ltd.

Matlab is a registered trademark of The MathWorks, Inc., other product or brand names are registered trademarksof their respective holders.

Page 3: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

Contents

Contents iii

1 Quickstart Guide 21.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3 Modeling Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.4 Structural Mechanics Example - Thin Plate with Hole . . . . . . . . . . . . . . 6

1.4.1 Thin Plate with Hole using the GUI . . . . . . . . . . . . . . . . . . . 71.4.2 Thin Plate with Hole using the CLI . . . . . . . . . . . . . . . . . . . 28

1.5 Multiphysics Example - Heat Exchanger . . . . . . . . . . . . . . . . . . . . . 291.5.1 Heat Exchanger using the GUI . . . . . . . . . . . . . . . . . . . . . . 301.5.2 Heat Exchanger using the CLI . . . . . . . . . . . . . . . . . . . . . . 46

1.6 Equation Editing Example - Axisymmetric Fluid Flow . . . . . . . . . . . . . . 471.6.1 Axisymmetric Fluid Flow using the GUI . . . . . . . . . . . . . . . . . 491.6.2 Axisymmetric Fluid Flow using the CLI . . . . . . . . . . . . . . . . . 58

1.7 Classic Equation Example - Poisson Equation with a Point Source . . . . . . . 591.7.1 Poisson Equation with a Point Source using the GUI . . . . . . . . . . 591.7.2 Poisson Equation with a Point Source using the CLI . . . . . . . . . . 72

1.8 Custom Equation Example - Wave Equation on a Circle . . . . . . . . . . . . . 731.8.1 Wave Equation using the GUI . . . . . . . . . . . . . . . . . . . . . . 731.8.2 Wave Equation using the CLI . . . . . . . . . . . . . . . . . . . . . . 84

1.9 More Examples and Information . . . . . . . . . . . . . . . . . . . . . . . . . 85

iii

Page 4: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

FEATool

Welcome to FEAToolTM (short for Finite Element Analysis Toolbox), aGNU Octave andMatlab®toolbox formodeling and simulationof physics, partial dierential equations (PDEs), andmath-ematical problems with the finite element method (FEM).

We aim to provide an easy to use and comprehensive all-in-one package for finite elementand multiphysics analysis. FEATool combines the best of ease of use, power, and extensibilityfor both beginners and advanced users with an intuitive and quick to learn graphical user inter-face (GUI), a complete library of grid generation, FEM, and postprocessing functions, as well ascommand line interface (CLI) programming, and scripting capabilities.

In this way hope that FEATool will be suitable for everyone from students learning math-ematical modeling and numerical analysis, researchers seeking a modeling environment thatis extensible, quick to learn, and easy to implement their own ideas in, to professionals andengineers wishing to explore new ideas in a simple and convenient way.

We really hope you will enjoy using and working with us and FEATool, and do not hesitateto contact us if you have any questions or suggestions for improvements.

1

Page 5: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1 Quickstart Guide

The quickstart guide explains how to install and start FEATool Multiphysics as well as describesthemodeling and simulation process. Furthermore, step by step instructions how to set up andsolve five modeling examples illustrating dierent techniques and features of FEATool is alsoincluded.

1. Introductory example of modeling stresses and strains in a thin plate with a hole.

2. Multiphysics example coupling heat and fluid flow in a heat exchanger.

3. Equation editing example modeling axisymmetric fluid flow in a narrowing pipe.

4. Classic equation example for the Poisson equation on a circle with a point source.

5. Custom equation example for solving the wave equation on a circle.

1.1 PrerequisitesThe FEATool simulation toolbox is written in the m-script language, which requires either GNUOctave or Matlab to run and interpret the source code. Octave is freely available from the Oc-tave homepage (Octave version 4.0 or later is required for GUI compatibility). Matlab is a

2

Page 6: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

commercial alternative to Octave andmust be licensed from The Mathworks Inc.

1.2 InstallationIn order to use the toolbox the FEATool directories must first be added to the Octave and/orMatlab search paths. This can be done permanently by running the install Octave/Matlabm-file script function found in the FEATool installation folder (here it is assumed tobeC:\featool)

in Octave or Matlab:

>> cd C:\featool>> install

or fromWindows Explorer

in the FEATool installation folder:

double-click on the "install.bat/install_octave.bat" file icon

Alternatively, instead of setting up the paths permanently it is possible to instead just runaddpaths on the command line before starting to use the FEATool functions and subroutines(starting the FEATool GUI by running the featool command also does this automatically).

To verify that the search paths have been installed correctly type

>> path

and check that the following paths are present in the displayed list (with location and direc-tories adjusted for where you have installed FEATool)

c:\featool\utilc:\featool\postc:\featool\physmodes

INSTALLATION | 3

Page 7: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

c:\featool\lib\uiextrasc:\featool\lib\surfaceintersectionc:\featool\lib\distmeshc:\featool\lib\findjobjc:\featool\impexpc:\featool\guic:\featool\gridc:\featool\geomc:\featool\featflowc:\featool\examplesc:\featool\ellibc:\featool\core

To permanently uninstall (that is to remove the saved paths), run the functionuninstallin Octave/Matlab, which also can be found in the FEATool installation folder.

4 | QUICKSTART GUIDE

Page 8: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1.3 Modeling ProcessThe typical modeling process in FEATool logically follows the six mode buttons located in theupper portion of the le side toolbar in the main graphical user interface (Gui) window. Themodeling steps are thus as follows:

• The first step is to create a geometry to define the domain to bemodeled. Geome-try objects such as rectangles, circles, blocks, and cylinders canbe created and combinedto represent complex domains.

• From the geometry a grid ormesh can be generated or imported from an externalpreprocessing tool or grid generator. Themodeled phenomena is to be approximated oneach grid cell by a finite element polynomial or shape function. Finer more dense gridsand regularly shaped high quality grid cells generally leads to more accurate solutions.

• Equations (PDEs) and model coeicients are then specified in subdomain/equa-tionmode todescribe thephysical phenomena tobemodeled. Equationsarepre-definedfor many types of physical phenomena like for example heat transfer, structural strainsand stresses, and fluid flow. In addition FEATool also allowsarbitrary andcustomsystemsof PDE equations to be described and entered.

• Boundary conditions must be prescribed on the geometrical boundaries to ac-count for interactions with the surroundings outside of the modeled domain. For timedependent problems initial conditions must also be given at the start of the simulations.

• Aer the model problem is fully specified a suitable solver can be employed tocompute a solution. FEATool can either use the default Matlab or Octave linear solversor use specialized external ones, such as the FeatFlow CFD solver, for increased perfor-mance.

• Finally, aer the problem has been solved, the solution can be visualized, post-processed, and exported to evaluate the computed results.

MODELING PROCESS | 5

Page 9: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1.4 Structural Mechanics Example - ThinPlate with Hole

The first example is a well known benchmark test case from structural mechanics, a thin platewith a circular hole in the center is subjected to a load along one axis.

The plate is thin enough to satisfy the two dimensional plane stress approximation, andsince both the problem and solution will be symmetric around the hole it is enough to modela quarter of the plate. The computational geometry will therefore consist of a 0.05 by 0.05 msquare with a quarter of a circle with radius 0.005m removed from one corner. Due to the sym-metry the displacement of the le edge of the plate should be zero in the x-direction, and simi-larly the y-displacement for the lower edge should also be zero. Furthermore, a horizontal forceof 1000 N is applied to the right edge. With a plate thickness of 0.001m, the resulting load willbe 1000/(2∗0.05∗0.001) N/m2.

symmetry, v=0

force, fx

L

symmetry, u=0

L

r

6 | QUICKSTART GUIDE

Page 10: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

Assuming that the plate ismade of steel with a Poisson ratio of 0.3 andmodulus of elasticity210∗109 Pa then it is expected that themaximum stress in the x-directionwill be three times thestress of a plate without a hole, that is σx = 3∗1000/(2∗0.05∗0.001) Pa = 3∗107 Pa.

1.4.1 Thin Plate with Hole using the GUI

This sectiondescribes how to set upand solve the thinplatewithhole examplewith the FEAToolgraphical user interface (GUI).

1. Start Octave or Matlab. If you have not run the installation script (which automaticallyadds the FEATool directory paths at startup) then change yourworkingdirectory towhereyour FEATool installation is, for example

cd C:\featool

2. In the Octave/Matlab main command window type

featool

to start the FEATool graphical user interface (GUI).

STRUCTURAL MECHANICS EXAMPLE - THIN PLATE WITH HOLE | 7

Page 11: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

3. Either select New... from the Filemenu, or click on the NewModel button in the up-per horizontal toolbar, to clear all data and start defining a newmodel.

8 | QUICKSTART GUIDE

Page 12: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

4. In the NewModel dialog box, click on the 2D radio button in the Select Space Dimensionsframe, and select Plane Stress from the Select Physics drop-down list. Leave the spacedimension and dependent variable names to their defaults. Finish and close the dialogbox by clicking on theOK button.

5. To create the rectangle for the plate, first click on the Create square/rectangle buttonin the le hand side Tools toolbar frame.

STRUCTURAL MECHANICS EXAMPLE - THIN PLATE WITH HOLE | 9

Page 13: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

6. Then le click in themainplot axeswindow, hold themousebutton, andmove themousepointer to draw a rectangle with red outlines.

10 | QUICKSTART GUIDE

Page 14: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

7. Release the button to finalize and create a solid geometry object. The object propertiesmust now be edited to set the correct size and position of the rectangle. To do this, clickon the rectangle R1 to select it and highlight it in red. Then click on the Inspect/edit se-lected geometry object toolbar button

8. In the Edit Geometry Object dialog box, change the min and max point coordinates todefine a rectangle with length and height 0.05 and lower le corner at the origin. Finishediting the geometry object and close the dialog box by clickingOK.

STRUCTURAL MECHANICS EXAMPLE - THIN PLATE WITH HOLE | 11

Page 15: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

9. To create the circular hole, first le click on the Create circle/ellipse button in the lehand side Tools toolbar frame.

12 | QUICKSTART GUIDE

Page 16: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

10. Then click and hold the lemouse button anywhere in themain plot axes window, movethemouse pointer to show red outlines of a circle or ellipse. Release the button to finalizeand a solid ellipse will be created.

11. The object properties of the ellipse E1must be changed tomake a circle with radius 0.005centered at (0, 0). To do this, click on the E1 to select it which also highlights it in red. Then

click on the Inspect/edit selected geometry object toolbar button

STRUCTURAL MECHANICS EXAMPLE - THIN PLATE WITH HOLE | 13

Page 17: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

12. In the opened Edit Geometry Object dialog box change the center coordinates to 0 0,and the x and y radii to 0.005 in the corresponding edit fields. Finish editing E1 and closethe dialog box by clicking OK (the smaller objects will automatically be selected to besubtracted from the larger).

14 | QUICKSTART GUIDE

Page 18: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

13. To subtract the circle from the rectangle first select both geometry objects by clicking onthem so both are highlighted in red. Alternatively, if the circle is obscured by the rectan-gle they can be selected by holding the Ctrl key while clicking on the labels R1 and E1 inthe Selection list box (or simply press Ctrl+a to select all objects). When the geometry ob-

jects are selected, press the Subtract geometry objects button to generate the finalgeometry shape.

14. Switch to Gridmode by clicking on the corresponding mode toolbar button.

STRUCTURAL MECHANICS EXAMPLE - THIN PLATE WITH HOLE | 15

Page 19: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

15. Click on the Generate unstructured grid button to call the grid generation functionwhich automatically generates a triangular grid for the geometry.

16 | QUICKSTART GUIDE

Page 20: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

16. The default estimated grid size is suicient to resolve the rectangle but the hole is notrepresented well. Try refining the grid by clicking on the Uniform grid refinement but-ton once or twice.

17. The uniformly refined grid does not improve resolution of curved boundaries and in thiscase also creates very distorted cells which leads to poor accuracy. To generate a bettergrid enter 0.002 in theGrid Size parameter edit field and click on theGenerate unstruc-tured grid button again.

STRUCTURAL MECHANICS EXAMPLE - THIN PLATE WITH HOLE | 17

Page 21: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

18. With an improved grid we now can proceed with specifying the equations. Press themode button in the Mode toolbar to switch from gridmode to physics and equa-

tion/subdomain specification mode.

18 | QUICKSTART GUIDE

Page 22: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

19. In the Equation Settings dialog box that automatically opens, enter 0.3 for the Poissonratio ν and 210e9 for themodulus of elasticity E. The other coeicients can be le to theirdefault values. PressOK to finish and close the dialog box.

20. Now we want to add an expression for the load force. We could do it by directly enteringtheexpression in thedialogbox, however thereareadvantages tousing the constants andexpressions functionality. To use this click on theModel Constants andExpressionsbut-ton

STRUCTURAL MECHANICS EXAMPLE - THIN PLATE WITH HOLE | 19

Page 23: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

21. Enter a new variable named loadwith expression 1000∗(2∗0.05∗0.001) (In this case weare just entering constants one can also use complicated formulas involving dependentvariables, space coordinates, time, and other expressions). Press OK to finish and closethe dialog box.

20 | QUICKSTART GUIDE

Page 24: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

22. Change to boundary condition specificationmode by clicking on the mode button.

23. In the Boundary Settings dialog box, first select all boundaries and set all conditions toEdge loadswith a value of zero, 0.

STRUCTURAL MECHANICS EXAMPLE - THIN PLATE WITH HOLE | 21

Page 25: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

24. Then select the le boundary (number 3 in this case) in the le hand side Boundarieslist box and select Fixed displacement, u and zero Edge load, y-dir.. This will fix the x-displacement of this boundary.

25. Continue by selecting boundary 5, the bottom boundary, and choose a zero Edge load,x-dir. and Fixed displacement, v boundary conditions. This similarly fixes the lowerboundary.

22 | QUICKSTART GUIDE

Page 26: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

26. Lastly, select both Edge load boundary conditions for the right boundary (number 1). Setthe edge load in the x-direction on this boundary to load, which will be evaluated fromthe expression we entered earlier. Finish by clicking theOK button.

STRUCTURAL MECHANICS EXAMPLE - THIN PLATE WITH HOLE | 23

Page 27: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

27. Now that the problem is fully specified, press the mode button to switch to solvemode. Then press the button with an equals sign in the Tools toolbar frame to call thesolver with the default solver settings.

28. Aer the problem has been solved FEATool will automatically switch to postprocessingmode and display the computed von Mieses stress. To change the plot, open the post-

processing settings dialog box by clicking on the Postprocessing settings button inthe Tools toolbar frame.

24 | QUICKSTART GUIDE

Page 28: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

29. In the Postprocessing settings dialog box choose to plot the Stress, x-component forboth the surface and contour plots.

STRUCTURAL MECHANICS EXAMPLE - THIN PLATE WITH HOLE | 25

Page 29: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

30. We can see that the solution for the stress is not smooth. This is due to the fact that stressis a function of derivatives of the displacements (the solution variables) and a linear so-lution approximation is used per default, this means that stresses will be representedas piecewise constant functions. We can improve on this by going back to the Equationspecification mode.

31. Select P2/Q2 second order conforming for the finite element shape function specifica-tion and Solve the problem again.

26 | QUICKSTART GUIDE

Page 30: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

32. Nowwecan see that theplotted stress is smoothand themaximumvalue is slightly above3∗107 which is the expected solution.

33. Saving the model can be done from the File menu. Save As... allows you to save themodel in binary (.fea) format which can be loaded into the GUI again. Save As M-ScriptModel... allows you to save all FEATool function commands used tomake themodel as am-script file. This file can not be loaded into the GUI but inspected, modified, and run onthe command line as a script file.

STRUCTURAL MECHANICS EXAMPLE - THIN PLATE WITH HOLE | 27

Page 31: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1.4.2 Thin Plate with Hole using the CLIThe process to set up and solve the thin plate with hole example problem on the command lineinterface is illustrated in theex_planestress1 script filewhichcanbe found in theexamplesdirectory. Moreover, if you export the model using the Save As M-Script Model... option thenone can easily see exactly which FEATool functions and commands are used to build themodel.

28 | QUICKSTART GUIDE

Page 32: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1.5 Multiphysics Example - Heat ExchangerThis example illustrates the multiphysics capabilities of FEATool with a simple heat exchangermodel featuring both free and forced convection. Themodel consists of a series of heated pipesaround which there is a lower temperature fluid flowing. Two kinds of physics are considered,fluid flow which is modeled by the Navier-Stokes equations and heat transport modeled by aconvection and conduction equation for the temperature field. The Boussinesq approximationmodels the temperature eects on the fluid, and the flow field is coupled to and transports thetemperature field. In this way the system is fully two way coupled, the fluid to the temperatureand temperature to the fluid.

outflow

inflowT=Tcold

T=Thot

Due to symmetry it is enough to study a two dimensional slice between the heated pipes.The geometry will therefore consist of a 0.0075 by 0.05m rectangle with a half circle removed(with radius 0.003m centered at (0, 0.02)). The mechanism for heating the pipes are not takenin consideration and are thus assumed to be at a fixed temperature of Th=330 K. A cooling fluid

MULTIPHYSICS EXAMPLE - HEAT EXCHANGER | 29

Page 33: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

flows from the bottom to the top and has an inlet temperature of Th=300 K. The other modelparameters can be found in the following model description.

1.5.1 Heat Exchanger using the GUI

This section describes how to set up and solve the heat exchanger example with the FEAToolgraphical user interface (GUI).

1. Start Octave/Matlab, and if you have not run the installation script (which automaticallyadds the FEATool directory paths at startup) then change yourworkingdirectory towhereyour FEATool installation is, for example

cd C:\featool

2. In the command window type

featool

to start the graphical user interface (GUI).

30 | QUICKSTART GUIDE

Page 34: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

3. Either select New... from the Filemenu, or click on the NewModel button in the up-per horizontal toolbar, to clear all data and start defining a newmodel.

MULTIPHYSICS EXAMPLE - HEAT EXCHANGER | 31

Page 35: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

4. In the opened New Model dialog box, click on the 2D radio button in the Select Space Di-mensions frame, and selectNavier-Stokes Equations from the Select Physics drop-downlist. Leave the space dimension and dependent variable names to their default values.Finish and close the dialog box by clicking on theOK button.

5. To define the geometry, first create a rectangle by clicking on the Create square/rectan-gle button in the le hand side Tools toolbar frame.

32 | QUICKSTART GUIDE

Page 36: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

6. Then le click in themainplot axeswindow, hold themousebutton, andmove themousepointer to draw a rectangle.

MULTIPHYSICS EXAMPLE - HEAT EXCHANGER | 33

Page 37: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

7. Release themousebutton to finalize and create a solid geometry object. The object prop-erties must now be edited to set the correct size and position of the rectangle. To do this,click on the rectangle R1 to select it and highlight it in red. Then click on the Inspect/editselected geometry object toolbar button

8. Change the minimum and maximum x-coordinates to 0 and 0.0075, respectively. Alsochange the y-dimensions to span between 0 and 0.05. PressOK to finish editing the rect-angle properties.

34 | QUICKSTART GUIDE

Page 38: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

9. In a similar way, create a circle centered at (0, 0.02) with a radius of 0.003.

10. To create the final geometry select both the rectangle and circle so they are highlightedin red (either by directly clicking on themor selecting them in the Selection list box). Then

MULTIPHYSICS EXAMPLE - HEAT EXCHANGER | 35

Page 39: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

click on theSubtract geometry objectsbutton to subtract the smaller circle from thelarger rectangle.

11. Switch toGridmode by clicking on the corresponding mode toolbar button. Enter0.001 in the Grid Size parameter edit field and click on the Generate unstructured gridbutton to automatically generate a grid.

36 | QUICKSTART GUIDE

Page 40: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

12. Press the modebutton in theMode toolbar to change tophysics and equation/sub-domain specificationmode. In the Equation Settings dialog box that automatically opensenter the followingcoeicients, rho for thedensity,mu for theviscosity, andalpha∗g∗rho∗(T-Tc) for the volume force in the y-direction.

MULTIPHYSICS EXAMPLE - HEAT EXCHANGER | 37

Page 41: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

13. We now have to add a heat transfer physics mode. To access the multiphysics selectionand add another physicsmode press the plus + tab and selectHeat Transfer from the Se-lect Physics drop down list. Add the selection by pressing the Add Physics>>> button.

38 | QUICKSTART GUIDE

Page 42: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

14. In the Equation Settings ht tab, set the density ρ , specific heatCp, and heat conductivityk to rho, cp and k, respectively. The convective velocities should be coupled from theNavier-Stokes equations physicsmode, to do this enter u and v in the corresponding editfields (as these are the default names of the dependent variables for the velocities). PressOK to finish with the equation specifications.

MULTIPHYSICS EXAMPLE - HEAT EXCHANGER | 39

Page 43: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

15. The values of the specified coeicients must now be prescribed. Click on theModel Con-stants and Expressions button to open the corresponding dialog box.

40 | QUICKSTART GUIDE

Page 44: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

16. Enter thevalues shownbelow in theModelConstantsandExpressionsdialogbox. Spacefor more constants can be made by clicking to the Add Row button. PressOK to finish.

17. Switch to boundary condition specification mode by clicking on the mode but-ton. First select the ns tab, which corresponds to the boundary conditions prescribedto the Navier-Stokes equations physics mode. Then select all vertical boundaries (here2, 4, and 7). Choose Symmetry/slip, x-direction from the drop down box. Switch to theheat transfer physics mode by selecting clicking on the ht tab and select Thermal insu-lation/symmetry boundary conditions.

MULTIPHYSICS EXAMPLE - HEAT EXCHANGER | 41

Page 45: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

18. Now continue with the top boundary (number 3) which is the outflow. Select Outflow/-pressure for the Navier-Stokes physics mode and Convective flux/outflow for the heattransfer mode.

42 | QUICKSTART GUIDE

Page 46: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

19. The bottom boundary (number 1) is the inflow and should be prescribed with the con-stant velocity uin in the y-direction by using the Inlet/velocity condition. The Tempera-ture should here be fixed to Tc, the lower temperature.

20. Lastly, the boundaries on the cylinder (5 and 6) are walls and should be prescribed withWall/no-slip boundary conditions for the velocity. For the Temperature a constant hightemperature of Th should be prescribed. Press OK to finish prescribing boundary condi-tions.

MULTIPHYSICS EXAMPLE - HEAT EXCHANGER | 43

Page 47: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

21. Now that the problem is fully specified, press the mode button to switch to solvemode. Then press the button with an equals sign to start the solution process.

22. Aer the problem has been solved FEATool will automatically switch to postprocessingmode and display the computed solution. We can see the the velocity will be acceler-ated when passing between the cylinders. Open the postprocessing settings dialog box

by clicking on the Postprocessing settings button and select to view the Tempera-ture, T.

44 | QUICKSTART GUIDE

Page 48: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

23. We can clearly see how the fluid is heated around the hot cylinder and follows the flowupwards. FEATool Multiphysics and Professional also allows advanced postprocessingsuch as boundary integration. By integrating the expression T/w (where w is the width0.0075 of the domain) we eectively calculate the mean temperature and can see that atthe outflow the temperature has risen by about 1.5 degrees.

MULTIPHYSICS EXAMPLE - HEAT EXCHANGER | 45

Page 49: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1.5.2 Heat Exchanger using the CLIThe process to set up and solve the heat exchangermultiphysics problemon the command lineinterface is illustrated in theex_heat_exhanger1 script filewhich canbe found in the exam-ples directory. Moreover, you can also export the model using the Save As M-Script Model...option and see exactly which FEATool commands are used in building the model.

46 | QUICKSTART GUIDE

Page 50: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1.6 Equation Editing Example - AxisymmetricFluid Flow

FEATool is designed to be able to perform complexOctave andMatlabmultiphysics simulationsin arbitrary dimensions (1D, 2D, and 3D). However, running full 3D simulations oen requires asignificant amount of computational resources in the formofmemory and simulation time. It istherefore desirable to find simplifications to reduce simulations to two or even one dimensionif possible.

Problems which feature cylindrical and rotationally symmetric geometries and solutionscan be reduced to two dimensions through a cylindrical or axisymmetric coordinate transfor-mation (also referred to 2.5D). A symmetry axis, usually r=0, is taken as reference aroundwhichthe coordinates and PDE operators (gradient and divergence) are transformed. In this way thegoverning equations will be reduced to 2D while representing a rotationally symmetric threedimensional problem.

This examplemodels fluid flow in a narrowing pipe section. The constriction of the pipewillaccelerate the flow according to the venturi eect. As the fluid is assumed to be both laminarand isothermal the problem is governed by the incompressible Navier-Stokes equations. Forscalar equations like the convection and diusion, and heat transfer equations axisymmetrictransformation simply results in a multiplication of the equation with the radial coordinate. Inthis case the vector valued equations results in additional terms compared to the usual Carte-sian case

rρ∂u∂ t− rµ(2

∂ 2u∂ r2 +

∂ 2u∂ z2 +

∂ 2v∂ r∂ z

)+ rρ(u∂u∂ r

+ v∂u∂ z

)+ r∂ p∂ r

+2µur= 0

rρ∂v∂ t− rµ(

∂ 2v∂ r2 +

∂ 2u∂ z∂ r

+2∂ 2v∂ z2 )+ rρ(u

∂v∂ r

+ v∂v∂ z

)+ r∂ p∂ z

= 0

u+ r∂u∂ r

+ r∂v∂ z

= 0

In addition tomodifying theequationsanappropriateboundary condition for the symmetryboundary must be chosen. A homogeneous Neumann insulation/symmetry condition is typi-cally employed for scalar equations, but in the case of fluid flow a slip condition preventing anyradial velocity u(r=0)=0while allowing axial velocity is appropriate.

The geometry of the problem considers a 2:1 constriction with an initial pipe diameter of 2.The inlet velocity is assumed to be uniform v(z=0)=1 and the fluid has a density of ρ = 1 andviscosity µ = 0.05. This results in a laminar Reynolds number of Re = ρUd

µ= 40.

EQUATION EDITING EXAMPLE - AXISYMMETRIC FLUID FLOW | 47

Page 51: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

zoutflow

r

inflow

symmetry axis

48 | QUICKSTART GUIDE

Page 52: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1.6.1 Axisymmetric Fluid Flow using the GUIThis section describes how to set up and solve the axisymmetric flow problemwith the FEAToolgraphical user interface (GUI). Although FEATool does not feature predefined physics modesfor axisymmetric coordinate systems, this example shows how one can use the edit equationsfeature to modify the built in equations and accommodate these transformations.

1. Start Octave/Matlab, and if you have not run the installation script (which automaticallyadds the FEATool directory paths at startup) then change yourworkingdirectory towhereyour FEATool installation is, for example

cd C:\featool

2. In the command window type

featool

to start the graphical user interface (GUI).

3. Either select New... from the Filemenu, or click on the NewModel button in the up-per horizontal toolbar, to clear all data and start defining a newmodel.

EQUATION EDITING EXAMPLE - AXISYMMETRIC FLUID FLOW | 49

Page 53: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

4. In the opened New Model dialog box, click on the 2D radio button in the Select Space Di-mensions frame, and selectNavier-Stokes Equations from the Select Physics drop-downlist. Change the space dimension names to r and z but leave the dependent variablenames to their default values. Finish and close the dialog box by clicking on the OK but-ton.

5. Use the Create square/rectangle button in lower le toolbar to create two rectan-gles. Put one on top of the other with their le edges aligned with the z-axis (r=0). Thelower one should have dimensions 1 x 2 and the upper one 0.5 x 1. Also create a circle withradius 0.5 centered at (1, 2).

50 | QUICKSTART GUIDE

Page 54: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

6. To create the compoundgeometry, selectCombineObjects... from theGeometrymenu.Enter the formula R1 + R2 - E1 in the edit field of the Combine Geometry Objects dialogbox and pressOK.

EQUATION EDITING EXAMPLE - AXISYMMETRIC FLUID FLOW | 51

Page 55: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

7. Press the mode button in theMode toolbar to switch from geometrymode to gridgenerationmode. To change the target grid size, enter 0.1 in the Grid Size edit field. Thenclick on theGenerate unstructured grid button to call the automatic grid generationfunction.

8. Change to physics and equation/subdomain specification mode by pressing thebutton. In the Equation Settings dialog box that automatically opens, set the density ρ to1, viscosity µ to 5e-2, and the source terms to zero.

52 | QUICKSTART GUIDE

Page 56: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

9. The equations must now be changed from a Cartesian to cylindrical coordinate system.To do this press the edit eqn button next to the equation description. This will bring upthe Edit Equations dialog box and show the currently defined partial dierential equa-tions. Change the equations to the following

- r*miu_ns*(2*ur_r + uz_z + vr_z) + r*rho_ns*(u*ur_t + v*uz_t)+ r*p_r + 2*miu_ns*u/r - p = 0- r*miu_ns*(vr_r + uz_r + 2*vz_z) + r*rho_ns*(u*vr_t + v*vz_t)+ r*p_z = 0

u_t + r*ur_t + r*vz_t = 0

PressOK to finish with the equation and subdomain specifications.

EQUATION EDITING EXAMPLE - AXISYMMETRIC FLUID FLOW | 53

Page 57: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

10. Switch to boundary condition specificationmode by clicking on the mode button.In theBoundary Settingsdialog box, first select all boundaries in the le hand sideBound-aries list box and choose theWall/no-slip boundary conditions from the drop-down list.Now select the lower inflowboundary (here number 1) in the lehand sideBoundaries listbox and choose the Inlet/velocity boundary condition from the drop-down list. Enter of1 in the edit field for the z-velocity coeicient vo.

54 | QUICKSTART GUIDE

Page 58: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

11. Select the top outflow boundary (number 5) in the le hand side Boundaries list box andchoose the Neutral outflow/stress boundary boundary condition from the drop-downlist (alternatively one can also prescribe a pressure po with theOutflow/pressure condi-tion).

12. Lastly, select the le side boundaries (here number 3 and 6) and select the Symmetry/s-lip, r-direction boundary condition from the drop-down list which will prevent flow inthe radial direction while allowing it in the axial direction. Finish by clicking the OK but-ton.

EQUATION EDITING EXAMPLE - AXISYMMETRIC FLUID FLOW | 55

Page 59: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

13. Now that theproblemhasbeen set up, press the modebutton to go to solvemode.

Then press the Solver Settings button . IncreaseMaximum non-linear iterations to100 and set the Non-linear relaxation parameter to 0.8 in the Non-Linear Solver Settingsframe to relax the convergence of the solver. Press Apply and then Solve to start the so-lution process.

56 | QUICKSTART GUIDE

Page 60: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

14. Aer the problem has been solved FEATool will automatically switch to postprocessingmode and display the computed solution. We can see that the velocity field is signifi-cantly accelerated by the pipe constriction.

EQUATION EDITING EXAMPLE - AXISYMMETRIC FLUID FLOW | 57

Page 61: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

15. It is also possible to study a section of the velocity profile by using thePoint/Line Evalua-tion... feature from thePostmenu (availablewith FEAToolMultiphysics and Professionallicenses). By entering a series of coordinates to examine we get both the values and across section plot of the evaluation expression. In this case the velocity profile close tothe outlet at z=2.8 is starting to shi from parabolic to a more square profile indicating ahigher velocity flow and we might need to study a longer outflow section to recover theexpected parabolic laminar flow profile.

1.6.2 Axisymmetric Fluid Flow using the CLIThe process to set up and solve this fluid flow problem on the command line interface is illus-trated in the ex_navierstokes8 script file which can be found in the examples directory.Alternatively, one can also use the Save As M-Script Model... feature to get an equivalent Mat-lab script file for all the corresponding CLI commands that has been executed by the GUI.

58 | QUICKSTART GUIDE

Page 62: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1.7 Classic Equation Example - PoissonEquation with a Point Source

TheclassicPoissonequation isoneof themost fundamentalpartial dierential equations (PDEs).Although one of the simplest equations, it is a very goodmodel for the process of diusion andcomesupagain andagain inmanyapplications suchas in fluid flow, heat transfer, and chemicaltransport.

This example shows how to up and solve the Poisson equation

dts∂u∂ t

+∇ · (−D∇u) = f (1)

for a scalar field u = u(x) on a circle Ω with radius r = 1 in two dimensions. The diusioncoeicient D = 1 and right hand side source term f = δ (0,0) which prescribes a point sourceat the center. The Poisson problem is also considered stationary meaning the time dependentterm can be neglected. With these assumptions equation (1) simplifies to

−∆u = δ (0,0).

Moreover, homogeneous Dirichlet boundary conditions are prescribed on all boundaries ofthedomain, that is u= 0 on ∂Ω. The exact solution for this problem is u(x,y) =− 1

2πlog(r)which

can be used to measure the accuracy of the computed solution.

1.7.1 Poisson Equation with a Point Source using theGUI

This section describes how to set up and solve the Poisson equation (1) with the FEATool graph-ical user interface (GUI) which is available when using FEATool together with Octave version 4.0or later and Matlab.

1. Start Octave/Matlab, and if you have not run the installation script (which automaticallyadds the FEATool directory paths at startup) then change yourworkingdirectory towhereyour FEATool installation is, for example

CLASSIC EQUATION EXAMPLE - POISSON EQUATIONWITH A POINT SOURCE | 59

Page 63: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

cd C:\featool

2. In the command window type

featool

to start the graphical user interface (GUI).

3. Either select New... from the Filemenu, or click on the NewModel button in the up-per horizontal toolbar, to clear all data and start defining a newmodel.

4. In the opened New Model dialog box, click on the 2D radio button in the Select SpaceDimensions frame, and select Poisson Equation from the Select Physics drop-down list.Leave the space dimension and dependent variable names to their default values. Finishand close the dialog box by clicking on theOK button.

60 | QUICKSTART GUIDE

Page 64: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

5. To create a circle, first le click on the Create circle/ellipse button in the le handside Tools toolbar frame.

CLASSIC EQUATION EXAMPLE - POISSON EQUATIONWITH A POINT SOURCE | 61

Page 65: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

6. Then click and hold the le mouse button anywhere in the main plot axes window, andmove the mouse pointer to show red outlines of a circle or ellipse. Release the button tofinalize and create a solid geometry object.

7. The object properties must be changed to make a circle with radius 1 centered at the ori-gin. Todo this, clickon theellipseE1 to select itwhichalsohighlights it in red (alternativelyyou select it by clicking on R1 in the selection list box under the le side toolbar buttons).

Then click on the Inspect/edit selected geometry object toolbar button

62 | QUICKSTART GUIDE

Page 66: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

8. In the opened Geometry Object dialog box change the center coordinates edit field 0 0,and the x radius and y radius to 1 in the corresponding fields. Finish editing the geometryobject and close the dialog box by clickingOK.

CLASSIC EQUATION EXAMPLE - POISSON EQUATIONWITH A POINT SOURCE | 63

Page 67: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

9. To define a point select Add Point... from the Geometrymenu. This opens a dialog boxwhere you can define a new point. Enter 0 0 in the Point Coordinates edit field and pressOK to add the point P1 to the center. This point will ensure that we will have a grid pointin the center where constraints can be prescribed.

10. Press the mode button in theMode toolbar to switch from geometrymode to gridgeneration mode.

64 | QUICKSTART GUIDE

Page 68: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

11. Click on the Generate unstructured grid button to call the grid generation functionwhich automatically generates a grid of triangles for the circle.

CLASSIC EQUATION EXAMPLE - POISSON EQUATIONWITH A POINT SOURCE | 65

Page 69: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

12. Press the mode button in the Mode toolbar to switch from grid mode to physicsand equation/subdomain specification mode.

13. In the Equation Settings dialog box that automatically opens, set the diusion coeicientD to 1 and source term coeicient f to 0 in the corresponding edit fields. All other coei-cients can be le to their default values. PressOK to finish and close the dialog box.

66 | QUICKSTART GUIDE

Page 70: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

14. To add the point source select Add Point Sources... the from the Equationmenu, andenter 1 in the corresponding edit field for thepoint in the center (in this casepoint number3). PressOK to finish.

CLASSIC EQUATION EXAMPLE - POISSON EQUATIONWITH A POINT SOURCE | 67

Page 71: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

15. Switch to boundary condition specificationmode by clicking on the mode button.

16. In theBoundary Settings dialog box, select all boundaries in the le hand sideBoundarieslist box and chooseDirichlet boundary condition in the drop-down list. Set the Dirichletboundary coeicient r equal to 0 in theBoundary Coeicients frame and finish by clickingonOK.

68 | QUICKSTART GUIDE

Page 72: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

17. Now that the problem is fully specified, press the mode button to switch to solvemode. Then press the button with an equals sign in the Tools toolbar frame to call thesolver with the default solver settings.

CLASSIC EQUATION EXAMPLE - POISSON EQUATIONWITH A POINT SOURCE | 69

Page 73: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

18. Aer the problem has been solved FEATool will automatically switch to postprocessingmode and display the computed solution. To change the plot, open the postprocessing

settings dialog box by clicking on the Postprocessing settings button in the Toolstoolbar frame.

19. ActivateHeight plot bymarking the corresponding check boxes and pressOK or Apply toshow how the solution looks like in three dimensions. We can clearly see how the centralpoint source results in a spike in the solution.

70 | QUICKSTART GUIDE

Page 74: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

20. By returning to the Postprocessing settings dialog box and entering the expressionu+1/2/pi∗sqrt(x∧2+y∧2) in the Surface Plot expression edit field it is possible to plot andvisualize the dierence between the computed and exact reference solution. We can seethat the largest errors are found in the center due to the coarse grid. To improve the ac-curacy one should ideally create a grid that is locally refined around the central point.

CLASSIC EQUATION EXAMPLE - POISSON EQUATIONWITH A POINT SOURCE | 71

Page 75: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1.7.2 Poisson Equation with a Point Source using theCLI

The process to set up and solve this Poisson problem on the command line interface is illus-trated in the ex_poisson7 script file which can be found in the examples directory.

72 | QUICKSTART GUIDE

Page 76: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1.8 Custom Equation Example - WaveEquation on a Circle

This section explains how to set up and solve a generalized wave equation model. The waveequation is a hyperbolic partial dierential equation (PDE) of the form

∂ 2u∂ t2 = c∆u+ f

where c is a constant defining the propagation speed of waves, and f is a source term. Thisequation cannot be solved as it reads due to the second order time derivative. However, theproblem can be transformed by reformulating the wave equation as two coupled parabolicPDEs, that is

∂u∂ t = v∂v∂ t = c∆u+ f

This dual coupled problem can easily be implemented in FEATool with the customequationfeature. An example of the wave equation on a unit circle, with zero boundary conditions, con-stant c = 1, source term f = 0, and initial condition u(t = 0) = 1− (x2 + y2) is described in thefollowing

1.8.1 Wave Equation using the GUIThis section describes how to set up and solve the wave equation with the FEATool graphicaluser interface (GUI) which is available when using FEATool together with Octave version 4.0 orlater and Matlab.

1. Start Octave/Matlab, and if you have not run the installation script (which automaticallyadds the FEATool directory paths at startup) then change yourworkingdirectory towhereyour FEATool installation is, for example

cd C:\featool

CUSTOM EQUATION EXAMPLE - WAVE EQUATION ON A CIRCLE | 73

Page 77: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

2. In the command window type

featool

to start the graphical user interface (GUI).

3. Click on theNewProblem button in the upper horizontal toolbar to clear all data andstart defining a new problem.

4. In the opened New Problem dialog box, click on the 2D radio button in the Select SpaceDimensions frame, and select Custom Equation from the Select Physics drop-down list.Leave the space dimension as it is but change the dependent variable names to u v (Thecustom equation physics mode allows for entering an arbitrary number of dependentvariables through the use of a space separated list). This will add two equations for uand v, respectively. Finish and close the dialog box by clicking on theOK button.

74 | QUICKSTART GUIDE

Page 78: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

5. To create a circle, first le click on the Create circle/ellipse button in the le handside Tools toolbar frame.

CUSTOM EQUATION EXAMPLE - WAVE EQUATION ON A CIRCLE | 75

Page 79: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

6. Then click and hold the le mouse button anywhere in the main plot axes window, andmove the mouse pointer to show red outlines of a circle or ellipse. Release the button tofinalize and create a solid geometry object.

7. The object properties must be changed to make a circle with radius 1 centered at the ori-gin. To do this, click on the ellipse E1 to select it which also highlights it in red. (Alter-natively you select it by clicking on R1 in the selection list box under the le side toolbar

buttons.)Then click on the Inspect/edit selected geometry object toolbar button

76 | QUICKSTART GUIDE

Page 80: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

8. In the opened Geometry Object dialog box change the center coordinates edit field 0 0,and the x radius and y radius to 1 in the corresponding fields. Finish editing the geometryobject and close the dialog box by clickingOK.

CUSTOM EQUATION EXAMPLE - WAVE EQUATION ON A CIRCLE | 77

Page 81: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

9. Press the mode button in theMode toolbar to switch from geometrymode to gridgeneration mode.

10. Click on the Generate unstructured grid button to call the grid generation functionwhich automatically generates a grid of triangles for the circle.

78 | QUICKSTART GUIDE

Page 82: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

11. Press the mode button in the Mode toolbar to switch from grid mode to physicsand equation/subdomain specification mode.

CUSTOM EQUATION EXAMPLE - WAVE EQUATION ON A CIRCLE | 79

Page 83: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

12. An Equation Settings dialog box will now automatically open. Set the initial condition foru, u0 to 1-(x∧2+y∧2). Then click on the edit eqn button.

13. In the Edit Equations dialog box enter the equations u’ - v_t = 0 and v’ + c∗(ux_x + uy_y)= 0 in the corresponding edit fields for u and v. Here u and v are the dependent variables,u’/v’ denote the corresponding time derivative, and an underscore will treat it implicitlyin the weak finite element formulation (for example v_t corresponds to vmultiplied withthe test function for u, and ux_x is analogous to du/dx∗dv_t/dx). Note, that the first equa-tion could also be implemented as u’ = v but then v would be evaluated explicitly in theright hand side, and by transferring it to the implicit le hand side matrix we will get alinear problemwhich is more eicient to solve. PressOK and close the equation settingsdialog boxes.

80 | QUICKSTART GUIDE

Page 84: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

14. Click on the Model Constants and Expressions button and enter a new constantnamed cwith value 1 (This is the constant used in diusion term of the v equation). PressOK to finish.

CUSTOM EQUATION EXAMPLE - WAVE EQUATION ON A CIRCLE | 81

Page 85: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

15. Switch to Boundary condition specification mode and set Dirichlet conditions with pre-scribed value 0 on all boundaries.

16. Change toSolvemodeandopen theSolverSettingsdialogbox. Choose theTime-Dependentsolver and also set the time step to 0.05. Press Apply and Solve to start the solution pro-cess.

82 | QUICKSTART GUIDE

Page 86: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

17. Once the solver has finished the solution at the final time step will be displayed. In thePostprocessing Settings dialog box it is also possible to select and visualize the solutionat dierent times.

CUSTOM EQUATION EXAMPLE - WAVE EQUATION ON A CIRCLE | 83

Page 87: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1.8.2 Wave Equation using the CLIThe process to set up and solve thewave equation problem on the command line interface is il-lustrated in theex_waveequation1 script file which can be found in the examples directory.

84 | QUICKSTART GUIDE

Page 88: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide

1.9 More Examples and InformationAdditional m-script command line examples and can also be found in the featool/exam-ples directory. Also bookmark the FEATool news and blog page where tips and tutori-als are posted.

MORE EXAMPLES AND INFORMATION | 85

Page 89: FEATool Multiphysics Matlab FEM and CFD Toolbox - v1.6 Quickstart Guide