[petsc-users] Load dense matrices from hdf5

Sajid Ali sajidsyed2021 at u.northwestern.edu
Fri Nov 30 16:27:02 CST 2018


Hi,

I'm trying to solve the Helmholtz equation in 1D for x-rays which roughly
like :

u_dot = a*u_xx + h(t)*u

I've already implemented
<https://github.com/s-sajid-ali/xwp_petsc/blob/master/1d/free_space/ex_modify.c>
the case where h(t) is always zero (free-space) in PETSc as per the last
box on page 156 of the manual.

For the time dependent version of the same the next step is to modify the
RHSMatrix by adding h(t) via MatDiagonalSet&Insert. (With h(t)=0, the RHS
matrix is just a (scaled) Laplacian matrix)

The h(t) is related to x-ray refractive index at that time. These x-ray
indices need to be (preferably) stored in matrix beforehand. Each column of
the matrix would be the refractive index to be used in one iteration. Using
hdf5 is something I'd like to do because I can make/view the grid using
numpy in python and solve the PDE using PETSc in C.

PS: I've seen past questions on this thread strongly discouraging users
from storing dense matrices in hdf5 format.

PPS : This 1D x-ray scattering problem is just a stepping stone to doing
the same in 2D so if there's a better approach to adopt, I'm be open to new
ideas.

Thank You,
Sajid Ali
Applied Physics
Northwestern University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20181130/f17dfd9c/attachment.html>


More information about the petsc-users mailing list