Skip to content

python_examples.ipynd Segmentation fault (core dumped) #1

@antonagafonov

Description

@antonagafonov

Hi,
Trying to run this piece of code from the example:

import meshplot as mp
import numpy as np
import polyfempy as pf

def create_quad_mesh(n_pts):
extend = np.linspace(0,1,n_pts)
x, y = np.meshgrid(extend, extend, sparse=False, indexing='xy')
pts = np.column_stack((x.ravel(), y.ravel()))

faces = np.ndarray([(n_pts-1)**2, 4],dtype=np.int32)

index = 0
for i in range(n_pts-1):
    for j in range(n_pts-1):
        faces[index, :] = np.array([
            j + i * n_pts,
            j+1 + i * n_pts,
            j+1 + (i+1) * n_pts,
            j + (i+1) * n_pts
        ])
        index = index + 1
        
return pts, faces

mesh_path = "plate_hole.obj"

settings = pf.Settings(
discr_order=1,
pde=pf.PDEs.LinearElasticity
)

settings.set_material_params("E", 210000)
settings.set_material_params("nu", 0.3)
problem = pf.Problem()
problem.set_x_symmetric(1)
problem.set_y_symmetric(4)
problem.set_force(3, [100, 0])
settings.problem = problem
solver = pf.Solver()

solver.settings(settings)
solver.load_mesh_from_path(mesh_path, normalize_mesh=False)

solver.solve()

pts, tets, disp = solver.get_sampled_solution()

the error is:

(PolyFEM) aa@aa:/Documents/GitHub/polyfem/polyfem.github.io/docs$ python python_example.py
[2023-01-24 10:34:18.524] [polyfem] [info] Loading mesh...
[2023-01-24 10:34:18.524] [geogram] [info] Loading file plate_hole.obj...
[2023-01-24 10:34:18.529] [geogram] [info] (FP64) nb_v:8549 nb_e:0 nb_f:16797 nb_b:299 tri:1 dim:3
[2023-01-24 10:34:18.529] [geogram] [info] Attributes on vertices: point[3]
[2023-01-24 10:34:18.533] [polyfem] [info] mesh bb min [0, 0], max [1, 0.500001]
[2023-01-24 10:34:18.534] [polyfem] [info] took 0.00976s
[2023-01-24 10:34:18.534] [polyfem] [info] simplex_count: 16797
[2023-01-24 10:34:18.534] [polyfem] [info] regular_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] regular_boundary_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] simple_singular_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] multi_singular_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] boundary_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] multi_singular_boundary_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] non_regular_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] non_regular_boundary_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] undefined_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] total count: 16797
[2023-01-24 10:34:18.534] [polyfem] [info] Building isoparametric basis...
[2023-01-24 10:34:18.542] [polyfem] [info] Computing polygonal basis...
[2023-01-24 10:34:18.542] [polyfem] [info] took 6e-06s
[2023-01-24 10:34:18.542] [2023-01-24 10:34:18.534] [polyfem] [info] took 0.00976s
[2023-01-24 10:34:18.534] [polyfem] [info] simplex_count: 16797
[2023-01-24 10:34:18.534] [polyfem] [info] regular_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] regular_boundary_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] simple_singular_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] multi_singular_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] boundary_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] multi_singular_boundary_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] non_regular_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] non_regular_boundary_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] undefined_count: 0
[2023-01-24 10:34:18.534] [polyfem] [info] total count: 16797
[2023-01-24 10:34:18.534] [polyfem] [info] Building isoparametric basis...
[2023-01-24 10:34:18.542] [polyfem] [info] Computing polygonal basis...
[2023-01-24 10:34:18.542] [polyfem] [info] took 6e-06s
[2023-01-24 10:34:18.542] Segmentation fault (core dumped)
(PolyFEM) aa@aa:
/Documents/GitHub/polyfem/polyfem.github.io/docs$ python python_example.py
[2023-01-24 10:34:45.607] [polyfem] [info] Loading mesh...
[2023-01-24 10:34:45.607] [geogram] [info] Loading file plate_hole.obj...
[2023-01-24 10:34:45.611] [geogram] [info] (FP64) nb_v:8549 nb_e:0 nb_f:16797 nb_b:299 tri:1 dim:3
[2023-01-24 10:34:45.611] [geogram] [info] Attributes on vertices: point[3]
[2023-01-24 10:34:45.616] [polyfem] [info] mesh bb min [0.500183, 0.5], max [100.5, 50.5]
[2023-01-24 10:34:45.616] [polyfem] [info] took 0.009104s
[2023-01-24 10:34:45.616] [polyfem] [info] simplex_count: 16797
[2023-01-24 10:34:45.616] [polyfem] [info] regular_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] regular_boundary_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] simple_singular_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] multi_singular_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] boundary_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] multi_singular_boundary_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] non_regular_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] non_regular_boundary_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] undefined_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] total count: 16797
[2023-01-24 10:34:45.616] [polyfem] [info] Building isoparametric basis...
[2023-01-24 10:34:45.624] [polyfem] [info] Computing polygonal basis...
[2023-01-24 10:34:45.624] [polyfem] [info] took 7e-06s
[2023-01-24 10:34:45.625] [polyfem] [info] hmin: 0.420699
[2023-01-24 10:34:45.625] [2023-01-24 10:34:45.616] [polyfem] [info] simplex_count: 16797
[2023-01-24 10:34:45.616] [polyfem] [info] regular_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] regular_boundary_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] simple_singular_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] multi_singular_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] boundary_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] multi_singular_boundary_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] non_regular_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] non_regular_boundary_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] undefined_count: 0
[2023-01-24 10:34:45.616] [polyfem] [info] total count: 16797
[2023-01-24 10:34:45.616] [polyfem] [info] Building isoparametric basis...
[2023-01-24 10:34:45.624] [polyfem] [info] Computing polygonal basis...
[2023-01-24 10:34:45.624] [polyfem] [info] took 7e-06s
[2023-01-24 10:34:45.625] [polyfem] [info] hmin: 0.420699
[2023-01-24 10:34:45.625] Segmentation fault (core dumped)

Any ideas why?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions