Dear Floriane, On 08/02/18 10:03, Floriane Gidel [RPG] wrote:
Dear all,
I try to extract the values of a function h, at some specific positions with the function .at() .
I define a coarse mesh with
Nx_fine = int(Lx/0.4) + 1
Ny_fine = int(Ly/0.4) + 1
coarse_mesh = RectangleMesh(Nx_coarse,Ny_coarse,Lx,Ly,quadrilateral=True)
coarse_V = FunctionSpace(coarse_mesh, "CG", 1)
coarse_h = Function(coarse_V, name="h")
V_vec_c = VectorFunctionSpace(coarse_mesh, "CG", 1)
coarse_points = Function(V_vec_c , name="coarse_points")
coarse_points.interpolate(SpatialCoordinate(coarse_mesh))
Then I define a finer mesh with
Nx_fine = int(Lx/0.1) + 1
Ny_fine = int(Ly/0.1) + 1
fine_mesh = RectangleMesh(Nx_fine,Ny_fine,Lx,Ly,quadrilateral=True)
fine_V = FunctionSpace(fine_mesh, "CG", 1)
fine_h = Function(fine_V, name="h")
Then I load an h5 function into fine_h (defined on the same function space) with
dumb_file_fine = DumbCheckpoint(save_path+"fine/h_0", mode=FILE_READ)
dumb_file_fine.load(fine_h)
dumb_file_fine.close()
But then, when I try to extract the values of fine_h at the coordinates of coarse_mesh with
coarse_data_fine = fine_h.at(coarse_points.dat.data_ro)
I get this error:
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
This says that somewhere (presumably in the interpolation code), there was an out of bounds memory access (reading off the end of an array or similar). I tried to reproduce this, by didn't manage to. Can you post a complete code that fails? Thanks, Lawrence