r. white, comsol acoustics introduction,...

Download R. White, Comsol Acoustics Introduction, 2/25/08emerald.tufts.edu/~rwhite07/PRESENTATIONS_REPORTS/comsol.pdf · R. White, Comsol Acoustics Introduction, 2/25/08 Finite Element Analysis

If you can't read please download the document

Upload: tranhuong

Post on 06-Feb-2018

223 views

Category:

Documents


3 download

TRANSCRIPT

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    Finite Element Analysis (FEA / FEM)

    Numerical Solution of Partial Differential Equations (PDEs).

    1. PDE representing the physics.

    2. Geometry on which to solve the problem.

    3. Boundary conditions (for static or steady state problems) and initial

    conditions (for transient problems).

    domain

    - boundary

    (or )

    Unknowns e.g. u(x,y,z)

    x

    y

    The Mathematical Problem:

    Independent

    Variables

    space and time

    (x,y,z,t)

    Dependent

    Variables

    unknown field

    (such as u)

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    Finite Element Analysis (FEA / FEM)

    Boundary Conditions. On each boundary you must specify either:

    1) The dependent variable itself (e.g. u) Essential Boundary

    Condition or Dirichlet Boundary Condition

    2) The derivative of the variable itself (e.g. du/dn) Natural Boundary

    Condition or Neumann Boundary Condition

    3) The relationship between the dependent variable and its normal

    derivative (e.g. du/dn=(1/z)u)).

    domain

    - boundary

    (or )

    Unknowns e.g. u(x,y,z,t)

    x

    y

    The Mathematical Problem:

    Independent

    Variables

    space and time

    (x,y,z,t)

    Dependent

    Variables

    unknown field

    (such as u)

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    Finite Element Analysis (FEA / FEM)

    1) Discretization of the space into pieces (the elements) this is called

    the Mesh.

    2) Choice of element type - shape (triangle, quadrilateral, etc.),

    number of nodes (3, 4, 5, 8, etc.) and shape function (linear,

    quadratic, etc.).

    3) Choice of solver (direct, iterative, preconditioning).

    4) Post-processing looking at the solution in various ways.

    The Finite Element Part:

    The shape is

    now meshed

    with triangle

    elements.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    So, this is always the sequence for any FEA problem:

    1. Decide on the representative physics (choose the PDE).

    2. Define the geometry on which to solve the problem.

    3. Set the material properties that is, all the constants that appear

    in the PDE.

    4. Set the boundary conditions (for static or steady state problems)

    and initial conditions (for transient problems).

    5. Choose an element type and mesh the geometry.

    6. Choose a solver and solve for the unknowns.

    7. Post-process the results to find the information you want.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    Finite Element Packages - Here are some of the common ones

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    Comsol Multiphysics (a.k.a. FemLab)

    - More recent than Ansys,

    Nastran, Abaqus.

    - Integrates well with Matlab

    (uses Matlab syntax too).

    - Focuses on Multiphysics

    coupling different physics

    together (e.g. acoustics and

    solid mechanics).

    - Highly flexible allows you to

    program in your own

    differential equations if they

    are not already impelemented.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    1. Decide on the representative physics (choose the PDE).

    2. Define the geometry on which to solve the problem.

    COMSOL Here we go!!

    I will focus on acoustics as an application, but the steps are very similar

    for other kinds of physics.

    Choose how many dimensions

    to work in. Warning: 3D is

    usually a large computational

    problem, avoid if at all

    possible!!

    Choose your type of physics.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    1. Decide on the representative physics (choose the PDE).

    2. Define the geometry on which to solve the problem.

    I have selected 2D (will solve

    the problem in assuming no

    variation in the z-direction).

    I have selected time-harmonic

    acoustics time-harmonic means

    single frequency we are

    assuming time dependence ejt.

    0

    2

    2 =

    + p

    cp

    0

    112

    00

    =

    +

    p

    cp

    Constant

    density

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    2. Define the geometry on which to solve the problem.

    I drew three rectangles using the

    Draw|Specify Objects Tool

    Draw menu : draw

    points, curves, and

    2D objects (in 3D you

    will have 3D tools)

    Boolean operations

    let you subtract,

    add, etc.

    Default units are mks units (SI units).

    You can change units under Physics

    | Model Settings

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    GO BUILD YOURSELF SOME GEOMETRY! DONT MAKE IT TOO

    COMPLEX BE REASONABLE

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    2. Define the geometry on which to solve the problem.

    For more

    complex

    geometry,

    you can

    import CAD

    data from file

    (DXF format

    works well)

    under

    File menu

    When you import DXF data, it will come

    in as a curve, not a solid. For instance, I

    drew this blob in Solidworks DWG editor,

    and exported it as Autocad 2004 DXF

    Ascii. Once it is imported into Comsol, I

    go to the Draw Menu and say Coerce

    To Solid and it turns the curve into a 2D

    solid.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    3. Set the material properties that is, all the constants that appear in the PDE.

    Go to subdomain settings under the Physics menu

    Each 2D

    object is a

    different

    subdomain

    Set the properties

    (density and

    wavespeed). They can

    be functions of x and y

    (and p if you want to

    make the problem

    nolinear)! Just use

    Matlab syntax.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    3. Set the material properties that is, all the constants that appear in the PDE.

    Go to scalar variables under the Physics menu

    Set any global

    variables in this case,

    we can set the frequency

    in Hz we are solving at,

    and the reference

    pressure used for

    displaying dB SPL

    (default is 20e-6 Pa).

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    4. Set the boundary conditions

    Go to Boundary Settings under the Physics menu

    For each boundary,

    choose a boundary

    condition.

    Internal Boundaries (boundaries between subdomains)

    are grayed out continuity of pressure and velocity will

    be enforced at the internal boundary.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    4. Set the boundary conditions

    Choices of boundary conditions (acoustics mode):

    1. Sound Hard Boundary Neumann condition; dp/dn = 0 (normal velocity = 0)

    2. Sound Soft Boundary Dirichlet condition; p = 0 (pressure release)

    3. Pressure Dirichlet condition; p=p0 (sets acoustic pressure amplitude)

    4. Normal Acceleration Neumann condition since Euler says dp/dn=-0an5. Impedance Condition set Z at the boundary (Z=p/un=-0jp/(dp/dn)) 6. Radiation Condition set a boundary that will not reflect normally incident plane

    waves. This is how you try to approximate an infinite space; only perfect if the

    incident wave is a perfect plane wave. You can include a source term in this

    condition to send in a plane wave at the boundary.

    For acoustics mode, we will be solving for

    the complex pressure p as a function of x,

    y. You can therefore use complex

    numbers for any of your pressure or

    velocity boundary conditions; these specify

    magnitude and phase.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    4. Set the boundary conditions

    Notes on Radiation Condition:

    - You want to use this if you are thinking of your problem extending off to infinity,

    but you dont want to mesh the problem.

    - If you are working in axisymmetric 2D mode or 3D mode you will have

    additional choices at the boundary to match spherical and cylindrical waves.

    - If you work on our research license (which includes the acoustics module), you

    have another choice for boundary conditions to simulate infinite spaces the

    Perfectly Matched Layer PLM.

    Notes on Symmetry:

    If you are working in one of the axisymmetric modes, you may specify a

    boundary as an axis of symmetry; the solution is revolved about the axis.

    If you are working in Cartesian coordinates and have a symmetric system, you

    can model only part of it (this can save a lot of computation time) often the

    symmetry boundary will act like a rigid wall; the derivative of pressure will be

    zero on the symmetry boundary.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    SET UP PHYSICS AND BOUNDARY CONDITIONS ON YOUR

    GEOMETRY

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    5. Choose an element type and mesh the geometry.

    These little triangle icons let you initialize the mesh

    (first one) refine the mesh (second one) and

    refine a portion of the mesh (third on). There are a

    lot more meshing tools under the Mesh menu.

    This is where you can change to quadrilaterals or

    bricks if you want. Triangles and tetrahedra are

    easier to mesh with, although sometimes bricks and

    quads may give better results.

    Keep in mind: 1. You need at least 5 elements per

    wavelength =c/f, so as your frequency goes up, you will need more elements! 2. If there are places in the

    model where you expect complex behavior, use a

    denser mesh in that region.

    You can set the

    element shape

    function order in

    Physics |

    Subdomain

    Settings.

    Default is

    quadratic which

    should be fine.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    6. Choose a solver and solve for the unknowns.

    Go to Solve | Solver

    Parameters to set

    up the solution.

    You have many

    solver

    choices the

    Direct solvers

    are usually

    more robust,

    but require

    more memory

    and may not

    work for large

    problems.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    6. Choose a solver and solve for the unknowns.

    The parametric solver is useful you can

    have Comsol solve the problem a number

    of times, each time varying a parameter.

    For acoustics, this might often be

    frequency. You can build up a frequency

    response function this way by solving the

    time harmonic problem multiple times.

    Adaptive mesh refinement is

    available the computer will

    try to change the mesh to

    reduce errors. I have not

    played with this.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    6. Choose a solver and solve for the unknowns.

    Click the equal sign

    to solve and hope

    for the best!!!!

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    7. Post-process the results to find the information you want.

    Please remember just

    because you get pretty

    colors does not mean

    the solution is correct!

    Be careful, please, when

    you are building the

    device which is

    supposed to save my

    life.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    7. Post-process the results to find the information you want.

    The Postprocessing |

    Plot Parameters

    menu lets you look at

    the results. If I did a

    parametric

    solve, I select

    which solution I

    want to view

    here.

    I have lots of

    choices for the

    kind of 2D plot

    to use.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    7. Post-process the results to find the information you want.

    These are the surface

    plot options.

    These are all the things it

    knows how to plot. I can

    also have it plot any

    computatoin involving these

    variables.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    Convergence - Mesh Refinement

    Here is what happens if I dont

    have enough elements to

    capture my high-frequency

    (short wavelength) solution

    the solution is not

    converged!!!!!!

    Watch out for this it is an

    easy mistake to make. Always

    do a convergence study, solve,

    then increase your mesh

    density, solve again, and make

    sure the solution does not

    change much.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    Convergence - Mesh Refinement

    Much better.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    7. Post-process the results to find the information you want.

    The Postprocessing |

    Domain Plot

    Parameters menu

    lets you look at the a

    result as a function of

    your parameterized

    variable.

    I am going to

    look at a the

    solution at a

    point for this

    range of values

    of freq_aco.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    I have defined the dB SPL here

    using a Matlab expression

    involving the solved-for complex

    pressure, p.

    7. Post-process the results to find the information you want.

    I am looking at the

    solution at two points

    that I created using the

    Draw menu.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    You can see the dB SPL on the other side

    of the barrier (green curve) is significantly

    below that on the upstream side. The

    difference is not TL or IL, since the

    upstream side includes both the incident

    and reflected waves!

    7. Post-process the results to find the information you want.

    Click here to send this

    data out to a text file so

    I load into Matlab or

    Excel.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    7. Post-process the results to find the information you want.

    I ran the Comsol computation

    twice, once with the

    intermediate layer having the

    same properties as the two

    other layers (this is the before

    insertion case) and then with

    the intermediate layer as a

    different layer (1cm thick

    plastic).

    I sent the results for the SPL at

    the two points in the two cases

    out to a text file, and loaded into

    Matlab. The Insertion Loss is

    the difference between the dB

    SPL on the far side of the

    barrier before and after it was

    inserted.

    102

    103

    104

    20

    25

    30

    35

    40

    45

    50

    55

    60

    65

    Frequency (Hz)

    IL (

    dB

    )

    Comsol Result

    Comsol - IL

    Analytic - TL

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    7. Post-process the results to find the information you want.

    If you want to get a

    cross-section plot at a

    line through your 2D

    model (or a plane

    through your 3D model)

    that can be achieved

    here.

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    WHENEVER YOU USE A NEW FEA

    SOLVER, SOLVE A PROBLEM YOU

    KNOW THE SOLUTION TO FIRST, TO

    MAKE SURE YOU ARE USING IT

    CORRECTLY!!!!!!!!!!

  • R. White, Comsol Acoustics

    Introduction, 2/25/08

    SOLVE AND PLAY WITH THE RESULTS