Skip to content

Quadrature order and faces shapes #111

@mancellin

Description

@mancellin

When meshing the boundary with triangles, setting qorder=1 gives me a quadrature with one quadrature point per face.
When meshing the boundary with quadrilaterals, setting qorder=1 gives me 4 points per face.
That is a bit counterintuitive to me. Is it on purpose?

using Inti, Gmsh

const gmsh = Gmsh.gmsh
const mesh_file = "/tmp/generated_mesh.msh"

function generate_cylinder_mesh(radius, h, resolution; triangles=true)
    gmsh.initialize()
    gmsh.model.add("disk_with_thickness")
    gmsh.option.setNumber("Mesh.CharacteristicLengthMin", resolution)
    gmsh.option.setNumber("Mesh.CharacteristicLengthMax", resolution)
    cyl = gmsh.model.occ.addCylinder(0.0, 0.0, 0.0, 0.0, 0.0, h, radius)
    gmsh.model.occ.synchronize()
    if !triangles
        gmsh.model.mesh.setRecombine(2, cyl)
        gmsh.option.setNumber("Mesh.RecombineAll", 1)
    end
    gmsh.model.mesh.generate(2)
    gmsh.write(mesh_file)
    gmsh.finalize()

    msh = Inti.import_mesh(mesh_file)
    Ω = Inti.Domain(e -> Inti.geometric_dimension(e) == 3, msh)
    Γ = Inti.boundary(Ω)
    return msh[Γ]
end

triangle_mesh = generate_cylinder_mesh(1.0, 1.0, 0.1, triangles=true)
triangle_quadra = Inti.Quadrature(triangle_mesh; qorder=1)
println(length(triangle_quadra))  # = number of elements in triangle_mesh

quadri_mesh = generate_cylinder_mesh(1.0, 1.0, 0.1, triangles=false)
quadri_quadra = Inti.Quadrature(quadri_mesh; qorder=1)
println(length(quadri_quadra))  # = 4 times the number of elements in quadri_mesh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions